mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
optimize compiler
Issue:#IALVU8 Signed-off-by: fangting <fangting12@huawei.com>
This commit is contained in:
parent
5be332038b
commit
cdbfa4340e
@ -38,7 +38,6 @@
|
|||||||
#include "ecmascript/mem/shared_heap/shared_concurrent_marker.h"
|
#include "ecmascript/mem/shared_heap/shared_concurrent_marker.h"
|
||||||
#include "ecmascript/module/module_logger.h"
|
#include "ecmascript/module/module_logger.h"
|
||||||
#include "ecmascript/pgo_profiler/pgo_trace.h"
|
#include "ecmascript/pgo_profiler/pgo_trace.h"
|
||||||
#include "ecmascript/runtime.h"
|
|
||||||
#include "ecmascript/snapshot/mem/snapshot.h"
|
#include "ecmascript/snapshot/mem/snapshot.h"
|
||||||
#include "ecmascript/stubs/runtime_stubs.h"
|
#include "ecmascript/stubs/runtime_stubs.h"
|
||||||
#include "ecmascript/ohos/jit_tools.h"
|
#include "ecmascript/ohos/jit_tools.h"
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_iterator.h"
|
#include "ecmascript/js_iterator.h"
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
JSHandle<JSObject> GeneratorHelper::Next(JSThread *thread, const JSHandle<GeneratorContext> &genContext,
|
JSHandle<JSObject> GeneratorHelper::Next(JSThread *thread, const JSHandle<GeneratorContext> &genContext,
|
||||||
|
@ -15,19 +15,10 @@
|
|||||||
|
|
||||||
#include "ecmascript/global_env_constants.h"
|
#include "ecmascript/global_env_constants.h"
|
||||||
|
|
||||||
#include "ecmascript/accessor_data.h"
|
|
||||||
#include "ecmascript/builtins/builtins.h"
|
|
||||||
#include "ecmascript/builtins/builtins_global.h"
|
|
||||||
#include "ecmascript/ecma_string-inl.h"
|
#include "ecmascript/ecma_string-inl.h"
|
||||||
#include "ecmascript/ecma_string_table.h"
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/free_object.h"
|
#include "ecmascript/free_object.h"
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/global_env_constants-inl.h"
|
|
||||||
#include "ecmascript/ic/ic_handler.h"
|
#include "ecmascript/ic/ic_handler.h"
|
||||||
#include "ecmascript/ic/property_box.h"
|
|
||||||
#include "ecmascript/ic/proto_change_details.h"
|
#include "ecmascript/ic/proto_change_details.h"
|
||||||
#include "ecmascript/jobs/micro_job_queue.h"
|
|
||||||
#include "ecmascript/jobs/pending_job.h"
|
#include "ecmascript/jobs/pending_job.h"
|
||||||
#include "ecmascript/js_api/js_api_arraylist_iterator.h"
|
#include "ecmascript/js_api/js_api_arraylist_iterator.h"
|
||||||
#include "ecmascript/js_api/js_api_bitvector_iterator.h"
|
#include "ecmascript/js_api/js_api_bitvector_iterator.h"
|
||||||
@ -45,43 +36,20 @@
|
|||||||
#include "ecmascript/js_api/js_api_tree_set_iterator.h"
|
#include "ecmascript/js_api/js_api_tree_set_iterator.h"
|
||||||
#include "ecmascript/js_api/js_api_vector_iterator.h"
|
#include "ecmascript/js_api/js_api_vector_iterator.h"
|
||||||
#include "ecmascript/js_async_generator_object.h"
|
#include "ecmascript/js_async_generator_object.h"
|
||||||
#include "ecmascript/jspandafile/class_info_extractor.h"
|
|
||||||
#include "ecmascript/jspandafile/class_literal.h"
|
|
||||||
#include "ecmascript/jspandafile/program_object.h"
|
#include "ecmascript/jspandafile/program_object.h"
|
||||||
#include "ecmascript/js_arguments.h"
|
|
||||||
#include "ecmascript/js_array.h"
|
|
||||||
#include "ecmascript/js_array_iterator.h"
|
#include "ecmascript/js_array_iterator.h"
|
||||||
#include "ecmascript/js_arraybuffer.h"
|
|
||||||
#include "ecmascript/js_finalization_registry.h"
|
#include "ecmascript/js_finalization_registry.h"
|
||||||
#include "ecmascript/js_for_in_iterator.h"
|
|
||||||
#include "ecmascript/js_generator_object.h"
|
|
||||||
#include "ecmascript/js_hclass.h"
|
|
||||||
#include "ecmascript/js_iterator.h"
|
|
||||||
#include "ecmascript/js_map.h"
|
|
||||||
#include "ecmascript/js_map_iterator.h"
|
#include "ecmascript/js_map_iterator.h"
|
||||||
#include "ecmascript/js_primitive_ref.h"
|
|
||||||
#include "ecmascript/js_promise.h"
|
#include "ecmascript/js_promise.h"
|
||||||
#include "ecmascript/js_proxy.h"
|
|
||||||
#include "ecmascript/js_realm.h"
|
#include "ecmascript/js_realm.h"
|
||||||
#include "ecmascript/js_regexp.h"
|
|
||||||
#include "ecmascript/js_regexp_iterator.h"
|
#include "ecmascript/js_regexp_iterator.h"
|
||||||
#include "ecmascript/js_set.h"
|
|
||||||
#include "ecmascript/js_set_iterator.h"
|
#include "ecmascript/js_set_iterator.h"
|
||||||
#include "ecmascript/js_symbol.h"
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/js_thread.h"
|
|
||||||
#include "ecmascript/marker_cell.h"
|
#include "ecmascript/marker_cell.h"
|
||||||
#include "ecmascript/method.h"
|
|
||||||
#include "ecmascript/module/js_module_source_text.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/runtime.h"
|
#include "ecmascript/runtime.h"
|
||||||
#include "ecmascript/shared_objects/js_shared_array.h"
|
#include "ecmascript/shared_objects/js_shared_array.h"
|
||||||
#include "ecmascript/shared_objects/js_shared_array_iterator.h"
|
#include "ecmascript/shared_objects/js_shared_array_iterator.h"
|
||||||
#include "ecmascript/shared_objects/js_shared_map.h"
|
|
||||||
#include "ecmascript/shared_objects/js_shared_map_iterator.h"
|
#include "ecmascript/shared_objects/js_shared_map_iterator.h"
|
||||||
#include "ecmascript/shared_objects/js_shared_set.h"
|
|
||||||
#include "ecmascript/shared_objects/js_shared_set_iterator.h"
|
#include "ecmascript/shared_objects/js_shared_set_iterator.h"
|
||||||
#include "ecmascript/tagged_node.h"
|
|
||||||
#include "ecmascript/vtable.h"
|
#include "ecmascript/vtable.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -15,13 +15,9 @@
|
|||||||
|
|
||||||
#include "ecmascript/intl/locale_helper.h"
|
#include "ecmascript/intl/locale_helper.h"
|
||||||
|
|
||||||
#include "ecmascript/base/string_helper.h"
|
|
||||||
#include "ecmascript/checkpoint/thread_state_transition.h"
|
#include "ecmascript/checkpoint/thread_state_transition.h"
|
||||||
#include "ecmascript/ecma_context.h"
|
#include "ecmascript/ecma_context.h"
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/checkpoint/thread_state_transition.h"
|
#include "ecmascript/checkpoint/thread_state_transition.h"
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
|
@ -17,13 +17,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_iterator.h"
|
|
||||||
#include "ecmascript/js_function.h"
|
#include "ecmascript/js_function.h"
|
||||||
#include "ecmascript/js_api/js_api_arraylist_iterator.h"
|
|
||||||
#include "ecmascript/js_function.h"
|
#include "ecmascript/js_function.h"
|
||||||
#include "ecmascript/js_iterator.h"
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using ContainerError = containers::ContainerError;
|
using ContainerError = containers::ContainerError;
|
||||||
|
@ -15,13 +15,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_arraylist_iterator.h"
|
#include "ecmascript/js_api/js_api_arraylist_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
|
||||||
#include "ecmascript/base/typed_array_helper-inl.h"
|
|
||||||
#include "ecmascript/base/typed_array_helper.h"
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/js_api/js_api_arraylist.h"
|
#include "ecmascript/js_api/js_api_arraylist.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -15,17 +15,7 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_bitvector.h"
|
#include "ecmascript/js_api/js_api_bitvector.h"
|
||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
|
||||||
#include "ecmascript/global_env_constants-inl.h"
|
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
|
||||||
#include "ecmascript/js_array.h"
|
|
||||||
#include "ecmascript/js_function.h"
|
|
||||||
#include "ecmascript/js_handle.h"
|
|
||||||
#include "ecmascript/js_tagged_number.h"
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
|
||||||
#include "ecmascript/tagged_array-inl.h"
|
#include "ecmascript/tagged_array-inl.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/shared_objects/concurrent_api_scope.h"
|
#include "ecmascript/shared_objects/concurrent_api_scope.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -15,11 +15,7 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_bitvector_iterator.h"
|
#include "ecmascript/js_api/js_api_bitvector_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/base/typed_array_helper.h"
|
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/js_api/js_api_bitvector.h"
|
#include "ecmascript/js_api/js_api_bitvector.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/shared_objects/concurrent_api_scope.h"
|
#include "ecmascript/shared_objects/concurrent_api_scope.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -16,13 +16,7 @@
|
|||||||
#include "ecmascript/js_api/js_api_deque.h"
|
#include "ecmascript/js_api/js_api_deque.h"
|
||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/js_object.h"
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
#include "ecmascript/js_tagged_value-inl.h"
|
||||||
#include "ecmascript/js_thread.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/tagged_array.h"
|
|
||||||
#include "ecmascript/tagged_array-inl.h"
|
#include "ecmascript/tagged_array-inl.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -15,16 +15,10 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_deque_iterator.h"
|
#include "ecmascript/js_api/js_api_deque_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/base/builtins_base.h"
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/global_env_constants-inl.h"
|
|
||||||
#include "ecmascript/js_api/js_api_deque.h"
|
#include "ecmascript/js_api/js_api_deque.h"
|
||||||
#include "ecmascript/js_handle.h"
|
|
||||||
#include "ecmascript/js_iterator.h"
|
#include "ecmascript/js_iterator.h"
|
||||||
#include "ecmascript/js_handle.h"
|
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
#include "ecmascript/js_tagged_value-inl.h"
|
||||||
#include "ecmascript/js_thread.h"
|
|
||||||
#include "ecmascript/tagged_array.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -16,11 +16,7 @@
|
|||||||
#include "ecmascript/js_api/js_api_hashmap.h"
|
#include "ecmascript/js_api/js_api_hashmap.h"
|
||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/js_handle.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/tagged_hash_array.h"
|
#include "ecmascript/tagged_hash_array.h"
|
||||||
#include "ecmascript/tagged_node.h"
|
|
||||||
#include "ecmascript/tagged_queue.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using ContainerError = containers::ContainerError;
|
using ContainerError = containers::ContainerError;
|
||||||
|
@ -15,13 +15,7 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_hashmap_iterator.h"
|
#include "ecmascript/js_api/js_api_hashmap_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/js_api/js_api_hashmap.h"
|
|
||||||
#include "ecmascript/js_array.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/tagged_node.h"
|
|
||||||
#include "ecmascript/tagged_queue.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/tagged_hash_array.h"
|
#include "ecmascript/tagged_hash_array.h"
|
||||||
#include "ecmascript/tagged_node.h"
|
|
||||||
#include "ecmascript/tagged_queue.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using ContainerError = containers::ContainerError;
|
using ContainerError = containers::ContainerError;
|
||||||
|
@ -15,14 +15,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_hashset_iterator.h"
|
#include "ecmascript/js_api/js_api_hashset_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/js_api/js_api_hashset.h"
|
#include "ecmascript/js_api/js_api_hashset.h"
|
||||||
#include "ecmascript/js_array.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/tagged_node.h"
|
|
||||||
#include "ecmascript/tagged_queue.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
using ContainerError = containers::ContainerError;
|
using ContainerError = containers::ContainerError;
|
||||||
|
@ -16,13 +16,7 @@
|
|||||||
#include "ecmascript/js_api/js_api_lightweightmap.h"
|
#include "ecmascript/js_api/js_api_lightweightmap.h"
|
||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/js_array.h"
|
|
||||||
#include "ecmascript/js_function.h"
|
|
||||||
#include "ecmascript/js_handle.h"
|
|
||||||
#include "ecmascript/js_object-inl.h"
|
#include "ecmascript/js_object-inl.h"
|
||||||
#include "ecmascript/js_tagged_number.h"
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
|
|
||||||
|
@ -15,14 +15,10 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_lightweightmap_iterator.h"
|
#include "ecmascript/js_api/js_api_lightweightmap_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
|
||||||
#include "ecmascript/base/typed_array_helper-inl.h"
|
#include "ecmascript/base/typed_array_helper-inl.h"
|
||||||
#include "ecmascript/base/typed_array_helper.h"
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/js_api/js_api_lightweightmap.h"
|
#include "ecmascript/js_api/js_api_lightweightmap.h"
|
||||||
#include "ecmascript/js_array.h"
|
#include "ecmascript/js_array.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -17,11 +17,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_api/js_api_lightweightset_iterator.h"
|
|
||||||
#include "ecmascript/js_array.h"
|
#include "ecmascript/js_array.h"
|
||||||
#include "ecmascript/js_function.h"
|
#include "ecmascript/js_function.h"
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
|
|
||||||
|
@ -16,13 +16,9 @@
|
|||||||
#include "ecmascript/js_api/js_api_lightweightset_iterator.h"
|
#include "ecmascript/js_api/js_api_lightweightset_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/base/typed_array_helper-inl.h"
|
#include "ecmascript/base/typed_array_helper-inl.h"
|
||||||
#include "ecmascript/base/typed_array_helper.h"
|
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/js_api/js_api_lightweightset.h"
|
#include "ecmascript/js_api/js_api_lightweightset.h"
|
||||||
#include "ecmascript/js_array.h"
|
#include "ecmascript/js_array.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -16,12 +16,6 @@
|
|||||||
#include "ecmascript/js_api/js_api_linked_list.h"
|
#include "ecmascript/js_api/js_api_linked_list.h"
|
||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/js_api/js_api_linked_list_iterator.h"
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/tagged_array-inl.h"
|
|
||||||
#include "ecmascript/tagged_list.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using ContainerError = containers::ContainerError;
|
using ContainerError = containers::ContainerError;
|
||||||
using ErrorFlag = containers::ErrorFlag;
|
using ErrorFlag = containers::ErrorFlag;
|
||||||
|
@ -15,14 +15,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_linked_list_iterator.h"
|
#include "ecmascript/js_api/js_api_linked_list_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/base/typed_array_helper.h"
|
|
||||||
#include "ecmascript/base/typed_array_helper-inl.h"
|
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/js_api/js_api_linked_list.h"
|
|
||||||
#include "ecmascript/js_array.h"
|
#include "ecmascript/js_array.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/tagged_list.h"
|
#include "ecmascript/tagged_list.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -16,14 +16,6 @@
|
|||||||
#include "ecmascript/js_api/js_api_list.h"
|
#include "ecmascript/js_api/js_api_list.h"
|
||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/js_api/js_api_list_iterator.h"
|
|
||||||
#include "ecmascript/js_array.h"
|
|
||||||
#include "ecmascript/js_function.h"
|
|
||||||
#include "ecmascript/js_handle.h"
|
|
||||||
#include "ecmascript/js_tagged_number.h"
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/tagged_list.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using ContainerError = containers::ContainerError;
|
using ContainerError = containers::ContainerError;
|
||||||
|
@ -15,14 +15,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_list_iterator.h"
|
#include "ecmascript/js_api/js_api_list_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/base/typed_array_helper.h"
|
|
||||||
#include "ecmascript/base/typed_array_helper-inl.h"
|
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/js_api/js_api_list.h"
|
#include "ecmascript/js_api/js_api_list.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/tagged_list.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -17,10 +17,7 @@
|
|||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_api/js_api_plain_array_iterator.h"
|
|
||||||
#include "ecmascript/js_function.h"
|
#include "ecmascript/js_function.h"
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -15,14 +15,10 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_plain_array_iterator.h"
|
#include "ecmascript/js_api/js_api_plain_array_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/base/typed_array_helper.h"
|
|
||||||
#include "ecmascript/base/typed_array_helper-inl.h"
|
#include "ecmascript/base/typed_array_helper-inl.h"
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/js_api/js_api_plain_array.h"
|
#include "ecmascript/js_api/js_api_plain_array.h"
|
||||||
#include "ecmascript/js_array.h"
|
#include "ecmascript/js_array.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -14,12 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/js_api/js_api_queue.h"
|
#include "ecmascript/js_api/js_api_queue.h"
|
||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
|
||||||
#include "ecmascript/interpreter/fast_runtime_stub-inl.h"
|
#include "ecmascript/interpreter/fast_runtime_stub-inl.h"
|
||||||
#include "ecmascript/js_object.h"
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using ContainerError = containers::ContainerError;
|
using ContainerError = containers::ContainerError;
|
||||||
|
@ -15,11 +15,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_queue_iterator.h"
|
#include "ecmascript/js_api/js_api_queue_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/js_api/js_api_queue.h"
|
#include "ecmascript/js_api/js_api_queue.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "ecmascript/js_api/js_api_stack.h"
|
#include "ecmascript/js_api/js_api_stack.h"
|
||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/object_factory-inl.h"
|
#include "ecmascript/object_factory-inl.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -15,14 +15,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_stack_iterator.h"
|
#include "ecmascript/js_api/js_api_stack_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
|
||||||
#include "ecmascript/base/typed_array_helper-inl.h"
|
#include "ecmascript/base/typed_array_helper-inl.h"
|
||||||
#include "ecmascript/base/typed_array_helper.h"
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/js_api/js_api_stack.h"
|
|
||||||
#include "ecmascript/js_hclass.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "ecmascript/js_api/js_api_tree_map.h"
|
#include "ecmascript/js_api/js_api_tree_map.h"
|
||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/tagged_tree.h"
|
#include "ecmascript/tagged_tree.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -15,12 +15,10 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_tree_map_iterator.h"
|
#include "ecmascript/js_api/js_api_tree_map_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/base/builtins_base.h"
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/js_api/js_api_tree_map.h"
|
#include "ecmascript/js_api/js_api_tree_map.h"
|
||||||
#include "ecmascript/js_array.h"
|
#include "ecmascript/js_array.h"
|
||||||
#include "ecmascript/tagged_tree.h"
|
#include "ecmascript/tagged_tree.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "ecmascript/js_api/js_api_tree_set.h"
|
#include "ecmascript/js_api/js_api_tree_set.h"
|
||||||
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/tagged_tree.h"
|
#include "ecmascript/tagged_tree.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -15,12 +15,9 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_tree_set_iterator.h"
|
#include "ecmascript/js_api/js_api_tree_set_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/base/builtins_base.h"
|
|
||||||
#include "ecmascript/containers/containers_errors.h"
|
#include "ecmascript/containers/containers_errors.h"
|
||||||
#include "ecmascript/js_api/js_api_tree_set.h"
|
#include "ecmascript/js_api/js_api_tree_set.h"
|
||||||
#include "ecmascript/js_array.h"
|
#include "ecmascript/js_array.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/tagged_array-inl.h"
|
|
||||||
#include "ecmascript/tagged_tree.h"
|
#include "ecmascript/tagged_tree.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -17,13 +17,7 @@
|
|||||||
|
|
||||||
#include "ecmascript/global_env_constants-inl.h"
|
#include "ecmascript/global_env_constants-inl.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_array.h"
|
|
||||||
#include "ecmascript/js_api/js_api_vector_iterator.h"
|
|
||||||
#include "ecmascript/js_handle.h"
|
|
||||||
#include "ecmascript/js_function.h"
|
#include "ecmascript/js_function.h"
|
||||||
#include "ecmascript/js_tagged_number.h"
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
@ -15,11 +15,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_api/js_api_vector_iterator.h"
|
#include "ecmascript/js_api/js_api_vector_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
|
||||||
#include "ecmascript/base/typed_array_helper.h"
|
#include "ecmascript/base/typed_array_helper.h"
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/js_api/js_api_vector.h"
|
#include "ecmascript/js_api/js_api_vector.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -16,10 +16,7 @@
|
|||||||
#include "ecmascript/js_arguments.h"
|
#include "ecmascript/js_arguments.h"
|
||||||
|
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
#include "ecmascript/js_tagged_value-inl.h"
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
#include "ecmascript/object_factory.h"
|
||||||
#include "ecmascript/tagged_array-inl.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
bool JSArguments::GetOwnProperty(JSThread *thread, const JSHandle<JSArguments> &args,
|
bool JSArguments::GetOwnProperty(JSThread *thread, const JSHandle<JSArguments> &args,
|
||||||
|
@ -15,14 +15,7 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_array.h"
|
#include "ecmascript/js_array.h"
|
||||||
|
|
||||||
#include "ecmascript/accessor_data.h"
|
|
||||||
#include "ecmascript/base/array_helper.h"
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
|
||||||
#include "ecmascript/message_string.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/object_fast_operator-inl.h"
|
#include "ecmascript/object_fast_operator-inl.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -16,10 +16,7 @@
|
|||||||
#include "ecmascript/js_array_iterator.h"
|
#include "ecmascript/js_array_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/base/typed_array_helper-inl.h"
|
#include "ecmascript/base/typed_array_helper-inl.h"
|
||||||
#include "ecmascript/base/typed_array_helper.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/js_array.h"
|
#include "ecmascript/js_array.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -15,16 +15,10 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_arraybuffer.h"
|
#include "ecmascript/js_arraybuffer.h"
|
||||||
|
|
||||||
#include "ecmascript/base/builtins_base.h"
|
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
#include "ecmascript/js_tagged_value-inl.h"
|
||||||
#include "ecmascript/mem/barriers-inl.h"
|
#include "ecmascript/mem/barriers-inl.h"
|
||||||
#include "ecmascript/object_factory.h"
|
#include "ecmascript/object_factory.h"
|
||||||
#include "ecmascript/platform/os.h"
|
#include "ecmascript/platform/os.h"
|
||||||
#include "ecmascript/tagged_array.h"
|
|
||||||
|
|
||||||
#include "securec.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
void JSArrayBuffer::CopyDataBlockBytes(JSTaggedValue toBlock, JSTaggedValue fromBlock, int32_t fromIndex, int32_t count)
|
void JSArrayBuffer::CopyDataBlockBytes(JSTaggedValue toBlock, JSTaggedValue fromBlock, int32_t fromIndex, int32_t count)
|
||||||
|
@ -15,19 +15,11 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_async_from_sync_iterator.h"
|
#include "ecmascript/js_async_from_sync_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/base/builtins_base.h"
|
|
||||||
#include "ecmascript/builtins/builtins_promise.h"
|
#include "ecmascript/builtins/builtins_promise.h"
|
||||||
#include "ecmascript/builtins/builtins_promise_handler.h"
|
#include "ecmascript/builtins/builtins_promise_handler.h"
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/js_iterator.h"
|
#include "ecmascript/js_iterator.h"
|
||||||
#include "ecmascript/js_promise.h"
|
|
||||||
#include "ecmascript/js_function.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
#include "libpandabase/macros.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
JSHandle<JSTaggedValue> JSAsyncFromSyncIterator::CreateAsyncFromSyncIterator(JSThread *thread,
|
JSHandle<JSTaggedValue> JSAsyncFromSyncIterator::CreateAsyncFromSyncIterator(JSThread *thread,
|
||||||
|
@ -18,14 +18,10 @@
|
|||||||
#include "ecmascript/async_generator_helper.h"
|
#include "ecmascript/async_generator_helper.h"
|
||||||
#include "ecmascript/builtins/builtins_promise.h"
|
#include "ecmascript/builtins/builtins_promise.h"
|
||||||
#include "ecmascript/builtins/builtins_promise_handler.h"
|
#include "ecmascript/builtins/builtins_promise_handler.h"
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/generator_helper.h"
|
#include "ecmascript/generator_helper.h"
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_async_generator_object.h"
|
#include "ecmascript/js_async_generator_object.h"
|
||||||
#include "ecmascript/js_promise.h"
|
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsPromiseHandler = builtins::BuiltinsPromiseHandler;
|
using BuiltinsPromiseHandler = builtins::BuiltinsPromiseHandler;
|
||||||
|
@ -15,19 +15,10 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_async_generator_object.h"
|
#include "ecmascript/js_async_generator_object.h"
|
||||||
#include "ecmascript/async_generator_helper.h"
|
#include "ecmascript/async_generator_helper.h"
|
||||||
#include "ecmascript/accessor_data.h"
|
|
||||||
#include "ecmascript/base/builtins_base.h"
|
|
||||||
#include "ecmascript/builtins/builtins_promise.h"
|
#include "ecmascript/builtins/builtins_promise.h"
|
||||||
#include "ecmascript/ecma_string.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_promise.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/tagged_queue.h"
|
|
||||||
#include "ecmascript/generator_helper.h"
|
|
||||||
#include "ecmascript/js_iterator.h"
|
#include "ecmascript/js_iterator.h"
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
|
||||||
#include "ecmascript/js_function.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_bigint.h"
|
#include "ecmascript/js_bigint.h"
|
||||||
|
|
||||||
#include "ecmascript/base/bit_helper.h"
|
|
||||||
#include "ecmascript/global_env_constants-inl.h"
|
#include "ecmascript/global_env_constants-inl.h"
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
#include "ecmascript/js_tagged_value-inl.h"
|
||||||
#include "ecmascript/js_tagged_number.h"
|
#include "ecmascript/js_tagged_number.h"
|
||||||
|
@ -18,13 +18,7 @@
|
|||||||
#include "ecmascript/ecma_context.h"
|
#include "ecmascript/ecma_context.h"
|
||||||
#include "ecmascript/intl/locale_helper.h"
|
#include "ecmascript/intl/locale_helper.h"
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/mem/c_string.h"
|
|
||||||
#include "ecmascript/mem/barriers-inl.h"
|
|
||||||
#include "ecmascript/object_factory-inl.h"
|
|
||||||
#include "ecmascript/ecma_string-inl.h"
|
#include "ecmascript/ecma_string-inl.h"
|
||||||
|
|
||||||
#include "unicode/udata.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
// NOLINTNEXTLINE (readability-identifier-naming, fuchsia-statically-constructed-objects)
|
// NOLINTNEXTLINE (readability-identifier-naming, fuchsia-statically-constructed-objects)
|
||||||
const CString JSCollator::uIcuDataColl = U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "coll";
|
const CString JSCollator::uIcuDataColl = U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "coll";
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_dataview.h"
|
#include "ecmascript/js_dataview.h"
|
||||||
|
|
||||||
#include "libpandabase/macros.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
uint32_t JSDataView::GetElementSize(DataViewType type)
|
uint32_t JSDataView::GetElementSize(DataViewType type)
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include <regex>
|
#include <regex>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "ecmascript/base/builtins_base.h"
|
|
||||||
#include "ecmascript/date_parse.h"
|
#include "ecmascript/date_parse.h"
|
||||||
#include "ecmascript/object_fast_operator-inl.h"
|
#include "ecmascript/object_fast_operator-inl.h"
|
||||||
#include "ecmascript/platform/time.h"
|
#include "ecmascript/platform/time.h"
|
||||||
|
@ -17,14 +17,10 @@
|
|||||||
|
|
||||||
#include "ecmascript/checkpoint/thread_state_transition.h"
|
#include "ecmascript/checkpoint/thread_state_transition.h"
|
||||||
#include "ecmascript/intl/locale_helper.h"
|
#include "ecmascript/intl/locale_helper.h"
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/js_array.h"
|
|
||||||
#include "ecmascript/js_date.h"
|
#include "ecmascript/js_date.h"
|
||||||
#include "ecmascript/js_function.h"
|
#include "ecmascript/js_function.h"
|
||||||
#include "ecmascript/js_intl.h"
|
#include "ecmascript/js_intl.h"
|
||||||
#include "ecmascript/js_locale.h"
|
|
||||||
#include "ecmascript/js_object-inl.h"
|
|
||||||
#include "ecmascript/object_factory-inl.h"
|
#include "ecmascript/object_factory-inl.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -16,11 +16,8 @@
|
|||||||
#include "ecmascript/js_finalization_registry.h"
|
#include "ecmascript/js_finalization_registry.h"
|
||||||
|
|
||||||
#include "ecmascript/ecma_context.h"
|
#include "ecmascript/ecma_context.h"
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
|
||||||
#include "ecmascript/jobs/micro_job_queue.h"
|
#include "ecmascript/jobs/micro_job_queue.h"
|
||||||
#include "ecmascript/js_function.h"
|
|
||||||
#include "ecmascript/js_object-inl.h"
|
#include "ecmascript/js_object-inl.h"
|
||||||
#include "ecmascript/linked_hash_table.h"
|
#include "ecmascript/linked_hash_table.h"
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "ecmascript/base/builtins_base.h"
|
#include "ecmascript/base/builtins_base.h"
|
||||||
#include "ecmascript/ic/proto_change_details.h"
|
#include "ecmascript/ic/proto_change_details.h"
|
||||||
#include "ecmascript/js_object-inl.h"
|
#include "ecmascript/js_object-inl.h"
|
||||||
#include "ecmascript/tagged_array-inl.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -15,30 +15,14 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_function.h"
|
#include "ecmascript/js_function.h"
|
||||||
|
|
||||||
#include "ecmascript/base/error_type.h"
|
|
||||||
#include "ecmascript/debugger/js_debugger_manager.h"
|
#include "ecmascript/debugger/js_debugger_manager.h"
|
||||||
#include "ecmascript/ecma_context.h"
|
#include "ecmascript/ecma_context.h"
|
||||||
#include "ecmascript/ecma_runtime_call_info.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_hclass.h"
|
|
||||||
#include "ecmascript/js_object.h"
|
|
||||||
#include "ecmascript/js_object-inl.h"
|
#include "ecmascript/js_object-inl.h"
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/jspandafile/class_info_extractor.h"
|
|
||||||
#include "ecmascript/js_handle.h"
|
|
||||||
#include "ecmascript/js_promise.h"
|
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
|
||||||
#include "ecmascript/jspandafile/js_pandafile.h"
|
|
||||||
#include "ecmascript/log_wrapper.h"
|
|
||||||
#include "ecmascript/mem/c_containers.h"
|
|
||||||
#include "ecmascript/module/js_module_source_text.h"
|
|
||||||
#include "ecmascript/module/js_module_manager.h"
|
#include "ecmascript/module/js_module_manager.h"
|
||||||
#include "ecmascript/module/js_shared_module.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/object_factory-inl.h"
|
#include "ecmascript/object_factory-inl.h"
|
||||||
#include "ecmascript/pgo_profiler/pgo_profiler.h"
|
#include "ecmascript/pgo_profiler/pgo_profiler.h"
|
||||||
#include "ecmascript/tagged_array.h"
|
|
||||||
#include "ecmascript/require/js_require_manager.h"
|
#include "ecmascript/require/js_require_manager.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -13,27 +13,15 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/elements.h"
|
|
||||||
#include "ecmascript/js_hclass-inl.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "ecmascript/base/config.h"
|
|
||||||
#include "ecmascript/ecma_context.h"
|
#include "ecmascript/ecma_context.h"
|
||||||
#include "ecmascript/global_env_constants-inl.h"
|
#include "ecmascript/global_env_constants-inl.h"
|
||||||
#include "ecmascript/pgo_profiler/pgo_profiler.h"
|
#include "ecmascript/pgo_profiler/pgo_profiler.h"
|
||||||
#include "ecmascript/pgo_profiler/pgo_profiler_layout.h"
|
#include "ecmascript/pgo_profiler/pgo_profiler_layout.h"
|
||||||
#include "ecmascript/shared_objects/js_shared_array.h"
|
|
||||||
#include "ecmascript/tagged_array.h"
|
|
||||||
#include "ecmascript/vtable.h"
|
|
||||||
#include "ecmascript/ic/proto_change_details.h"
|
#include "ecmascript/ic/proto_change_details.h"
|
||||||
#include "ecmascript/js_function.h"
|
#include "ecmascript/js_function.h"
|
||||||
#include "ecmascript/js_object-inl.h"
|
#include "ecmascript/js_object-inl.h"
|
||||||
#include "ecmascript/js_symbol.h"
|
|
||||||
#include "ecmascript/mem/c_containers.h"
|
|
||||||
#include "ecmascript/tagged_array-inl.h"
|
|
||||||
#include "ecmascript/tagged_dictionary.h"
|
|
||||||
#include "ecmascript/weak_vector.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using ProfileType = pgo::ProfileType;
|
using ProfileType = pgo::ProfileType;
|
||||||
|
@ -15,14 +15,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_iterator.h"
|
#include "ecmascript/js_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/accessor_data.h"
|
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_symbol.h"
|
|
||||||
#include "ecmascript/js_async_from_sync_iterator.h"
|
#include "ecmascript/js_async_from_sync_iterator.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/object_fast_operator-inl.h"
|
#include "ecmascript/object_fast_operator-inl.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -1,434 +1,422 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/js_list_format.h"
|
#include "ecmascript/js_list_format.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "ecmascript/intl/locale_helper.h"
|
#include "ecmascript/intl/locale_helper.h"
|
||||||
#include "ecmascript/ecma_macros.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/js_iterator.h"
|
||||||
#include "ecmascript/global_env_constants.h"
|
#include "ecmascript/object_factory-inl.h"
|
||||||
#include "ecmascript/js_array.h"
|
|
||||||
#include "ecmascript/js_locale.h"
|
|
||||||
#include "ecmascript/js_iterator.h"
|
namespace panda::ecmascript {
|
||||||
#include "ecmascript/object_factory-inl.h"
|
icu::ListFormatter *JSListFormat::GetIcuListFormatter() const
|
||||||
|
{
|
||||||
#include "unicode/fieldpos.h"
|
ASSERT(GetIcuLF().IsJSNativePointer());
|
||||||
#include "unicode/fpositer.h"
|
auto result = JSNativePointer::Cast(GetIcuLF().GetTaggedObject())->GetExternalPointer();
|
||||||
#include "unicode/formattedvalue.h"
|
return reinterpret_cast<icu::ListFormatter *>(result);
|
||||||
#include "unicode/stringpiece.h"
|
}
|
||||||
#include "unicode/unistr.h"
|
|
||||||
#include "unicode/utf8.h"
|
void JSListFormat::FreeIcuListFormatter([[maybe_unused]] void *env, void *pointer, [[maybe_unused]] void* hint)
|
||||||
#include "unicode/uloc.h"
|
{
|
||||||
#include "unicode/ustring.h"
|
if (pointer == nullptr) {
|
||||||
|
return;
|
||||||
namespace panda::ecmascript {
|
}
|
||||||
icu::ListFormatter *JSListFormat::GetIcuListFormatter() const
|
auto icuListFormat = reinterpret_cast<icu::ListFormatter *>(pointer);
|
||||||
{
|
icuListFormat->~ListFormatter();
|
||||||
ASSERT(GetIcuLF().IsJSNativePointer());
|
delete icuListFormat;
|
||||||
auto result = JSNativePointer::Cast(GetIcuLF().GetTaggedObject())->GetExternalPointer();
|
}
|
||||||
return reinterpret_cast<icu::ListFormatter *>(result);
|
|
||||||
}
|
void JSListFormat::SetIcuListFormatter(JSThread *thread, const JSHandle<JSListFormat> listFormat,
|
||||||
|
icu::ListFormatter *icuListFormatter, const NativePointerCallback &callback)
|
||||||
void JSListFormat::FreeIcuListFormatter([[maybe_unused]] void *env, void *pointer, [[maybe_unused]] void* hint)
|
{
|
||||||
{
|
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||||
if (pointer == nullptr) {
|
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||||
return;
|
ASSERT(icuListFormatter != nullptr);
|
||||||
}
|
JSTaggedValue data = listFormat->GetIcuLF();
|
||||||
auto icuListFormat = reinterpret_cast<icu::ListFormatter *>(pointer);
|
if (data.IsJSNativePointer()) {
|
||||||
icuListFormat->~ListFormatter();
|
JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject());
|
||||||
delete icuListFormat;
|
native->ResetExternalPointer(thread, icuListFormatter);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
void JSListFormat::SetIcuListFormatter(JSThread *thread, const JSHandle<JSListFormat> listFormat,
|
JSHandle<JSNativePointer> pointer = factory->NewJSNativePointer(icuListFormatter, callback);
|
||||||
icu::ListFormatter *icuListFormatter, const NativePointerCallback &callback)
|
listFormat->SetIcuLF(thread, pointer.GetTaggedValue());
|
||||||
{
|
}
|
||||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
|
||||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
JSHandle<TaggedArray> JSListFormat::GetAvailableLocales(JSThread *thread)
|
||||||
ASSERT(icuListFormatter != nullptr);
|
{
|
||||||
JSTaggedValue data = listFormat->GetIcuLF();
|
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||||
if (data.IsJSNativePointer()) {
|
JSHandle<JSTaggedValue> listFormatLocales = env->GetListFormatLocales();
|
||||||
JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject());
|
if (!listFormatLocales->IsUndefined()) {
|
||||||
native->ResetExternalPointer(thread, icuListFormatter);
|
return JSHandle<TaggedArray>::Cast(listFormatLocales);
|
||||||
return;
|
}
|
||||||
}
|
const char *key = "listPattern";
|
||||||
JSHandle<JSNativePointer> pointer = factory->NewJSNativePointer(icuListFormatter, callback);
|
const char *path = nullptr;
|
||||||
listFormat->SetIcuLF(thread, pointer.GetTaggedValue());
|
std::vector<std::string> availableStringLocales = intl::LocaleHelper::GetAvailableLocales(thread, key, path);
|
||||||
}
|
JSHandle<TaggedArray> availableLocales = JSLocale::ConstructLocaleList(thread, availableStringLocales);
|
||||||
|
env->SetListFormatLocales(thread, availableLocales);
|
||||||
JSHandle<TaggedArray> JSListFormat::GetAvailableLocales(JSThread *thread)
|
return availableLocales;
|
||||||
{
|
}
|
||||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
|
||||||
JSHandle<JSTaggedValue> listFormatLocales = env->GetListFormatLocales();
|
// 13. InitializeListFormat ( listformat, locales, options )
|
||||||
if (!listFormatLocales->IsUndefined()) {
|
JSHandle<JSListFormat> JSListFormat::InitializeListFormat(JSThread *thread,
|
||||||
return JSHandle<TaggedArray>::Cast(listFormatLocales);
|
const JSHandle<JSListFormat> &listFormat,
|
||||||
}
|
const JSHandle<JSTaggedValue> &locales,
|
||||||
const char *key = "listPattern";
|
const JSHandle<JSTaggedValue> &options)
|
||||||
const char *path = nullptr;
|
{
|
||||||
std::vector<std::string> availableStringLocales = intl::LocaleHelper::GetAvailableLocales(thread, key, path);
|
[[maybe_unused]] EcmaHandleScope scope(thread);
|
||||||
JSHandle<TaggedArray> availableLocales = JSLocale::ConstructLocaleList(thread, availableStringLocales);
|
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||||
env->SetListFormatLocales(thread, availableLocales);
|
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||||
return availableLocales;
|
auto globalConst = thread->GlobalConstants();
|
||||||
}
|
|
||||||
|
// 3. Let requestedLocales be ? CanonicalizeLocaleList(locales).
|
||||||
// 13. InitializeListFormat ( listformat, locales, options )
|
JSHandle<TaggedArray> requestedLocales = intl::LocaleHelper::CanonicalizeLocaleList(thread, locales);
|
||||||
JSHandle<JSListFormat> JSListFormat::InitializeListFormat(JSThread *thread,
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
||||||
const JSHandle<JSListFormat> &listFormat,
|
|
||||||
const JSHandle<JSTaggedValue> &locales,
|
// 4. Let options be ? GetOptionsObject(options).
|
||||||
const JSHandle<JSTaggedValue> &options)
|
JSHandle<JSObject> optionsObject;
|
||||||
{
|
if (options->IsUndefined()) {
|
||||||
[[maybe_unused]] EcmaHandleScope scope(thread);
|
optionsObject = factory->CreateNullJSObject();
|
||||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
} else if (!options->IsJSObject()) {
|
||||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
THROW_TYPE_ERROR_AND_RETURN(thread, "options is not Object", listFormat);
|
||||||
auto globalConst = thread->GlobalConstants();
|
} else {
|
||||||
|
optionsObject = JSTaggedValue::ToObject(thread, options);
|
||||||
// 3. Let requestedLocales be ? CanonicalizeLocaleList(locales).
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
||||||
JSHandle<TaggedArray> requestedLocales = intl::LocaleHelper::CanonicalizeLocaleList(thread, locales);
|
}
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
|
||||||
|
// 5. Let opt be a new Record.
|
||||||
// 4. Let options be ? GetOptionsObject(options).
|
// 6. Let matcher be ? GetOption(options, "localeMatcher", "string", « "lookup", "best fit" », "best fit").
|
||||||
JSHandle<JSObject> optionsObject;
|
JSHandle<JSTaggedValue> property = globalConst->GetHandledLocaleMatcherString();
|
||||||
if (options->IsUndefined()) {
|
auto matcher = JSLocale::GetOptionOfString<LocaleMatcherOption>(
|
||||||
optionsObject = factory->CreateNullJSObject();
|
thread, optionsObject, property, {LocaleMatcherOption::LOOKUP, LocaleMatcherOption::BEST_FIT},
|
||||||
} else if (!options->IsJSObject()) {
|
{"lookup", "best fit"}, LocaleMatcherOption::BEST_FIT);
|
||||||
THROW_TYPE_ERROR_AND_RETURN(thread, "options is not Object", listFormat);
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
||||||
} else {
|
|
||||||
optionsObject = JSTaggedValue::ToObject(thread, options);
|
// 8. Let localeData be %ListFormat%.[[LocaleData]].
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
JSHandle<TaggedArray> availableLocales;
|
||||||
}
|
if (requestedLocales->GetLength() == 0) {
|
||||||
|
availableLocales = factory->EmptyArray();
|
||||||
// 5. Let opt be a new Record.
|
} else {
|
||||||
// 6. Let matcher be ? GetOption(options, "localeMatcher", "string", « "lookup", "best fit" », "best fit").
|
availableLocales = GetAvailableLocales(thread);
|
||||||
JSHandle<JSTaggedValue> property = globalConst->GetHandledLocaleMatcherString();
|
}
|
||||||
auto matcher = JSLocale::GetOptionOfString<LocaleMatcherOption>(
|
|
||||||
thread, optionsObject, property, {LocaleMatcherOption::LOOKUP, LocaleMatcherOption::BEST_FIT},
|
// 9. Let r be ResolveLocale(%ListFormat%.[[AvailableLocales]], requestedLocales,
|
||||||
{"lookup", "best fit"}, LocaleMatcherOption::BEST_FIT);
|
// opt, %ListFormat%.[[RelevantExtensionKeys]], localeData).
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
std::set<std::string> relevantExtensionKeys {""};
|
||||||
|
ResolvedLocale r =
|
||||||
// 8. Let localeData be %ListFormat%.[[LocaleData]].
|
JSLocale::ResolveLocale(thread, availableLocales, requestedLocales, matcher, relevantExtensionKeys);
|
||||||
JSHandle<TaggedArray> availableLocales;
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
||||||
if (requestedLocales->GetLength() == 0) {
|
|
||||||
availableLocales = factory->EmptyArray();
|
// 10. Set listFormat.[[Locale]] to r.[[locale]].
|
||||||
} else {
|
icu::Locale icuLocale = r.localeData;
|
||||||
availableLocales = GetAvailableLocales(thread);
|
JSHandle<EcmaString> localeStr = intl::LocaleHelper::ToLanguageTag(thread, icuLocale);
|
||||||
}
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
||||||
|
listFormat->SetLocale(thread, localeStr.GetTaggedValue());
|
||||||
// 9. Let r be ResolveLocale(%ListFormat%.[[AvailableLocales]], requestedLocales,
|
|
||||||
// opt, %ListFormat%.[[RelevantExtensionKeys]], localeData).
|
// 11. Let type be ? GetOption(options, "type", "string", « "conjunction", "disjunction", "unit" », "conjunction").
|
||||||
std::set<std::string> relevantExtensionKeys {""};
|
property = globalConst->GetHandledTypeString();
|
||||||
ResolvedLocale r =
|
auto type = JSLocale::GetOptionOfString<ListTypeOption>(thread, optionsObject, property,
|
||||||
JSLocale::ResolveLocale(thread, availableLocales, requestedLocales, matcher, relevantExtensionKeys);
|
{ListTypeOption::CONJUNCTION, ListTypeOption::DISJUNCTION,
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
ListTypeOption::UNIT},
|
||||||
|
{"conjunction", "disjunction", "unit"},
|
||||||
// 10. Set listFormat.[[Locale]] to r.[[locale]].
|
ListTypeOption::CONJUNCTION);
|
||||||
icu::Locale icuLocale = r.localeData;
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
||||||
JSHandle<EcmaString> localeStr = intl::LocaleHelper::ToLanguageTag(thread, icuLocale);
|
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
// 12. Set listFormat.[[Type]] to type.
|
||||||
listFormat->SetLocale(thread, localeStr.GetTaggedValue());
|
listFormat->SetType(type);
|
||||||
|
|
||||||
// 11. Let type be ? GetOption(options, "type", "string", « "conjunction", "disjunction", "unit" », "conjunction").
|
// 13. Let style be ? GetOption(options, "style", "string", « "long", "short", "narrow" », "long").
|
||||||
property = globalConst->GetHandledTypeString();
|
property = globalConst->GetHandledStyleString();
|
||||||
auto type = JSLocale::GetOptionOfString<ListTypeOption>(thread, optionsObject, property,
|
auto style = JSLocale::GetOptionOfString<ListStyleOption>(thread, optionsObject, property,
|
||||||
{ListTypeOption::CONJUNCTION, ListTypeOption::DISJUNCTION,
|
{ListStyleOption::LONG, ListStyleOption::SHORT,
|
||||||
ListTypeOption::UNIT},
|
ListStyleOption::NARROW},
|
||||||
{"conjunction", "disjunction", "unit"},
|
{"long", "short", "narrow"}, ListStyleOption::LONG);
|
||||||
ListTypeOption::CONJUNCTION);
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
|
||||||
|
// 14. Set listFormat.[[Style]] to style.
|
||||||
// 12. Set listFormat.[[Type]] to type.
|
listFormat->SetStyle(style);
|
||||||
listFormat->SetType(type);
|
|
||||||
|
// 15. Let dataLocale be r.[[dataLocale]].
|
||||||
// 13. Let style be ? GetOption(options, "style", "string", « "long", "short", "narrow" », "long").
|
// 16. Let dataLocaleData be localeData.[[<dataLocale>]].
|
||||||
property = globalConst->GetHandledStyleString();
|
// 17. Let dataLocaleTypes be dataLocaleData.[[<type>]].
|
||||||
auto style = JSLocale::GetOptionOfString<ListStyleOption>(thread, optionsObject, property,
|
// 18. Set listFormat.[[Templates]] to dataLocaleTypes.[[<style>]].
|
||||||
{ListStyleOption::LONG, ListStyleOption::SHORT,
|
// 19. Return listFormat.
|
||||||
ListStyleOption::NARROW},
|
|
||||||
{"long", "short", "narrow"}, ListStyleOption::LONG);
|
// Trans typeOption to ICU type
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSListFormat, thread);
|
UListFormatterType uType;
|
||||||
|
switch (type) {
|
||||||
// 14. Set listFormat.[[Style]] to style.
|
case ListTypeOption::CONJUNCTION:
|
||||||
listFormat->SetStyle(style);
|
uType = ULISTFMT_TYPE_AND;
|
||||||
|
break;
|
||||||
// 15. Let dataLocale be r.[[dataLocale]].
|
case ListTypeOption::DISJUNCTION:
|
||||||
// 16. Let dataLocaleData be localeData.[[<dataLocale>]].
|
uType = ULISTFMT_TYPE_OR;
|
||||||
// 17. Let dataLocaleTypes be dataLocaleData.[[<type>]].
|
break;
|
||||||
// 18. Set listFormat.[[Templates]] to dataLocaleTypes.[[<style>]].
|
case ListTypeOption::UNIT:
|
||||||
// 19. Return listFormat.
|
uType = ULISTFMT_TYPE_UNITS;
|
||||||
|
break;
|
||||||
// Trans typeOption to ICU type
|
default:
|
||||||
UListFormatterType uType;
|
LOG_ECMA(FATAL) << "this branch is unreachable";
|
||||||
switch (type) {
|
UNREACHABLE();
|
||||||
case ListTypeOption::CONJUNCTION:
|
}
|
||||||
uType = ULISTFMT_TYPE_AND;
|
|
||||||
break;
|
// Trans StyleOption to ICU Style
|
||||||
case ListTypeOption::DISJUNCTION:
|
UListFormatterWidth uStyle;
|
||||||
uType = ULISTFMT_TYPE_OR;
|
switch (style) {
|
||||||
break;
|
case ListStyleOption::LONG:
|
||||||
case ListTypeOption::UNIT:
|
uStyle = ULISTFMT_WIDTH_WIDE;
|
||||||
uType = ULISTFMT_TYPE_UNITS;
|
break;
|
||||||
break;
|
case ListStyleOption::SHORT:
|
||||||
default:
|
uStyle = ULISTFMT_WIDTH_SHORT;
|
||||||
LOG_ECMA(FATAL) << "this branch is unreachable";
|
break;
|
||||||
UNREACHABLE();
|
case ListStyleOption::NARROW:
|
||||||
}
|
uStyle = ULISTFMT_WIDTH_NARROW;
|
||||||
|
break;
|
||||||
// Trans StyleOption to ICU Style
|
default:
|
||||||
UListFormatterWidth uStyle;
|
LOG_ECMA(FATAL) << "this branch is unreachable";
|
||||||
switch (style) {
|
UNREACHABLE();
|
||||||
case ListStyleOption::LONG:
|
}
|
||||||
uStyle = ULISTFMT_WIDTH_WIDE;
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
break;
|
icu::ListFormatter *icuListFormatter = icu::ListFormatter::createInstance(icuLocale, uType, uStyle, status);
|
||||||
case ListStyleOption::SHORT:
|
if (U_FAILURE(status) || icuListFormatter == nullptr) {
|
||||||
uStyle = ULISTFMT_WIDTH_SHORT;
|
delete icuListFormatter;
|
||||||
break;
|
if (status == UErrorCode::U_MISSING_RESOURCE_ERROR) {
|
||||||
case ListStyleOption::NARROW:
|
THROW_REFERENCE_ERROR_AND_RETURN(thread, "can not find icu data resources", listFormat);
|
||||||
uStyle = ULISTFMT_WIDTH_NARROW;
|
}
|
||||||
break;
|
THROW_RANGE_ERROR_AND_RETURN(thread, "create icu::ListFormatter failed", listFormat);
|
||||||
default:
|
}
|
||||||
LOG_ECMA(FATAL) << "this branch is unreachable";
|
SetIcuListFormatter(thread, listFormat, icuListFormatter, JSListFormat::FreeIcuListFormatter);
|
||||||
UNREACHABLE();
|
return listFormat;
|
||||||
}
|
}
|
||||||
UErrorCode status = U_ZERO_ERROR;
|
|
||||||
icu::ListFormatter *icuListFormatter = icu::ListFormatter::createInstance(icuLocale, uType, uStyle, status);
|
// 13.1.5 StringListFromIterable ( iterable )
|
||||||
if (U_FAILURE(status) || icuListFormatter == nullptr) {
|
JSHandle<JSTaggedValue> JSListFormat::StringListFromIterable(JSThread *thread, const JSHandle<JSTaggedValue> &iterable)
|
||||||
delete icuListFormatter;
|
{
|
||||||
if (status == UErrorCode::U_MISSING_RESOURCE_ERROR) {
|
JSHandle<JSArray> array = JSHandle<JSArray>::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)));
|
||||||
THROW_REFERENCE_ERROR_AND_RETURN(thread, "can not find icu data resources", listFormat);
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||||
}
|
JSHandle<JSTaggedValue> arrayList = JSHandle<JSTaggedValue>::Cast(array);
|
||||||
THROW_RANGE_ERROR_AND_RETURN(thread, "create icu::ListFormatter failed", listFormat);
|
// 1. If iterable is undefined, then
|
||||||
}
|
// a. Return a new empty List.
|
||||||
SetIcuListFormatter(thread, listFormat, icuListFormatter, JSListFormat::FreeIcuListFormatter);
|
if (iterable->IsUndefined()) {
|
||||||
return listFormat;
|
return arrayList;
|
||||||
}
|
}
|
||||||
|
// 2. Let iteratorRecord be ? GetIterator(iterable).
|
||||||
// 13.1.5 StringListFromIterable ( iterable )
|
JSHandle<JSTaggedValue> iteratorRecord(JSIterator::GetIterator(thread, iterable));
|
||||||
JSHandle<JSTaggedValue> JSListFormat::StringListFromIterable(JSThread *thread, const JSHandle<JSTaggedValue> &iterable)
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||||
{
|
// 3. Let list be a new empty List.
|
||||||
JSHandle<JSArray> array = JSHandle<JSArray>::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)));
|
// 4. Let next be true.
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
JSHandle<JSTaggedValue> next(thread, JSTaggedValue::True());
|
||||||
JSHandle<JSTaggedValue> arrayList = JSHandle<JSTaggedValue>::Cast(array);
|
// 5. Repeat, while next is not false,
|
||||||
// 1. If iterable is undefined, then
|
// a. Set next to ? IteratorStep(iteratorRecord).
|
||||||
// a. Return a new empty List.
|
// b. If next is not false, then
|
||||||
if (iterable->IsUndefined()) {
|
// i. Let nextValue be ? IteratorValue(next).
|
||||||
return arrayList;
|
// ii. If Type(nextValue) is not String, then
|
||||||
}
|
// 1. Let error be ThrowCompletion(a newly created TypeError object).
|
||||||
// 2. Let iteratorRecord be ? GetIterator(iterable).
|
// 2. Return ? IteratorClose(iteratorRecord, error).
|
||||||
JSHandle<JSTaggedValue> iteratorRecord(JSIterator::GetIterator(thread, iterable));
|
// iii. Append nextValue to the end of the List list.
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
uint32_t k = 0;
|
||||||
// 3. Let list be a new empty List.
|
while (!next->IsFalse()) {
|
||||||
// 4. Let next be true.
|
next = JSIterator::IteratorStep(thread, iteratorRecord);
|
||||||
JSHandle<JSTaggedValue> next(thread, JSTaggedValue::True());
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||||
// 5. Repeat, while next is not false,
|
if (!next->IsFalse()) {
|
||||||
// a. Set next to ? IteratorStep(iteratorRecord).
|
JSHandle<JSTaggedValue> nextValue(JSIterator::IteratorValue(thread, next));
|
||||||
// b. If next is not false, then
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
||||||
// i. Let nextValue be ? IteratorValue(next).
|
if (!nextValue->IsString()) {
|
||||||
// ii. If Type(nextValue) is not String, then
|
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||||
// 1. Let error be ThrowCompletion(a newly created TypeError object).
|
JSHandle<JSObject> typeError =
|
||||||
// 2. Return ? IteratorClose(iteratorRecord, error).
|
factory->GetJSError(ErrorType::TYPE_ERROR, "nextValue is not string", StackCheck::NO);
|
||||||
// iii. Append nextValue to the end of the List list.
|
JSHandle<JSTaggedValue> error(
|
||||||
uint32_t k = 0;
|
factory->NewCompletionRecord(CompletionRecordType::THROW, JSHandle<JSTaggedValue>(typeError)));
|
||||||
while (!next->IsFalse()) {
|
JSTaggedValue result = JSIterator::IteratorClose(thread, iteratorRecord, error).GetTaggedValue();
|
||||||
next = JSIterator::IteratorStep(thread, iteratorRecord);
|
THROW_TYPE_ERROR_AND_RETURN(thread, "type error", JSHandle<JSTaggedValue>(thread, result));
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
}
|
||||||
if (!next->IsFalse()) {
|
JSArray::FastSetPropertyByValue(thread, arrayList, k, nextValue);
|
||||||
JSHandle<JSTaggedValue> nextValue(JSIterator::IteratorValue(thread, next));
|
k++;
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread);
|
}
|
||||||
if (!nextValue->IsString()) {
|
}
|
||||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
// 6. Return list.
|
||||||
JSHandle<JSObject> typeError =
|
return arrayList;
|
||||||
factory->GetJSError(ErrorType::TYPE_ERROR, "nextValue is not string", StackCheck::NO);
|
}
|
||||||
JSHandle<JSTaggedValue> error(
|
|
||||||
factory->NewCompletionRecord(CompletionRecordType::THROW, JSHandle<JSTaggedValue>(typeError)));
|
namespace {
|
||||||
JSTaggedValue result = JSIterator::IteratorClose(thread, iteratorRecord, error).GetTaggedValue();
|
std::vector<icu::UnicodeString> ToUnicodeStringArray(JSThread *thread, const JSHandle<JSArray> &array)
|
||||||
THROW_TYPE_ERROR_AND_RETURN(thread, "type error", JSHandle<JSTaggedValue>(thread, result));
|
{
|
||||||
}
|
uint32_t length = array->GetArrayLength();
|
||||||
JSArray::FastSetPropertyByValue(thread, arrayList, k, nextValue);
|
std::vector<icu::UnicodeString> result;
|
||||||
k++;
|
for (uint32_t k = 0; k < length; k++) {
|
||||||
}
|
JSHandle<JSTaggedValue> listArray = JSHandle<JSTaggedValue>::Cast(array);
|
||||||
}
|
JSHandle<JSTaggedValue> kValue = JSArray::FastGetPropertyByValue(thread, listArray, k);
|
||||||
// 6. Return list.
|
ASSERT(kValue->IsString());
|
||||||
return arrayList;
|
JSHandle<EcmaString> kValueString = JSTaggedValue::ToString(thread, kValue);
|
||||||
}
|
std::string stdString = intl::LocaleHelper::ConvertToStdString(kValueString);
|
||||||
|
icu::StringPiece sp(stdString);
|
||||||
namespace {
|
icu::UnicodeString uString = icu::UnicodeString::fromUTF8(sp);
|
||||||
std::vector<icu::UnicodeString> ToUnicodeStringArray(JSThread *thread, const JSHandle<JSArray> &array)
|
result.push_back(uString);
|
||||||
{
|
}
|
||||||
uint32_t length = array->GetArrayLength();
|
return result;
|
||||||
std::vector<icu::UnicodeString> result;
|
}
|
||||||
for (uint32_t k = 0; k < length; k++) {
|
|
||||||
JSHandle<JSTaggedValue> listArray = JSHandle<JSTaggedValue>::Cast(array);
|
icu::FormattedList GetIcuFormatted(JSThread *thread, const JSHandle<JSListFormat> &listFormat,
|
||||||
JSHandle<JSTaggedValue> kValue = JSArray::FastGetPropertyByValue(thread, listArray, k);
|
const JSHandle<JSArray> &listArray)
|
||||||
ASSERT(kValue->IsString());
|
{
|
||||||
JSHandle<EcmaString> kValueString = JSTaggedValue::ToString(thread, kValue);
|
icu::ListFormatter *icuListFormat = listFormat->GetIcuListFormatter();
|
||||||
std::string stdString = intl::LocaleHelper::ConvertToStdString(kValueString);
|
ASSERT(icuListFormat != nullptr);
|
||||||
icu::StringPiece sp(stdString);
|
std::vector<icu::UnicodeString> usArray = ToUnicodeStringArray(thread, listArray);
|
||||||
icu::UnicodeString uString = icu::UnicodeString::fromUTF8(sp);
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
result.push_back(uString);
|
icu::FormattedList formatted = icuListFormat->formatStringsToValue(usArray.data(),
|
||||||
}
|
static_cast<int32_t>(usArray.size()),
|
||||||
return result;
|
status);
|
||||||
}
|
return formatted;
|
||||||
|
}
|
||||||
icu::FormattedList GetIcuFormatted(JSThread *thread, const JSHandle<JSListFormat> &listFormat,
|
|
||||||
const JSHandle<JSArray> &listArray)
|
void FormatListToArray(JSThread *thread, const icu::FormattedList &formatted, const JSHandle<JSArray> &receiver,
|
||||||
{
|
UErrorCode &status, icu::UnicodeString &listString)
|
||||||
icu::ListFormatter *icuListFormat = listFormat->GetIcuListFormatter();
|
{
|
||||||
ASSERT(icuListFormat != nullptr);
|
icu::ConstrainedFieldPosition cfpo;
|
||||||
std::vector<icu::UnicodeString> usArray = ToUnicodeStringArray(thread, listArray);
|
cfpo.constrainCategory(UFIELD_CATEGORY_LIST);
|
||||||
UErrorCode status = U_ZERO_ERROR;
|
auto globalConst = thread->GlobalConstants();
|
||||||
icu::FormattedList formatted = icuListFormat->formatStringsToValue(usArray.data(),
|
JSMutableHandle<JSTaggedValue> typeString(thread, JSTaggedValue::Undefined());
|
||||||
static_cast<int32_t>(usArray.size()),
|
int index = 0;
|
||||||
status);
|
while (formatted.nextPosition(cfpo, status) && U_SUCCESS(status)) {
|
||||||
return formatted;
|
int32_t fieldId = cfpo.getField();
|
||||||
}
|
int32_t start = cfpo.getStart();
|
||||||
|
int32_t limit = cfpo.getLimit();
|
||||||
void FormatListToArray(JSThread *thread, const icu::FormattedList &formatted, const JSHandle<JSArray> &receiver,
|
if (static_cast<UListFormatterField>(fieldId) == ULISTFMT_ELEMENT_FIELD) {
|
||||||
UErrorCode &status, icu::UnicodeString &listString)
|
JSHandle<EcmaString> substring = intl::LocaleHelper::UStringToString(thread, listString, start, limit);
|
||||||
{
|
typeString.Update(globalConst->GetElementString());
|
||||||
icu::ConstrainedFieldPosition cfpo;
|
JSLocale::PutElement(thread, index, receiver, typeString, JSHandle<JSTaggedValue>::Cast(substring));
|
||||||
cfpo.constrainCategory(UFIELD_CATEGORY_LIST);
|
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||||
auto globalConst = thread->GlobalConstants();
|
index++;
|
||||||
JSMutableHandle<JSTaggedValue> typeString(thread, JSTaggedValue::Undefined());
|
} else {
|
||||||
int index = 0;
|
JSHandle<EcmaString> substring = intl::LocaleHelper::UStringToString(thread, listString, start, limit);
|
||||||
while (formatted.nextPosition(cfpo, status) && U_SUCCESS(status)) {
|
typeString.Update(globalConst->GetLiteralString());
|
||||||
int32_t fieldId = cfpo.getField();
|
JSLocale::PutElement(thread, index, receiver, typeString, JSHandle<JSTaggedValue>::Cast(substring));
|
||||||
int32_t start = cfpo.getStart();
|
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||||
int32_t limit = cfpo.getLimit();
|
index++;
|
||||||
if (static_cast<UListFormatterField>(fieldId) == ULISTFMT_ELEMENT_FIELD) {
|
}
|
||||||
JSHandle<EcmaString> substring = intl::LocaleHelper::UStringToString(thread, listString, start, limit);
|
}
|
||||||
typeString.Update(globalConst->GetElementString());
|
}
|
||||||
JSLocale::PutElement(thread, index, receiver, typeString, JSHandle<JSTaggedValue>::Cast(substring));
|
|
||||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
JSHandle<JSTaggedValue> ListOptionStyleToEcmaString(JSThread *thread, ListStyleOption style)
|
||||||
index++;
|
{
|
||||||
} else {
|
JSMutableHandle<JSTaggedValue> result(thread, JSTaggedValue::Undefined());
|
||||||
JSHandle<EcmaString> substring = intl::LocaleHelper::UStringToString(thread, listString, start, limit);
|
auto globalConst = thread->GlobalConstants();
|
||||||
typeString.Update(globalConst->GetLiteralString());
|
switch (style) {
|
||||||
JSLocale::PutElement(thread, index, receiver, typeString, JSHandle<JSTaggedValue>::Cast(substring));
|
case ListStyleOption::LONG:
|
||||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
result.Update(globalConst->GetHandledLongString().GetTaggedValue());
|
||||||
index++;
|
break;
|
||||||
}
|
case ListStyleOption::SHORT:
|
||||||
}
|
result.Update(globalConst->GetHandledShortString().GetTaggedValue());
|
||||||
}
|
break;
|
||||||
|
case ListStyleOption::NARROW:
|
||||||
JSHandle<JSTaggedValue> ListOptionStyleToEcmaString(JSThread *thread, ListStyleOption style)
|
result.Update(globalConst->GetHandledNarrowString().GetTaggedValue());
|
||||||
{
|
break;
|
||||||
JSMutableHandle<JSTaggedValue> result(thread, JSTaggedValue::Undefined());
|
default:
|
||||||
auto globalConst = thread->GlobalConstants();
|
LOG_ECMA(FATAL) << "this branch is unreachable";
|
||||||
switch (style) {
|
UNREACHABLE();
|
||||||
case ListStyleOption::LONG:
|
}
|
||||||
result.Update(globalConst->GetHandledLongString().GetTaggedValue());
|
return result;
|
||||||
break;
|
}
|
||||||
case ListStyleOption::SHORT:
|
|
||||||
result.Update(globalConst->GetHandledShortString().GetTaggedValue());
|
JSHandle<JSTaggedValue> ListOptionTypeToEcmaString(JSThread *thread, ListTypeOption type)
|
||||||
break;
|
{
|
||||||
case ListStyleOption::NARROW:
|
JSMutableHandle<JSTaggedValue> result(thread, JSTaggedValue::Undefined());
|
||||||
result.Update(globalConst->GetHandledNarrowString().GetTaggedValue());
|
auto globalConst = thread->GlobalConstants();
|
||||||
break;
|
switch (type) {
|
||||||
default:
|
case ListTypeOption::CONJUNCTION:
|
||||||
LOG_ECMA(FATAL) << "this branch is unreachable";
|
result.Update(globalConst->GetHandledConjunctionString().GetTaggedValue());
|
||||||
UNREACHABLE();
|
break;
|
||||||
}
|
case ListTypeOption::DISJUNCTION:
|
||||||
return result;
|
result.Update(globalConst->GetHandledDisjunctionString().GetTaggedValue());
|
||||||
}
|
break;
|
||||||
|
case ListTypeOption::UNIT:
|
||||||
JSHandle<JSTaggedValue> ListOptionTypeToEcmaString(JSThread *thread, ListTypeOption type)
|
result.Update(globalConst->GetHandledUnitString().GetTaggedValue());
|
||||||
{
|
break;
|
||||||
JSMutableHandle<JSTaggedValue> result(thread, JSTaggedValue::Undefined());
|
default:
|
||||||
auto globalConst = thread->GlobalConstants();
|
LOG_ECMA(FATAL) << "this branch is unreachable";
|
||||||
switch (type) {
|
UNREACHABLE();
|
||||||
case ListTypeOption::CONJUNCTION:
|
}
|
||||||
result.Update(globalConst->GetHandledConjunctionString().GetTaggedValue());
|
return result;
|
||||||
break;
|
}
|
||||||
case ListTypeOption::DISJUNCTION:
|
}
|
||||||
result.Update(globalConst->GetHandledDisjunctionString().GetTaggedValue());
|
|
||||||
break;
|
// 13.1.3 FormatList ( listFormat, list )
|
||||||
case ListTypeOption::UNIT:
|
JSHandle<EcmaString> JSListFormat::FormatList(JSThread *thread, const JSHandle<JSListFormat> &listFormat,
|
||||||
result.Update(globalConst->GetHandledUnitString().GetTaggedValue());
|
const JSHandle<JSArray> &listArray)
|
||||||
break;
|
{
|
||||||
default:
|
JSHandle<EcmaString> stringValue;
|
||||||
LOG_ECMA(FATAL) << "this branch is unreachable";
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
UNREACHABLE();
|
icu::FormattedList formatted = GetIcuFormatted(thread, listFormat, listArray);
|
||||||
}
|
if (U_FAILURE(status)) {
|
||||||
return result;
|
THROW_RANGE_ERROR_AND_RETURN(thread, "icu listformat failed", stringValue);
|
||||||
}
|
}
|
||||||
}
|
icu::UnicodeString result = formatted.toString(status);
|
||||||
|
if (U_FAILURE(status)) {
|
||||||
// 13.1.3 FormatList ( listFormat, list )
|
THROW_RANGE_ERROR_AND_RETURN(thread, "formatted list toString failed", stringValue);
|
||||||
JSHandle<EcmaString> JSListFormat::FormatList(JSThread *thread, const JSHandle<JSListFormat> &listFormat,
|
}
|
||||||
const JSHandle<JSArray> &listArray)
|
stringValue = intl::LocaleHelper::UStringToString(thread, result);
|
||||||
{
|
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, stringValue);
|
||||||
JSHandle<EcmaString> stringValue;
|
// 4. Return result
|
||||||
UErrorCode status = U_ZERO_ERROR;
|
return stringValue;
|
||||||
icu::FormattedList formatted = GetIcuFormatted(thread, listFormat, listArray);
|
}
|
||||||
if (U_FAILURE(status)) {
|
|
||||||
THROW_RANGE_ERROR_AND_RETURN(thread, "icu listformat failed", stringValue);
|
// 13.1.4 FormatListToParts ( listFormat, list )
|
||||||
}
|
JSHandle<JSArray> JSListFormat::FormatListToParts(JSThread *thread, const JSHandle<JSListFormat> &listFormat,
|
||||||
icu::UnicodeString result = formatted.toString(status);
|
const JSHandle<JSArray> &listArray)
|
||||||
if (U_FAILURE(status)) {
|
{
|
||||||
THROW_RANGE_ERROR_AND_RETURN(thread, "formatted list toString failed", stringValue);
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
}
|
icu::FormattedList formatted = GetIcuFormatted(thread, listFormat, listArray);
|
||||||
stringValue = intl::LocaleHelper::UStringToString(thread, result);
|
if (U_FAILURE(status)) {
|
||||||
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, stringValue);
|
THROW_RANGE_ERROR_AND_RETURN(thread, "icu listformat failed", listArray);
|
||||||
// 4. Return result
|
}
|
||||||
return stringValue;
|
icu::UnicodeString result = formatted.toString(status);
|
||||||
}
|
if (U_FAILURE(status)) {
|
||||||
|
THROW_RANGE_ERROR_AND_RETURN(thread, "formatted list toString failed", listArray);
|
||||||
// 13.1.4 FormatListToParts ( listFormat, list )
|
}
|
||||||
JSHandle<JSArray> JSListFormat::FormatListToParts(JSThread *thread, const JSHandle<JSListFormat> &listFormat,
|
JSHandle<JSArray> array = JSHandle<JSArray>::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)));
|
||||||
const JSHandle<JSArray> &listArray)
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSArray, thread);
|
||||||
{
|
FormatListToArray(thread, formatted, array, status, result);
|
||||||
UErrorCode status = U_ZERO_ERROR;
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSArray, thread);
|
||||||
icu::FormattedList formatted = GetIcuFormatted(thread, listFormat, listArray);
|
return array;
|
||||||
if (U_FAILURE(status)) {
|
}
|
||||||
THROW_RANGE_ERROR_AND_RETURN(thread, "icu listformat failed", listArray);
|
|
||||||
}
|
void JSListFormat::ResolvedOptions(JSThread *thread, const JSHandle<JSListFormat> &listFormat,
|
||||||
icu::UnicodeString result = formatted.toString(status);
|
const JSHandle<JSObject> &options)
|
||||||
if (U_FAILURE(status)) {
|
{
|
||||||
THROW_RANGE_ERROR_AND_RETURN(thread, "formatted list toString failed", listArray);
|
auto globalConst = thread->GlobalConstants();
|
||||||
}
|
|
||||||
JSHandle<JSArray> array = JSHandle<JSArray>::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)));
|
// [[Locale]]
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSArray, thread);
|
JSHandle<JSTaggedValue> propertyKey = globalConst->GetHandledLocaleString();
|
||||||
FormatListToArray(thread, formatted, array, status, result);
|
JSHandle<JSTaggedValue> locale(thread, listFormat->GetLocale());
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSArray, thread);
|
JSObject::CreateDataPropertyOrThrow(thread, options, propertyKey, locale);
|
||||||
return array;
|
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||||
}
|
|
||||||
|
// [[type]]
|
||||||
void JSListFormat::ResolvedOptions(JSThread *thread, const JSHandle<JSListFormat> &listFormat,
|
ListTypeOption type = listFormat->GetType();
|
||||||
const JSHandle<JSObject> &options)
|
propertyKey = globalConst->GetHandledTypeString();
|
||||||
{
|
JSHandle<JSTaggedValue> typeString = ListOptionTypeToEcmaString(thread, type);
|
||||||
auto globalConst = thread->GlobalConstants();
|
JSObject::CreateDataPropertyOrThrow(thread, options, propertyKey, typeString);
|
||||||
|
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||||
// [[Locale]]
|
|
||||||
JSHandle<JSTaggedValue> propertyKey = globalConst->GetHandledLocaleString();
|
// [[Style]]
|
||||||
JSHandle<JSTaggedValue> locale(thread, listFormat->GetLocale());
|
ListStyleOption style = listFormat->GetStyle();
|
||||||
JSObject::CreateDataPropertyOrThrow(thread, options, propertyKey, locale);
|
propertyKey = globalConst->GetHandledStyleString();
|
||||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
JSHandle<JSTaggedValue> styleString = ListOptionStyleToEcmaString(thread, style);
|
||||||
|
JSObject::CreateDataPropertyOrThrow(thread, options, propertyKey, styleString);
|
||||||
// [[type]]
|
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||||
ListTypeOption type = listFormat->GetType();
|
}
|
||||||
propertyKey = globalConst->GetHandledTypeString();
|
} // namespace panda::ecmascript
|
||||||
JSHandle<JSTaggedValue> typeString = ListOptionTypeToEcmaString(thread, type);
|
|
||||||
JSObject::CreateDataPropertyOrThrow(thread, options, propertyKey, typeString);
|
|
||||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
|
||||||
|
|
||||||
// [[Style]]
|
|
||||||
ListStyleOption style = listFormat->GetStyle();
|
|
||||||
propertyKey = globalConst->GetHandledStyleString();
|
|
||||||
JSHandle<JSTaggedValue> styleString = ListOptionStyleToEcmaString(thread, style);
|
|
||||||
JSObject::CreateDataPropertyOrThrow(thread, options, propertyKey, styleString);
|
|
||||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
|
||||||
}
|
|
||||||
} // namespace panda::ecmascript
|
|
||||||
|
@ -16,10 +16,6 @@
|
|||||||
#include "ecmascript/js_locale.h"
|
#include "ecmascript/js_locale.h"
|
||||||
|
|
||||||
#include "ecmascript/intl/locale_helper.h"
|
#include "ecmascript/intl/locale_helper.h"
|
||||||
#include "ecmascript/base/string_helper.h"
|
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/object_factory-inl.h"
|
#include "ecmascript/object_factory-inl.h"
|
||||||
#include "ecmascript/checkpoint/thread_state_transition.h"
|
#include "ecmascript/checkpoint/thread_state_transition.h"
|
||||||
|
|
||||||
@ -37,8 +33,6 @@
|
|||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "unicode/localematcher.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
const std::string LATN_STRING = "latn";
|
const std::string LATN_STRING = "latn";
|
||||||
// 6.4.1 IsValidTimeZoneName ( timeZone )
|
// 6.4.1 IsValidTimeZoneName ( timeZone )
|
||||||
|
@ -15,9 +15,7 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_map.h"
|
#include "ecmascript/js_map.h"
|
||||||
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/linked_hash_table.h"
|
#include "ecmascript/linked_hash_table.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
void JSMap::Set(JSThread *thread, const JSHandle<JSMap> &map, const JSHandle<JSTaggedValue> &key,
|
void JSMap::Set(JSThread *thread, const JSHandle<JSMap> &map, const JSHandle<JSTaggedValue> &key,
|
||||||
|
@ -18,9 +18,7 @@
|
|||||||
#include "ecmascript/builtins/builtins_errors.h"
|
#include "ecmascript/builtins/builtins_errors.h"
|
||||||
#include "ecmascript/element_accessor-inl.h"
|
#include "ecmascript/element_accessor-inl.h"
|
||||||
#include "ecmascript/js_array.h"
|
#include "ecmascript/js_array.h"
|
||||||
#include "ecmascript/js_map.h"
|
|
||||||
#include "ecmascript/linked_hash_table.h"
|
#include "ecmascript/linked_hash_table.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -14,34 +14,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/js_object.h"
|
#include "ecmascript/js_object.h"
|
||||||
#include "ecmascript/js_handle.h"
|
|
||||||
#include "ecmascript/js_object-inl.h"
|
|
||||||
|
|
||||||
#include "ecmascript/accessor_data.h"
|
|
||||||
#include "ecmascript/dfx/native_module_failure_info.h"
|
#include "ecmascript/dfx/native_module_failure_info.h"
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/element_accessor-inl.h"
|
|
||||||
#include "ecmascript/filter_helper.h"
|
|
||||||
#include "ecmascript/global_dictionary-inl.h"
|
#include "ecmascript/global_dictionary-inl.h"
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/ic/proto_change_details.h"
|
#include "ecmascript/ic/proto_change_details.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_for_in_iterator.h"
|
|
||||||
#include "ecmascript/js_hclass.h"
|
|
||||||
#include "ecmascript/js_iterator.h"
|
#include "ecmascript/js_iterator.h"
|
||||||
#include "ecmascript/js_object_resizing_strategy.h"
|
|
||||||
#include "ecmascript/js_primitive_ref.h"
|
#include "ecmascript/js_primitive_ref.h"
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/js_thread.h"
|
|
||||||
#include "ecmascript/object_factory-inl.h"
|
|
||||||
#include "ecmascript/object_fast_operator-inl.h"
|
#include "ecmascript/object_fast_operator-inl.h"
|
||||||
#include "ecmascript/pgo_profiler/pgo_profiler.h"
|
#include "ecmascript/pgo_profiler/pgo_profiler.h"
|
||||||
#include "ecmascript/property_accessor.h"
|
#include "ecmascript/property_accessor.h"
|
||||||
#include "ecmascript/property_attributes.h"
|
|
||||||
#include "ecmascript/shared_objects/js_shared_array.h"
|
|
||||||
#include "ecmascript/tagged_array-inl.h"
|
|
||||||
#include "ecmascript/jspandafile/debug_info_extractor.h"
|
|
||||||
#include "ecmascript/jspandafile/js_pandafile_manager.h"
|
#include "ecmascript/jspandafile/js_pandafile_manager.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_plural_rules.h"
|
#include "ecmascript/js_plural_rules.h"
|
||||||
|
|
||||||
#include "ecmascript/intl/locale_helper.h"
|
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/global_env_constants.h"
|
|
||||||
#include "ecmascript/object_factory-inl.h"
|
#include "ecmascript/object_factory-inl.h"
|
||||||
#include "ecmascript/js_number_format.h"
|
#include "ecmascript/js_number_format.h"
|
||||||
#include "ecmascript/checkpoint/thread_state_transition.h"
|
#include "ecmascript/checkpoint/thread_state_transition.h"
|
||||||
|
@ -15,11 +15,7 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_primitive_ref.h"
|
#include "ecmascript/js_primitive_ref.h"
|
||||||
|
|
||||||
#include "ecmascript/ecma_string-inl.h"
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/mem/assert_scope.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
// ES6 9.4.3.4 StringCreate( value, prototype)
|
// ES6 9.4.3.4 StringCreate( value, prototype)
|
||||||
|
@ -15,18 +15,10 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_promise.h"
|
#include "ecmascript/js_promise.h"
|
||||||
|
|
||||||
#include "ecmascript/base/error_type.h"
|
|
||||||
#include "ecmascript/builtins/builtins_promise_handler.h"
|
#include "ecmascript/builtins/builtins_promise_handler.h"
|
||||||
#include "ecmascript/ecma_context.h"
|
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/jobs/micro_job_queue.h"
|
#include "ecmascript/jobs/micro_job_queue.h"
|
||||||
#include "ecmascript/js_function.h"
|
|
||||||
#include "ecmascript/js_handle.h"
|
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
|
||||||
#include "ecmascript/js_thread.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsPromiseHandler = builtins::BuiltinsPromiseHandler;
|
using BuiltinsPromiseHandler = builtins::BuiltinsPromiseHandler;
|
||||||
|
@ -15,14 +15,10 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_proxy.h"
|
#include "ecmascript/js_proxy.h"
|
||||||
|
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_array.h"
|
|
||||||
#include "ecmascript/js_function.h"
|
#include "ecmascript/js_function.h"
|
||||||
#include "ecmascript/js_handle.h"
|
|
||||||
#include "ecmascript/js_object-inl.h"
|
#include "ecmascript/js_object-inl.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
// ES6 9.5.15 ProxyCreate(target, handler)
|
// ES6 9.5.15 ProxyCreate(target, handler)
|
||||||
|
@ -15,10 +15,7 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_regexp_iterator.h"
|
#include "ecmascript/js_regexp_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
|
||||||
#include "ecmascript/builtins/builtins_regexp.h"
|
#include "ecmascript/builtins/builtins_regexp.h"
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/object_fast_operator-inl.h"
|
#include "ecmascript/object_fast_operator-inl.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,10 +17,6 @@
|
|||||||
#include "ecmascript/js_function.h"
|
#include "ecmascript/js_function.h"
|
||||||
#include "ecmascript/object_factory-inl.h"
|
#include "ecmascript/object_factory-inl.h"
|
||||||
|
|
||||||
#include "unicode/decimfmt.h"
|
|
||||||
#include "unicode/numfmt.h"
|
|
||||||
#include "unicode/unum.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
// 14.1.1 InitializeRelativeTimeFormat ( relativeTimeFormat, locales, options )
|
// 14.1.1 InitializeRelativeTimeFormat ( relativeTimeFormat, locales, options )
|
||||||
JSHandle<JSRelativeTimeFormat> JSRelativeTimeFormat::InitializeRelativeTimeFormat(
|
JSHandle<JSRelativeTimeFormat> JSRelativeTimeFormat::InitializeRelativeTimeFormat(
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
#include "ecmascript/compiler/aot_file/an_file_data_manager.h"
|
#include "ecmascript/compiler/aot_file/an_file_data_manager.h"
|
||||||
#include "ecmascript/mem/mem_common.h"
|
|
||||||
#include "ecmascript/compiler/ecma_opcode_des.h"
|
#include "ecmascript/compiler/ecma_opcode_des.h"
|
||||||
#include "ecmascript/platform/os.h"
|
#include "ecmascript/platform/os.h"
|
||||||
|
|
||||||
|
@ -1,124 +1,111 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/js_segment_iterator.h"
|
#include "ecmascript/js_segment_iterator.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "ecmascript/base/builtins_base.h"
|
#include "ecmascript/js_iterator.h"
|
||||||
#include "ecmascript/intl/locale_helper.h"
|
#include "ecmascript/js_segments.h"
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/object_factory-inl.h"
|
||||||
#include "ecmascript/global_env_constants.h"
|
|
||||||
#include "ecmascript/js_iterator.h"
|
namespace panda::ecmascript {
|
||||||
#include "ecmascript/js_segments.h"
|
|
||||||
#include "ecmascript/object_factory-inl.h"
|
void JSSegmentIterator::SetIcuBreakIterator(JSThread *thread, const JSHandle<JSSegmentIterator> &iterator,
|
||||||
|
icu::BreakIterator* icuBreakIterator, const NativePointerCallback &callback)
|
||||||
#include "unicode/errorcode.h"
|
{
|
||||||
#include "unicode/locdspnm.h"
|
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||||
#include "unicode/locid.h"
|
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||||
#include "unicode/udisplaycontext.h"
|
|
||||||
#include "unicode/uloc.h"
|
ASSERT(icuBreakIterator != nullptr);
|
||||||
#include "unicode/unistr.h"
|
JSTaggedValue data = iterator->GetIcuField();
|
||||||
#include "unicode/uscript.h"
|
if (data.IsJSNativePointer()) {
|
||||||
#include "unicode/ustring.h"
|
JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject());
|
||||||
|
native->ResetExternalPointer(thread, icuBreakIterator);
|
||||||
namespace panda::ecmascript {
|
return;
|
||||||
|
}
|
||||||
void JSSegmentIterator::SetIcuBreakIterator(JSThread *thread, const JSHandle<JSSegmentIterator> &iterator,
|
JSHandle<JSNativePointer> pointer = factory->NewJSNativePointer(icuBreakIterator, callback);
|
||||||
icu::BreakIterator* icuBreakIterator, const NativePointerCallback &callback)
|
iterator->SetIcuField(thread, pointer.GetTaggedValue());
|
||||||
{
|
}
|
||||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
|
||||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
void JSSegmentIterator::SetUString(JSThread *thread, const JSHandle<JSSegmentIterator> &iterator,
|
||||||
|
icu::UnicodeString* icuUnicodeString, const NativePointerCallback &callback)
|
||||||
ASSERT(icuBreakIterator != nullptr);
|
{
|
||||||
JSTaggedValue data = iterator->GetIcuField();
|
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||||
if (data.IsJSNativePointer()) {
|
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||||
JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject());
|
|
||||||
native->ResetExternalPointer(thread, icuBreakIterator);
|
ASSERT(icuUnicodeString != nullptr);
|
||||||
return;
|
JSTaggedValue data = iterator->GetUnicodeString();
|
||||||
}
|
if (data.IsJSNativePointer()) {
|
||||||
JSHandle<JSNativePointer> pointer = factory->NewJSNativePointer(icuBreakIterator, callback);
|
JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject());
|
||||||
iterator->SetIcuField(thread, pointer.GetTaggedValue());
|
native->ResetExternalPointer(thread, icuUnicodeString);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
void JSSegmentIterator::SetUString(JSThread *thread, const JSHandle<JSSegmentIterator> &iterator,
|
JSHandle<JSNativePointer> pointer = factory->NewJSNativePointer(icuUnicodeString, callback);
|
||||||
icu::UnicodeString* icuUnicodeString, const NativePointerCallback &callback)
|
iterator->SetUnicodeString(thread, pointer.GetTaggedValue());
|
||||||
{
|
}
|
||||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
|
||||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
JSHandle<JSSegmentIterator> JSSegmentIterator::CreateSegmentIterator(JSThread *thread,
|
||||||
|
icu::BreakIterator* icuBreakIterator, const JSHandle<EcmaString> &string, GranularityOption granularity)
|
||||||
ASSERT(icuUnicodeString != nullptr);
|
{
|
||||||
JSTaggedValue data = iterator->GetUnicodeString();
|
// 1. Let internalSlotsList be « [[IteratingSegmenter]], [[IteratedString]],
|
||||||
if (data.IsJSNativePointer()) {
|
// [[IteratedStringNextSegmentCodeUnitIndex]] ».
|
||||||
JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject());
|
// 2. Let iterator be OrdinaryObjectCreate(%SegmentIteratorPrototype%, internalSlotsList).
|
||||||
native->ResetExternalPointer(thread, icuUnicodeString);
|
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||||
return;
|
JSHandle<JSFunction> segIterCtor(env->GetSegmentIterator());
|
||||||
}
|
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||||
JSHandle<JSNativePointer> pointer = factory->NewJSNativePointer(icuUnicodeString, callback);
|
JSHandle<JSSegmentIterator> iterator(factory->NewJSObjectByConstructor(segIterCtor));
|
||||||
iterator->SetUnicodeString(thread, pointer.GetTaggedValue());
|
icuBreakIterator = icuBreakIterator->clone();
|
||||||
}
|
// 5. Set iterator.[[IteratedStringNextSegmentCodeUnitIndex]] to 0.
|
||||||
|
icuBreakIterator->first();
|
||||||
JSHandle<JSSegmentIterator> JSSegmentIterator::CreateSegmentIterator(JSThread *thread,
|
icu::UnicodeString* uString = new icu::UnicodeString();
|
||||||
icu::BreakIterator* icuBreakIterator, const JSHandle<EcmaString> &string, GranularityOption granularity)
|
icuBreakIterator->getText().getText(*uString);
|
||||||
{
|
// 3. Set iterator.[[IteratingSegmenter]] to segmenter.
|
||||||
// 1. Let internalSlotsList be « [[IteratingSegmenter]], [[IteratedString]],
|
SetIcuBreakIterator(thread, iterator, icuBreakIterator, JSSegmentIterator::FreeIcuBreakIterator);
|
||||||
// [[IteratedStringNextSegmentCodeUnitIndex]] ».
|
iterator->SetGranularity(granularity);
|
||||||
// 2. Let iterator be OrdinaryObjectCreate(%SegmentIteratorPrototype%, internalSlotsList).
|
// 4. Set iterator.[[IteratedString]] to string.
|
||||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
iterator->SetIteratedString(thread, string);
|
||||||
JSHandle<JSFunction> segIterCtor(env->GetSegmentIterator());
|
SetUString(thread, iterator, uString, JSSegmentIterator::FreeUString);
|
||||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
// 6. Return iterator.
|
||||||
JSHandle<JSSegmentIterator> iterator(factory->NewJSObjectByConstructor(segIterCtor));
|
return iterator;
|
||||||
icuBreakIterator = icuBreakIterator->clone();
|
}
|
||||||
// 5. Set iterator.[[IteratedStringNextSegmentCodeUnitIndex]] to 0.
|
|
||||||
icuBreakIterator->first();
|
JSTaggedValue JSSegmentIterator::Next(JSThread *thread, const JSHandle<JSSegmentIterator> &iterator)
|
||||||
icu::UnicodeString* uString = new icu::UnicodeString();
|
{
|
||||||
icuBreakIterator->getText().getText(*uString);
|
icu::BreakIterator* icuBreakIterator = iterator->GetIcuBreakIterator();
|
||||||
// 3. Set iterator.[[IteratingSegmenter]] to segmenter.
|
// 5. Let startIndex be iterator.[[IteratedStringNextSegmentCodeUnitIndex]].
|
||||||
SetIcuBreakIterator(thread, iterator, icuBreakIterator, JSSegmentIterator::FreeIcuBreakIterator);
|
int32_t startIndex = icuBreakIterator->current();
|
||||||
iterator->SetGranularity(granularity);
|
// 6. Let endIndex be ! FindBoundary(segmenter, string, startIndex, after).
|
||||||
// 4. Set iterator.[[IteratedString]] to string.
|
int32_t endIndex = icuBreakIterator->next();
|
||||||
iterator->SetIteratedString(thread, string);
|
// 7. If endIndex is not finite, then
|
||||||
SetUString(thread, iterator, uString, JSSegmentIterator::FreeUString);
|
if (endIndex == icu::BreakIterator::DONE) {
|
||||||
// 6. Return iterator.
|
// a. Return CreateIterResultObject(undefined, true).
|
||||||
return iterator;
|
JSHandle<JSTaggedValue> result(thread, JSTaggedValue::Undefined());
|
||||||
}
|
return JSIterator::CreateIterResultObject(thread, result, true).GetTaggedValue();
|
||||||
|
}
|
||||||
JSTaggedValue JSSegmentIterator::Next(JSThread *thread, const JSHandle<JSSegmentIterator> &iterator)
|
|
||||||
{
|
// 8. Set iterator.[[IteratedStringNextSegmentCodeUnitIndex]] to endIndex.
|
||||||
icu::BreakIterator* icuBreakIterator = iterator->GetIcuBreakIterator();
|
// 9. Let segmentData be ! CreateSegmentDataObject(segmenter, string, startIndex, endIndex).
|
||||||
// 5. Let startIndex be iterator.[[IteratedStringNextSegmentCodeUnitIndex]].
|
icu::UnicodeString unicodeString;
|
||||||
int32_t startIndex = icuBreakIterator->current();
|
icuBreakIterator->getText().getText(unicodeString);
|
||||||
// 6. Let endIndex be ! FindBoundary(segmenter, string, startIndex, after).
|
JSHandle<JSObject> segmentData = JSSegments::CreateSegmentDataObject(thread, iterator->GetGranularity(),
|
||||||
int32_t endIndex = icuBreakIterator->next();
|
icuBreakIterator, JSHandle<EcmaString>(thread, iterator->GetIteratedString()),
|
||||||
// 7. If endIndex is not finite, then
|
unicodeString, startIndex, endIndex);
|
||||||
if (endIndex == icu::BreakIterator::DONE) {
|
|
||||||
// a. Return CreateIterResultObject(undefined, true).
|
// 10. Return CreateIterResultObject(segmentData, false).
|
||||||
JSHandle<JSTaggedValue> result(thread, JSTaggedValue::Undefined());
|
return JSIterator::CreateIterResultObject(thread, JSHandle<JSTaggedValue>::Cast(segmentData), false)
|
||||||
return JSIterator::CreateIterResultObject(thread, result, true).GetTaggedValue();
|
.GetTaggedValue();
|
||||||
}
|
}
|
||||||
|
} // namespace panda::ecmascript
|
||||||
// 8. Set iterator.[[IteratedStringNextSegmentCodeUnitIndex]] to endIndex.
|
|
||||||
// 9. Let segmentData be ! CreateSegmentDataObject(segmenter, string, startIndex, endIndex).
|
|
||||||
icu::UnicodeString unicodeString;
|
|
||||||
icuBreakIterator->getText().getText(unicodeString);
|
|
||||||
JSHandle<JSObject> segmentData = JSSegments::CreateSegmentDataObject(thread, iterator->GetGranularity(),
|
|
||||||
icuBreakIterator, JSHandle<EcmaString>(thread, iterator->GetIteratedString()),
|
|
||||||
unicodeString, startIndex, endIndex);
|
|
||||||
|
|
||||||
// 10. Return CreateIterResultObject(segmentData, false).
|
|
||||||
return JSIterator::CreateIterResultObject(thread, JSHandle<JSTaggedValue>::Cast(segmentData), false)
|
|
||||||
.GetTaggedValue();
|
|
||||||
}
|
|
||||||
} // namespace panda::ecmascript
|
|
||||||
|
@ -1,197 +1,186 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/js_segmenter.h"
|
#include "ecmascript/js_segmenter.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "ecmascript/intl/locale_helper.h"
|
#include "ecmascript/intl/locale_helper.h"
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/object_factory-inl.h"
|
||||||
#include "ecmascript/global_env_constants.h"
|
|
||||||
#include "ecmascript/object_factory-inl.h"
|
namespace panda::ecmascript {
|
||||||
|
|
||||||
#include "unicode/errorcode.h"
|
void JSSegmenter::SetIcuBreakIterator(JSThread *thread, const JSHandle<JSSegmenter> &segmenter,
|
||||||
#include "unicode/locdspnm.h"
|
icu::BreakIterator* icuBreakIterator, const NativePointerCallback &callback)
|
||||||
#include "unicode/locid.h"
|
{
|
||||||
#include "unicode/udisplaycontext.h"
|
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||||
#include "unicode/uloc.h"
|
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||||
#include "unicode/unistr.h"
|
|
||||||
#include "unicode/uscript.h"
|
ASSERT(icuBreakIterator != nullptr);
|
||||||
#include "unicode/ustring.h"
|
JSTaggedValue data = segmenter->GetIcuField();
|
||||||
|
if (data.IsJSNativePointer()) {
|
||||||
namespace panda::ecmascript {
|
JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject());
|
||||||
|
native->ResetExternalPointer(thread, icuBreakIterator);
|
||||||
void JSSegmenter::SetIcuBreakIterator(JSThread *thread, const JSHandle<JSSegmenter> &segmenter,
|
return;
|
||||||
icu::BreakIterator* icuBreakIterator, const NativePointerCallback &callback)
|
}
|
||||||
{
|
JSHandle<JSNativePointer> pointer = factory->NewJSNativePointer(icuBreakIterator, callback);
|
||||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
segmenter->SetIcuField(thread, pointer.GetTaggedValue());
|
||||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
}
|
||||||
|
|
||||||
ASSERT(icuBreakIterator != nullptr);
|
JSHandle<TaggedArray> JSSegmenter::GetAvailableLocales(JSThread *thread)
|
||||||
JSTaggedValue data = segmenter->GetIcuField();
|
{
|
||||||
if (data.IsJSNativePointer()) {
|
std::vector<std::string> availableStringLocales = intl::LocaleHelper::GetAvailableLocales(thread, nullptr, nullptr);
|
||||||
JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject());
|
JSHandle<TaggedArray> availableLocales = JSLocale::ConstructLocaleList(thread, availableStringLocales);
|
||||||
native->ResetExternalPointer(thread, icuBreakIterator);
|
return availableLocales;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
JSHandle<JSNativePointer> pointer = factory->NewJSNativePointer(icuBreakIterator, callback);
|
void JSSegmenter::InitializeIcuBreakIterator(JSThread *thread, const JSHandle<JSSegmenter> &segmenter,
|
||||||
segmenter->SetIcuField(thread, pointer.GetTaggedValue());
|
const icu::Locale &icuLocale, GranularityOption granularity)
|
||||||
}
|
{
|
||||||
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
JSHandle<TaggedArray> JSSegmenter::GetAvailableLocales(JSThread *thread)
|
std::unique_ptr<icu::BreakIterator> icuBreakIterator;
|
||||||
{
|
|
||||||
std::vector<std::string> availableStringLocales = intl::LocaleHelper::GetAvailableLocales(thread, nullptr, nullptr);
|
switch (granularity) {
|
||||||
JSHandle<TaggedArray> availableLocales = JSLocale::ConstructLocaleList(thread, availableStringLocales);
|
case GranularityOption::GRAPHEME:
|
||||||
return availableLocales;
|
icuBreakIterator.reset(icu::BreakIterator::createCharacterInstance(icuLocale, status));
|
||||||
}
|
break;
|
||||||
|
case GranularityOption::WORD:
|
||||||
void JSSegmenter::InitializeIcuBreakIterator(JSThread *thread, const JSHandle<JSSegmenter> &segmenter,
|
icuBreakIterator.reset(icu::BreakIterator::createWordInstance(icuLocale, status));
|
||||||
const icu::Locale &icuLocale, GranularityOption granularity)
|
break;
|
||||||
{
|
case GranularityOption::SENTENCE:
|
||||||
UErrorCode status = U_ZERO_ERROR;
|
icuBreakIterator.reset(icu::BreakIterator::createSentenceInstance(icuLocale, status));
|
||||||
std::unique_ptr<icu::BreakIterator> icuBreakIterator;
|
break;
|
||||||
|
default:
|
||||||
switch (granularity) {
|
LOG_ECMA(FATAL) << "this branch is unreachable";
|
||||||
case GranularityOption::GRAPHEME:
|
UNREACHABLE();
|
||||||
icuBreakIterator.reset(icu::BreakIterator::createCharacterInstance(icuLocale, status));
|
}
|
||||||
break;
|
if (U_FAILURE(status) || icuBreakIterator == nullptr) {
|
||||||
case GranularityOption::WORD:
|
if (status == UErrorCode::U_MISSING_RESOURCE_ERROR) {
|
||||||
icuBreakIterator.reset(icu::BreakIterator::createWordInstance(icuLocale, status));
|
THROW_ERROR(thread, ErrorType::REFERENCE_ERROR, "can not find icu data resources");
|
||||||
break;
|
}
|
||||||
case GranularityOption::SENTENCE:
|
THROW_ERROR(thread, ErrorType::RANGE_ERROR, "create icu::BreakIterator failed");
|
||||||
icuBreakIterator.reset(icu::BreakIterator::createSentenceInstance(icuLocale, status));
|
}
|
||||||
break;
|
|
||||||
default:
|
SetIcuBreakIterator(thread, segmenter, icuBreakIterator.release(), JSSegmenter::FreeIcuBreakIterator);
|
||||||
LOG_ECMA(FATAL) << "this branch is unreachable";
|
}
|
||||||
UNREACHABLE();
|
|
||||||
}
|
JSHandle<JSSegmenter> JSSegmenter::InitializeSegmenter(JSThread *thread,
|
||||||
if (U_FAILURE(status) || icuBreakIterator == nullptr) {
|
const JSHandle<JSSegmenter> &segmenter,
|
||||||
if (status == UErrorCode::U_MISSING_RESOURCE_ERROR) {
|
const JSHandle<JSTaggedValue> &locales,
|
||||||
THROW_ERROR(thread, ErrorType::REFERENCE_ERROR, "can not find icu data resources");
|
const JSHandle<JSTaggedValue> &options)
|
||||||
}
|
{
|
||||||
THROW_ERROR(thread, ErrorType::RANGE_ERROR, "create icu::BreakIterator failed");
|
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||||
}
|
auto globalConst = thread->GlobalConstants();
|
||||||
|
// 4. Let requestedLocales be ? CanonicalizeLocaleList(locales).
|
||||||
SetIcuBreakIterator(thread, segmenter, icuBreakIterator.release(), JSSegmenter::FreeIcuBreakIterator);
|
JSHandle<TaggedArray> requestedLocales = intl::LocaleHelper::CanonicalizeLocaleList(thread, locales);
|
||||||
}
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSSegmenter, thread);
|
||||||
|
|
||||||
JSHandle<JSSegmenter> JSSegmenter::InitializeSegmenter(JSThread *thread,
|
// 5. Let options be ? GetOptionsObject(options).
|
||||||
const JSHandle<JSSegmenter> &segmenter,
|
JSHandle<JSObject> optionsObject;
|
||||||
const JSHandle<JSTaggedValue> &locales,
|
if (options->IsUndefined()) {
|
||||||
const JSHandle<JSTaggedValue> &options)
|
optionsObject = factory->CreateNullJSObject();
|
||||||
{
|
} else if (!options->IsJSObject()) {
|
||||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
THROW_TYPE_ERROR_AND_RETURN(thread, "options is not Object", segmenter);
|
||||||
auto globalConst = thread->GlobalConstants();
|
} else {
|
||||||
// 4. Let requestedLocales be ? CanonicalizeLocaleList(locales).
|
optionsObject = JSTaggedValue::ToObject(thread, options);
|
||||||
JSHandle<TaggedArray> requestedLocales = intl::LocaleHelper::CanonicalizeLocaleList(thread, locales);
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSSegmenter, thread);
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSSegmenter, thread);
|
}
|
||||||
|
|
||||||
// 5. Let options be ? GetOptionsObject(options).
|
// 6. Let opt be a new Record.
|
||||||
JSHandle<JSObject> optionsObject;
|
// 7. Let matcher be ? GetOption(options, "localeMatcher", string, « "lookup", "best fit" », "best fit").
|
||||||
if (options->IsUndefined()) {
|
JSHandle<JSTaggedValue> property = globalConst->GetHandledLocaleMatcherString();
|
||||||
optionsObject = factory->CreateNullJSObject();
|
auto matcher = JSLocale::GetOptionOfString<LocaleMatcherOption>(
|
||||||
} else if (!options->IsJSObject()) {
|
thread, optionsObject, property, {LocaleMatcherOption::LOOKUP, LocaleMatcherOption::BEST_FIT},
|
||||||
THROW_TYPE_ERROR_AND_RETURN(thread, "options is not Object", segmenter);
|
{"lookup", "best fit"}, LocaleMatcherOption::BEST_FIT);
|
||||||
} else {
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSSegmenter, thread);
|
||||||
optionsObject = JSTaggedValue::ToObject(thread, options);
|
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSSegmenter, thread);
|
// 9. Let localeData be %Segmenter%.[[LocaleData]].
|
||||||
}
|
// 10. Let r be ResolveLocale(%Segmenter%.[[AvailableLocales]], requestedLocales, opt,
|
||||||
|
// %Segmenter%.[[RelevantExtensionKeys]], localeData).
|
||||||
// 6. Let opt be a new Record.
|
JSHandle<TaggedArray> availableLocales;
|
||||||
// 7. Let matcher be ? GetOption(options, "localeMatcher", string, « "lookup", "best fit" », "best fit").
|
if (requestedLocales->GetLength() == 0) {
|
||||||
JSHandle<JSTaggedValue> property = globalConst->GetHandledLocaleMatcherString();
|
availableLocales = factory->EmptyArray();
|
||||||
auto matcher = JSLocale::GetOptionOfString<LocaleMatcherOption>(
|
} else {
|
||||||
thread, optionsObject, property, {LocaleMatcherOption::LOOKUP, LocaleMatcherOption::BEST_FIT},
|
availableLocales = JSSegmenter::GetAvailableLocales(thread);
|
||||||
{"lookup", "best fit"}, LocaleMatcherOption::BEST_FIT);
|
}
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSSegmenter, thread);
|
std::set<std::string> relevantExtensionKeys {""};
|
||||||
|
ResolvedLocale r =
|
||||||
// 9. Let localeData be %Segmenter%.[[LocaleData]].
|
JSLocale::ResolveLocale(thread, availableLocales, requestedLocales, matcher, relevantExtensionKeys);
|
||||||
// 10. Let r be ResolveLocale(%Segmenter%.[[AvailableLocales]], requestedLocales, opt,
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSSegmenter, thread);
|
||||||
// %Segmenter%.[[RelevantExtensionKeys]], localeData).
|
|
||||||
JSHandle<TaggedArray> availableLocales;
|
// 11. Set segmenter.[[Locale]] to r.[[locale]].
|
||||||
if (requestedLocales->GetLength() == 0) {
|
icu::Locale icuLocale = r.localeData;
|
||||||
availableLocales = factory->EmptyArray();
|
JSHandle<EcmaString> localeStr = intl::LocaleHelper::ToLanguageTag(thread, icuLocale);
|
||||||
} else {
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSSegmenter, thread);
|
||||||
availableLocales = JSSegmenter::GetAvailableLocales(thread);
|
segmenter->SetLocale(thread, localeStr.GetTaggedValue());
|
||||||
}
|
|
||||||
std::set<std::string> relevantExtensionKeys {""};
|
// 12. Let granularity be ? GetOption(options, "granularity", string, « "grapheme", "word", "sentence" »,
|
||||||
ResolvedLocale r =
|
// "grapheme").
|
||||||
JSLocale::ResolveLocale(thread, availableLocales, requestedLocales, matcher, relevantExtensionKeys);
|
property = globalConst->GetHandledGranularityString();
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSSegmenter, thread);
|
auto granularity = JSLocale::GetOptionOfString<GranularityOption>(thread, optionsObject, property,
|
||||||
|
{GranularityOption::GRAPHEME,
|
||||||
// 11. Set segmenter.[[Locale]] to r.[[locale]].
|
GranularityOption::WORD,
|
||||||
icu::Locale icuLocale = r.localeData;
|
GranularityOption::SENTENCE},
|
||||||
JSHandle<EcmaString> localeStr = intl::LocaleHelper::ToLanguageTag(thread, icuLocale);
|
{"grapheme", "word", "sentence"},
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSSegmenter, thread);
|
GranularityOption::GRAPHEME);
|
||||||
segmenter->SetLocale(thread, localeStr.GetTaggedValue());
|
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSSegmenter, thread);
|
||||||
|
|
||||||
// 12. Let granularity be ? GetOption(options, "granularity", string, « "grapheme", "word", "sentence" »,
|
// 13. Set segmenter.[[SegmenterGranularity]] to granularity.
|
||||||
// "grapheme").
|
segmenter->SetGranularity(granularity);
|
||||||
property = globalConst->GetHandledGranularityString();
|
InitializeIcuBreakIterator(thread, segmenter, icuLocale, granularity);
|
||||||
auto granularity = JSLocale::GetOptionOfString<GranularityOption>(thread, optionsObject, property,
|
// 14. Return segmenter.
|
||||||
{GranularityOption::GRAPHEME,
|
return segmenter;
|
||||||
GranularityOption::WORD,
|
}
|
||||||
GranularityOption::SENTENCE},
|
|
||||||
{"grapheme", "word", "sentence"},
|
JSHandle<JSTaggedValue> JSSegmenter::GranularityOptionToEcmaString(JSThread *thread, GranularityOption granularity)
|
||||||
GranularityOption::GRAPHEME);
|
{
|
||||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSSegmenter, thread);
|
JSMutableHandle<JSTaggedValue> result(thread, JSTaggedValue::Undefined());
|
||||||
|
auto globalConst = thread->GlobalConstants();
|
||||||
// 13. Set segmenter.[[SegmenterGranularity]] to granularity.
|
switch (granularity) {
|
||||||
segmenter->SetGranularity(granularity);
|
case GranularityOption::GRAPHEME:
|
||||||
InitializeIcuBreakIterator(thread, segmenter, icuLocale, granularity);
|
result.Update(globalConst->GetHandledGraphemeString().GetTaggedValue());
|
||||||
// 14. Return segmenter.
|
break;
|
||||||
return segmenter;
|
case GranularityOption::WORD:
|
||||||
}
|
result.Update(globalConst->GetHandledWordString().GetTaggedValue());
|
||||||
|
break;
|
||||||
JSHandle<JSTaggedValue> JSSegmenter::GranularityOptionToEcmaString(JSThread *thread, GranularityOption granularity)
|
case GranularityOption::SENTENCE:
|
||||||
{
|
result.Update(globalConst->GetHandledSentenceString().GetTaggedValue());
|
||||||
JSMutableHandle<JSTaggedValue> result(thread, JSTaggedValue::Undefined());
|
break;
|
||||||
auto globalConst = thread->GlobalConstants();
|
default:
|
||||||
switch (granularity) {
|
LOG_ECMA(FATAL) << "this branch is unreachable";
|
||||||
case GranularityOption::GRAPHEME:
|
UNREACHABLE();
|
||||||
result.Update(globalConst->GetHandledGraphemeString().GetTaggedValue());
|
}
|
||||||
break;
|
return result;
|
||||||
case GranularityOption::WORD:
|
}
|
||||||
result.Update(globalConst->GetHandledWordString().GetTaggedValue());
|
|
||||||
break;
|
void JSSegmenter::ResolvedOptions(JSThread *thread, const JSHandle<JSSegmenter> &segmenter,
|
||||||
case GranularityOption::SENTENCE:
|
const JSHandle<JSObject> &options)
|
||||||
result.Update(globalConst->GetHandledSentenceString().GetTaggedValue());
|
{
|
||||||
break;
|
auto globalConst = thread->GlobalConstants();
|
||||||
default:
|
|
||||||
LOG_ECMA(FATAL) << "this branch is unreachable";
|
// [[Locale]]
|
||||||
UNREACHABLE();
|
JSHandle<JSTaggedValue> propertyKey = globalConst->GetHandledLocaleString();
|
||||||
}
|
JSHandle<JSTaggedValue> locale(thread, segmenter->GetLocale());
|
||||||
return result;
|
JSObject::CreateDataPropertyOrThrow(thread, options, propertyKey, locale);
|
||||||
}
|
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||||
|
|
||||||
void JSSegmenter::ResolvedOptions(JSThread *thread, const JSHandle<JSSegmenter> &segmenter,
|
// [[SegmenterGranularity]]
|
||||||
const JSHandle<JSObject> &options)
|
GranularityOption granularity = segmenter->GetGranularity();
|
||||||
{
|
propertyKey = globalConst->GetHandledGranularityString();
|
||||||
auto globalConst = thread->GlobalConstants();
|
JSHandle<JSTaggedValue> granularityString = GranularityOptionToEcmaString(thread, granularity);
|
||||||
|
JSObject::CreateDataPropertyOrThrow(thread, options, propertyKey, granularityString);
|
||||||
// [[Locale]]
|
RETURN_IF_ABRUPT_COMPLETION(thread);
|
||||||
JSHandle<JSTaggedValue> propertyKey = globalConst->GetHandledLocaleString();
|
}
|
||||||
JSHandle<JSTaggedValue> locale(thread, segmenter->GetLocale());
|
} // namespace panda::ecmascript
|
||||||
JSObject::CreateDataPropertyOrThrow(thread, options, propertyKey, locale);
|
|
||||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
|
||||||
|
|
||||||
// [[SegmenterGranularity]]
|
|
||||||
GranularityOption granularity = segmenter->GetGranularity();
|
|
||||||
propertyKey = globalConst->GetHandledGranularityString();
|
|
||||||
JSHandle<JSTaggedValue> granularityString = GranularityOptionToEcmaString(thread, granularity);
|
|
||||||
JSObject::CreateDataPropertyOrThrow(thread, options, propertyKey, granularityString);
|
|
||||||
RETURN_IF_ABRUPT_COMPLETION(thread);
|
|
||||||
}
|
|
||||||
} // namespace panda::ecmascript
|
|
||||||
|
@ -1,182 +1,171 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/js_segments.h"
|
#include "ecmascript/js_segments.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "ecmascript/base/builtins_base.h"
|
#include "ecmascript/base/builtins_base.h"
|
||||||
#include "ecmascript/intl/locale_helper.h"
|
#include "ecmascript/intl/locale_helper.h"
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/object_factory-inl.h"
|
||||||
#include "ecmascript/global_env_constants.h"
|
|
||||||
#include "ecmascript/object_factory-inl.h"
|
namespace panda::ecmascript {
|
||||||
|
|
||||||
#include "unicode/errorcode.h"
|
void JSSegments::SetIcuBreakIterator(JSThread *thread, const JSHandle<JSSegments> &segments,
|
||||||
#include "unicode/locdspnm.h"
|
icu::BreakIterator* icuBreakIterator, const NativePointerCallback &callback)
|
||||||
#include "unicode/locid.h"
|
{
|
||||||
#include "unicode/udisplaycontext.h"
|
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||||
#include "unicode/uloc.h"
|
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||||
#include "unicode/unistr.h"
|
|
||||||
#include "unicode/uscript.h"
|
ASSERT(icuBreakIterator != nullptr);
|
||||||
#include "unicode/ustring.h"
|
JSTaggedValue data = segments->GetIcuField();
|
||||||
|
if (data.IsJSNativePointer()) {
|
||||||
namespace panda::ecmascript {
|
JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject());
|
||||||
|
native->ResetExternalPointer(thread, icuBreakIterator);
|
||||||
void JSSegments::SetIcuBreakIterator(JSThread *thread, const JSHandle<JSSegments> &segments,
|
return;
|
||||||
icu::BreakIterator* icuBreakIterator, const NativePointerCallback &callback)
|
}
|
||||||
{
|
JSHandle<JSNativePointer> pointer = factory->NewJSNativePointer(icuBreakIterator, callback);
|
||||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
segments->SetIcuField(thread, pointer.GetTaggedValue());
|
||||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
}
|
||||||
|
|
||||||
ASSERT(icuBreakIterator != nullptr);
|
void JSSegments::SetUString(JSThread *thread, const JSHandle<JSSegments> &segments,
|
||||||
JSTaggedValue data = segments->GetIcuField();
|
icu::UnicodeString* icuUnicodeString, const NativePointerCallback &callback)
|
||||||
if (data.IsJSNativePointer()) {
|
{
|
||||||
JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject());
|
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
||||||
native->ResetExternalPointer(thread, icuBreakIterator);
|
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||||
return;
|
|
||||||
}
|
ASSERT(icuUnicodeString != nullptr);
|
||||||
JSHandle<JSNativePointer> pointer = factory->NewJSNativePointer(icuBreakIterator, callback);
|
JSTaggedValue data = segments->GetUnicodeString();
|
||||||
segments->SetIcuField(thread, pointer.GetTaggedValue());
|
if (data.IsJSNativePointer()) {
|
||||||
}
|
JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject());
|
||||||
|
native->ResetExternalPointer(thread, icuUnicodeString);
|
||||||
void JSSegments::SetUString(JSThread *thread, const JSHandle<JSSegments> &segments,
|
return;
|
||||||
icu::UnicodeString* icuUnicodeString, const NativePointerCallback &callback)
|
}
|
||||||
{
|
JSHandle<JSNativePointer> pointer = factory->NewJSNativePointer(icuUnicodeString, callback);
|
||||||
EcmaVM *ecmaVm = thread->GetEcmaVM();
|
segments->SetUnicodeString(thread, pointer.GetTaggedValue());
|
||||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
}
|
||||||
|
|
||||||
ASSERT(icuUnicodeString != nullptr);
|
void SetTextToBreakIterator(JSThread *thread, const JSHandle<JSSegments> &segments,
|
||||||
JSTaggedValue data = segments->GetUnicodeString();
|
JSHandle<EcmaString> text, icu::BreakIterator* breakIterator)
|
||||||
if (data.IsJSNativePointer()) {
|
{
|
||||||
JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject());
|
std::u16string u16str = EcmaStringAccessor(text).ToU16String();
|
||||||
native->ResetExternalPointer(thread, icuUnicodeString);
|
icu::UnicodeString src(u16str.data(), u16str.size());
|
||||||
return;
|
icu::UnicodeString* uText = static_cast<icu::UnicodeString*>(src.clone());
|
||||||
}
|
breakIterator->setText(*uText);
|
||||||
JSHandle<JSNativePointer> pointer = factory->NewJSNativePointer(icuUnicodeString, callback);
|
JSSegments::SetUString(thread, segments, uText, JSSegments::FreeUString);
|
||||||
segments->SetUnicodeString(thread, pointer.GetTaggedValue());
|
}
|
||||||
}
|
|
||||||
|
JSHandle<JSSegments> JSSegments::CreateSegmentsObject(JSThread *thread,
|
||||||
void SetTextToBreakIterator(JSThread *thread, const JSHandle<JSSegments> &segments,
|
const JSHandle<JSSegmenter> &segmenter,
|
||||||
JSHandle<EcmaString> text, icu::BreakIterator* breakIterator)
|
const JSHandle<EcmaString> &string)
|
||||||
{
|
{
|
||||||
std::u16string u16str = EcmaStringAccessor(text).ToU16String();
|
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||||
icu::UnicodeString src(u16str.data(), u16str.size());
|
// 1. Let internalSlotsList be « [[SegmentsSegmenter]], [[SegmentsString]] ».
|
||||||
icu::UnicodeString* uText = static_cast<icu::UnicodeString*>(src.clone());
|
// 2. Let segments be OrdinaryObjectCreate(%SegmentsPrototype%, internalSlotsList).
|
||||||
breakIterator->setText(*uText);
|
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
||||||
JSSegments::SetUString(thread, segments, uText, JSSegments::FreeUString);
|
JSHandle<JSFunction> segmentsCtor(env->GetSegmentsFunction());
|
||||||
}
|
JSHandle<JSSegments> segments(factory->NewJSObjectByConstructor(segmentsCtor));
|
||||||
|
// 3. Set segments.[[SegmentsSegmenter]] to segmenter.
|
||||||
JSHandle<JSSegments> JSSegments::CreateSegmentsObject(JSThread *thread,
|
icu::BreakIterator* icuBreakIterator = segmenter->GetIcuBreakIterator()->clone();
|
||||||
const JSHandle<JSSegmenter> &segmenter,
|
SetIcuBreakIterator(thread, segments, icuBreakIterator, JSSegments::FreeIcuBreakIterator);
|
||||||
const JSHandle<EcmaString> &string)
|
segments->SetGranularity(segmenter->GetGranularity());
|
||||||
{
|
// 4. Set segments.[[SegmentsString]] to string.
|
||||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
segments->SetSegmentsString(thread, string);
|
||||||
// 1. Let internalSlotsList be « [[SegmentsSegmenter]], [[SegmentsString]] ».
|
SetTextToBreakIterator(thread, segments, string, icuBreakIterator);
|
||||||
// 2. Let segments be OrdinaryObjectCreate(%SegmentsPrototype%, internalSlotsList).
|
return segments;
|
||||||
JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
|
}
|
||||||
JSHandle<JSFunction> segmentsCtor(env->GetSegmentsFunction());
|
|
||||||
JSHandle<JSSegments> segments(factory->NewJSObjectByConstructor(segmentsCtor));
|
JSTaggedValue JSSegments::Containing(JSThread *thread, const JSHandle<JSSegments> &segments, double index)
|
||||||
// 3. Set segments.[[SegmentsSegmenter]] to segmenter.
|
{
|
||||||
icu::BreakIterator* icuBreakIterator = segmenter->GetIcuBreakIterator()->clone();
|
icu::UnicodeString* unicodeString = segments->GetUString();
|
||||||
SetIcuBreakIterator(thread, segments, icuBreakIterator, JSSegments::FreeIcuBreakIterator);
|
// 5. Let len be the length of string.
|
||||||
segments->SetGranularity(segmenter->GetGranularity());
|
int32_t len = unicodeString->length();
|
||||||
// 4. Set segments.[[SegmentsString]] to string.
|
// 7. If n < 0 or n ≥ len, return undefined.
|
||||||
segments->SetSegmentsString(thread, string);
|
if (index < 0 || index >= len) {
|
||||||
SetTextToBreakIterator(thread, segments, string, icuBreakIterator);
|
return JSTaggedValue::Undefined();
|
||||||
return segments;
|
}
|
||||||
}
|
int32_t n = static_cast<int32_t>(index);
|
||||||
|
// n may point to the surrogate tail- adjust it back to the lead.
|
||||||
JSTaggedValue JSSegments::Containing(JSThread *thread, const JSHandle<JSSegments> &segments, double index)
|
n = unicodeString->getChar32Start(n);
|
||||||
{
|
icu::BreakIterator* breakIterator = segments->GetIcuBreakIterator();
|
||||||
icu::UnicodeString* unicodeString = segments->GetUString();
|
// 8. Let startIndex be ! FindBoundary(segmenter, string, n, before).
|
||||||
// 5. Let len be the length of string.
|
int32_t startIndex = breakIterator->isBoundary(n) ? n : breakIterator->preceding(n);
|
||||||
int32_t len = unicodeString->length();
|
// 9. Let endIndex be ! FindBoundary(segmenter, string, n, after).
|
||||||
// 7. If n < 0 or n ≥ len, return undefined.
|
int32_t endIndex = breakIterator->following(n);
|
||||||
if (index < 0 || index >= len) {
|
// 10. Return ! CreateSegmentDataObject(segmenter, string, startIndex, endIndex).
|
||||||
return JSTaggedValue::Undefined();
|
return CreateSegmentDataObject(thread, segments->GetGranularity(), breakIterator,
|
||||||
}
|
JSHandle<EcmaString>(thread, segments->GetSegmentsString()),
|
||||||
int32_t n = static_cast<int32_t>(index);
|
*unicodeString, startIndex, endIndex).GetTaggedValue();
|
||||||
// n may point to the surrogate tail- adjust it back to the lead.
|
}
|
||||||
n = unicodeString->getChar32Start(n);
|
|
||||||
icu::BreakIterator* breakIterator = segments->GetIcuBreakIterator();
|
bool CurrentSegmentIsWordLike(icu::BreakIterator* breakIterator)
|
||||||
// 8. Let startIndex be ! FindBoundary(segmenter, string, n, before).
|
{
|
||||||
int32_t startIndex = breakIterator->isBoundary(n) ? n : breakIterator->preceding(n);
|
int32_t rule_status = breakIterator->getRuleStatus();
|
||||||
// 9. Let endIndex be ! FindBoundary(segmenter, string, n, after).
|
return (rule_status >= UBRK_WORD_NUMBER &&
|
||||||
int32_t endIndex = breakIterator->following(n);
|
rule_status < UBRK_WORD_NUMBER_LIMIT) ||
|
||||||
// 10. Return ! CreateSegmentDataObject(segmenter, string, startIndex, endIndex).
|
(rule_status >= UBRK_WORD_LETTER &&
|
||||||
return CreateSegmentDataObject(thread, segments->GetGranularity(), breakIterator,
|
rule_status < UBRK_WORD_LETTER_LIMIT) ||
|
||||||
JSHandle<EcmaString>(thread, segments->GetSegmentsString()),
|
(rule_status >= UBRK_WORD_KANA &&
|
||||||
*unicodeString, startIndex, endIndex).GetTaggedValue();
|
rule_status < UBRK_WORD_KANA_LIMIT) ||
|
||||||
}
|
(rule_status >= UBRK_WORD_IDEO && rule_status < UBRK_WORD_IDEO_LIMIT);
|
||||||
|
}
|
||||||
bool CurrentSegmentIsWordLike(icu::BreakIterator* breakIterator)
|
|
||||||
{
|
// 18.7.1 CreateSegmentDataObject ( segmenter, string, startIndex, endIndex )
|
||||||
int32_t rule_status = breakIterator->getRuleStatus();
|
JSHandle<JSObject> JSSegments::CreateSegmentDataObject(JSThread *thread, GranularityOption granularity,
|
||||||
return (rule_status >= UBRK_WORD_NUMBER &&
|
icu::BreakIterator* breakIterator, const JSHandle<EcmaString> &inputString,
|
||||||
rule_status < UBRK_WORD_NUMBER_LIMIT) ||
|
const icu::UnicodeString& unicodeString, int32_t startIndex, int32_t endIndex)
|
||||||
(rule_status >= UBRK_WORD_LETTER &&
|
{
|
||||||
rule_status < UBRK_WORD_LETTER_LIMIT) ||
|
// 1. Let len be the length of string.
|
||||||
(rule_status >= UBRK_WORD_KANA &&
|
// 2. Assert: startIndex ≥ 0.
|
||||||
rule_status < UBRK_WORD_KANA_LIMIT) ||
|
ASSERT(startIndex >= 0);
|
||||||
(rule_status >= UBRK_WORD_IDEO && rule_status < UBRK_WORD_IDEO_LIMIT);
|
// 3. Assert: endIndex ≤ len.
|
||||||
}
|
ASSERT(endIndex <= unicodeString.length());
|
||||||
|
// 4. Assert: startIndex < endIndex.
|
||||||
// 18.7.1 CreateSegmentDataObject ( segmenter, string, startIndex, endIndex )
|
ASSERT(startIndex < endIndex);
|
||||||
JSHandle<JSObject> JSSegments::CreateSegmentDataObject(JSThread *thread, GranularityOption granularity,
|
// 5. Let result be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
icu::BreakIterator* breakIterator, const JSHandle<EcmaString> &inputString,
|
auto ecmaVm = thread->GetEcmaVM();
|
||||||
const icu::UnicodeString& unicodeString, int32_t startIndex, int32_t endIndex)
|
JSHandle<GlobalEnv> env = ecmaVm->GetGlobalEnv();
|
||||||
{
|
ObjectFactory *factory = ecmaVm->GetFactory();
|
||||||
// 1. Let len be the length of string.
|
JSHandle<JSFunction> ctor(env->GetObjectFunction());
|
||||||
// 2. Assert: startIndex ≥ 0.
|
JSHandle<JSObject> result(factory->NewJSObjectByConstructor(ctor));
|
||||||
ASSERT(startIndex >= 0);
|
// 6. Let segment be the substring of string from startIndex to endIndex.
|
||||||
// 3. Assert: endIndex ≤ len.
|
JSHandle<EcmaString> segment =
|
||||||
ASSERT(endIndex <= unicodeString.length());
|
intl::LocaleHelper::UStringToString(thread, unicodeString, startIndex, endIndex);
|
||||||
// 4. Assert: startIndex < endIndex.
|
auto globalConst = thread->GlobalConstants();
|
||||||
ASSERT(startIndex < endIndex);
|
// 7. Perform ! CreateDataPropertyOrThrow(result, "segment", segment).
|
||||||
// 5. Let result be OrdinaryObjectCreate(%Object.prototype%).
|
JSHandle<JSTaggedValue> segmentKey = globalConst->GetHandledSegmentString();
|
||||||
auto ecmaVm = thread->GetEcmaVM();
|
JSObject::CreateDataPropertyOrThrow(thread, result, segmentKey, JSHandle<JSTaggedValue>::Cast(segment));
|
||||||
JSHandle<GlobalEnv> env = ecmaVm->GetGlobalEnv();
|
// 8. Perform ! CreateDataPropertyOrThrow(result, "index", 𝔽(startIndex)).
|
||||||
ObjectFactory *factory = ecmaVm->GetFactory();
|
JSHandle<JSTaggedValue> indexKey = globalConst->GetHandledIndexString();
|
||||||
JSHandle<JSFunction> ctor(env->GetObjectFunction());
|
JSObject::CreateDataPropertyOrThrow(thread, result, indexKey, JSHandle<JSTaggedValue>(thread,
|
||||||
JSHandle<JSObject> result(factory->NewJSObjectByConstructor(ctor));
|
base::BuiltinsBase::GetTaggedInt(startIndex)));
|
||||||
// 6. Let segment be the substring of string from startIndex to endIndex.
|
// 9. Perform ! CreateDataPropertyOrThrow(result, "input", string).
|
||||||
JSHandle<EcmaString> segment =
|
JSHandle<JSTaggedValue> inputKey = globalConst->GetHandledInputString();
|
||||||
intl::LocaleHelper::UStringToString(thread, unicodeString, startIndex, endIndex);
|
JSObject::CreateDataPropertyOrThrow(thread, result, inputKey, JSHandle<JSTaggedValue>::Cast(inputString));
|
||||||
auto globalConst = thread->GlobalConstants();
|
// 10. Let granularity be segmenter.[[SegmenterGranularity]].
|
||||||
// 7. Perform ! CreateDataPropertyOrThrow(result, "segment", segment).
|
// 11. If granularity is "word", then
|
||||||
JSHandle<JSTaggedValue> segmentKey = globalConst->GetHandledSegmentString();
|
// a. Let isWordLike be a Boolean value indicating whether the segment in string is "word-like"
|
||||||
JSObject::CreateDataPropertyOrThrow(thread, result, segmentKey, JSHandle<JSTaggedValue>::Cast(segment));
|
// according to locale segmenter.[[Locale]].
|
||||||
// 8. Perform ! CreateDataPropertyOrThrow(result, "index", 𝔽(startIndex)).
|
// b. Perform ! CreateDataPropertyOrThrow(result, "isWordLike", isWordLike).
|
||||||
JSHandle<JSTaggedValue> indexKey = globalConst->GetHandledIndexString();
|
if (granularity == GranularityOption::WORD) {
|
||||||
JSObject::CreateDataPropertyOrThrow(thread, result, indexKey, JSHandle<JSTaggedValue>(thread,
|
bool isWordLike = CurrentSegmentIsWordLike(breakIterator);
|
||||||
base::BuiltinsBase::GetTaggedInt(startIndex)));
|
JSHandle<JSTaggedValue> isWordLikeKey = globalConst->GetHandledIsWordLikeString();
|
||||||
// 9. Perform ! CreateDataPropertyOrThrow(result, "input", string).
|
JSObject::CreateDataPropertyOrThrow(thread, result, isWordLikeKey, JSHandle<JSTaggedValue>(thread,
|
||||||
JSHandle<JSTaggedValue> inputKey = globalConst->GetHandledInputString();
|
base::BuiltinsBase::GetTaggedBoolean(isWordLike)));
|
||||||
JSObject::CreateDataPropertyOrThrow(thread, result, inputKey, JSHandle<JSTaggedValue>::Cast(inputString));
|
}
|
||||||
// 10. Let granularity be segmenter.[[SegmenterGranularity]].
|
// 12. Return result.
|
||||||
// 11. If granularity is "word", then
|
return result;
|
||||||
// a. Let isWordLike be a Boolean value indicating whether the segment in string is "word-like"
|
}
|
||||||
// according to locale segmenter.[[Locale]].
|
} // namespace panda::ecmascript
|
||||||
// b. Perform ! CreateDataPropertyOrThrow(result, "isWordLike", isWordLike).
|
|
||||||
if (granularity == GranularityOption::WORD) {
|
|
||||||
bool isWordLike = CurrentSegmentIsWordLike(breakIterator);
|
|
||||||
JSHandle<JSTaggedValue> isWordLikeKey = globalConst->GetHandledIsWordLikeString();
|
|
||||||
JSObject::CreateDataPropertyOrThrow(thread, result, isWordLikeKey, JSHandle<JSTaggedValue>(thread,
|
|
||||||
base::BuiltinsBase::GetTaggedBoolean(isWordLike)));
|
|
||||||
}
|
|
||||||
// 12. Return result.
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
} // namespace panda::ecmascript
|
|
||||||
|
@ -14,10 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/js_set.h"
|
#include "ecmascript/js_set.h"
|
||||||
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/linked_hash_table.h"
|
#include "ecmascript/linked_hash_table.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
void JSSet::Add(JSThread *thread, const JSHandle<JSSet> &set, const JSHandle<JSTaggedValue> &value)
|
void JSSet::Add(JSThread *thread, const JSHandle<JSSet> &set, const JSHandle<JSTaggedValue> &value)
|
||||||
|
@ -16,11 +16,8 @@
|
|||||||
#include "ecmascript/js_set_iterator.h"
|
#include "ecmascript/js_set_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/builtins/builtins_errors.h"
|
#include "ecmascript/builtins/builtins_errors.h"
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/js_array.h"
|
#include "ecmascript/js_array.h"
|
||||||
#include "ecmascript/js_set.h"
|
|
||||||
#include "ecmascript/linked_hash_table.h"
|
#include "ecmascript/linked_hash_table.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using BuiltinsBase = base::BuiltinsBase;
|
using BuiltinsBase = base::BuiltinsBase;
|
||||||
|
@ -15,27 +15,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_stable_array.h"
|
#include "ecmascript/js_stable_array.h"
|
||||||
|
|
||||||
#include "ecmascript/base/array_helper.h"
|
|
||||||
#include "ecmascript/base/builtins_base.h"
|
|
||||||
#include "ecmascript/base/typed_array_helper-inl.h"
|
#include "ecmascript/base/typed_array_helper-inl.h"
|
||||||
#include "ecmascript/builtins/builtins_arraybuffer.h"
|
|
||||||
#include "ecmascript/builtins/builtins_sendable_arraybuffer.h"
|
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/ecma_context.h"
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/ecma_string-inl.h"
|
|
||||||
#include "ecmascript/element_accessor.h"
|
|
||||||
#include "ecmascript/element_accessor-inl.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/interpreter/fast_runtime_stub-inl.h"
|
#include "ecmascript/interpreter/fast_runtime_stub-inl.h"
|
||||||
#include "ecmascript/js_array.h"
|
|
||||||
#include "ecmascript/js_hclass.h"
|
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/shared_objects/js_shared_array.h"
|
|
||||||
#include "ecmascript/tagged_array.h"
|
|
||||||
#include "macros.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
using TypedArrayHelper = base::TypedArrayHelper;
|
using TypedArrayHelper = base::TypedArrayHelper;
|
||||||
|
@ -14,13 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/js_string_iterator.h"
|
#include "ecmascript/js_string_iterator.h"
|
||||||
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
#include "libpandabase/macros.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
JSHandle<JSStringIterator> JSStringIterator::CreateStringIterator(const JSThread *thread,
|
JSHandle<JSStringIterator> JSStringIterator::CreateStringIterator(const JSThread *thread,
|
||||||
|
@ -15,37 +15,23 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
#include "ecmascript/js_tagged_value.h"
|
||||||
|
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/ecma_string-inl.h"
|
#include "ecmascript/ecma_string-inl.h"
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/js_api/js_api_arraylist.h"
|
#include "ecmascript/js_api/js_api_arraylist.h"
|
||||||
#include "ecmascript/js_api/js_api_bitvector.h"
|
#include "ecmascript/js_api/js_api_bitvector.h"
|
||||||
#include "ecmascript/js_api/js_api_deque.h"
|
#include "ecmascript/js_api/js_api_deque.h"
|
||||||
#include "ecmascript/js_api/js_api_lightweightset.h"
|
|
||||||
#include "ecmascript/js_api/js_api_lightweightmap.h"
|
|
||||||
#include "ecmascript/js_api/js_api_linked_list.h"
|
#include "ecmascript/js_api/js_api_linked_list.h"
|
||||||
#include "ecmascript/js_api/js_api_list.h"
|
#include "ecmascript/js_api/js_api_list.h"
|
||||||
#include "ecmascript/js_api/js_api_plain_array.h"
|
#include "ecmascript/js_api/js_api_plain_array.h"
|
||||||
#include "ecmascript/js_api/js_api_queue.h"
|
#include "ecmascript/js_api/js_api_queue.h"
|
||||||
#include "ecmascript/js_api/js_api_stack.h"
|
#include "ecmascript/js_api/js_api_stack.h"
|
||||||
#include "ecmascript/js_api/js_api_vector.h"
|
#include "ecmascript/js_api/js_api_vector.h"
|
||||||
#include "ecmascript/js_array.h"
|
|
||||||
#include "ecmascript/js_date.h"
|
#include "ecmascript/js_date.h"
|
||||||
#include "ecmascript/js_handle.h"
|
|
||||||
#include "ecmascript/js_object-inl.h"
|
|
||||||
#include "ecmascript/js_object.h"
|
|
||||||
#include "ecmascript/js_primitive_ref.h"
|
#include "ecmascript/js_primitive_ref.h"
|
||||||
#include "ecmascript/js_proxy.h"
|
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
|
||||||
#include "ecmascript/js_thread.h"
|
|
||||||
#include "ecmascript/js_typed_array.h"
|
#include "ecmascript/js_typed_array.h"
|
||||||
#include "ecmascript/message_string.h"
|
#include "ecmascript/message_string.h"
|
||||||
#include "ecmascript/module/js_module_namespace.h"
|
|
||||||
#include "ecmascript/shared_objects/js_shared_array.h"
|
#include "ecmascript/shared_objects/js_shared_array.h"
|
||||||
#include "ecmascript/tagged_array.h"
|
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/symbol_table.h"
|
#include "ecmascript/symbol_table.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -16,15 +16,10 @@
|
|||||||
#include "ecmascript/js_thread.h"
|
#include "ecmascript/js_thread.h"
|
||||||
|
|
||||||
#include "ecmascript/runtime.h"
|
#include "ecmascript/runtime.h"
|
||||||
#include "ecmascript/builtin_entries.h"
|
|
||||||
#include "ecmascript/debugger/js_debugger_manager.h"
|
#include "ecmascript/debugger/js_debugger_manager.h"
|
||||||
#include "ecmascript/ecma_context.h"
|
|
||||||
#include "ecmascript/enum_conversion.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
|
||||||
#include "ecmascript/js_object-inl.h"
|
#include "ecmascript/js_object-inl.h"
|
||||||
#include "ecmascript/js_tagged_value.h"
|
#include "ecmascript/js_tagged_value.h"
|
||||||
#include "ecmascript/runtime_call_id.h"
|
#include "ecmascript/runtime_call_id.h"
|
||||||
#include "ecmascript/ts_types/builtin_type_id.h"
|
|
||||||
|
|
||||||
#if !defined(PANDA_TARGET_WINDOWS) && !defined(PANDA_TARGET_MACOS) && !defined(PANDA_TARGET_IOS)
|
#if !defined(PANDA_TARGET_WINDOWS) && !defined(PANDA_TARGET_MACOS) && !defined(PANDA_TARGET_IOS)
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
@ -38,17 +33,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "ecmascript/dfx/vm_thread_control.h"
|
#include "ecmascript/dfx/vm_thread_control.h"
|
||||||
#include "ecmascript/ecma_global_storage.h"
|
#include "ecmascript/ecma_global_storage.h"
|
||||||
#include "ecmascript/ecma_param_configuration.h"
|
|
||||||
#include "ecmascript/global_env_constants-inl.h"
|
|
||||||
#include "ecmascript/ic/properties_cache.h"
|
#include "ecmascript/ic/properties_cache.h"
|
||||||
#include "ecmascript/interpreter/interpreter.h"
|
#include "ecmascript/interpreter/interpreter.h"
|
||||||
#include "ecmascript/log_wrapper.h"
|
|
||||||
#include "ecmascript/mem/concurrent_marker.h"
|
#include "ecmascript/mem/concurrent_marker.h"
|
||||||
#include "ecmascript/mem/mark_word.h"
|
|
||||||
#include "ecmascript/napi/include/dfx_jsnapi.h"
|
|
||||||
#include "ecmascript/platform/file.h"
|
#include "ecmascript/platform/file.h"
|
||||||
#include "ecmascript/stackmap/llvm/llvm_stackmap_parser.h"
|
|
||||||
#include "ecmascript/builtin_entries.h"
|
|
||||||
#include "ecmascript/jit/jit.h"
|
#include "ecmascript/jit/jit.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -15,11 +15,7 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_typed_array.h"
|
#include "ecmascript/js_typed_array.h"
|
||||||
|
|
||||||
#include "ecmascript/accessor_data.h"
|
|
||||||
#include "ecmascript/base/typed_array_helper-inl.h"
|
#include "ecmascript/base/typed_array_helper-inl.h"
|
||||||
#include "ecmascript/builtins/builtins_arraybuffer.h"
|
|
||||||
#include "ecmascript/builtins/builtins_sendable_arraybuffer.h"
|
|
||||||
#include "ecmascript/js_object-inl.h"
|
|
||||||
#include "ecmascript/shared_objects/js_sendable_arraybuffer.h"
|
#include "ecmascript/shared_objects/js_sendable_arraybuffer.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/js_weak_container.h"
|
#include "ecmascript/js_weak_container.h"
|
||||||
|
|
||||||
#include "ecmascript/js_tagged_value.h"
|
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
#include "ecmascript/js_tagged_value-inl.h"
|
||||||
#include "ecmascript/linked_hash_table.h"
|
#include "ecmascript/linked_hash_table.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
void JSWeakMap::Set(JSThread *thread, const JSHandle<JSWeakMap> &map, const JSHandle<JSTaggedValue> &key,
|
void JSWeakMap::Set(JSThread *thread, const JSHandle<JSWeakMap> &map, const JSHandle<JSTaggedValue> &key,
|
||||||
|
@ -14,12 +14,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/jsnapi_sendable.h"
|
#include "ecmascript/jsnapi_sendable.h"
|
||||||
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/global_env.h"
|
#include "ecmascript/global_env.h"
|
||||||
#include "ecmascript/napi/jsnapi_helper.h"
|
#include "ecmascript/napi/jsnapi_helper.h"
|
||||||
#include "ecmascript/object_factory.h"
|
|
||||||
#include "ecmascript/tagged_dictionary.h"
|
|
||||||
#include "js_function.h"
|
#include "js_function.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
#include "ecmascript/base/number_helper.h"
|
#include "ecmascript/base/number_helper.h"
|
||||||
#include "ecmascript/dfx/hprof/heap_sampling.h"
|
#include "ecmascript/dfx/hprof/heap_sampling.h"
|
||||||
#include "ecmascript/mem/assert_scope.h"
|
|
||||||
#include "ecmascript/mem/heap.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
void AllocationInspector::Step([[maybe_unused]] Address object, [[maybe_unused]] size_t size)
|
void AllocationInspector::Step([[maybe_unused]] Address object, [[maybe_unused]] size_t size)
|
||||||
|
@ -12,10 +12,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/mem/barriers-inl.h"
|
|
||||||
#include "ecmascript/mem/heap.h"
|
|
||||||
#include "ecmascript/runtime.h"
|
#include "ecmascript/runtime.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -20,9 +20,6 @@
|
|||||||
|
|
||||||
#include "ecmascript/ecma_string-inl.h"
|
#include "ecmascript/ecma_string-inl.h"
|
||||||
#include "ecmascript/js_symbol.h"
|
#include "ecmascript/js_symbol.h"
|
||||||
#include "ecmascript/mem/c_containers.h"
|
|
||||||
|
|
||||||
#include "libpandabase/macros.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
long CStringToL(const CString &str)
|
long CStringToL(const CString &str)
|
||||||
|
@ -15,18 +15,7 @@
|
|||||||
|
|
||||||
#include "ecmascript/mem/concurrent_marker.h"
|
#include "ecmascript/mem/concurrent_marker.h"
|
||||||
|
|
||||||
#include "ecmascript/mem/allocator-inl.h"
|
|
||||||
#include "ecmascript/mem/heap-inl.h"
|
|
||||||
#include "ecmascript/mem/mark_stack.h"
|
|
||||||
#include "ecmascript/mem/mark_word.h"
|
|
||||||
#include "ecmascript/mem/parallel_marker-inl.h"
|
#include "ecmascript/mem/parallel_marker-inl.h"
|
||||||
#include "ecmascript/mem/space-inl.h"
|
|
||||||
#include "ecmascript/mem/sparse_space.h"
|
|
||||||
#include "ecmascript/mem/verification.h"
|
|
||||||
#include "ecmascript/mem/visitor.h"
|
|
||||||
#include "ecmascript/mem/gc_stats.h"
|
|
||||||
#include "ecmascript/ecma_string_table.h"
|
|
||||||
#include "ecmascript/taskpool/taskpool.h"
|
|
||||||
#include "ecmascript/runtime_call_id.h"
|
#include "ecmascript/runtime_call_id.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -14,12 +14,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/mem/concurrent_sweeper.h"
|
#include "ecmascript/mem/concurrent_sweeper.h"
|
||||||
|
|
||||||
#include "ecmascript/ecma_macros.h"
|
|
||||||
#include "ecmascript/mem/heap.h"
|
#include "ecmascript/mem/heap.h"
|
||||||
#include "ecmascript/mem/region-inl.h"
|
#include "ecmascript/mem/region-inl.h"
|
||||||
#include "ecmascript/mem/space-inl.h"
|
|
||||||
#include "ecmascript/taskpool/taskpool.h"
|
|
||||||
#include "ecmascript/runtime_call_id.h"
|
#include "ecmascript/runtime_call_id.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -16,10 +16,7 @@
|
|||||||
#include "ecmascript/mem/free_object_list.h"
|
#include "ecmascript/mem/free_object_list.h"
|
||||||
|
|
||||||
#include "ecmascript/free_object.h"
|
#include "ecmascript/free_object.h"
|
||||||
#include "ecmascript/mem/free_object_set.h"
|
|
||||||
#include "ecmascript/mem/free_object_list.h"
|
#include "ecmascript/mem/free_object_list.h"
|
||||||
#include "ecmascript/mem/mem.h"
|
|
||||||
#include "ecmascript/mem/region.h"
|
|
||||||
#include "ecmascript/mem/jit_fort.h"
|
#include "ecmascript/mem/jit_fort.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -15,9 +15,7 @@
|
|||||||
|
|
||||||
#include "ecmascript/mem/free_object_set.h"
|
#include "ecmascript/mem/free_object_set.h"
|
||||||
|
|
||||||
#include "ecmascript/base/asan_interface.h"
|
|
||||||
#include "ecmascript/free_object.h"
|
#include "ecmascript/free_object.h"
|
||||||
#include "ecmascript/mem/free_object_list.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -15,20 +15,10 @@
|
|||||||
|
|
||||||
#include "ecmascript/mem/full_gc.h"
|
#include "ecmascript/mem/full_gc.h"
|
||||||
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/mem/clock_scope.h"
|
|
||||||
#include "ecmascript/mem/concurrent_marker.h"
|
#include "ecmascript/mem/concurrent_marker.h"
|
||||||
#include "ecmascript/mem/concurrent_sweeper.h"
|
|
||||||
#include "ecmascript/mem/heap-inl.h"
|
|
||||||
#include "ecmascript/mem/incremental_marker.h"
|
#include "ecmascript/mem/incremental_marker.h"
|
||||||
#include "ecmascript/mem/mark_stack.h"
|
|
||||||
#include "ecmascript/mem/mem.h"
|
|
||||||
#include "ecmascript/mem/parallel_marker-inl.h"
|
#include "ecmascript/mem/parallel_marker-inl.h"
|
||||||
#include "ecmascript/mem/space-inl.h"
|
|
||||||
#include "ecmascript/mem/verification.h"
|
#include "ecmascript/mem/verification.h"
|
||||||
#include "ecmascript/mem/visitor.h"
|
|
||||||
#include "ecmascript/mem/gc_stats.h"
|
|
||||||
#include "ecmascript/ecma_string_table.h"
|
|
||||||
#include "ecmascript/runtime_call_id.h"
|
#include "ecmascript/runtime_call_id.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -25,10 +25,7 @@
|
|||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ecmascript/mem/heap.h"
|
|
||||||
#include "ecmascript/mem/heap-inl.h"
|
#include "ecmascript/mem/heap-inl.h"
|
||||||
#include "ecmascript/mem/mem.h"
|
|
||||||
#include "ecmascript/mem/gc_stats.h"
|
|
||||||
#include "ecmascript/pgo_profiler/pgo_profiler_manager.h"
|
#include "ecmascript/pgo_profiler/pgo_profiler_manager.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -16,10 +16,7 @@
|
|||||||
#include "ecmascript/mem/gc_stats.h"
|
#include "ecmascript/mem/gc_stats.h"
|
||||||
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include "ecmascript/common.h"
|
|
||||||
#include "ecmascript/mem/heap.h"
|
|
||||||
#include "ecmascript/mem/heap-inl.h"
|
#include "ecmascript/mem/heap-inl.h"
|
||||||
#include "ecmascript/mem/mem.h"
|
|
||||||
|
|
||||||
constexpr int DESCRIPTION_LENGTH = 25;
|
constexpr int DESCRIPTION_LENGTH = 25;
|
||||||
constexpr int DATA_LENGTH = 8;
|
constexpr int DATA_LENGTH = 8;
|
||||||
|
@ -12,9 +12,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/mem/heap-inl.h"
|
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
@ -23,22 +20,8 @@
|
|||||||
#if defined(ECMASCRIPT_SUPPORT_CPUPROFILER)
|
#if defined(ECMASCRIPT_SUPPORT_CPUPROFILER)
|
||||||
#include "ecmascript/dfx/cpu_profiler/cpu_profiler.h"
|
#include "ecmascript/dfx/cpu_profiler/cpu_profiler.h"
|
||||||
#endif
|
#endif
|
||||||
#include "ecmascript/daemon/daemon_thread.h"
|
|
||||||
#include "ecmascript/ecma_string_table.h"
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/free_object.h"
|
|
||||||
#include "ecmascript/js_finalization_registry.h"
|
|
||||||
#include "ecmascript/js_native_pointer.h"
|
|
||||||
#include "ecmascript/mem/assert_scope.h"
|
|
||||||
#include "ecmascript/mem/concurrent_marker.h"
|
|
||||||
#include "ecmascript/mem/concurrent_sweeper.h"
|
|
||||||
#include "ecmascript/mem/full_gc.h"
|
|
||||||
#include "ecmascript/mem/incremental_marker.h"
|
#include "ecmascript/mem/incremental_marker.h"
|
||||||
#include "ecmascript/mem/linear_space.h"
|
|
||||||
#include "ecmascript/mem/mark_stack.h"
|
|
||||||
#include "ecmascript/mem/mem_controller.h"
|
|
||||||
#include "ecmascript/mem/shared_mem_controller.h"
|
|
||||||
#include "ecmascript/mem/native_area_allocator.h"
|
|
||||||
#include "ecmascript/mem/partial_gc.h"
|
#include "ecmascript/mem/partial_gc.h"
|
||||||
#include "ecmascript/mem/parallel_evacuator.h"
|
#include "ecmascript/mem/parallel_evacuator.h"
|
||||||
#include "ecmascript/mem/parallel_marker-inl.h"
|
#include "ecmascript/mem/parallel_marker-inl.h"
|
||||||
@ -49,11 +32,7 @@
|
|||||||
#include "ecmascript/mem/shared_heap/shared_concurrent_marker.h"
|
#include "ecmascript/mem/shared_heap/shared_concurrent_marker.h"
|
||||||
#include "ecmascript/mem/stw_young_gc.h"
|
#include "ecmascript/mem/stw_young_gc.h"
|
||||||
#include "ecmascript/mem/verification.h"
|
#include "ecmascript/mem/verification.h"
|
||||||
#include "ecmascript/mem/work_manager.h"
|
|
||||||
#include "ecmascript/mem/gc_stats.h"
|
|
||||||
#include "ecmascript/mem/gc_key_stats.h"
|
|
||||||
#include "ecmascript/runtime_call_id.h"
|
#include "ecmascript/runtime_call_id.h"
|
||||||
#include "ecmascript/runtime_lock.h"
|
|
||||||
#include "ecmascript/jit/jit.h"
|
#include "ecmascript/jit/jit.h"
|
||||||
#include "ecmascript/ohos/ohos_params.h"
|
#include "ecmascript/ohos/ohos_params.h"
|
||||||
#if !WIN_OR_MAC_OR_IOS_PLATFORM
|
#if !WIN_OR_MAC_OR_IOS_PLATFORM
|
||||||
|
@ -15,14 +15,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/mem/heap_region_allocator.h"
|
#include "ecmascript/mem/heap_region_allocator.h"
|
||||||
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/jit/jit.h"
|
#include "ecmascript/jit/jit.h"
|
||||||
#include "ecmascript/mem/heap-inl.h"
|
|
||||||
#include "ecmascript/mem/mark_stack.h"
|
|
||||||
#include "ecmascript/mem/mem_map_allocator.h"
|
#include "ecmascript/mem/mem_map_allocator.h"
|
||||||
#include "ecmascript/mem/region.h"
|
|
||||||
#include "ecmascript/mem/space-inl.h"
|
|
||||||
#include "ecmascript/platform/map.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
constexpr size_t PANDA_POOL_ALIGNMENT_IN_BYTES = 256_KB;
|
constexpr size_t PANDA_POOL_ALIGNMENT_IN_BYTES = 256_KB;
|
||||||
|
@ -19,19 +19,8 @@
|
|||||||
#include <regex>
|
#include <regex>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "ecmascript/mem/allocator-inl.h"
|
|
||||||
#include "ecmascript/mem/clock_scope.h"
|
|
||||||
#include "ecmascript/mem/concurrent_marker.h"
|
#include "ecmascript/mem/concurrent_marker.h"
|
||||||
#include "ecmascript/mem/heap-inl.h"
|
|
||||||
#include "ecmascript/mem/mark_stack.h"
|
|
||||||
#include "ecmascript/mem/mark_word.h"
|
|
||||||
#include "ecmascript/mem/parallel_marker-inl.h"
|
#include "ecmascript/mem/parallel_marker-inl.h"
|
||||||
#include "ecmascript/mem/space-inl.h"
|
|
||||||
#include "ecmascript/mem/verification.h"
|
|
||||||
#include "ecmascript/mem/visitor.h"
|
|
||||||
#include "ecmascript/mem/gc_stats.h"
|
|
||||||
#include "ecmascript/ecma_string_table.h"
|
|
||||||
#include "ecmascript/taskpool/taskpool.h"
|
|
||||||
#include "ecmascript/runtime_call_id.h"
|
#include "ecmascript/runtime_call_id.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/mem/free_object_set.h"
|
|
||||||
#include "ecmascript/mem/heap-inl.h"
|
#include "ecmascript/mem/heap-inl.h"
|
||||||
#include "ecmascript/mem/jit_fort.h"
|
#include "ecmascript/mem/jit_fort.h"
|
||||||
#include "ecmascript/jit/jit.h"
|
#include "ecmascript/jit/jit.h"
|
||||||
|
@ -15,11 +15,8 @@
|
|||||||
|
|
||||||
#include "ecmascript/mem/linear_space.h"
|
#include "ecmascript/mem/linear_space.h"
|
||||||
|
|
||||||
#include "ecmascript/free_object.h"
|
|
||||||
#include "ecmascript/js_hclass-inl.h"
|
#include "ecmascript/js_hclass-inl.h"
|
||||||
#include "ecmascript/mem/allocator-inl.h"
|
#include "ecmascript/mem/allocator-inl.h"
|
||||||
#include "ecmascript/mem/concurrent_marker.h"
|
|
||||||
#include "ecmascript/mem/heap.h"
|
|
||||||
#include "ecmascript/mem/mem_controller.h"
|
#include "ecmascript/mem/mem_controller.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -14,11 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/mem/machine_code.h"
|
#include "ecmascript/mem/machine_code.h"
|
||||||
#include "ecmascript/mem/assert_scope.h"
|
|
||||||
#include "ecmascript/compiler/aot_file/func_entry_des.h"
|
#include "ecmascript/compiler/aot_file/func_entry_des.h"
|
||||||
#include "ecmascript/stackmap/ark_stackmap.h"
|
|
||||||
#include "ecmascript/js_handle.h"
|
|
||||||
#include "ecmascript/js_tagged_value-inl.h"
|
|
||||||
#include "ecmascript/jit/jit.h"
|
#include "ecmascript/jit/jit.h"
|
||||||
#ifdef CODE_SIGN_ENABLE
|
#ifdef CODE_SIGN_ENABLE
|
||||||
#include "jit_buffer_integrity.h"
|
#include "jit_buffer_integrity.h"
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "ecmascript/mem/mem_controller.h"
|
#include "ecmascript/mem/mem_controller.h"
|
||||||
|
|
||||||
#include "ecmascript/mem/concurrent_marker.h"
|
#include "ecmascript/mem/concurrent_marker.h"
|
||||||
#include "ecmascript/mem/heap-inl.h"
|
|
||||||
#include "ecmascript/mem/parallel_evacuator.h"
|
#include "ecmascript/mem/parallel_evacuator.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/mem/mem_map_allocator.h"
|
#include "ecmascript/mem/mem_map_allocator.h"
|
||||||
#include "ecmascript/js_thread.h"
|
|
||||||
#include "ecmascript/platform/map.h"
|
|
||||||
#include "ecmascript/platform/os.h"
|
#include "ecmascript/platform/os.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "ecmascript/mem/native_area_allocator.h"
|
#include "ecmascript/mem/native_area_allocator.h"
|
||||||
|
|
||||||
#include "ecmascript/platform/os.h"
|
#include "ecmascript/platform/os.h"
|
||||||
#include "libpandabase/os/mem.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
Area *NativeAreaAllocator::AllocateArea(size_t capacity)
|
Area *NativeAreaAllocator::AllocateArea(size_t capacity)
|
||||||
|
@ -15,18 +15,7 @@
|
|||||||
|
|
||||||
#include "ecmascript/mem/parallel_evacuator-inl.h"
|
#include "ecmascript/mem/parallel_evacuator-inl.h"
|
||||||
|
|
||||||
#include "ecmascript/js_hclass-inl.h"
|
|
||||||
#include "ecmascript/mem/barriers-inl.h"
|
|
||||||
#include "ecmascript/mem/clock_scope.h"
|
|
||||||
#include "ecmascript/mem/concurrent_sweeper.h"
|
|
||||||
#include "ecmascript/mem/gc_bitset.h"
|
|
||||||
#include "ecmascript/mem/heap-inl.h"
|
|
||||||
#include "ecmascript/mem/mem.h"
|
|
||||||
#include "ecmascript/mem/space-inl.h"
|
|
||||||
#include "ecmascript/mem/tlab_allocator-inl.h"
|
#include "ecmascript/mem/tlab_allocator-inl.h"
|
||||||
#include "ecmascript/mem/visitor.h"
|
|
||||||
#include "ecmascript/mem/gc_stats.h"
|
|
||||||
#include "ecmascript/ecma_string_table.h"
|
|
||||||
#include "ecmascript/runtime_call_id.h"
|
#include "ecmascript/runtime_call_id.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -12,11 +12,8 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ecmascript/mem/gc_stats.h"
|
|
||||||
#include "ecmascript/mem/incremental_marker.h"
|
#include "ecmascript/mem/incremental_marker.h"
|
||||||
#include "ecmascript/mem/parallel_marker-inl.h"
|
#include "ecmascript/mem/parallel_marker-inl.h"
|
||||||
#include "ecmascript/mem/visitor.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
Marker::Marker(Heap *heap) : heap_(heap), workManager_(heap->GetWorkManager()) {}
|
Marker::Marker(Heap *heap) : heap_(heap), workManager_(heap->GetWorkManager()) {}
|
||||||
|
@ -15,20 +15,10 @@
|
|||||||
|
|
||||||
#include "ecmascript/mem/partial_gc.h"
|
#include "ecmascript/mem/partial_gc.h"
|
||||||
|
|
||||||
#include "ecmascript/ecma_vm.h"
|
|
||||||
#include "ecmascript/mem/barriers-inl.h"
|
|
||||||
#include "ecmascript/mem/clock_scope.h"
|
|
||||||
#include "ecmascript/mem/concurrent_marker.h"
|
#include "ecmascript/mem/concurrent_marker.h"
|
||||||
#include "ecmascript/mem/heap-inl.h"
|
|
||||||
#include "ecmascript/mem/incremental_marker.h"
|
#include "ecmascript/mem/incremental_marker.h"
|
||||||
#include "ecmascript/mem/mark_stack.h"
|
|
||||||
#include "ecmascript/mem/mem.h"
|
|
||||||
#include "ecmascript/mem/parallel_evacuator.h"
|
#include "ecmascript/mem/parallel_evacuator.h"
|
||||||
#include "ecmascript/mem/parallel_marker-inl.h"
|
#include "ecmascript/mem/parallel_marker-inl.h"
|
||||||
#include "ecmascript/mem/space-inl.h"
|
|
||||||
#include "ecmascript/mem/visitor.h"
|
|
||||||
#include "ecmascript/mem/gc_stats.h"
|
|
||||||
#include "ecmascript/ecma_string_table.h"
|
|
||||||
#include "ecmascript/runtime_call_id.h"
|
#include "ecmascript/runtime_call_id.h"
|
||||||
#include "ecmascript/mem/verification.h"
|
#include "ecmascript/mem/verification.h"
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
#include "ecmascript/mem/regexp_cached_chunk.h"
|
#include "ecmascript/mem/regexp_cached_chunk.h"
|
||||||
|
|
||||||
#include "ecmascript/js_thread.h"
|
|
||||||
#include "ecmascript/mem/heap.h"
|
#include "ecmascript/mem/heap.h"
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
|
@ -16,20 +16,9 @@
|
|||||||
#include "ecmascript/mem/shared_heap/shared_concurrent_marker.h"
|
#include "ecmascript/mem/shared_heap/shared_concurrent_marker.h"
|
||||||
|
|
||||||
#include "ecmascript/checkpoint/thread_state_transition.h"
|
#include "ecmascript/checkpoint/thread_state_transition.h"
|
||||||
#include "ecmascript/ecma_string_table.h"
|
|
||||||
#include "ecmascript/mem/allocator-inl.h"
|
|
||||||
#include "ecmascript/mem/clock_scope.h"
|
|
||||||
#include "ecmascript/mem/heap-inl.h"
|
|
||||||
#include "ecmascript/mem/mark_stack.h"
|
|
||||||
#include "ecmascript/mem/mark_word.h"
|
|
||||||
#include "ecmascript/mem/shared_heap/shared_gc_marker-inl.h"
|
#include "ecmascript/mem/shared_heap/shared_gc_marker-inl.h"
|
||||||
#include "ecmascript/mem/space-inl.h"
|
|
||||||
#include "ecmascript/mem/verification.h"
|
#include "ecmascript/mem/verification.h"
|
||||||
#include "ecmascript/mem/visitor.h"
|
|
||||||
#include "ecmascript/mem/gc_stats.h"
|
|
||||||
#include "ecmascript/mem/verification.h"
|
#include "ecmascript/mem/verification.h"
|
||||||
#include "ecmascript/mem/shared_heap/shared_concurrent_sweeper.h"
|
|
||||||
#include "ecmascript/taskpool/taskpool.h"
|
|
||||||
|
|
||||||
namespace panda::ecmascript {
|
namespace panda::ecmascript {
|
||||||
SharedConcurrentMarker::SharedConcurrentMarker(EnableConcurrentMarkType type)
|
SharedConcurrentMarker::SharedConcurrentMarker(EnableConcurrentMarkType type)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user