8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h>
52 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr))
54 #define ENTER_V8(isolate) \
55 DCHECK((isolate)->IsInitialized()); \
56 i::VMState<i::OTHER> __state__((isolate))
60 #define ON_BAILOUT(isolate, location, code) \
61 if (IsExecutionTerminatingCheck(isolate)) { \
67 #define EXCEPTION_PREAMBLE(isolate) \
68 (isolate)->handle_scope_implementer()->IncrementCallDepth(); \
69 DCHECK(!(isolate)->external_caught_exception()); \
70 bool has_pending_exception = false
73 #define EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, do_callback) \
75 i::HandleScopeImplementer* handle_scope_implementer = \
76 (isolate)->handle_scope_implementer(); \
77 handle_scope_implementer->DecrementCallDepth(); \
78 if (has_pending_exception) { \
79 bool call_depth_is_zero = handle_scope_implementer->CallDepthIsZero(); \
80 (isolate)->OptionalRescheduleException(call_depth_is_zero); \
88 #define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value) \
89 EXCEPTION_BAILOUT_CHECK_GENERIC( \
90 isolate, value, isolate->FireCallCompletedCallback();)
93 #define EXCEPTION_BAILOUT_CHECK(isolate, value) \
94 EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, ;)
113 int new_space_capacity;
114 heap_stats.new_space_capacity = &new_space_capacity;
115 intptr_t old_pointer_space_size;
116 heap_stats.old_pointer_space_size = &old_pointer_space_size;
117 intptr_t old_pointer_space_capacity;
118 heap_stats.old_pointer_space_capacity = &old_pointer_space_capacity;
119 intptr_t old_data_space_size;
120 heap_stats.old_data_space_size = &old_data_space_size;
121 intptr_t old_data_space_capacity;
122 heap_stats.old_data_space_capacity = &old_data_space_capacity;
123 intptr_t code_space_size;
124 heap_stats.code_space_size = &code_space_size;
125 intptr_t code_space_capacity;
126 heap_stats.code_space_capacity = &code_space_capacity;
127 intptr_t map_space_size;
129 intptr_t map_space_capacity;
130 heap_stats.map_space_capacity = &map_space_capacity;
131 intptr_t cell_space_size;
132 heap_stats.cell_space_size = &cell_space_size;
133 intptr_t cell_space_capacity;
134 heap_stats.cell_space_capacity = &cell_space_capacity;
135 intptr_t property_cell_space_size;
136 heap_stats.property_cell_space_size = &property_cell_space_size;
137 intptr_t property_cell_space_capacity;
138 heap_stats.property_cell_space_capacity = &property_cell_space_capacity;
139 intptr_t lo_space_size;
141 int global_handle_count;
142 heap_stats.global_handle_count = &global_handle_count;
143 int weak_global_handle_count;
144 heap_stats.weak_global_handle_count = &weak_global_handle_count;
145 int pending_global_handle_count;
146 heap_stats.pending_global_handle_count = &pending_global_handle_count;
147 int near_death_global_handle_count;
148 heap_stats.near_death_global_handle_count = &near_death_global_handle_count;
149 int free_global_handle_count;
150 heap_stats.free_global_handle_count = &free_global_handle_count;
151 intptr_t memory_allocator_size;
152 heap_stats.memory_allocator_size = &memory_allocator_size;
153 intptr_t memory_allocator_capacity;
154 heap_stats.memory_allocator_capacity = &memory_allocator_capacity;
155 int objects_per_type[
LAST_TYPE + 1] = {0};
156 heap_stats.objects_per_type = objects_per_type;
169 Utils::ApiCheck(
false, location,
"Allocation failed - process out of memory");
171 FATAL(
"API fatal error handler returned after process out of memory");
178 if (callback ==
NULL) {
183 callback(location, message);
199 isolate->
heap()->termination_exception();
206 : raw_data(
i::
NewArray<char*>(
V8::GetCompressedStartupDataCount())) {
224 i::NewArray<StartupData>(compressed_data_count);
226 for (
int i = 0;
i < compressed_data_count; ++
i) {
228 i::NewArray<char>(compressed_data[
i].raw_size);
229 if (compressed_data[
i].compressed_size != 0) {
231 &compressed_data[
i].raw_size,
232 compressed_data[
i].data,
233 compressed_data[
i].compressed_size);
234 if (result != 0)
return result;
238 compressed_data[
i].
data = decompressed;
247 #ifdef COMPRESS_STARTUP_DATA_BZ2
265 #ifdef COMPRESS_STARTUP_DATA_BZ2
274 #ifdef COMPRESS_STARTUP_DATA_BZ2
288 reinterpret_cast<const char*
>(libraries_source.
start());
295 reinterpret_cast<const char*
>(exp_libraries_source.
start());
297 exp_libraries_source.
length();
305 #ifdef COMPRESS_STARTUP_DATA_BZ2
313 reinterpret_cast<const i::byte*
>(
334 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
343 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
353 isolate->set_exception_behavior(that);
360 isolate->set_allow_code_gen_callback(callback);
378 : extension_(extension) { }
410 source_length_(source_length >= 0 ?
412 (source ? static_cast<
int>(strlen(source)) : 0)),
413 source_(source, source_length_),
414 dep_count_(dep_count),
416 auto_enable_(
false) {
422 : max_semi_space_size_(0),
423 max_old_space_size_(0),
424 max_executable_size_(0),
426 max_available_threads_(0),
427 code_range_size_(0) { }
430 uint64_t virtual_memory_limit,
435 const uint64_t low_limit = 512ul *
i::MB;
436 const uint64_t medium_limit = 1ul *
i::GB;
437 const uint64_t high_limit = 2ul *
i::GB;
439 const uint64_t low_limit = 512ul *
i::MB;
440 const uint64_t medium_limit = 768ul *
i::MB;
441 const uint64_t high_limit = 1ul *
i::GB;
444 if (physical_memory <= low_limit) {
448 }
else if (physical_memory <= medium_limit) {
452 }
else if (physical_memory <= high_limit) {
469 static_cast<size_t>((virtual_memory_limit >> 3) /
i::MB)));
480 if (semi_space_size != 0 || old_space_size != 0 ||
481 max_executable_size != 0 || code_range_size != 0) {
483 max_executable_size, code_range_size);
495 LOG_API(isolate,
"Persistent::New");
498 (*obj)->ObjectVerify();
500 return result.location();
507 (*obj)->ObjectVerify();
509 return result.location();
558 "HandleScope::HandleScope",
559 "Entering the V8 API without proper locking in place");
586 DCHECK(heap_object->IsHeapObject());
601 "EscapeableHandleScope::Escape",
602 "Escape value set twice");
603 if (escape_value ==
NULL) {
629 "v8::Context::Exit()",
630 "Cannot exit non-entered context")) {
640 return reinterpret_cast<void*
>(value);
654 const char* location) {
659 "Not a native context") &&
663 if (index < data->length())
return data;
667 int new_size =
i::Max(index, data->length() << 1) + 1;
669 env->set_embedder_data(*data);
675 const char* location =
"v8::Context::GetEmbedderData()";
684 const char* location =
"v8::Context::SetEmbedderData()";
688 data->set(index, *val);
695 const char* location =
"v8::Context::GetAlignedPointerFromEmbedderData()";
703 const char* location =
"v8::Context::SetAlignedPointerInEmbedderData()";
722 value_->set_elements(*elements);
727 return i::FixedArray::cast(
value_->elements())->length();
737 return i::Smi::cast(
obj_.
get(0))->value();
756 if (length ==
size - 1) {
757 i::Factory* factory = i::Isolate::Current()->factory();
760 new_elms->set(
i + 1,
get(
i));
769 if (index < 0 || index >= this->
length())
return;
787 if (list->IsUndefined()) {
792 array.
add(isolate->
factory()->NewNumberFromInt(length));
793 for (
int i = 0;
i < length;
i++) {
855 if (result->IsUndefined()) {
860 return ToApiHandle<ObjectTemplate>(result);
884 int next_serial_number = 0;
886 next_serial_number = isolate->next_serial_number() + 1;
887 isolate->set_next_serial_number(next_serial_number);
896 obj->set_length(length);
897 obj->set_undetectable(
false);
898 obj->set_needs_access_check(
false);
911 LOG_API(i_isolate,
"FunctionTemplate::New");
914 i_isolate, callback, data, signature, length,
false);
922 LOG_API(i_isolate,
"Signature::New");
931 for (
int i = 0;
i < argc;
i++) {
932 if (!argv[
i].IsEmpty())
935 obj->set_args(*args);
948 template<
typename Operation>
952 Data* previous_descriptor) {
956 if (previous_descriptor !=
NULL) {
962 return Utils::Convert<i::DeclaredAccessorDescriptor, Operation>(descriptor);
966 Local<RawOperationDescriptor>
969 int internal_field) {
973 return NewDescriptor<RawOperationDescriptor>(isolate, data,
NULL);
983 return NewDescriptor<RawOperationDescriptor>(isolate, data,
this);
991 return NewDescriptor<DeclaredAccessorDescriptor>(isolate, data,
this);
999 return NewDescriptor<RawOperationDescriptor>(isolate, data,
this);
1005 void* compare_value) {
1009 return NewDescriptor<DeclaredAccessorDescriptor>(isolate, data,
this);
1016 uint8_t bool_offset) {
1021 return NewDescriptor<DeclaredAccessorDescriptor>(isolate, data,
this);
1025 template<
typename T>
1036 return NewDescriptor<DeclaredAccessorDescriptor>(isolate, data, operation);
1043 uint8_t compare_value) {
1072 LOG_API(isolate,
"TypeSwitch::New");
1075 for (
int i = 0;
i < argc;
i++)
1081 obj->set_types(*vector);
1088 LOG_API(isolate,
"TypeSwitch::match");
1093 for (
int i = 0;
i < types->
length();
i++) {
1094 if (i::FunctionTemplateInfo::cast(types->
get(
i))->IsTemplateFor(*obj))
1101 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \
1102 i::Handle<i::Object> foreign = FromCData(obj->GetIsolate(), cdata); \
1103 (obj)->setter(*foreign); \
1132 if (settings &
ALL_CAN_READ) obj->set_all_can_read(
true);
1142 template<
typename Getter,
typename Setter>
1153 isolate->
factory()->NewExecutableAccessorInfo();
1167 void* setter_ignored,
1175 isolate->
factory()->NewDeclaredAccessorInfo();
1184 "v8::FunctionTemplate::InstanceTemplate()",
1185 "Reading from empty handle")) {
1190 if (
handle->instance_template()->IsUndefined()) {
1196 i::ObjectTemplateInfo::cast(
handle->instance_template()));
1252 LOG_API(isolate,
"ObjectTemplate::New");
1272 if (!obj ->IsUndefined()) {
1290 if (list->IsUndefined()) {
1292 info->set_property_accessors(*list);
1315 template<
typename Getter,
typename Setter,
typename Data,
typename Template>
1329 name, getter, setter, data, settings, attribute, signature);
1330 if (obj.
is_null())
return false;
1345 this,
name, descriptor,
null,
null, settings, attribute, signature);
1357 this,
name, getter, setter, data, settings, attribute, signature);
1369 this,
name, getter, setter, data, settings, attribute, signature);
1381 this,
name, getter, setter, data, settings, attribute, signature);
1393 this,
name, getter, setter, data, settings, attribute, signature);
1426 cons->set_named_property_handler(*obj);
1438 cons->set_undetectable(
true);
1446 bool turned_on_by_default) {
1468 cons->set_access_check_info(*info);
1469 cons->set_needs_access_check(turned_on_by_default);
1502 cons->set_indexed_property_handler(*obj);
1524 cons->set_instance_call_handler(*obj);
1536 "v8::ObjectTemplate::SetInternalFieldCount()",
1537 "Invalid internal field count")) {
1559 : data(data_), length(length_), buffer_policy(buffer_policy_) {}
1563 if (buffer_policy == BufferOwned) {
1579 return impl_->cached_data.get();
1587 function_info(i::SharedFunctionInfo::cast(*obj), obj->GetIsolate());
1589 obj->GetIsolate()->factory()->NewFunctionFromSharedFunctionInfo(
1590 function_info, obj->GetIsolate()->global_context());
1591 return ToApiHandle<Script>(
function);
1599 ON_BAILOUT(isolate,
"v8::UnboundScript::GetId()",
return -1);
1600 LOG_API(isolate,
"v8::UnboundScript::GetId");
1604 i::SharedFunctionInfo::cast(*obj));
1606 return script->id()->value();
1615 ON_BAILOUT(isolate,
"v8::UnboundScript::GetLineNumber()",
return -1);
1616 LOG_API(isolate,
"UnboundScript::GetLineNumber");
1617 if (obj->script()->IsScript()) {
1630 ON_BAILOUT(isolate,
"v8::UnboundScript::GetName()",
1632 LOG_API(isolate,
"UnboundScript::GetName");
1633 if (obj->script()->IsScript()) {
1646 ON_BAILOUT(isolate,
"v8::UnboundScript::GetSourceURL()",
1648 LOG_API(isolate,
"UnboundScript::GetSourceURL");
1649 if (obj->script()->IsScript()) {
1650 i::Object* url = i::Script::cast(obj->script())->source_url();
1662 ON_BAILOUT(isolate,
"v8::UnboundScript::GetSourceMappingURL()",
1664 LOG_API(isolate,
"UnboundScript::GetSourceMappingURL");
1665 if (obj->script()->IsScript()) {
1666 i::Object* url = i::Script::cast(obj->script())->source_mapping_url();
1681 LOG_API(isolate,
"Script::Run");
1689 has_pending_exception = !i::Execution::Call(
1690 isolate, fun, receiver, 0,
NULL).ToHandle(&result);
1698 return ToApiHandle<UnboundScript>(
1708 ON_BAILOUT(isolate,
"v8::ScriptCompiler::CompileUnbound()",
1729 LOG_API(isolate,
"ScriptCompiler::CompileUnbound");
1734 int line_offset = 0;
1735 int column_offset = 0;
1736 bool is_shared_cross_origin =
false;
1749 is_shared_cross_origin =
1754 str, name_obj, line_offset, column_offset, is_shared_cross_origin,
1757 has_pending_exception = result.
is_null();
1758 if (has_pending_exception && script_data !=
NULL) {
1766 raw_result = *result;
1769 script_data !=
NULL) {
1779 return ToApiHandle<UnboundScript>(result);
1789 LOG_API(isolate,
"ScriptCompiler::CompiletBound()");
1793 return generic->BindToCurrentContext();
1812 i::FLAG_stack_size, isolate);
1823 LOG_API(isolate,
"ScriptCompiler::Compile()");
1846 source->
info->set_script(script);
1853 source->
parser->Internalize();
1857 if (source->
info->function() !=
NULL) {
1862 has_pending_exception = result.
is_null();
1866 raw_result = *result;
1873 if (
generic.IsEmpty()) {
1876 return generic->BindToCurrentContext();
1886 reinterpret_cast<v8::Isolate*
>(str->GetIsolate()),
1891 reinterpret_cast<v8::Isolate*
>(str->GetIsolate()),
1899 return Compile(source, &origin);
1908 next_(isolate_->try_catch_handler()),
1910 can_continue_(
true),
1911 capture_message_(
true),
1913 has_terminated_(
false) {
1924 DCHECK(isolate_ == i::Isolate::Current());
1929 if (HasCaught() && capture_message_) {
1934 isolate_->thread_local_top()->rethrowing_message_ =
true;
1935 isolate_->RestorePendingMessageFromTryCatch(
this);
1937 isolate_->UnregisterTryCatchHandler(
this);
1939 reinterpret_cast<Isolate*
>(isolate_)->ThrowException(exc);
1940 DCHECK(!isolate_->thread_local_top()->rethrowing_message_);
1942 if (HasCaught() && isolate_->has_scheduled_exception()) {
1946 isolate_->CancelScheduledExceptionFromTryCatch(
this);
1948 isolate_->UnregisterTryCatchHandler(
this);
1955 return !
reinterpret_cast<i::Object*
>(exception_)->IsTheHole();
1960 return can_continue_;
1965 return has_terminated_;
1977 DCHECK(isolate_ == i::Isolate::Current());
1989 DCHECK(isolate_ == i::Isolate::Current());
1998 has_pending_exception = !
maybe.has_value;
2013 DCHECK(isolate_ == i::Isolate::Current());
2015 DCHECK(message->IsJSMessageObject() || message->IsTheHole());
2016 if (HasCaught() && !message->IsTheHole()) {
2025 DCHECK(isolate_ == i::Isolate::Current());
2026 if (!rethrow_ && HasCaught() && isolate_->has_scheduled_exception()) {
2030 isolate_->CancelScheduledExceptionFromTryCatch(
this);
2037 i::Object* the_hole = isolate_->heap()->the_hole_value();
2038 exception_ = the_hole;
2039 message_obj_ = the_hole;
2040 message_script_ = the_hole;
2041 message_start_pos_ = 0;
2042 message_end_pos_ = 0;
2047 is_verbose_ = value;
2052 capture_message_ = value;
2067 return scope.
Escape(result);
2082 reinterpret_cast<v8::Isolate*
>(script->GetIsolate());
2122 return i::Execution::Call(isolate, fun, recv, argc, argv);
2131 i::Isolate::Current()->js_builtins_object(),
2148 return static_cast<int>(result->Number());
2158 return message->start_position();
2168 return message->end_position();
2181 "GetPositionInLine", data_obj).ToHandle(&start_col_obj);
2183 return static_cast<int>(start_col_obj->Number());
2196 "GetPositionInLine", data_obj).ToHandle(&start_col_obj);
2200 int start = message->start_position();
2201 int end = message->end_position();
2202 return static_cast<int>(start_col_obj->Number()) + (end - start);
2215 return i::Script::cast(script->value())->is_shared_cross_origin();
2229 if (result->IsString()) {
2297 return obj->IsSmi() ? i::Smi::cast(*obj)->value() : defaultValue;
2317 const char* propertyName) {
2324 return obj->IsString()
2352 return obj->IsTrue();
2376 has_pending_exception = !maybe_result.ToHandle(&result);
2451 #define VALUE_IS_TYPED_ARRAY(Type, typeName, TYPE, ctype, size) \
2452 bool Value::Is##Type##Array() const { \
2453 i::Handle<i::Object> obj = Utils::OpenHandle(this); \
2454 return obj->IsJSTypedArray() && \
2455 i::JSTypedArray::cast(*obj)->type() == kExternal##Type##Array; \
2460 #undef VALUE_IS_TYPED_ARRAY
2478 #define VALUE_IS_SPECIFIC_TYPE(Type, Class) \
2479 bool Value::Is##Type() const { \
2480 i::Handle<i::Object> obj = Utils::OpenHandle(this); \
2481 if (!obj->IsHeapObject()) return false; \
2482 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate(); \
2483 return obj->HasSpecificClassOf(isolate->heap()->Class##_string()); \
2497 #undef VALUE_IS_SPECIFIC_TYPE
2512 if (obj->IsSmi())
return true;
2513 if (obj->IsNumber()) {
2522 if (obj->IsSmi())
return i::Smi::cast(*obj)->value() >= 0;
2523 if (obj->IsNumber()) {
2524 double value = obj->Number();
2536 const char* class_name) {
2538 if (!constr->IsJSFunction())
return false;
2540 return func->shared()->native() && constr.is_identical_to(
2543 class_name).ToHandleChecked());
2549 if (obj->IsJSObject()) {
2567 return obj->IsJSRegExp();
2573 if (!obj->IsJSFunction())
return false;
2575 return func->shared()->is_generator();
2587 if (obj->IsString()) {
2594 has_pending_exception = !i::Execution::ToString(
2595 isolate, obj).ToHandle(&str);
2598 return ToApiHandle<String>(str);
2605 if (obj->IsString()) {
2609 LOG_API(isolate,
"ToDetailString");
2612 has_pending_exception = !i::Execution::ToDetailString(
2613 isolate, obj).ToHandle(&str);
2616 return ToApiHandle<String>(str);
2623 if (obj->IsJSObject()) {
2630 has_pending_exception = !i::Execution::ToObject(
2631 isolate, obj).ToHandle(&val);
2634 return ToApiHandle<Object>(val);
2640 if (obj->IsBoolean()) {
2641 return ToApiHandle<Boolean>(obj);
2644 LOG_API(isolate,
"ToBoolean");
2647 isolate->
factory()->ToBoolean(obj->BooleanValue());
2648 return ToApiHandle<Boolean>(val);
2656 if (obj->IsNumber()) {
2659 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
2664 isolate, obj).ToHandle(&num);
2667 return ToApiHandle<Number>(num);
2677 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
2678 LOG_API(isolate,
"ToInteger");
2681 has_pending_exception = !i::Execution::ToInteger(
2682 isolate, obj).ToHandle(&num);
2685 return ToApiHandle<Integer>(num);
2694 "v8::internal::Internals::CheckInitialized()",
2695 "Isolate is not initialized or V8 has died");
2701 "v8::External::Cast()",
2702 "Could not convert to external");
2709 "v8::Object::Cast()",
2710 "Could not convert to object");
2717 "v8::Function::Cast()",
2718 "Could not convert to function");
2726 "Could not convert to name");
2733 "v8::String::Cast()",
2734 "Could not convert to string");
2741 "v8::Symbol::Cast()",
2742 "Could not convert to symbol");
2749 "v8::Number::Cast()",
2750 "Could not convert to number");
2757 "v8::Integer::Cast()",
2758 "Could not convert to number");
2765 "v8::Array::Cast()",
2766 "Could not convert to array");
2772 "v8::Promise::Cast()",
2773 "Could not convert to promise");
2779 "v8::Promise::Resolver::Cast()",
2780 "Could not convert to promise resolver");
2787 "v8::ArrayBuffer::Cast()",
2788 "Could not convert to ArrayBuffer");
2795 "v8::ArrayBufferView::Cast()",
2796 "Could not convert to ArrayBufferView");
2803 "v8::TypedArray::Cast()",
2804 "Could not convert to TypedArray");
2808 #define CHECK_TYPED_ARRAY_CAST(Type, typeName, TYPE, ctype, size) \
2809 void v8::Type##Array::CheckCast(Value* that) { \
2810 i::Handle<i::Object> obj = Utils::OpenHandle(that); \
2811 Utils::ApiCheck(obj->IsJSTypedArray() && \
2812 i::JSTypedArray::cast(*obj)->type() == \
2813 kExternal##Type##Array, \
2814 "v8::" #Type "Array::Cast()", \
2815 "Could not convert to " #Type "Array"); \
2821 #undef CHECK_TYPED_ARRAY_CAST
2827 "v8::DataView::Cast()",
2828 "Could not convert to DataView");
2835 if (obj->IsHeapObject()) isolate = i::HeapObject::cast(*obj)->GetIsolate();
2837 obj->HasSpecificClassOf(isolate->
heap()->Date_string()),
2839 "Could not convert to date");
2846 if (obj->IsHeapObject()) isolate = i::HeapObject::cast(*obj)->GetIsolate();
2848 obj->HasSpecificClassOf(isolate->
heap()->String_string()),
2849 "v8::StringObject::Cast()",
2850 "Could not convert to StringObject");
2857 if (obj->IsHeapObject()) isolate = i::HeapObject::cast(*obj)->GetIsolate();
2859 obj->HasSpecificClassOf(isolate->
heap()->Symbol_string()),
2860 "v8::SymbolObject::Cast()",
2861 "Could not convert to SymbolObject");
2868 if (obj->IsHeapObject()) isolate = i::HeapObject::cast(*obj)->GetIsolate();
2870 obj->HasSpecificClassOf(isolate->
heap()->Number_string()),
2871 "v8::NumberObject::Cast()",
2872 "Could not convert to NumberObject");
2879 if (obj->IsHeapObject()) isolate = i::HeapObject::cast(*obj)->GetIsolate();
2881 obj->HasSpecificClassOf(isolate->
heap()->Boolean_string()),
2882 "v8::BooleanObject::Cast()",
2883 "Could not convert to BooleanObject");
2890 "v8::RegExp::Cast()",
2891 "Could not convert to regular expression");
2903 if (obj->IsNumber()) {
2906 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
2907 LOG_API(isolate,
"NumberValue");
2911 isolate, obj).ToHandle(&num);
2914 return num->Number();
2921 if (obj->IsNumber()) {
2924 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
2925 LOG_API(isolate,
"IntegerValue");
2928 has_pending_exception = !i::Execution::ToInteger(
2929 isolate, obj).ToHandle(&num);
2933 return i::Smi::cast(*num)->value();
2935 return static_cast<int64_t
>(num->Number());
2946 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
2950 has_pending_exception = !i::Execution::ToInt32(isolate, obj).ToHandle(&num);
2953 return ToApiHandle<Int32>(num);
2963 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
2967 has_pending_exception = !i::Execution::ToUint32(
2968 isolate, obj).ToHandle(&num);
2971 return ToApiHandle<Uint32>(num);
2981 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
2982 LOG_API(isolate,
"ToArrayIndex");
2986 has_pending_exception = !i::Execution::ToString(
2987 isolate, obj).ToHandle(&string_obj);
2991 if (str->AsArrayIndex(&index)) {
2996 value = isolate->
factory()->NewNumber(index);
3007 return i::Smi::cast(*obj)->value();
3009 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
3010 LOG_API(isolate,
"Int32Value (slow)");
3014 has_pending_exception = !i::Execution::ToInt32(isolate, obj).ToHandle(&num);
3017 return i::Smi::cast(*num)->value();
3019 return static_cast<int32_t>(num->Number());
3029 "v8::Value::Equals()",
3030 "Reading from empty handle")) {
3039 if (obj->IsJSObject() && other->IsJSObject()) {
3040 return *obj == *other;
3046 "EQUALS", obj,
arraysize(args), args).ToHandle(&result);
3056 "v8::Value::StrictEquals()",
3057 "Reading from empty handle")) {
3060 LOG_API(isolate,
"StrictEquals");
3063 if (obj->IsHeapNumber()) {
3064 if (!other->IsNumber())
return false;
3065 double x = obj->Number();
3066 double y = other->Number();
3068 return x ==
y && !std::isnan(x) && !std::isnan(
y);
3069 }
else if (*obj == *other) {
3071 }
else if (obj->IsSmi()) {
3072 return other->IsNumber() && obj->Number() == other->Number();
3073 }
else if (obj->IsString()) {
3074 return other->IsString() &&
3077 }
else if (obj->IsUndefined() || obj->IsUndetectableObject()) {
3078 return other->IsUndefined() || other->IsUndetectableObject();
3088 "v8::Value::SameValue()",
3089 "Reading from empty handle")) {
3093 return obj->SameValue(*other);
3100 return i::Smi::cast(*obj)->value();
3102 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate();
3103 LOG_API(isolate,
"Uint32Value");
3107 has_pending_exception = !i::Execution::ToUint32(
3108 isolate, obj).ToHandle(&num);
3111 return i::Smi::cast(*num)->value();
3113 return static_cast<uint32_t>(num->Number());
3121 ON_BAILOUT(isolate,
"v8::Object::Set()",
return false);
3128 has_pending_exception =
3138 ON_BAILOUT(isolate,
"v8::Object::Set()",
return false);
3155 ON_BAILOUT(isolate,
"v8::Object::ForceSet()",
return false);
3180 ON_BAILOUT(isolate,
"v8::Object::ForceDelete()",
return false);
3190 if (self->IsJSGlobalProxy() || self->IsGlobalObject()) {
3199 return obj->IsTrue();
3211 has_pending_exception =
3225 has_pending_exception =
3239 ON_BAILOUT(isolate,
"v8::Object::GetPropertyAttributes()",
3245 if (!key_obj->IsName()) {
3247 has_pending_exception = !i::Execution::ToString(
3248 isolate, key_obj).ToHandle(&key_obj);
3255 has_pending_exception = !result.
has_value;
3264 ON_BAILOUT(isolate,
"v8::Object::GetOwnPropertyDescriptor()",
3273 "ObjectGetOwnPropertyDescriptor",
3274 isolate->
factory()->undefined_value(),
3276 args).ToHandle(&result);
3294 ON_BAILOUT(isolate,
"v8::Object::SetPrototype()",
return false);
3304 has_pending_exception = result.
is_null();
3314 "v8::Object::FindInstanceInPrototypeChain()",
3333 ON_BAILOUT(isolate,
"v8::Object::GetPropertyNames()",
3348 isolate->
factory()->NewJSArrayWithElements(elms);
3355 ON_BAILOUT(isolate,
"v8::Object::GetOwnPropertyNames()",
3370 isolate->
factory()->NewJSArrayWithElements(elms);
3378 ON_BAILOUT(i_isolate,
"v8::Object::ObjectProtoToString()",
3395 i_isolate->
factory()->Arguments_string())) {
3398 const char* prefix =
"[object ";
3400 const char* postfix =
"]";
3403 int str_len = str->Utf8Length();
3406 int buf_len = prefix_len + str_len + postfix_len;
3410 char* ptr = buf.
start();
3415 str->WriteUtf8(ptr, str_len);
3432 ON_BAILOUT(isolate,
"v8::Object::GetConstructorName()",
3443 ON_BAILOUT(isolate,
"v8::Object::Delete()",
return false);
3453 return obj->IsTrue();
3464 ON_BAILOUT(isolate,
"v8::Object::Has()",
return false);
3471 isolate,
self, key_obj).ToHandle(&obj);
3473 return obj->IsTrue();
3486 ON_BAILOUT(isolate,
"v8::Object::DeleteProperty()",
3494 has_pending_exception =
3497 return obj->IsTrue();
3503 ON_BAILOUT(isolate,
"v8::Object::HasProperty()",
return false);
3507 has_pending_exception = !
maybe.has_value;
3513 template<
typename Getter,
typename Setter,
typename Data>
3522 ON_BAILOUT(isolate,
"v8::Object::SetAccessor()",
return false);
3527 name, getter, setter, data, settings, attributes, signature);
3528 if (info.
is_null())
return false;
3535 if (result->IsUndefined())
return false;
3548 this,
name, getter, setter, data, settings, attributes);
3559 this,
name, getter, setter, data, settings, attributes);
3569 this,
name, descriptor,
null,
null, settings, attributes);
3581 ON_BAILOUT(isolate,
"v8::Object::SetAccessorProperty()",
return);
3586 if (setter_i.
is_null()) setter_i = isolate->
factory()->null_value();
3597 ON_BAILOUT(isolate,
"v8::Object::HasOwnProperty()",
3602 has_pending_exception = !
maybe.has_value;
3610 ON_BAILOUT(isolate,
"v8::Object::HasRealNamedProperty()",
3615 has_pending_exception = !
maybe.has_value;
3623 ON_BAILOUT(isolate,
"v8::Object::HasRealIndexedProperty()",
3628 has_pending_exception = !
maybe.has_value;
3637 "v8::Object::HasRealNamedCallbackProperty()",
3643 has_pending_exception = !
maybe.has_value;
3651 ON_BAILOUT(isolate,
"v8::Object::HasNamedLookupInterceptor()",
3659 ON_BAILOUT(isolate,
"v8::Object::HasIndexedLookupInterceptor()",
3681 "v8::Object::GetRealNamedPropertyInPrototypeChain()",
3690 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
3697 ON_BAILOUT(isolate,
"v8::Object::GetRealNamedProperty()",
3702 i::LookupIterator it(self_obj, key_obj,
3703 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
3713 ON_BAILOUT(isolate,
"v8::Object::TurnOnAccessCheck()",
return);
3723 new_map->set_is_access_check_needed(
true);
3740 has_pending_exception = result.
is_null();
3752 i::Context* context =
self->GetCreationContext();
3759 ON_BAILOUT(isolate,
"v8::Object::GetIdentityHash()",
return 0);
3770 ON_BAILOUT(isolate,
"v8::Object::SetHiddenValue()",
return false);
3771 if (value.
IsEmpty())
return DeleteHiddenValue(key);
3777 isolate->
factory()->InternalizeString(key_obj);
3781 return *result == *
self;
3787 ON_BAILOUT(isolate,
"v8::Object::GetHiddenValue()",
3793 isolate->
factory()->InternalizeString(key_obj);
3802 ON_BAILOUT(isolate,
"v8::DeleteHiddenValue()",
return false);
3808 isolate->
factory()->InternalizeString(key_obj);
3818 switch (array_type) {
3819 #define ARRAY_TYPE_TO_ELEMENTS_KIND(Type, type, TYPE, ctype, size) \
3820 case kExternal##Type##Array: \
3821 return i::EXTERNAL_##TYPE##_ELEMENTS;
3824 #undef ARRAY_TYPE_TO_ELEMENTS_KIND
3837 isolate->
factory()->NewExternalArray(length, array_type, data);
3852 ON_BAILOUT(isolate,
"v8::SetElementsToPixelData()",
return);
3856 length <= i::ExternalUint8ClampedArray::kMaxLength,
3857 "v8::Object::SetIndexedPropertiesToPixelData()",
3858 "length exceeds max acceptable value")) {
3863 "v8::Object::SetIndexedPropertiesToPixelData()",
3864 "JSArray is not supported")) {
3873 ON_BAILOUT(self->GetIsolate(),
"v8::HasIndexedPropertiesInPixelData()",
3875 return self->HasExternalUint8ClampedElements();
3881 ON_BAILOUT(self->GetIsolate(),
"v8::GetIndexedPropertiesPixelData()",
3883 if (self->HasExternalUint8ClampedElements()) {
3884 return i::ExternalUint8ClampedArray::cast(self->elements())->
3885 external_uint8_clamped_pointer();
3894 ON_BAILOUT(self->GetIsolate(),
"v8::GetIndexedPropertiesPixelDataLength()",
3896 if (self->HasExternalUint8ClampedElements()) {
3897 return i::ExternalUint8ClampedArray::cast(self->elements())->length();
3909 ON_BAILOUT(isolate,
"v8::SetIndexedPropertiesToExternalArrayData()",
return);
3912 if (!
Utils::ApiCheck(length >= 0 && length <= i::ExternalArray::kMaxLength,
3913 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3914 "length exceeds max acceptable value")) {
3919 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3920 "JSArray is not supported")) {
3930 "v8::HasIndexedPropertiesInExternalArrayData()",
3932 return self->HasExternalArrayElements();
3939 "v8::GetIndexedPropertiesExternalArrayData()",
3941 if (self->HasExternalArrayElements()) {
3942 return i::ExternalArray::cast(self->elements())->external_pointer();
3952 "v8::GetIndexedPropertiesExternalArrayDataType()",
3954 switch (self->elements()->map()->instance_type()) {
3955 #define INSTANCE_TYPE_TO_ARRAY_TYPE(Type, type, TYPE, ctype, size) \
3956 case i::EXTERNAL_##TYPE##_ARRAY_TYPE: \
3957 return kExternal##Type##Array;
3959 #undef INSTANCE_TYPE_TO_ARRAY_TYPE
3969 "v8::GetIndexedPropertiesExternalArrayDataLength()",
3971 if (self->HasExternalArrayElements()) {
3972 return i::ExternalArray::cast(self->elements())->length();
3981 ON_BAILOUT(isolate,
"v8::Object::IsCallable()",
return false);
3985 return obj->IsCallable();
3993 ON_BAILOUT(isolate,
"v8::Object::CallAsFunction()",
3995 LOG_API(isolate,
"Object::CallAsFunction");
4004 if (obj->IsJSFunction()) {
4009 has_pending_exception = !i::Execution::TryGetFunctionDelegate(
4010 isolate, obj).ToHandle(&delegate);
4017 has_pending_exception = !i::Execution::Call(
4018 isolate, fun, recv_obj, argc, args,
true).ToHandle(&returned);
4027 ON_BAILOUT(isolate,
"v8::Object::CallAsConstructor()",
4029 LOG_API(isolate,
"Object::CallAsConstructor");
4036 if (obj->IsJSFunction()) {
4040 has_pending_exception = !i::Execution::New(
4041 fun, argc, args).ToHandle(&returned);
4048 has_pending_exception = !i::Execution::TryGetConstructorDelegate(
4049 isolate, obj).ToHandle(&delegate);
4051 if (!delegate->IsUndefined()) {
4055 has_pending_exception = !i::Execution::Call(
4056 isolate, fun, obj, argc, args).ToHandle(&returned);
4058 DCHECK(!delegate->IsUndefined());
4070 LOG_API(isolate,
"Function::New");
4086 ON_BAILOUT(isolate,
"v8::Function::NewInstance()",
4088 LOG_API(isolate,
"Function::NewInstance");
4097 has_pending_exception = !i::Execution::New(
4098 function, argc, args).ToHandle(&returned);
4108 LOG_API(isolate,
"Function::Call");
4118 has_pending_exception = !i::Execution::Call(
4119 isolate, fun, recv_obj, argc, args,
true).ToHandle(&returned);
4137 func->GetIsolate()));
4144 func->GetIsolate()));
4150 ON_BAILOUT(isolate,
"v8::Function::GetDisplayName()",
4151 return ToApiHandle<Primitive>(
4152 isolate->
factory()->undefined_value()));
4156 isolate->
factory()->InternalizeOneByteString(
4161 if (value->IsString()) {
4166 return ToApiHandle<Primitive>(isolate->
factory()->undefined_value());
4172 if (func->shared()->script()->IsScript()) {
4191 if (func->shared()->script()->IsScript()) {
4201 if (func->shared()->script()->IsScript()) {
4211 return func->IsBuiltin();
4217 if (!func->shared()->script()->IsScript()) {
4221 return script->id()->value();
4227 if (!func->shared()->bound()) {
4231 i::FixedArray::cast(func->function_bindings()));
4234 func->GetIsolate());
4241 return str->length();
4247 return str->HasOnlyOneByteChars();
4267 return reinterpret_cast<uint16_t*
>(
4286 const uint16_t* end = chars + length;
4287 while (
Unaligned(chars) && chars != end) {
4294 const int inner_loops = 16;
4295 while (chars + inner_loops*increment < aligned_end) {
4296 for (
int i = 0;
i < inner_loops;
i++) {
4297 acc |= *
reinterpret_cast<const uintptr_t*
>(chars);
4307 while (chars != end) {
4328 if (left_as_cons !=
NULL && right_as_cons !=
NULL) {
4331 cons_string = right_as_cons;
4334 cons_string = left_as_cons;
4341 if (left_as_cons !=
NULL) {
4342 cons_string = left_as_cons;
4346 if (right_as_cons !=
NULL) {
4347 cons_string = right_as_cons;
4362 if (str->HasOnlyOneByteChars())
return true;
4364 return helper.
Check(*str);
4394 int utf8_length = 0;
4396 for (
int i = 0;
i < length;
i++) {
4397 utf8_length += *chars++ >> 7;
4405 int utf8_length = 0;
4407 for (
int i = 0;
i < length;
i++) {
4441 uint8_t leaf_state) {
4459 uint8_t leaf_state) {
4477 uint8_t* state_out) {
4489 using namespace internal;
4490 int total_length = 0;
4495 uint8_t right_leaf_state;
4496 uint8_t left_leaf_state;
4498 ConsString* left_as_cons =
4500 if (left_as_cons ==
NULL) {
4501 total_length += leaf_length;
4504 ConsString* right_as_cons =
4506 if (right_as_cons ==
NULL) {
4507 total_length += leaf_length;
4509 if (left_as_cons !=
NULL) {
4511 current = left_as_cons;
4516 return total_length;
4518 }
else if (left_as_cons ==
NULL) {
4520 current = right_as_cons;
4526 total_length +=
Calculate(left_as_cons, &left_leaf_state);
4528 current = right_as_cons;
4530 total_length +=
Calculate(right_as_cons, &right_leaf_state);
4532 current = left_as_cons;
4550 int length = str->
length();
4551 if (length == 0)
return 0;
4555 if (cons_string ==
NULL)
return length;
4572 bool skip_capacity_check,
4573 bool replace_invalid_utf8)
4574 : early_termination_(
false),
4575 last_character_(
unibrow::Utf16::kNoPreviousCharacter),
4578 capacity_(capacity),
4579 skip_capacity_check_(capacity == -1 || skip_capacity_check),
4580 replace_invalid_utf8_(replace_invalid_utf8),
4581 utf16_chars_read_(0) {
4588 bool replace_invalid_utf8) {
4594 if (Utf16::IsSurrogatePair(last_character, character)) {
4595 int written = Utf8::Encode(buffer,
4598 replace_invalid_utf8);
4603 char temp_buffer[Utf8::kMaxEncodedSize];
4605 int written = Utf8::Encode(temp_buffer,
4607 Utf16::kNoPreviousCharacter,
4608 replace_invalid_utf8);
4610 if (written > remaining)
return 0;
4612 for (
int j = 0; j < written; j++) {
4613 buffer[j] = temp_buffer[j];
4628 template<
typename Char>
4629 void Visit(
const Char* chars,
const int length) {
4631 DCHECK(!early_termination_);
4632 if (length == 0)
return;
4634 char* buffer = buffer_;
4635 int last_character =
4636 sizeof(Char) == 1 ? Utf16::kNoPreviousCharacter : last_character_;
4641 if (skip_capacity_check_) {
4642 fast_length = length;
4644 int remaining_capacity = capacity_ -
static_cast<int>(buffer - start_);
4646 STATIC_ASSERT(Utf16::kMaxExtraUtf8BytesForOneUtf16CodeUnit == 3);
4647 int max_size_per_char =
sizeof(Char) == 1 ? 2 : 3;
4648 int writable_length =
4649 (remaining_capacity - max_size_per_char)/max_size_per_char;
4651 if (writable_length <= 0)
break;
4652 fast_length =
i + writable_length;
4653 if (fast_length > length) fast_length = length;
4656 if (
sizeof(Char) == 1) {
4657 for (;
i < fast_length;
i++) {
4659 Utf8::EncodeOneByte(buffer,
static_cast<uint8_t
>(*chars++));
4660 DCHECK(capacity_ == -1 || (buffer - start_) <= capacity_);
4663 for (;
i < fast_length;
i++) {
4665 buffer += Utf8::Encode(buffer,
4668 replace_invalid_utf8_);
4669 last_character = character;
4670 DCHECK(capacity_ == -1 || (buffer - start_) <= capacity_);
4674 if (fast_length == length) {
4676 last_character_ = last_character;
4678 utf16_chars_read_ += length;
4682 DCHECK(!skip_capacity_check_);
4684 int remaining_capacity = capacity_ -
static_cast<int>(buffer - start_);
4685 DCHECK(remaining_capacity >= 0);
4686 for (; i < length && remaining_capacity > 0;
i++) {
4690 if (replace_invalid_utf8_ && Utf16::IsLeadSurrogate(character)) {
4691 early_termination_ =
true;
4694 int written = WriteEndCharacter(character,
4698 replace_invalid_utf8_);
4700 early_termination_ =
true;
4704 remaining_capacity -= written;
4705 last_character = character;
4708 last_character_ = last_character;
4710 utf16_chars_read_ +=
i;
4714 return early_termination_;
4718 Visit(chars, length);
4722 Visit(chars, length);
4727 if (utf16_chars_read_out !=
NULL) {
4728 *utf16_chars_read_out = utf16_chars_read_;
4732 !early_termination_ &&
4733 (capacity_ == -1 || (buffer_ - start_) < capacity_)) {
4736 return static_cast<int>(buffer_ - start_);
4754 int recursion_budget) {
4755 while (!writer->
IsDone()) {
4757 if (cons_string ==
NULL)
return true;
4758 if (recursion_budget <= 0)
return false;
4763 recursion_budget - 1);
4764 if (!success)
return false;
4766 current = cons_string->
second();
4775 int options)
const {
4777 LOG_API(isolate,
"String::WriteUtf8");
4780 if (options & HINT_MANY_WRITES_EXPECTED) {
4783 const int string_length = str->length();
4784 bool write_null = !(options & NO_NULL_TERMINATION);
4785 bool replace_invalid_utf8 = (options & REPLACE_INVALID_UTF8);
4788 if (capacity == -1 || capacity / max16BitCodeUnitSize >= string_length) {
4790 const int kMaxRecursion = 100;
4792 if (success)
return writer.
CompleteWrite(write_null, nchars_ref);
4793 }
else if (capacity >= string_length) {
4796 if (utf8_bytes <= capacity) {
4798 if (utf8_bytes == string_length) {
4799 WriteOneByte(
reinterpret_cast<uint8_t*
>(buffer), 0, capacity, options);
4800 if (nchars_ref !=
NULL) *nchars_ref = string_length;
4801 if (write_null && (utf8_bytes+1 <= capacity)) {
4802 return string_length + 1;
4804 return string_length;
4806 if (write_null && (utf8_bytes+1 > capacity)) {
4807 options |= NO_NULL_TERMINATION;
4812 return WriteUtf8(buffer, -1, nchars_ref, options);
4823 template<
typename CharType>
4830 LOG_API(isolate,
"String::Write");
4832 DCHECK(start >= 0 && length >= -1);
4840 int end = start + length;
4841 if ((length == -1) || (length > str->length() - start) )
4842 end = str->length();
4843 if (end < 0)
return 0;
4846 (length == -1 || end - start < length)) {
4847 buffer[end - start] =
'\0';
4856 int options)
const {
4857 return WriteHelper(
this, buffer, start, length, options);
4864 int options)
const {
4865 return WriteHelper(
this, buffer, start, length, options);
4871 return i::StringShape(*str).IsExternalTwoByte();
4877 return i::StringShape(*str).IsExternalOneByte();
4885 if (i::StringShape(*str).IsExternalTwoByte()) {
4886 const void* resource =
4900 if (i::StringShape(*str).IsExternalOneByte()) {
4901 const void* resource =
4904 expectedEncoding = ONE_BYTE_ENCODING;
4905 }
else if (i::StringShape(*str).IsExternalTwoByte()) {
4906 const void* resource =
4909 expectedEncoding = TWO_BYTE_ENCODING;
4913 str->IsOneByteRepresentation() ? ONE_BYTE_ENCODING : TWO_BYTE_ENCODING;
4916 CHECK_EQ(expectedEncoding, encoding);
4922 if (i::StringShape(*str).IsExternalOneByte()) {
4923 const void* resource =
4940 return reinterpret_cast<const Symbol*
>(
this)->
Name();
4946 return obj->Number();
4952 return obj->IsTrue();
4959 return i::Smi::cast(*obj)->value();
4961 return static_cast<int64_t
>(obj->Number());
4969 return i::Smi::cast(*obj)->value();
4971 return static_cast<int32_t>(obj->Number());
4979 return i::Smi::cast(*obj)->value();
4981 return static_cast<uint32_t>(obj->Number());
4988 return obj->GetInternalFieldCount();
4994 const char* location) {
4997 "Internal field out of bounds");
5003 const char* location =
"v8::Object::GetInternalField()";
5012 const char* location =
"v8::Object::SetInternalField()";
5015 obj->SetInternalField(index, *val);
5016 DCHECK_EQ(value, GetInternalField(index));
5022 const char* location =
"v8::Object::GetAlignedPointerFromInternalField()";
5030 const char* location =
"v8::Object::SetAlignedPointerInInternalField()";
5033 DCHECK_EQ(value, GetAlignedPointerFromInternalField(index));
5039 if (obj->IsUndefined())
return NULL;
5040 i::Object* foreign = i::JSObject::cast(obj)->GetInternalField(0);
5041 return i::Foreign::cast(foreign)->foreign_address();
5077 "v8::V8::SetArrayBufferAllocator",
5078 "ArrayBufferAllocator might only be set once"))
5091 total_heap_size_executable_(0),
5092 total_physical_size_(0),
5094 heap_size_limit_(0) { }
5132 DCHECK(isolate == i::Isolate::Current());
5165 if (!global_template.
IsEmpty()) {
5176 proxy_constructor->set_prototype_template(
5182 if (!global_constructor->access_check_info()->IsUndefined()) {
5183 proxy_constructor->set_access_check_info(
5184 global_constructor->access_check_info());
5185 proxy_constructor->set_needs_access_check(
5186 global_constructor->needs_access_check());
5187 global_constructor->set_needs_access_check(
false);
5188 global_constructor->set_access_check_info(
5189 isolate->
heap()->undefined_value());
5200 maybe_proxy, proxy_template, extensions);
5203 if (!global_template.
IsEmpty()) {
5206 global_constructor->set_access_check_info(
5207 proxy_constructor->access_check_info());
5208 global_constructor->set_needs_access_check(
5209 proxy_constructor->needs_access_check());
5223 LOG_API(isolate,
"Context::New");
5227 if (extensions ==
NULL) extensions = &no_extensions;
5240 env->set_security_token(*token_handle);
5248 env->set_security_token(env->global_object());
5255 i::Object* security_token = env->security_token();
5263 return reinterpret_cast<Isolate*
>(env->GetIsolate());
5274 global)->IsDetachedFrom(context->global_object())) {
5293 context->set_allow_code_gen_from_strings(
5294 allow ? isolate->
heap()->true_value() : isolate->
heap()->false_value());
5300 return !context->allow_code_gen_from_strings()->IsFalse();
5308 context->set_error_message_for_code_gen_from_strings(*error_handle);
5314 ON_BAILOUT(isolate,
"v8::ObjectTemplate::NewInstance()",
5316 LOG_API(isolate,
"ObjectTemplate::NewInstance");
5320 has_pending_exception = !i::Execution::InstantiateObject(
5329 ON_BAILOUT(isolate,
"v8::FunctionTemplate::GetFunction()",
5331 LOG_API(isolate,
"FunctionTemplate::GetFunction");
5335 has_pending_exception = !i::Execution::InstantiateFunction(
5343 ON_BAILOUT(i::Isolate::Current(),
"v8::FunctionTemplate::HasInstanceOf()",
5353 LOG_API(i_isolate,
"External::New");
5374 return i::StrLength(
reinterpret_cast<const char*
>(
string));
5380 while (
string[length] !=
'\0')
5391 return factory->InternalizeUtf8String(
string);
5393 return factory->NewStringFromUtf8(
string);
5402 return factory->InternalizeOneByteString(
string);
5404 return factory->NewStringFromOneByte(
string);
5413 return factory->InternalizeTwoByteString(
string);
5415 return factory->NewStringFromTwoByte(
string);
5419 template<
typename Char>
5421 const char* location,
5439 result->MarkAsUndetectable();
5452 "v8::String::NewFromUtf8()",
5453 "String::NewFromUtf8",
5461 const uint8_t* data,
5465 "v8::String::NewFromOneByte()",
5466 "String::NewFromOneByte",
5478 "v8::String::NewFromTwoByte()",
5479 "String::NewFromTwoByte",
5488 i::Isolate* isolate = left_string->GetIsolate();
5489 LOG_API(isolate,
"String::New(char)");
5494 left_string, right_string).ToHandleChecked();
5501 return isolate->
factory()->NewExternalStringFromTwoByte(resource);
5507 return isolate->
factory()->NewExternalStringFromOneByte(resource);
5515 LOG_API(i_isolate,
"String::NewExternal");
5520 has_pending_exception =
5531 if (i::StringShape(*obj).IsExternal()) {
5543 bool result = obj->MakeExternal(resource);
5545 DCHECK(!CanMakeExternal() || result);
5547 DCHECK(obj->IsExternalString());
5557 LOG_API(i_isolate,
"String::NewExternal");
5562 has_pending_exception =
5574 if (i::StringShape(*obj).IsExternal()) {
5586 bool result = obj->MakeExternal(resource);
5588 DCHECK(!CanMakeExternal() || result);
5590 DCHECK(obj->IsExternalString());
5598 if (!internal::FLAG_clever_optimizations)
return false;
5603 int size = obj->Size();
5605 i::StringShape shape(*obj);
5606 return !shape.IsExternal();
5612 LOG_API(i_isolate,
"Object::New");
5615 i_isolate->
factory()->NewJSObject(i_isolate->object_function());
5622 LOG_API(i_isolate,
"NumberObject::New");
5635 LOG_API(isolate,
"NumberObject::NumberValue");
5636 return jsvalue->value()->Number();
5642 LOG_API(isolate,
"BooleanObject::New");
5645 ? isolate->
heap()->true_value()
5646 : isolate->
heap()->false_value(),
5658 LOG_API(isolate,
"BooleanObject::BooleanValue");
5659 return jsvalue->value()->IsTrue();
5666 LOG_API(isolate,
"StringObject::New");
5678 LOG_API(isolate,
"StringObject::StringValue");
5686 LOG_API(i_isolate,
"SymbolObject::New");
5698 LOG_API(isolate,
"SymbolObject::SymbolValue");
5706 LOG_API(i_isolate,
"Date::New");
5707 if (std::isnan(time)) {
5714 has_pending_exception = !i::Execution::NewDate(
5715 i_isolate, time).ToHandle(&obj);
5725 LOG_API(isolate,
"Date::NumberValue");
5726 return jsdate->value()->Number();
5733 ON_BAILOUT(i_isolate,
"v8::Date::DateTimeConfigurationChangeNotification()",
5735 LOG_API(i_isolate,
"Date::DateTimeConfigurationChangeNotification");
5747 DCHECK_EQ(1, date_cache_version->length());
5748 CHECK(date_cache_version->get(0)->IsSmi());
5749 date_cache_version->set(
5751 i::Smi::FromInt(i::Smi::cast(date_cache_version->get(0))->value() + 1));
5757 uint8_t flags_buf[3];
5763 return isolate->
factory()->InternalizeOneByteString(
5771 LOG_API(isolate,
"RegExp::New");
5775 has_pending_exception = !i::Execution::NewJSRegExp(
5790 #define REGEXP_FLAG_ASSERT_EQ(api_flag, internal_flag) \
5791 STATIC_ASSERT(static_cast<int>(v8::RegExp::api_flag) == \
5792 static_cast<int>(i::JSRegExp::internal_flag))
5797 #undef REGEXP_FLAG_ASSERT_EQ
5807 LOG_API(i_isolate,
"Array::New");
5809 int real_length = length > 0 ? length : 0;
5812 i_isolate->
factory()->NewNumberFromInt(real_length);
5813 obj->set_length(*length_obj);
5821 if (length->IsSmi()) {
5822 return i::Smi::cast(length)->value();
5833 if (!self->HasFastObjectElements()) {
5836 i::FixedArray* elms = i::FixedArray::cast(self->elements());
5838 if (!paragon->IsJSObject()) {
5845 isolate->
factory()->CopyJSObject(paragon_handle);
5846 has_pending_exception = result.
is_null();
5854 if (!val->IsJSObject())
return false;
5857 LOG_API(isolate,
"IsPromise");
5862 has_pending_exception = !i::Execution::Call(
5864 isolate->is_promise(),
5865 isolate->
factory()->undefined_value(),
5867 false).ToHandle(&b);
5869 return b->BooleanValue();
5875 LOG_API(isolate,
"Promise::Resolver::New");
5879 has_pending_exception = !i::Execution::Call(
5881 isolate->promise_create(),
5882 isolate->
factory()->undefined_value(),
5884 false).ToHandle(&result);
5899 LOG_API(isolate,
"Promise::Resolver::Resolve");
5903 has_pending_exception = i::Execution::Call(
5905 isolate->promise_resolve(),
5906 isolate->
factory()->undefined_value(),
5916 LOG_API(isolate,
"Promise::Resolver::Reject");
5920 has_pending_exception = i::Execution::Call(
5922 isolate->promise_reject(),
5923 isolate->
factory()->undefined_value(),
5933 LOG_API(isolate,
"Promise::Chain");
5938 has_pending_exception = !i::Execution::Call(
5940 isolate->promise_chain(),
5943 false).ToHandle(&result);
5952 LOG_API(isolate,
"Promise::Catch");
5957 has_pending_exception = !i::Execution::Call(
5959 isolate->promise_catch(),
5962 false).ToHandle(&result);
5971 LOG_API(isolate,
"Promise::Then");
5976 has_pending_exception = !i::Execution::Call(
5978 isolate->promise_then(),
5981 false).ToHandle(&result);
5995 "v8::ArrayBuffer::Externalize",
5996 "ArrayBuffer already externalized");
5997 obj->set_is_external(
true);
5998 size_t byte_length =
static_cast<size_t>(obj->byte_length()->Number());
6000 contents.
data_ = obj->backing_store();
6010 "v8::ArrayBuffer::Neuter",
6011 "Only externalized ArrayBuffers can be neutered");
6012 LOG_API(obj->GetIsolate(),
"v8::ArrayBuffer::Neuter()");
6020 return static_cast<size_t>(obj->byte_length()->Number());
6026 LOG_API(i_isolate,
"v8::ArrayBuffer::New(size_t)");
6029 i_isolate->
factory()->NewJSArrayBuffer();
6036 size_t byte_length) {
6038 LOG_API(i_isolate,
"v8::ArrayBuffer::New(void*, size_t)");
6041 i_isolate->
factory()->NewJSArrayBuffer();
6050 if (obj->IsJSDataView()) {
6052 DCHECK(data_view->buffer()->IsJSArrayBuffer());
6053 buffer =
i::handle(i::JSArrayBuffer::cast(data_view->buffer()));
6055 DCHECK(obj->IsJSTypedArray());
6056 buffer = i::JSTypedArray::cast(*obj)->GetBuffer();
6064 return static_cast<size_t>(obj->byte_offset()->Number());
6070 return static_cast<size_t>(obj->byte_length()->Number());
6076 return static_cast<size_t>(obj->length()->Number());
6085 size_t byte_length) {
6086 DCHECK(byte_offset + byte_length <=
6087 static_cast<size_t>(buffer->byte_length()->Number()));
6089 obj->set_buffer(*buffer);
6091 obj->set_weak_next(buffer->weak_first_view());
6092 buffer->set_weak_first_view(*obj);
6095 isolate->
factory()->NewNumberFromSize(byte_offset);
6096 obj->set_byte_offset(*byte_offset_object);
6099 isolate->
factory()->NewNumberFromSize(byte_length);
6100 obj->set_byte_length(*byte_length_object);
6103 template<
typename ElementType,
6110 isolate->
factory()->NewJSTypedArray(array_type);
6113 DCHECK(byte_offset %
sizeof(ElementType) == 0);
6115 CHECK(length <= (std::numeric_limits<size_t>::max() /
sizeof(ElementType)));
6117 size_t byte_length = length *
sizeof(ElementType);
6119 isolate, obj, buffer, byte_offset, byte_length);
6122 isolate->
factory()->NewNumberFromSize(length);
6123 obj->set_length(*length_object);
6126 isolate->
factory()->NewExternalArray(
6127 static_cast<int>(length), array_type,
6128 static_cast<uint8_t*
>(buffer->backing_store()) + byte_offset);
6136 #define TYPED_ARRAY_NEW(Type, type, TYPE, ctype, size) \
6137 Local<Type##Array> Type##Array::New(Handle<ArrayBuffer> array_buffer, \
6138 size_t byte_offset, size_t length) { \
6139 i::Isolate* isolate = Utils::OpenHandle(*array_buffer)->GetIsolate(); \
6141 "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)"); \
6142 ENTER_V8(isolate); \
6143 if (!Utils::ApiCheck(length <= static_cast<size_t>(i::Smi::kMaxValue), \
6144 "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)", \
6145 "length exceeds max allowed value")) { \
6146 return Local<Type##Array>(); \
6148 i::Handle<i::JSTypedArray> obj = \
6149 NewTypedArray<ctype, v8::kExternal##Type##Array, \
6150 i::EXTERNAL_##TYPE##_ELEMENTS>( \
6151 isolate, array_buffer, byte_offset, length); \
6152 return Utils::ToLocal##Type##Array(obj); \
6157 #undef TYPED_ARRAY_NEW
6160 size_t byte_offset,
size_t byte_length) {
6163 LOG_API(isolate,
"v8::DataView::New(void*, size_t, size_t)");
6167 isolate, obj, buffer, byte_offset, byte_length);
6174 LOG_API(i_isolate,
"Symbol::New()");
6191 if (!symbol->IsSymbol()) {
6192 DCHECK(symbol->IsUndefined());
6193 symbol = isolate->
factory()->NewSymbol();
6238 LOG_API(i_isolate,
"Private::New()");
6257 if (!symbol->IsSymbol()) {
6258 DCHECK(symbol->IsUndefined());
6259 symbol = i_isolate->
factory()->NewPrivateSymbol();
6271 if (std::isnan(value)) {
6297 bool fits_into_int32_t = (value & (1 << 31)) == 0;
6298 if (fits_into_int32_t) {
6309 ON_BAILOUT(isolate,
"v8::V8::AddMessageListener()",
return false);
6324 ON_BAILOUT(isolate,
"v8::V8::RemoveMessageListeners()",
return);
6328 for (
int i = 0;
i < listeners.
length();
i++) {
6329 if (listeners.
get(
i)->IsUndefined())
continue;
6333 if (callback_obj->foreign_address() ==
FUNCTION_ADDR(that)) {
6334 listeners.
set(
i, isolate->
heap()->undefined_value());
6344 i::Isolate::Current()->SetCaptureStackTraceForUncaughtExceptions(
6359 reinterpret_cast<i::Isolate*
>(
this)->heap()->CollectAllGarbage(
6366 reinterpret_cast<i::Isolate*
>(
this)->heap_profiler();
6373 reinterpret_cast<i::Isolate*
>(
this)->cpu_profiler();
6374 return reinterpret_cast<CpuProfiler*
>(cpu_profiler);
6515 callback,
space, action);
6528 i_isolate->
stack_guard()->RequestTerminateExecution();
6534 reinterpret_cast<i::Isolate*
>(isolate) : i::Isolate::Current();
6541 i_isolate->
stack_guard()->ClearTerminateExecution();
6548 i_isolate->set_api_interrupt_callback(callback);
6549 i_isolate->set_api_interrupt_callback_data(data);
6557 i_isolate->set_api_interrupt_callback(
NULL);
6558 i_isolate->set_api_interrupt_callback_data(
NULL);
6563 CHECK(i::FLAG_expose_gc);
6564 if (type == kMinorGarbageCollection) {
6565 reinterpret_cast<i::Isolate*
>(
this)->heap()->CollectGarbage(
6569 DCHECK_EQ(kFullGarbageCollection, type);
6570 reinterpret_cast<i::Isolate*
>(
this)->heap()->CollectAllGarbage(
6579 return reinterpret_cast<Isolate*
>(isolate);
6612 "v8::Isolate::Dispose()",
6613 "Disposing the isolate that is entered by a thread.")) {
6635 : on_failure_(on_failure) {
6649 if (on_failure_ == CRASH_ON_FAILURE) {
6660 internal_assert_ =
reinterpret_cast<void*
>(
6662 internal_throws_ =
reinterpret_cast<void*
>(
6675 : isolate_(reinterpret_cast<
i::
Isolate*>(isolate)) {
6681 isolate_->handle_scope_implementer()->DecrementCallDepth();
6707 if (i::FLAG_log_timer_events)
return;
6709 isolate->set_event_logger(that);
6714 if (callback ==
NULL)
return;
6750 reinterpret_cast<i::Isolate*
>(
this)->set_autorun_microtasks(autorun);
6755 return reinterpret_cast<const i::Isolate*
>(
this)->autorun_microtasks();
6784 ->SetAddHistogramSampleFunction(callback);
6792 if (!i::FLAG_use_idle_notification)
return true;
6800 i::HistogramTimerScope idle_notification_scope(
6801 isolate->
counters()->gc_low_memory_notification());
6825 isolate->
stack_guard()->SetStackLimit(stack_limit);
6836 *length_in_bytes = 0;
6842 : str_(
NULL), length_(0) {
6853 str->WriteUtf8(
str_);
6863 : str_(
NULL), length_(0) {
6882 #define DEFINE_ERROR(NAME) \
6883 Local<Value> Exception::NAME(v8::Handle<v8::String> raw_message) { \
6884 i::Isolate* isolate = i::Isolate::Current(); \
6885 LOG_API(isolate, #NAME); \
6886 ON_BAILOUT(isolate, "v8::Exception::" #NAME "()", return Local<Value>()); \
6887 ENTER_V8(isolate); \
6890 i::HandleScope scope(isolate); \
6891 i::Handle<i::String> message = Utils::OpenHandle(*raw_message); \
6892 i::Handle<i::Object> result; \
6893 EXCEPTION_PREAMBLE(isolate); \
6894 i::MaybeHandle<i::Object> maybe_result = \
6895 isolate->factory()->New##NAME(message); \
6896 has_pending_exception = !maybe_result.ToHandle(&result); \
6898 EXCEPTION_BAILOUT_CHECK( \
6899 isolate, v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate))); \
6902 i::Handle<i::Object> result(error, isolate); \
6903 return Utils::ToLocal(result); \
6919 ON_BAILOUT(isolate,
"v8::Debug::SetDebugEventListener()",
return false);
6933 reinterpret_cast<i::Isolate*
>(isolate)->stack_guard()->RequestDebugBreak();
6939 internal_isolate->
stack_guard()->ClearDebugBreak();
6945 return internal_isolate->
stack_guard()->CheckDebugBreak();
6988 has_pending_exception = !maybe_result.ToHandle(&result);
7002 has_pending_exception = !isolate_debug->
Load();
7004 if (!has_pending_exception) {
7013 const int kArgc = 1;
7016 has_pending_exception = result.
IsEmpty();
7019 return scope.
Escape(result);
7024 i::Isolate::Current()->debug()->ProcessDebugMessages(
true);
7031 return Utils::ToLocal(i::Isolate::Current()->debug()->GetDebugContext());
7046 isolate->
factory()->InternalizeUtf8String(entry->
name());
7048 return ToApiHandle<String>(
name);
7053 name).ToHandleChecked();
7054 return ToApiHandle<String>(cons);
7069 return ToApiHandle<String>(isolate->
factory()->InternalizeUtf8String(
7075 return reinterpret_cast<const i::ProfileNode*
>(
this)->entry()->line_number();
7081 entry()->column_number();
7092 return reinterpret_cast<const i::ProfileNode*
>(
this)->self_ticks();
7097 return reinterpret_cast<const i::ProfileNode*
>(
this)->entry()->GetCallUid();
7107 return reinterpret_cast<const i::ProfileNode*
>(
this)->children()->length();
7113 reinterpret_cast<const i::ProfileNode*
>(
this)->children()->at(index);
7129 return ToApiHandle<String>(isolate->
factory()->InternalizeUtf8String(
7155 return (profile->
start_time() - base::TimeTicks()).InMicroseconds();
7161 return (profile->
end_time() - base::TimeTicks()).InMicroseconds();
7166 return reinterpret_cast<const i::CpuProfile*
>(
this)->samples_count();
7172 return reinterpret_cast<i::CpuProfiler*
>(
this)->set_sampling_interval(
7173 base::TimeDelta::FromMicroseconds(us));
7183 void CpuProfiler::StartCpuProfiling(
Handle<String> title,
bool record_samples) {
7184 StartProfiling(title, record_samples);
7196 return StopProfiling(title);
7206 isolate->set_current_vm_state(
i::IDLE);
7207 }
else if (state ==
i::IDLE) {
7214 return const_cast<i::HeapGraphEdge*
>(
7215 reinterpret_cast<const i::HeapGraphEdge*
>(edge));
7227 switch (edge->type()) {
7228 case i::HeapGraphEdge::kContextVariable:
7229 case i::HeapGraphEdge::kInternal:
7230 case i::HeapGraphEdge::kProperty:
7231 case i::HeapGraphEdge::kShortcut:
7233 return ToApiHandle<String>(
7234 isolate->
factory()->InternalizeUtf8String(edge->name()));
7235 case i::HeapGraphEdge::kElement:
7236 case i::HeapGraphEdge::kHidden:
7237 return ToApiHandle<Number>(
7238 isolate->
factory()->NewNumberFromInt(edge->index()));
7246 const i::HeapEntry* from =
ToInternal(
this)->from();
7258 return const_cast<i::HeapEntry*
>(
7259 reinterpret_cast<const i::HeapEntry*
>(entry));
7270 return ToApiHandle<String>(
7280 int HeapGraphNode::GetSelfSize()
const {
7283 return static_cast<int>(
size);
7293 return ToInternal(
this)->children().length();
7327 return ToApiHandle<String>(
7355 return ToInternal(
this)->max_snapshot_js_object_id();
7362 "v8::HeapSnapshot::Serialize",
7363 "Unknown serialization format");
7365 "v8::HeapSnapshot::Serialize",
7366 "Invalid stream chunk size");
7385 return reinterpret_cast<i::HeapProfiler*
>(
this)->GetSnapshotObjectId(obj);
7424 return reinterpret_cast<i::HeapProfiler*
>(
this)->PushHeapObjectsStats(stream);
7434 WrapperInfoCallback callback) {
7435 reinterpret_cast<i::HeapProfiler*
>(
this)->DefineWrapperClass(class_id,
7442 GetMemorySizeUsedByProfiler();
7448 reinterpret_cast<i::HeapProfiler*
>(
this)->SetRetainedObjectInfo(
id, info);
7462 if (internal::FLAG_stress_runs != 0)
return internal::FLAG_stress_runs;
7479 static const char* kLazyOptimizations =
7480 "--prepare-always-opt "
7481 "--max-inlined-source-size=999999 "
7482 "--max-inlined-nodes=999999 "
7483 "--max-inlined-nodes-cumulative=999999 "
7485 static const char* kForcedOptimizations =
"--always-opt";
7489 static const char* kDeoptEvery13Times =
"--deopt-every-n-times=13";
7491 internal::FLAG_deopt_every_n_times == 0) {
7498 if (run == GetStressRuns() - 1) {
7504 if (run == GetStressRuns() - 1) {
7506 }
else if (run != GetStressRuns() - 2) {
7521 namespace internal {
7524 void HandleScopeImplementer::FreeThreadResources() {
7529 char* HandleScopeImplementer::ArchiveThread(
char* storage) {
7531 handle_scope_data_ = *current;
7532 MemCopy(storage,
this,
sizeof(*
this));
7534 ResetAfterArchive();
7546 char* HandleScopeImplementer::RestoreThread(
char* storage) {
7547 MemCopy(
this, storage,
sizeof(*
this));
7548 *isolate_->handle_scope_data() = handle_scope_data_;
7555 bool found_block_before_deferred =
false;
7558 for (
int i = blocks()->length() - 2;
i >= 0; --
i) {
7559 Object** block = blocks()->at(
i);
7560 if (last_handle_before_deferred_block_ !=
NULL &&
7562 (last_handle_before_deferred_block_ >= block)) {
7563 v->VisitPointers(block, last_handle_before_deferred_block_);
7564 DCHECK(!found_block_before_deferred);
7566 found_block_before_deferred =
true;
7573 DCHECK(last_handle_before_deferred_block_ ==
NULL ||
7574 found_block_before_deferred);
7577 if (!blocks()->is_empty()) {
7578 v->VisitPointers(blocks()->last(), handle_scope_data_.next);
7581 List<Context*>* context_lists[2] = { &saved_contexts_, &entered_contexts_};
7582 for (
unsigned i = 0;
i <
arraysize(context_lists);
i++) {
7583 if (context_lists[
i]->is_empty())
continue;
7585 v->VisitPointers(start, start + context_lists[
i]->length());
7592 handle_scope_data_ = *current;
7609 while (!blocks_.is_empty()) {
7610 Object** block_start = blocks_.last();
7613 DCHECK(prev_limit == block_limit ||
7614 !(block_start <= prev_limit && prev_limit <= block_limit));
7615 if (prev_limit == block_limit)
break;
7616 deferred->
blocks_.Add(blocks_.last());
7617 blocks_.RemoveLast();
7624 DCHECK(prev_limit ==
NULL || !blocks_.is_empty());
7626 DCHECK(!blocks_.is_empty() && prev_limit !=
NULL);
7627 DCHECK(last_handle_before_deferred_block_ !=
NULL);
7628 last_handle_before_deferred_block_ =
NULL;
7633 void HandleScopeImplementer::BeginDeferredScope() {
7634 DCHECK(last_handle_before_deferred_block_ ==
NULL);
7639 DeferredHandles::~DeferredHandles() {
7640 isolate_->UnlinkDeferredHandles(
this);
7642 for (
int i = 0;
i < blocks_.length();
i++) {
7643 #ifdef ENABLE_HANDLE_ZAPPING
7646 isolate_->handle_scope_implementer()->ReturnBlock(blocks_[
i]);
7652 DCHECK(!blocks_.is_empty());
7654 DCHECK((first_block_limit_ >= blocks_.first()) &&
7657 v->VisitPointers(blocks_.first(), first_block_limit_);
7659 for (
int i = 1;
i < blocks_.length();
i++) {
7671 Address getter_address =
reinterpret_cast<Address>(
reinterpret_cast<intptr_t
>(
7674 ExternalCallbackScope call_scope(isolate, getter_address);
7675 getter(property, info);
7683 reinterpret_cast<Address>(
reinterpret_cast<intptr_t
>(callback));
7685 ExternalCallbackScope call_scope(isolate, callback_address);
#define ON_BAILOUT(isolate, location, code)
#define INSTANCE_TYPE_TO_ARRAY_TYPE(Type, type, TYPE, ctype, size)
#define LOG_API(isolate, expr)
#define EXCEPTION_BAILOUT_CHECK(isolate, value)
#define SET_FIELD_WRAPPED(obj, setter, cdata)
#define VALUE_IS_SPECIFIC_TYPE(Type, Class)
#define VALUE_IS_TYPED_ARRAY(Type, typeName, TYPE, ctype, size)
#define ENTER_V8(isolate)
#define CHECK_TYPED_ARRAY_CAST(Type, typeName, TYPE, ctype, size)
#define TYPED_ARRAY_NEW(Type, type, TYPE, ctype, size)
#define ARRAY_TYPE_TO_ELEMENTS_KIND(Type, type, TYPE, ctype, size)
#define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value)
#define EXCEPTION_PREAMBLE(isolate)
#define DEFINE_ERROR(NAME)
static const int kNoPreviousCharacter
static bool IsTrailSurrogate(int code)
static bool IsLeadSurrogate(int code)
static uchar Length(uchar chr, int previous)
static const unsigned kMax16BitCodeUnitSize
static const unsigned kBytesSavedByCombiningSurrogates
static Local< AccessorSignature > New(Isolate *isolate, Handle< FunctionTemplate > receiver=Handle< FunctionTemplate >())
An interface for reporting progress and controlling long-running activities.
Local< ArrayBuffer > Buffer()
Returns underlying ArrayBuffer.
size_t ByteOffset()
Byte offset in |Buffer|.
size_t ByteLength()
Size of a view in bytes.
static void CheckCast(Value *obj)
Allocator that V8 uses to allocate |ArrayBuffer|'s memory.
The contents of an |ArrayBuffer|.
Contents Externalize()
Make this ArrayBuffer external.
bool IsExternal() const
Returns true if ArrayBuffer is extrenalized, that is, does not own its memory block.
static Local< ArrayBuffer > New(Isolate *isolate, size_t byte_length)
Create a new ArrayBuffer.
void Neuter()
Neuters this ArrayBuffer and all its views (typed arrays).
static void CheckCast(Value *obj)
size_t ByteLength() const
Data length in bytes.
Local< Object > CloneElementAt(uint32_t index)
Clones an element at index |index|.
static Local< Array > New(Isolate *isolate, int length=0)
Creates a JavaScript array with the given length.
static void CheckCast(Value *obj)
static void CheckCast(v8::Value *obj)
static Local< Value > New(bool value)
DISALLOW_COPY_AND_ASSIGN(ContainsOnlyOneByteHelper)
void VisitOneByteString(const uint8_t *chars, int length)
ContainsOnlyOneByteHelper()
void VisitTwoByteString(const uint16_t *chars, int length)
bool CheckCons(i::ConsString *cons_string)
bool Check(i::String *string)
A sandboxed execution context with its own set of built-in objects and functions.
void SetSecurityToken(Handle< Value > token)
Sets the security token for the context.
void Exit()
Exit this context.
static Local< Context > New(Isolate *isolate, ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
Creates a new context and returns a handle to the newly allocated context.
void SetAlignedPointerInEmbedderData(int index, void *value)
Sets a 2-byte-aligned native pointer in the embedder data with the given index, growing the data as n...
void * SlowGetAlignedPointerFromEmbedderData(int index)
Local< Value > SlowGetEmbedderData(int index)
void Enter()
Enter this context.
void SetErrorMessageForCodeGenerationFromStrings(Handle< String > message)
Sets the error description for the exception that is thrown when code generation from strings is not ...
void AllowCodeGenerationFromStrings(bool allow)
Control whether code generation from strings is allowed.
Handle< Value > GetSecurityToken()
Returns the security token of this context.
void DetachGlobal()
Detaches the global object from its context before the global object can be reused to create a new co...
v8::Isolate * GetIsolate()
Returns an isolate associated with a current context.
Local< Value > GetEmbedderData(int index)
Gets the embedder data with the given index, which must have been set by a previous call to SetEmbedd...
void * GetAlignedPointerFromEmbedderData(int index)
Gets a 2-byte-aligned native pointer from the embedder data with the given index, which must have bee...
Local< Object > Global()
Returns the global proxy object.
bool IsCodeGenerationFromStringsAllowed()
Returns true if code generation from strings is allowed for the context.
void UseDefaultSecurityToken()
Restores the security token to the default value.
void SetEmbedderData(int index, Handle< Value > value)
Sets the embedder data with the given index, growing the data as needed.
CpuProfileNode represents a node in a call graph.
const CpuProfileNode * GetChild(int index) const
Retrieves a child node by index.
unsigned GetHitCount() const
Returns the count of samples where the function was currently executing.
int GetLineNumber() const
Returns the number, 1-based, of the line where the function originates.
unsigned GetNodeId() const
Returns id of the node.
Handle< String > GetFunctionName() const
Returns function name (empty string for anonymous functions.)
unsigned GetCallUid() const
Returns function entry UID.
int GetColumnNumber() const
Returns 1-based number of the column where the function originates.
Handle< String > GetScriptResourceName() const
Returns resource name for script from where the function originates.
const char * GetBailoutReason() const
Returns bailout reason for the function if the optimization was disabled for it.
int GetScriptId() const
Returns id of the script where function is located.
int GetChildrenCount() const
Returns child nodes count of the node.
CpuProfile contains a CPU profile in a form of top-down call tree (from main() down to functions that...
const CpuProfileNode * GetTopDownRoot() const
Returns the root node of the top down call tree.
int GetSamplesCount() const
Returns number of samples recorded.
int64_t GetEndTime() const
Returns time when the profile recording was stopped (in microseconds) since some unspecified starting...
void Delete()
Deletes the profile and removes it from CpuProfiler's list.
Handle< String > GetTitle() const
Returns CPU profile title.
const CpuProfileNode * GetSample(int index) const
Returns profile node corresponding to the top frame the sample at the given index.
int64_t GetSampleTimestamp(int index) const
Returns the timestamp of the sample.
int64_t GetStartTime() const
Returns time when the profile recording was started (in microseconds) since some unspecified starting...
Interface for controlling CPU profiling.
void StartProfiling(Handle< String > title, bool record_samples=false)
Starts collecting CPU profile.
void SetIdle(bool is_idle)
Tells the profiler whether the embedder is idle.
CpuProfile * StopProfiling(Handle< String > title)
Stops collecting CPU profile with a given title and returns it.
void SetSamplingInterval(int us)
Changes default CPU profiler sampling interval to the specified number of microseconds.
static Local< DataView > New(Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
static void CheckCast(Value *obj)
The superclass of values and API object templates.
static void CheckCast(v8::Value *obj)
double ValueOf() const
A specialization of Value::NumberValue that is more efficient because we know the structure of this o...
static void DateTimeConfigurationChangeNotification(Isolate *isolate)
Notification that the embedder has changed the time zone, daylight savings time, or other date / time...
static Local< Value > New(Isolate *isolate, double time)
A client object passed to the v8 debugger whose ownership will be taken by it.
static void DebugBreak(Isolate *isolate)
static void CancelDebugBreak(Isolate *isolate)
static Local< Value > GetMirror(v8::Handle< v8::Value > obj)
Returns a mirror object for the given object.
static bool SetDebugEventListener(EventCallback that, Handle< Value > data=Handle< Value >())
static void SetLiveEditEnabled(Isolate *isolate, bool enable)
Enable/disable LiveEdit functionality for the given Isolate (default Isolate if not provided).
static void SetMessageHandler(MessageHandler handler)
void(* MessageHandler)(const Message &message)
Debug message callback function.
static void SendCommand(Isolate *isolate, const uint16_t *command, int length, ClientData *client_data=NULL)
static bool CheckDebugBreak(Isolate *isolate)
static void ProcessDebugMessages()
Makes V8 process all pending debug messages.
static Local< Value > Call(v8::Handle< v8::Function > fun, Handle< Value > data=Handle< Value >())
Run a JavaScript function in the debugger.
static Local< Context > GetDebugContext()
Debugger is running in its own context which is entered while debugger messages are being dispatched.
static void DebugBreakForCommand(Isolate *isolate, ClientData *data)
A HandleScope which first allocates a handle in the current scope which will be later filled with the...
Local< T > Escape(Local< T > value)
Pushes the value into the previous scope and returns a handle to it.
internal::Object ** escape_slot_
EscapableHandleScope(Isolate *isolate)
A container for extension names.
Extension(const char *name, const char *source=0, int dep_count=0, const char **deps=0, int source_length=-1)
const String::ExternalOneByteStringResource * source() const
Interface for iterating through all external resources in the heap.
static Local< External > New(Isolate *isolate, void *value)
static void CheckCast(v8::Value *obj)
The argument information given to function call callbacks.
Isolate * GetIsolate() const
Local< ObjectTemplate > PrototypeTemplate()
A PrototypeTemplate is the template used to create the prototype object of the function created by th...
void SetClassName(Handle< String > name)
Set the class name of the FunctionTemplate.
void Inherit(Handle< FunctionTemplate > parent)
Causes the function template to inherit from a parent function template.
static Local< FunctionTemplate > New(Isolate *isolate, FunctionCallback callback=0, Handle< Value > data=Handle< Value >(), Handle< Signature > signature=Handle< Signature >(), int length=0)
Creates a function template.
void SetCallHandler(FunctionCallback callback, Handle< Value > data=Handle< Value >())
Set the call-handler callback for a FunctionTemplate.
void RemovePrototype()
Removes the prototype property from functions created from this FunctionTemplate.
void SetLength(int length)
Set the predefined length property for the FunctionTemplate.
void ReadOnlyPrototype()
Sets the ReadOnly flag in the attributes of the 'prototype' property of functions created from this F...
bool HasInstance(Handle< Value > object)
Returns true if the given object is an instance of this function template.
Local< ObjectTemplate > InstanceTemplate()
Get the InstanceTemplate.
Local< Function > GetFunction()
Returns the unique function instance in the current execution context.
void SetHiddenPrototype(bool value)
Determines whether the proto accessor ignores instances of the function template.
Local< Object > NewInstance() const
bool IsBuiltin() const
Tells whether this function is builtin.
int ScriptId() const
Returns scriptId.
void SetName(Handle< String > name)
int GetScriptLineNumber() const
Returns zero based line number of function body and kLineOffsetNotFound if no information available.
Handle< Value > GetName() const
ScriptOrigin GetScriptOrigin() const
Handle< Value > GetInferredName() const
Name inferred from variable or property assignment of this function.
int GetScriptColumnNumber() const
Returns zero based column number of function body and kLineOffsetNotFound if no information available...
static void CheckCast(Value *obj)
Local< Value > GetBoundFunction() const
Returns the original function if this function is bound, else returns v8::Undefined.
static const int kLineOffsetNotFound
static Local< Function > New(Isolate *isolate, FunctionCallback callback, Local< Value > data=Local< Value >(), int length=0)
Create a function in the current execution context for a given FunctionCallback.
Local< Value > Call(Handle< Value > recv, int argc, Handle< Value > argv[])
Handle< Value > GetDisplayName() const
User-defined name assigned to the "displayName" property of this function.
A stack-allocated class that governs a number of local handles.
internal::Isolate * isolate_
internal::Object ** prev_next_
void Initialize(Isolate *isolate)
static internal::Object ** CreateHandle(internal::Isolate *isolate, internal::Object *value)
internal::Object ** prev_limit_
static int NumberOfHandles(Isolate *isolate)
Counts the number of allocated handles.
Isolate * GetIsolate() const
An object reference managed by the v8 garbage collector.
bool IsEmpty() const
Returns true if the handle is empty.
HeapSnapshotEdge represents a directed connection between heap graph nodes: from retainers to retaine...
const HeapGraphNode * GetToNode() const
Returns destination node.
const HeapGraphNode * GetFromNode() const
Returns origin node.
Type GetType() const
Returns edge type (see HeapGraphEdge::Type).
Handle< Value > GetName() const
Returns edge name.
HeapGraphNode represents a node in a heap graph.
Handle< String > GetName() const
Returns node name.
SnapshotObjectId GetId() const
Returns node id.
Type GetType() const
Returns node type (see HeapGraphNode::Type).
const HeapGraphEdge * GetChild(int index) const
Retrieves a child by index.
size_t GetShallowSize() const
Returns node's own size, in bytes.
int GetChildrenCount() const
Returns child nodes count of the node.
Callback interface for retrieving user friendly names of global objects.
Interface for controlling heap profiling.
void StartTrackingHeapObjects(bool track_allocations=false)
Starts tracking of heap objects population statistics.
SnapshotObjectId GetObjectId(Handle< Value > value)
Returns SnapshotObjectId for a heap object referenced by |value| if it has been seen by the heap prof...
int GetSnapshotCount()
Returns the number of snapshots taken.
void DeleteAllHeapSnapshots()
Deletes all snapshots taken.
void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo *info)
Sets a RetainedObjectInfo for an object group (see V8::SetObjectGroupId).
const HeapSnapshot * TakeHeapSnapshot(Handle< String > title, ActivityControl *control=NULL, ObjectNameResolver *global_object_name_resolver=NULL)
Takes a heap snapshot and returns it.
size_t GetProfilerMemorySize()
Returns memory used for profiler internal data and snapshots.
void SetWrapperClassInfoProvider(uint16_t class_id, WrapperInfoCallback callback)
Binds a callback to embedder's class ID.
SnapshotObjectId GetHeapStats(OutputStream *stream)
Adds a new time interval entry to the aggregated statistics array.
void ClearObjectIds()
Clears internal map from SnapshotObjectId to heap object.
const HeapSnapshot * GetHeapSnapshot(int index)
Returns a snapshot by index.
void StopTrackingHeapObjects()
Stops tracking of heap objects population statistics, cleans up all collected data.
Handle< Value > FindObjectById(SnapshotObjectId id)
Returns heap object with given SnapshotObjectId if the object is alive, otherwise empty handle is ret...
HeapSnapshots record the state of the JS heap at some moment.
const HeapGraphNode * GetNodeById(SnapshotObjectId id) const
Returns a node by its id.
int GetNodesCount() const
Returns total nodes count in the snapshot.
Handle< String > GetTitle() const
Returns heap snapshot title.
unsigned GetUid() const
Returns heap snapshot UID (assigned by the profiler.)
const HeapGraphNode * GetRoot() const
Returns the root node of the heap graph.
SnapshotObjectId GetMaxSnapshotJSObjectId() const
Returns a max seen JS object Id.
const HeapGraphNode * GetNode(int index) const
Returns a node by index.
void Delete()
Deletes the snapshot and removes it from HeapProfiler's list.
void Serialize(OutputStream *stream, SerializationFormat format) const
Prepare a serialized representation of the snapshot.
Collection of V8 heap information.
size_t total_heap_size_executable_
size_t total_physical_size_
static Local< Integer > New(Isolate *isolate, int32_t value)
static void CheckCast(v8::Value *obj)
static Local< Integer > NewFromUnsigned(Isolate *isolate, uint32_t value)
~AllowJavascriptExecutionScope()
AllowJavascriptExecutionScope(Isolate *isolate)
~DisallowJavascriptExecutionScope()
DisallowJavascriptExecutionScope(Isolate *isolate, OnFailure on_failure)
Stack-allocated class which sets the isolate for all operations executed within a local scope.
internal::Isolate * isolate_
~SuppressMicrotaskExecutionScope()
SuppressMicrotaskExecutionScope(Isolate *isolate)
Isolate represents an isolated instance of the V8 engine.
void ClearInterrupt()
Clear interrupt request created by |RequestInterrupt|.
void SetReference(const Persistent< T > &parent, const Persistent< S > &child)
Allows the host application to declare implicit references from an object to another object.
Local< Context > GetEnteredContext()
Returns the last entered context.
int ContextDisposedNotification()
Optional notification that a context has been disposed.
void SetReferenceFromGroup(UniqueId id, const Persistent< T > &child)
Allows the host application to declare implicit references from an object group to an object.
Local< Context > GetCallingContext()
Returns the context of the calling JavaScript code.
HeapProfiler * GetHeapProfiler()
Returns heap profiler for this isolate.
void Dispose()
Disposes the isolate.
void RemoveGCEpilogueCallback(GCEpilogueCallback callback)
This function removes callback which was installed by AddGCEpilogueCallback function.
void SetEventLogger(LogEventCallback that)
Set the callback to invoke for logging event.
CpuProfiler * GetCpuProfiler()
Returns CPU profiler for this isolate.
void EnqueueMicrotask(Handle< Function > microtask)
Experimental: Enqueues the callback to the Microtask Work Queue.
void(* GCEpilogueCallback)(Isolate *isolate, GCType type, GCCallbackFlags flags)
void GetCodeRange(void **start, size_t *length_in_bytes)
Returns a memory range that can potentially contain jitted code.
void RemoveCallCompletedCallback(CallCompletedCallback callback)
Removes callback that was installed by AddCallCompletedCallback.
void RequestGarbageCollectionForTesting(GarbageCollectionType type)
Request garbage collection in this Isolate.
GarbageCollectionType
Types of garbage collections that can be requested via RequestGarbageCollectionForTesting.
void Exit()
Exits this isolate by restoring the previously entered one in the current thread.
bool WillAutorunMicrotasks() const
Experimental: Returns whether the Microtask Work Queue is automatically run when the script call dept...
void SetAutorunMicrotasks(bool autorun)
Experimental: Controls whether the Microtask Work Queue is automatically run when the script call dep...
void SetJitCodeEventHandler(JitCodeEventOptions options, JitCodeEventHandler event_handler)
Allows the host application to provide the address of a function that is notified each time code is a...
void(* UseCounterCallback)(Isolate *isolate, UseCounterFeature feature)
void RemoveGCPrologueCallback(GCPrologueCallback callback)
This function removes callback which was installed by AddGCPrologueCallback function.
void CollectAllGarbage(const char *gc_reason)
static Isolate * New(const CreateParams ¶ms=CreateParams())
Creates a new isolate.
void AddCallCompletedCallback(CallCompletedCallback callback)
Adds a callback to notify the host application when a script finished running.
void RequestInterrupt(InterruptCallback callback, void *data)
Request V8 to interrupt long running JavaScript code and invoke the given |callback| passing the give...
void LowMemoryNotification()
Optional notification that the system is running low on memory.
void(* GCPrologueCallback)(Isolate *isolate, GCType type, GCCallbackFlags flags)
void SetCounterFunction(CounterLookupCallback)
Enables the host application to provide a mechanism for recording statistics counters.
void RunMicrotasks()
Experimental: Runs the Microtask Work Queue until empty Any exceptions thrown by microtask callbacks ...
void AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type_filter=kGCTypeAll)
Enables the host application to receive a notification before a garbage collection.
Local< Value > ThrowException(Local< Value > exception)
Schedules an exception to be thrown when returning to JavaScript.
void SetUseCounterCallback(UseCounterCallback callback)
Sets a callback for counting the number of times a feature of V8 is used.
void GetHeapStatistics(HeapStatistics *heap_statistics)
Get statistics about the heap memory usage.
void AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type_filter=kGCTypeAll)
Enables the host application to receive a notification after a garbage collection.
void SetStackLimit(uintptr_t stack_limit)
Modifies the stack limit for this Isolate.
void SetObjectGroupId(const Persistent< T > &object, UniqueId id)
Allows the host application to group objects together.
void SetAddHistogramSampleFunction(AddHistogramSampleCallback)
bool IdleNotification(int idle_time_in_ms)
Optional notification that the embedder is idle.
void Enter()
Methods below this point require holding a lock (using Locker) in a multi-threaded environment.
Local< Context > GetCurrentContext()
Returns the context that is on the top of the stack.
bool InContext()
Returns true if this isolate has a current context.
void SetCreateHistogramFunction(CreateHistogramCallback)
Enables the host application to provide a mechanism for recording histograms.
static Isolate * GetCurrent()
Returns the entered isolate for the current thread or NULL in case there is no current isolate.
static Local< Value > Parse(Local< String > json_string)
Tries to parse the string |json_string| and returns it as value if successful.
A light-weight stack-allocated object handle.
static Local< T > Cast(Local< S > that)
static Local< T > New(Isolate *isolate, Handle< T > that)
Create a local handle for the content of another handle.
static bool IsActive()
Returns whether v8::Locker is being used by this V8 instance.
Local< String > GetSourceLine() const
ScriptOrigin GetScriptOrigin() const
Returns the origin for the script from where the function causing the error originates.
static const int kNoLineNumberInfo
int GetStartColumn() const
Returns the index within the line of the first character where the error occurred.
static const int kNoScriptIdInfo
Local< String > Get() const
bool IsSharedCrossOrigin() const
Passes on the value set by the embedder when it fed the script from which this Message was generated ...
Handle< StackTrace > GetStackTrace() const
Exception stack trace.
int GetStartPosition() const
Returns the index within the script of the first character where the error occurred.
static const int kNoColumnInfo
int GetEndPosition() const
Returns the index within the script of the last character where the error occurred.
static void PrintCurrentStackTrace(Isolate *isolate, FILE *out)
int GetEndColumn() const
Returns the index within the line of the last character where the error occurred.
int GetLineNumber() const
Returns the number, 1-based, of the line where the error occurred.
Handle< Value > GetScriptResourceName() const
Returns the resource name for the script from where the function causing the error originates.
A superclass for symbols and strings.
static void CheckCast(v8::Value *obj)
void add(v8::internal::Handle< v8::internal::Object > value)
void set(int index, v8::internal::Object *value)
NeanderArray(v8::internal::Isolate *isolate)
v8::internal::Object * get(int index)
v8::internal::Handle< v8::internal::JSObject > value()
v8::internal::Handle< v8::internal::JSObject > value_
v8::internal::Object * get(int index)
v8::internal::Handle< v8::internal::JSObject > value()
NeanderObject(v8::internal::Isolate *isolate, int size)
void set(int index, v8::internal::Object *value)
static void CheckCast(v8::Value *obj)
static Local< Value > New(Isolate *isolate, double value)
static void CheckCast(v8::Value *obj)
static Local< Number > New(Isolate *isolate, double value)
static Local< RawOperationDescriptor > NewInternalFieldDereference(Isolate *isolate, int internal_field)
An ObjectTemplate is used to create objects at runtime.
Local< Object > NewInstance()
Creates a new instance of this template.
static Local< ObjectTemplate > New()
int InternalFieldCount()
Gets the number of internal fields for objects generated from this template.
void SetIndexedPropertyHandler(IndexedPropertyGetterCallback getter, IndexedPropertySetterCallback setter=0, IndexedPropertyQueryCallback query=0, IndexedPropertyDeleterCallback deleter=0, IndexedPropertyEnumeratorCallback enumerator=0, Handle< Value > data=Handle< Value >())
Sets an indexed property handler on the object template.
void SetCallAsFunctionHandler(FunctionCallback callback, Handle< Value > data=Handle< Value >())
Sets the callback to be used when calling instances created from this template as a function.
void MarkAsUndetectable()
Mark object instances of the template as undetectable.
void SetInternalFieldCount(int value)
Sets the number of internal fields for objects generated from this template.
void SetNamedPropertyHandler(NamedPropertyGetterCallback getter, NamedPropertySetterCallback setter=0, NamedPropertyQueryCallback query=0, NamedPropertyDeleterCallback deleter=0, NamedPropertyEnumeratorCallback enumerator=0, Handle< Value > data=Handle< Value >())
Sets a named property handler on the object template.
void SetAccessCheckCallbacks(NamedSecurityCallback named_handler, IndexedSecurityCallback indexed_handler, Handle< Value > data=Handle< Value >(), bool turned_on_by_default=true)
Sets access check callbacks on the object template.
void SetAccessor(Handle< String > name, AccessorGetterCallback getter, AccessorSetterCallback setter=0, Handle< Value > data=Handle< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None, Handle< AccessorSignature > signature=Handle< AccessorSignature >())
Sets an accessor on the object template.
A JavaScript object (ECMA-262, 4.3.3)
ExternalArrayType GetIndexedPropertiesExternalArrayDataType()
Local< Value > GetPrivate(Handle< Private > key)
void * SlowGetAlignedPointerFromInternalField(int index)
void SetAlignedPointerInInternalField(int index, void *value)
Sets a 2-byte-aligned native pointer in an internal field.
Local< Value > Get(Handle< Value > key)
Local< Value > CallAsFunction(Handle< Value > recv, int argc, Handle< Value > argv[])
Call an Object as a function if a callback is set by the ObjectTemplate::SetCallAsFunctionHandler met...
bool HasNamedLookupInterceptor()
Tests for a named lookup interceptor.
bool SetHiddenValue(Handle< String > key, Handle< Value > value)
Access hidden properties on JavaScript objects.
bool IsCallable()
Checks whether a callback is set by the ObjectTemplate::SetCallAsFunctionHandler method.
bool HasIndexedLookupInterceptor()
Tests for an index lookup interceptor.
bool HasRealIndexedProperty(uint32_t index)
static Local< Object > New(Isolate *isolate)
bool Has(Handle< Value > key)
void SetInternalField(int index, Handle< Value > value)
Sets the value in an internal field.
bool IsDirty()
Returns true if this is an instance of an api function (one created from a function created from a fu...
bool HasOwnProperty(Handle< String > key)
PropertyAttribute GetPropertyAttributes(Handle< Value > key)
Gets the property attributes of a property which can be None or any combination of ReadOnly,...
Local< Value > GetHiddenValue(Handle< String > key)
bool DeletePrivate(Handle< Private > key)
void SetAccessorProperty(Local< Name > name, Local< Function > getter, Handle< Function > setter=Handle< Function >(), PropertyAttribute attribute=None, AccessControl settings=DEFAULT)
void SetIndexedPropertiesToExternalArrayData(void *data, ExternalArrayType array_type, int number_of_elements)
Set the backing store of the indexed properties to be managed by the embedding layer.
Local< Value > CallAsConstructor(int argc, Handle< Value > argv[])
Call an Object as a constructor if a callback is set by the ObjectTemplate::SetCallAsFunctionHandler ...
Local< Object > FindInstanceInPrototypeChain(Handle< FunctionTemplate > tmpl)
Finds an instance of the given function template in the prototype chain.
bool HasPrivate(Handle< Private > key)
Functionality for private properties.
bool HasRealNamedProperty(Handle< String > key)
Local< Value > GetPrototype()
Get the prototype object.
bool Delete(Handle< Value > key)
Local< Object > Clone()
Clone this object with a fast but shallow copy.
void SetIndexedPropertiesToPixelData(uint8_t *data, int length)
Set the backing store of the indexed properties to be managed by the embedding layer.
void TurnOnAccessCheck()
Turns on access check on the object if the object is an instance of a template that has access check ...
Local< Value > SlowGetInternalField(int index)
Local< Array > GetOwnPropertyNames()
This function has the same functionality as GetPropertyNames but the returned array doesn't contain t...
bool SetAccessor(Handle< String > name, AccessorGetterCallback getter, AccessorSetterCallback setter=0, Handle< Value > data=Handle< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None)
bool ForceDelete(Handle< Value > key)
uint8_t * GetIndexedPropertiesPixelData()
bool HasIndexedPropertiesInPixelData()
Local< String > ObjectProtoToString()
Call builtin Object.prototype.toString on this object.
int GetIndexedPropertiesExternalArrayDataLength()
bool HasRealNamedCallbackProperty(Handle< String > key)
bool ForceSet(Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None)
int InternalFieldCount()
Gets the number of internal fields for this Object.
bool DeleteHiddenValue(Handle< String > key)
bool SetPrototype(Handle< Value > prototype)
Set the prototype object.
Local< Value > GetOwnPropertyDescriptor(Local< String > key)
Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3.
bool SetPrivate(Handle< Private > key, Handle< Value > value)
int GetIdentityHash()
Returns the identity hash for this object.
int GetIndexedPropertiesPixelDataLength()
Local< Context > CreationContext()
Returns the context in which the object was created.
Local< Value > GetRealNamedPropertyInPrototypeChain(Handle< String > key)
If result.IsEmpty() no real property was located in the prototype chain.
bool SetDeclaredAccessor(Local< Name > name, Local< DeclaredAccessorDescriptor > descriptor, PropertyAttribute attribute=None, AccessControl settings=DEFAULT)
Local< String > GetConstructorName()
Returns the name of the function invoked as a constructor for this object.
bool Set(Handle< Value > key, Handle< Value > value)
bool HasIndexedPropertiesInExternalArrayData()
static void CheckCast(Value *obj)
void * GetIndexedPropertiesExternalArrayData()
Local< Array > GetPropertyNames()
Returns an array containing the names of the enumerable properties of this object,...
Local< Value > GetRealNamedProperty(Handle< String > key)
If result.IsEmpty() no real property was located on the object or in the prototype chain.
An interface for exporting data from V8, using "push" model.
virtual int GetChunkSize()
Get preferred output chunk size.
Interface for iterating through all the persistent handles in the heap.
virtual void VisitPersistentHandle(Persistent< Value > *value, uint16_t class_id)
A PersistentBase which allows copy and assignment.
static Local< Private > ForApi(Isolate *isolate, Local< String > name)
Local< Value > Name() const
static Local< Private > New(Isolate *isolate, Local< String > name=Local< String >())
void Reject(Handle< Value > value)
Local< Promise > GetPromise()
Extract the associated promise.
static Local< Resolver > New(Isolate *isolate)
Create a new resolver, along with an associated promise in pending state.
void Resolve(Handle< Value > value)
Resolve/reject the associated promise with a given value.
static void CheckCast(Value *obj)
Local< Promise > Catch(Handle< Function > handler)
Local< Promise > Chain(Handle< Function > handler)
Register a resolution/rejection handler with a promise.
Local< Promise > Then(Handle< Function > handler)
static void CheckCast(Value *obj)
The information passed to a property callback about the context of the property access.
Isolate * GetIsolate() const
Local< DeclaredAccessorDescriptor > NewPrimitiveValue(Isolate *isolate, DeclaredAccessorDescriptorDataType data_type, uint8_t bool_offset=0)
Local< DeclaredAccessorDescriptor > NewBitmaskCompare16(Isolate *isolate, uint16_t bitmask, uint16_t compare_value)
Local< RawOperationDescriptor > NewRawDereference(Isolate *isolate)
Local< DeclaredAccessorDescriptor > NewBitmaskCompare8(Isolate *isolate, uint8_t bitmask, uint8_t compare_value)
Local< DeclaredAccessorDescriptor > NewHandleDereference(Isolate *isolate)
Local< DeclaredAccessorDescriptor > NewPointerCompare(Isolate *isolate, void *compare_value)
Local< RawOperationDescriptor > NewRawShift(Isolate *isolate, int16_t byte_offset)
Local< DeclaredAccessorDescriptor > NewBitmaskCompare32(Isolate *isolate, uint32_t bitmask, uint32_t compare_value)
Flags GetFlags() const
Returns the flags bit field.
Local< String > GetSource() const
Returns the value of the source property: a string representing the regular expression.
static void CheckCast(v8::Value *obj)
Flags
Regular expression flag bits.
static Local< RegExp > New(Handle< String > pattern, Flags flags)
Creates a regular expression from the given pattern string and the flags bit field.
RegisteredExtension * next()
static void Register(RegisteredExtension *that)
static void UnregisterAll()
RegisteredExtension * next_
RegisteredExtension(Extension *extension)
static RegisteredExtension * first_extension_
A set of constraints that specifies the limits of the runtime's memory use.
void set_max_available_threads(int value)
int max_semi_space_size() const
void set_max_executable_size(int value)
int max_old_space_size() const
void ConfigureDefaults(uint64_t physical_memory, uint64_t virtual_memory_limit, uint32_t number_of_processors)
Configures the constraints with reasonable default values based on the capabilities of the current de...
void set_max_old_space_size(int value)
int max_available_threads() const
int max_executable_size() const
uint32_t * stack_limit() const
void set_max_semi_space_size(int value)
size_t code_range_size() const
void set_code_range_size(size_t value)
Interface for providing information about embedder's objects held by global handles.
For streaming incomplete script data to V8.
A streaming task which the embedder must run on a background thread to stream scripts into V8.
Source code which can be then compiled to a UnboundScript or Script.
Local< String > source_string
Handle< Integer > resource_column_offset
Handle< Value > resource_name
Handle< Integer > resource_line_offset
Handle< Boolean > resource_is_shared_cross_origin
Source code which can be streamed into V8 in pieces.
StreamedSource(ExternalSourceStream *source_stream, Encoding encoding)
internal::StreamedSource * impl() const
const CachedData * GetCachedData() const
static ScriptStreamingTask * StartStreamingScript(Isolate *isolate, StreamedSource *source, CompileOptions options=kNoCompileOptions)
Returns a task which streams script data into V8, or NULL if the script cannot be streamed.
static Local< UnboundScript > CompileUnbound(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions)
Compiles the specified script (context-independent).
static Local< Script > Compile(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions)
Compiles the specified script (bound to current context).
The origin, within a file, of a script.
Handle< Boolean > ResourceIsSharedCrossOrigin() const
Handle< Integer > ResourceColumnOffset() const
Handle< Integer > ResourceLineOffset() const
Handle< Value > ResourceName() const
static Local< Script > Compile(Handle< String > source, ScriptOrigin *origin=NULL)
A shorthand for ScriptCompiler::Compile().
Local< UnboundScript > GetUnboundScript()
Returns the corresponding context-unbound script.
Local< Value > Run()
Runs the script returning the resulting value.
static Local< Signature > New(Isolate *isolate, Handle< FunctionTemplate > receiver=Handle< FunctionTemplate >(), int argc=0, Handle< FunctionTemplate > argv[]=0)
A single JavaScript stack frame.
int GetLineNumber() const
Returns the number, 1-based, of the line for the associate function call.
int GetColumn() const
Returns the 1-based column offset on the line for the associated function call.
Local< String > GetScriptName() const
Returns the name of the resource that contains the script for the function for this StackFrame.
Local< String > GetScriptNameOrSourceURL() const
Returns the name of the resource that contains the script for the function for this StackFrame or sou...
bool IsConstructor() const
Returns whether or not the associated function is called as a constructor via "new".
bool IsEval() const
Returns whether or not the associated function is compiled via a call to eval().
Local< String > GetFunctionName() const
Returns the name of the function associated with this stack frame.
int GetScriptId() const
Returns the id of the script for the function for this StackFrame.
Local< StackFrame > GetFrame(uint32_t index) const
Returns a StackFrame at a particular index.
StackTraceOptions
Flags that determine what information is placed captured for each StackFrame when grabbing the curren...
@ kExposeFramesAcrossSecurityOrigins
int GetFrameCount() const
Returns the number of StackFrames.
static Local< StackTrace > CurrentStackTrace(Isolate *isolate, int frame_limit, StackTraceOptions options=kOverview)
Grab a snapshot of the current JavaScript execution stack.
Local< Array > AsArray()
Returns StackTrace as a v8::Array that contains StackFrame objects.
virtual int DecompressData(char *raw_data, int *raw_data_size, const char *compressed_data, int compressed_data_size)=0
StartupDataDecompressor()
virtual ~StartupDataDecompressor()
Local< String > ValueOf() const
static void CheckCast(v8::Value *obj)
static Local< Value > New(Handle< String > value)
An ExternalOneByteStringResource is a wrapper around an one-byte string buffer that resides outside V...
virtual const char * data() const =0
The string data from the underlying buffer.
An ExternalStringResource is a wrapper around a two-byte string buffer that resides outside V8's heap...
virtual const uint16_t * data() const =0
The string data from the underlying buffer.
Utf8Value(Handle< v8::Value > obj)
Value(Handle< v8::Value > obj)
A JavaScript string value (ECMA-262, 4.3.17).
int Utf8Length() const
Returns the number of bytes in the UTF-8 encoded representation of this string.
bool CanMakeExternal()
Returns true if this string can be made external.
static Local< String > NewFromOneByte(Isolate *isolate, const uint8_t *data, NewStringType type=kNormalString, int length=-1)
Allocates a new string from Latin-1 data.
bool IsExternal() const
Returns true if the string is external.
int WriteOneByte(uint8_t *buffer, int start=0, int length=-1, int options=NO_OPTIONS) const
bool IsExternalOneByte() const
Returns true if the string is both external and one-byte.
bool ContainsOnlyOneByte() const
Returns whether this string contain only one byte data.
int Write(uint16_t *buffer, int start=0, int length=-1, int options=NO_OPTIONS) const
bool MakeExternal(ExternalStringResource *resource)
Associate an external string resource with this string by transforming it in place so that existing r...
static Local< String > NewFromTwoByte(Isolate *isolate, const uint16_t *data, NewStringType type=kNormalString, int length=-1)
Allocates a new string from UTF-16 data.
static Local< String > Concat(Handle< String > left, Handle< String > right)
Creates a new string by concatenating the left and the right strings passed in as parameters.
bool IsOneByte() const
Returns whether this string is known to contain only one byte data.
@ HINT_MANY_WRITES_EXPECTED
int WriteUtf8(char *buffer, int length=-1, int *nchars_ref=NULL, int options=NO_OPTIONS) const
static v8::Local< v8::String > Empty(Isolate *isolate)
A zero length string.
static void CheckCast(v8::Value *obj)
static Local< String > NewExternal(Isolate *isolate, ExternalStringResource *resource)
Creates a new external string using the data defined in the given resource.
static Local< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=kNormalString, int length=-1)
Allocates a new string from UTF-8 data.
const ExternalOneByteStringResource * GetExternalOneByteStringResource() const
Get the ExternalOneByteStringResource for an external one-byte string.
void VerifyExternalStringResource(ExternalStringResource *val) const
void VerifyExternalStringResourceBase(ExternalStringResourceBase *v, Encoding encoding) const
int Length() const
Returns the number of characters in this string.
static Local< Value > New(Isolate *isolate, Handle< Symbol > value)
Local< Symbol > ValueOf() const
static void CheckCast(v8::Value *obj)
A JavaScript symbol (ECMA-262 edition 6)
static Local< Symbol > GetUnscopables(Isolate *isolate)
static Local< Symbol > GetIterator(Isolate *isolate)
static Local< Symbol > For(Isolate *isolate, Local< String > name)
static void CheckCast(v8::Value *obj)
Local< Value > Name() const
static Local< Symbol > New(Isolate *isolate, Local< String > name=Local< String >())
static Local< Symbol > ForApi(Isolate *isolate, Local< String > name)
The superclass of object and function templates.
void SetAccessorProperty(Local< Name > name, Local< FunctionTemplate > getter=Local< FunctionTemplate >(), Local< FunctionTemplate > setter=Local< FunctionTemplate >(), PropertyAttribute attribute=None, AccessControl settings=DEFAULT)
bool SetDeclaredAccessor(Local< Name > name, Local< DeclaredAccessorDescriptor > descriptor, PropertyAttribute attribute=None, Local< AccessorSignature > signature=Local< AccessorSignature >(), AccessControl settings=DEFAULT)
void Set(Handle< Name > name, Handle< Data > value, PropertyAttribute attributes=None)
Adds a property to each instance created by this template.
void SetNativeDataProperty(Local< String > name, AccessorGetterCallback getter, AccessorSetterCallback setter=0, Handle< Value > data=Handle< Value >(), PropertyAttribute attribute=None, Local< AccessorSignature > signature=Local< AccessorSignature >(), AccessControl settings=DEFAULT)
Whenever the property with the given name is accessed on objects created from this Template the gette...
static int GetStressRuns()
Get the number of runs of a given test that is required to get the full stress coverage.
static void DeoptimizeAll()
Force deoptimization of all functions.
static void PrepareStressRun(int run)
Indicate the number of the run which is about to start.
static void SetStressRunType(StressType type)
Set the type of stressing to do.
An external exception handler.
void SetVerbose(bool value)
Set verbosity of the external exception handler.
Local< v8::Message > Message() const
Returns the message associated with this exception.
void * js_stack_comparable_address_
~TryCatch()
Unregisters and deletes this try/catch block.
bool HasTerminated() const
Returns true if an exception has been caught due to script execution being terminated.
void Reset()
Clears any exceptions that may have been caught by this try/catch block.
v8::internal::Isolate * isolate_
void SetCaptureMessage(bool value)
Set whether or not this TryCatch should capture a Message object which holds source information about...
Local< Value > Exception() const
Returns the exception caught by this try/catch block.
Handle< Value > ReThrow()
Throws the exception caught by this TryCatch in a way that avoids it being caught again by this same ...
Local< Value > StackTrace() const
Returns the .stack property of the thrown object.
bool HasCaught() const
Returns true if an exception has been caught by this try/catch block.
TryCatch()
Creates a new try/catch block and registers it with v8.
bool CanContinue() const
For certain types of exceptions, it makes no sense to continue execution.
static Local< TypeSwitch > New(Handle< FunctionTemplate > type)
int match(Handle< Value > value)
static void CheckCast(Value *obj)
size_t Length()
Number of elements in this typed array (e.g.
int GetLineNumber(int code_pos)
Returns zero based line number of the code_pos location in the script.
Handle< Value > GetScriptName()
Handle< Value > GetSourceURL()
Data read from magic sourceURL comments.
static const int kNoScriptId
Handle< Value > GetSourceMappingURL()
Data read from magic sourceMappingURL comments.
Local< Script > BindToCurrentContext()
Binds the script to the currently entered context.
General purpose unique identifier.
void VisitTwoByteString(const uint16_t *chars, int length)
DISALLOW_COPY_AND_ASSIGN(Visitor)
static i::ConsString * VisitFlat(i::String *string, int *length, uint8_t *state)
void VisitOneByteString(const uint8_t *chars, int length)
static bool StartsWithSurrogate(uint8_t state)
static int Calculate(i::ConsString *current, uint8_t *state_out)
static const uint8_t kInitialState
static void MergeTerminal(int *length, uint8_t state, uint8_t *state_out)
static void MergeLeafLeft(int *length, uint8_t *state, uint8_t leaf_state)
@ kLeftmostEdgeIsSurrogate
@ kEndsWithLeadingSurrogate
@ kStartsWithTrailingSurrogate
@ kRightmostEdgeIsSurrogate
@ kRightmostEdgeIsCalculated
@ kLeftmostEdgeIsCalculated
DISALLOW_IMPLICIT_CONSTRUCTORS(Utf8LengthHelper)
static int Calculate(i::ConsString *current)
static void MergeLeafRight(int *length, uint8_t *state, uint8_t leaf_state)
static bool EndsWithSurrogate(uint8_t state)
static int WriteEndCharacter(uint16_t character, int last_character, int remaining, char *const buffer, bool replace_invalid_utf8)
Utf8WriterVisitor(char *buffer, int capacity, bool skip_capacity_check, bool replace_invalid_utf8)
int CompleteWrite(bool write_null, int *utf16_chars_read_out)
void Visit(const Char *chars, const int length)
bool const skip_capacity_check_
void VisitOneByteString(const uint8_t *chars, int length)
bool const replace_invalid_utf8_
void VisitTwoByteString(const uint16_t *chars, int length)
DISALLOW_IMPLICIT_CONSTRUCTORS(Utf8WriterVisitor)
static bool ApiCheck(bool condition, const char *location, const char *message)
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
static Local< AccessorSignature > AccessorSignatureToLocal(v8::internal::Handle< v8::internal::FunctionTemplateInfo > obj)
static Local< Uint32 > Uint32ToLocal(v8::internal::Handle< v8::internal::Object > obj)
static Local< External > ExternalToLocal(v8::internal::Handle< v8::internal::JSObject > obj)
static Local< Integer > IntegerToLocal(v8::internal::Handle< v8::internal::Object > obj)
static Local< Message > MessageToLocal(v8::internal::Handle< v8::internal::Object > obj)
static Local< StackTrace > StackTraceToLocal(v8::internal::Handle< v8::internal::JSArray > obj)
static void ReportApiFailure(const char *location, const char *message)
static Local< StackFrame > StackFrameToLocal(v8::internal::Handle< v8::internal::JSObject > obj)
static Local< Number > NumberToLocal(v8::internal::Handle< v8::internal::Object > obj)
Container class for static utility functions.
WeakCallbackData< Value, void >::Callback WeakCallback
static Local< Value > GetEternal(Isolate *isolate, int index)
static void RemoveMessageListeners(MessageCallback that)
Remove all message listeners from the specified callback function.
static void Eternalize(Isolate *isolate, Value *handle, int *index)
static void TerminateExecution(Isolate *isolate)
Forcefully terminate the current thread of JavaScript execution in the given isolate.
static void SetReturnAddressLocationResolver(ReturnAddressLocationResolver return_address_resolver)
Allows the host application to provide a callback that allows v8 to cooperate with a profiler that re...
static void SetFatalErrorHandler(FatalErrorCallback that)
Set the callback to invoke in case of fatal errors.
static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback)
Removes callback that was installed by AddMemoryAllocationCallback.
static bool InitializeICU(const char *icu_data_file=NULL)
Initialize the ICU library bundled with V8.
static void AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type_filter=kGCTypeAll)
Enables the host application to receive a notification before a garbage collection.
static const char * GetVersion()
Get the version string.
static bool AddMessageListener(MessageCallback that, Handle< Value > data=Handle< Value >())
Adds a message listener.
static internal::Object ** GlobalizeReference(internal::Isolate *isolate, internal::Object **handle)
static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorithm()
The following 4 functions are to be used when V8 is built with the 'compress_startup_data' flag enabl...
static void SetFlagsFromString(const char *str, int length)
Sets V8 flags from a string.
static void MakeWeak(internal::Object **global_handle, void *data, WeakCallback weak_callback)
static void SetAllowCodeGenerationFromStringsCallback(AllowCodeGenerationFromStringsCallback that)
Set the callback to invoke to check if code generation from strings should be allowed.
static void GetCompressedStartupData(StartupData *compressed_data)
static void SetCaptureStackTraceForUncaughtExceptions(bool capture, int frame_limit=10, StackTrace::StackTraceOptions options=StackTrace::kOverview)
Tells V8 to capture current stack trace when uncaught exception occurs and report it to the message l...
static void SetDecompressedStartupData(StartupData *decompressed_data)
static void InitializePlatform(Platform *platform)
Sets the v8::Platform to use.
static int GetCompressedStartupDataCount()
static void VisitExternalResources(ExternalResourceVisitor *visitor)
Iterates through all external resources referenced from current isolate heap.
static void VisitHandlesWithClassIds(PersistentHandleVisitor *visitor)
Iterates through all the persistent handles in the current isolate's heap that have class_ids.
static void AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type_filter=kGCTypeAll)
Enables the host application to receive a notification after a garbage collection.
static void SetSnapshotDataBlob(StartupData *startup_blob)
static void SetFlagsFromCommandLine(int *argc, char **argv, bool remove_flags)
Sets V8 flags from the command line.
static bool IsExecutionTerminating(Isolate *isolate=NULL)
Is V8 terminating JavaScript execution.
static void DisposeGlobal(internal::Object **global_handle)
static void SetArrayBufferAllocator(ArrayBuffer::Allocator *allocator)
Set allocator to use for ArrayBuffer memory.
static void SetNativesDataBlob(StartupData *startup_blob)
Hand startup data to V8, in case the embedder has chosen to build V8 with external startup data.
static void AddMemoryAllocationCallback(MemoryAllocationCallback callback, ObjectSpace space, AllocationAction action)
Enables the host application to provide a mechanism to be notified and perform custom logging when V8...
static internal::Object ** CopyPersistent(internal::Object **handle)
static void * ClearWeak(internal::Object **global_handle)
static void RemoveGCPrologueCallback(GCPrologueCallback callback)
This function removes callback which was installed by AddGCPrologueCallback function.
static bool IsDead()
Check if V8 is dead and therefore unusable.
static void SetEntropySource(EntropySource source)
Allows the host application to provide a callback which can be used as a source of entropy for random...
static void RemoveGCEpilogueCallback(GCEpilogueCallback callback)
This function removes callback which was installed by AddGCEpilogueCallback function.
static void ShutdownPlatform()
Clears all references to the v8::Platform.
static void VisitHandlesForPartialDependence(Isolate *isolate, PersistentHandleVisitor *visitor)
Iterates through all the persistent handles in the current isolate's heap that have class_ids and are...
static void CancelTerminateExecution(Isolate *isolate)
Resume execution capability in the given isolate, whose execution was previously forcefully terminate...
static bool Dispose()
Releases any resources used by v8 and stops any utility threads that may be running.
static bool Initialize()
Initializes V8.
static void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback)
Callback function for reporting failed access checks.
The superclass of all JavaScript values and objects.
bool IsRegExp() const
Returns true if this value is a RegExp.
bool IsTypedArray() const
Returns true if this value is one of TypedArrays.
double NumberValue() const
bool IsSymbol() const
Returns true if this value is a symbol.
Local< Uint32 > ToArrayIndex() const
Attempts to convert a string to an array index.
Local< Boolean > ToBoolean() const
Local< String > ToString() const
bool IsName() const
Returns true if this value is a symbol or a string.
Local< String > ToDetailString() const
bool StrictEquals(Handle< Value > that) const
bool BooleanValue() const
bool FullIsUndefined() const
bool IsTrue() const
Returns true if this value is true.
bool IsArray() const
Returns true if this value is an array.
bool IsPromise() const
Returns true if this value is a Promise.
bool QuickIsUndefined() const
Local< Integer > ToInteger() const
bool IsArrayBuffer() const
Returns true if this value is an ArrayBuffer.
Local< Uint32 > ToUint32() const
bool IsString() const
Returns true if this value is an instance of the String type.
bool IsNumber() const
Returns true if this value is a number.
bool IsObject() const
Returns true if this value is an object.
int64_t IntegerValue() const
bool IsBoolean() const
Returns true if this value is boolean.
bool IsNativeError() const
Returns true if this value is a NativeError.
bool IsFalse() const
Returns true if this value is false.
bool IsExternal() const
Returns true if this value is external.
bool QuickIsString() const
bool FullIsString() const
Local< Int32 > ToInt32() const
int32_t Int32Value() const
bool IsArrayBufferView() const
Returns true if this value is an ArrayBufferView.
bool Equals(Handle< Value > that) const
JS ==.
bool IsGeneratorFunction() const
Returns true if this value is a Generator function.
bool SameValue(Handle< Value > that) const
bool IsFunction() const
Returns true if this value is a function.
bool IsInt32() const
Returns true if this value is a 32-bit signed integer.
bool IsDataView() const
Returns true if this value is a DataView.
bool IsUint32() const
Returns true if this value is a 32-bit unsigned integer.
uint32_t Uint32Value() const
Local< Object > ToObject() const
Local< Number > ToNumber() const
bool IsGeneratorObject() const
Returns true if this value is a Generator object (iterator).
virtual void VisitPointers(i::Object **start, i::Object **end)
VisitorAdapter(PersistentHandleVisitor *visitor)
virtual void VisitEmbedderReference(i::Object **p, uint16_t class_id)
PersistentHandleVisitor * visitor_
static double nan_value()
static void PrintError(const char *format,...)
bool has_name_prefix() const
const char * bailout_reason() const
const char * name_prefix() const
const char * resource_name() const
const char * name() const
static Handle< SharedFunctionInfo > CompileStreamedScript(CompilationInfo *info, int source_length)
static Handle< SharedFunctionInfo > CompileScript(Handle< String > source, Handle< Object > script_name, int line_offset, int column_offset, bool is_shared_cross_origin, Handle< Context > context, v8::Extension *extension, ScriptData **cached_data, ScriptCompiler::CompileOptions compile_options, NativesFlag is_natives_code)
Context * native_context()
const ProfileTree * top_down() const
base::TimeTicks sample_timestamp(int index) const
base::TimeTicks start_time() const
const char * title() const
base::TimeTicks end_time() const
ProfileNode * sample(int index) const
void EnqueueCommandMessage(Vector< const uint16_t > command, v8::Debug::ClientData *client_data=NULL)
MUST_USE_RESULT MaybeHandle< Object > Call(Handle< JSFunction > fun, Handle< Object > data)
void SetMessageHandler(v8::Debug::MessageHandler handler)
void SetEventListener(Handle< Object > callback, Handle< Object > data)
void set_live_edit_enabled(bool v)
Handle< Context > debug_context()
void EnqueueDebugCommand(v8::Debug::ClientData *client_data=NULL)
static Handle< DeclaredAccessorDescriptor > Create(Isolate *isolate, const DeclaredAccessorDescriptorData &data, Handle< DeclaredAccessorDescriptor > previous)
List< Object ** > blocks_
static void DeoptimizeGlobalObject(JSObject *object)
static void DeoptimizeAll(Isolate *isolate)
bool Exists(SingletonHandle singleton)
Handle< Object > Get(int index)
void Create(Isolate *isolate, Object *object, int *index)
Handle< Object > GetSingleton(SingletonHandle singleton)
void AddString(String *string)
static const int kShortSize
static Handle< FixedArray > CopySize(Handle< FixedArray > array, int new_length, PretenureFlag pretenure=NOT_TENURED)
static int SetFlagsFromCommandLine(int *argc, char **argv, bool remove_flags)
static int SetFlagsFromString(const char *str, int len)
bool IsTemplateFor(Object *object)
void IterateAllRootsInNewSpaceWithClassIds(ObjectVisitor *v)
static void MakeWeak(Object **location, void *parameter, WeakCallback weak_callback)
static void * ClearWeakness(Object **location)
void SetReference(HeapObject **parent, Object **child)
void IterateAllRootsWithClassIds(ObjectVisitor *v)
void SetReferenceFromGroup(UniqueId id, Object **child)
static Handle< Object > CopyGlobal(Object **location)
void SetObjectGroupId(Object **handle, UniqueId id)
static void Destroy(Object **location)
Handle< Object > Create(Object *value)
void EnterContext(Handle< Context > context)
Handle< Context > LastEnteredContext()
bool LastEnteredContextWas(Handle< Context > context)
void IterateThis(ObjectVisitor *v)
void IncrementCallDepth()
Context * RestoreContext()
void SaveContext(Context *context)
static int NumberOfHandles(Isolate *isolate)
Handle< T > CloseAndEscape(Handle< T > handle_value)
static void CloseScope(Isolate *isolate, Object **prev_next, Object **prev_limit)
static T ** CreateHandle(Isolate *isolate, T *value)
static Handle< T > cast(Handle< S > that)
static Handle< T > null()
Isolate * GetIsolate() const
void DeleteAllSnapshots()
void Serialize(v8::OutputStream *stream)
size_t CommittedPhysicalMemory()
static const int kMaxSemiSpaceSizeHighMemoryDevice
void VisitExternalResources(v8::ExternalResourceVisitor *visitor)
intptr_t CommittedMemoryExecutable()
ExternalStringTable * external_string_table()
void RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback)
static const int kMaxOldSpaceSizeHighMemoryDevice
void AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback, GCType gc_type_filter, bool pass_isolate=true)
static const int kMaxExecutableSizeHighMemoryDevice
static const int kMaxOldSpaceSizeMediumMemoryDevice
static const int kAbortIncrementalMarkingMask
void AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback, GCType gc_type_filter, bool pass_isolate=true)
bool ConfigureHeap(int max_semi_space_size, int max_old_space_size, int max_executable_size, size_t code_range_size)
static const int kMaxExecutableSizeHugeMemoryDevice
static const int kNoGCFlags
bool IsInGCPostProcessing()
static const int kMaxExecutableSizeMediumMemoryDevice
void RecordStats(HeapStats *stats, bool take_snapshot=false)
bool IdleNotification(int idle_time_in_ms)
intptr_t CommittedMemory()
static const int kMaxOldSpaceSizeHugeMemoryDevice
static const int kMaxOldSpaceSizeLowMemoryDevice
static const int kMaxSemiSpaceSizeHugeMemoryDevice
void RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback)
static const int kMaxSemiSpaceSizeMediumMemoryDevice
void CollectAllAvailableGarbage(const char *gc_reason=NULL)
static const int kMaxExecutableSizeLowMemoryDevice
static const int kMaxSemiSpaceSizeLowMemoryDevice
int NotifyContextDisposed()
static void CheckInitializedImpl(v8::Isolate *isolate)
bool has_scheduled_exception()
Object * scheduled_exception()
void PrintCurrentStackTrace(FILE *out)
HandleScopeImplementer * handle_scope_implementer()
void EnqueueMicrotask(Handle< Object > microtask)
void SetFailedAccessCheckCallback(v8::FailedAccessCheckCallback callback)
StackGuard * stack_guard()
Handle< Context > GetCallingNativeContext()
void RemoveCallCompletedCallback(CallCompletedCallback callback)
void CancelTerminateExecution()
void ScheduleThrow(Object *exception)
HeapProfiler * heap_profiler() const
MemoryAllocator * memory_allocator()
void set_context(Context *context)
void InitializeLoggingAndCounters()
HandleScopeData * handle_scope_data()
Handle< JSBuiltinsObject > js_builtins_object()
Handle< Context > global_context()
void ReportPendingMessages()
ThreadManager * thread_manager()
void AddCallCompletedCallback(CallCompletedCallback callback)
Handle< JSObject > GetSymbolRegistry()
Handle< JSArray > CaptureCurrentStackTrace(int frame_limit, StackTrace::StackTraceOptions options)
void set_function_entry_hook(FunctionEntryHook function_entry_hook)
StringTracker * string_tracker()
JSObject * global_proxy()
bool Init(Deserializer *des)
CpuProfiler * cpu_profiler() const
StatsTable * stats_table()
void RegisterTryCatchHandler(v8::TryCatch *that)
EternalHandles * eternal_handles()
GlobalHandles * global_handles()
Bootstrapper * bootstrapper()
static const int kBoundFunctionIndex
static void SetMapAndElements(Handle< JSObject > object, Handle< Map > map, Handle< FixedArrayBase > elements)
static void MigrateSlowToFast(Handle< JSObject > object, int unused_property_fields)
static MUST_USE_RESULT MaybeHandle< Object > SetAccessor(Handle< JSObject > object, Handle< AccessorInfo > info)
static void DeleteHiddenProperty(Handle< JSObject > object, Handle< Name > key)
static MUST_USE_RESULT Maybe< bool > HasRealNamedCallbackProperty(Handle< JSObject > object, Handle< Name > key)
static MUST_USE_RESULT Maybe< bool > HasRealNamedProperty(Handle< JSObject > object, Handle< Name > key)
static MUST_USE_RESULT MaybeHandle< Object > SetElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, bool check_prototype=true, SetPropertyMode set_mode=SET_PROPERTY)
static void MigrateToMap(Handle< JSObject > object, Handle< Map > new_map)
static MUST_USE_RESULT Maybe< bool > HasRealElementProperty(Handle< JSObject > object, uint32_t index)
static Handle< Object > GetDataProperty(Handle< JSObject > object, Handle< Name > key)
static Handle< Map > GetElementsTransitionMap(Handle< JSObject > object, ElementsKind to_kind)
static MUST_USE_RESULT MaybeHandle< Object > SetPrototype(Handle< JSObject > object, Handle< Object > value, bool from_javascript)
static Handle< Object > SetHiddenProperty(Handle< JSObject > object, Handle< Name > key, Handle< Object > value)
static MaybeHandle< Object > DefineAccessor(Handle< JSObject > object, Handle< Name > name, Handle< Object > getter, Handle< Object > setter, PropertyAttributes attributes)
static MUST_USE_RESULT Maybe< PropertyAttributes > GetPropertyAttributes(Handle< JSReceiver > object, Handle< Name > name)
static MUST_USE_RESULT Maybe< bool > HasElement(Handle< JSReceiver > object, uint32_t index)
static Handle< Smi > GetOrCreateIdentityHash(Handle< JSReceiver > object)
static MUST_USE_RESULT MaybeHandle< Object > DeleteElement(Handle< JSReceiver > object, uint32_t index, DeleteMode mode=NORMAL_DELETION)
static MUST_USE_RESULT Maybe< bool > HasOwnProperty(Handle< JSReceiver >, Handle< Name > name)
static MUST_USE_RESULT MaybeHandle< FixedArray > GetKeys(Handle< JSReceiver > object, KeyCollectionType type)
static MUST_USE_RESULT Maybe< bool > HasProperty(Handle< JSReceiver > object, Handle< Name > name)
void SetCodeEventHandler(uint32_t options, JitCodeEventHandler event_handler)
static Handle< Map > Copy(Handle< Map > map)
void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback)
void AddMemoryAllocationCallback(MemoryAllocationCallback callback, ObjectSpace space, AllocationAction action)
static Handle< String > GetMessage(Isolate *isolate, Handle< Object > data)
static int GetRawScriptsSize()
static Vector< const byte > GetScriptsSource()
static void SetRawScriptsSource(Vector< const char > raw_source)
static MUST_USE_RESULT MaybeHandle< Object > GetPropertyOrElement(Handle< Object > object, Handle< Name > key)
static MaybeHandle< JSReceiver > ToObject(Isolate *isolate, Handle< Object > object)
static MUST_USE_RESULT MaybeHandle< Object > GetElement(Isolate *isolate, Handle< Object > object, uint32_t index)
static MUST_USE_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it)
static MUST_USE_RESULT MaybeHandle< Object > SetProperty(Handle< Object > object, Handle< Name > key, Handle< Object > value, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
CodeEntry * entry() const
ProfileNode * root() const
A class to uniformly access the prototype of any Object and walk its prototype chain.
bool IsAtEnd(WhereToEnd where_to_end=END_AT_NULL) const
Object * GetCurrent() const
static MUST_USE_RESULT MaybeHandle< Object > HasObjectProperty(Isolate *isolate, Handle< JSReceiver > object, Handle< Object > key)
static MUST_USE_RESULT MaybeHandle< Object > SetObjectProperty(Isolate *isolate, Handle< Object > object, Handle< Object > key, Handle< Object > value, StrictMode strict_mode)
static void NeuterArrayBuffer(Handle< JSArrayBuffer > array_buffer)
static void SetupArrayBuffer(Isolate *isolate, Handle< JSArrayBuffer > array_buffer, bool is_external, void *data, size_t allocated_length)
static MUST_USE_RESULT MaybeHandle< Object > GetObjectProperty(Isolate *isolate, Handle< Object > object, Handle< Object > key)
static MUST_USE_RESULT MaybeHandle< Object > DefineObjectProperty(Handle< JSObject > object, Handle< Object > key, Handle< Object > value, PropertyAttributes attr)
static MUST_USE_RESULT MaybeHandle< Object > DeleteObjectProperty(Isolate *isolate, Handle< JSReceiver > object, Handle< Object > key, JSReceiver::DeleteMode mode)
static bool SetupArrayBufferAllocatingData(Isolate *isolate, Handle< JSArrayBuffer > array_buffer, size_t allocated_length, bool initialize=true)
const byte * data() const
void ReleaseDataOwnership()
static Handle< Object > GetNameOrSourceURL(Handle< Script > script)
static int GetColumnNumber(Handle< Script > script, int code_pos)
static int GetLineNumber(Handle< Script > script, int code_pos)
static void UnregisterCTryCatch()
static uintptr_t RegisterCTryCatch(uintptr_t try_catch_address)
static const int kMaxValue
static Smi * FromInt(int value)
static bool IsValid(intptr_t value)
static bool Initialize(Isolate *isolate)
static const byte * context_data()
static void set_context_raw_data(const byte *context_raw_data)
static void set_raw_data(const byte *raw_data)
static const byte * data()
static int context_size()
static int context_raw_size()
void SetCounterFunction(CounterLookupCallback f)
void SetCreateHistogramFunction(CreateHistogramCallback f)
void RecordWrite(Handle< String > string)
bool IsFreshUnusedString(Handle< String > string)
static void WriteToFlat(String *source, sinkchar *sink, int from, int to)
static ConsString * VisitFlat(Visitor *visitor, String *string, int offset=0)
static Handle< String > Flatten(Handle< String > string, PretenureFlag pretenure=NOT_TENURED)
bool Equals(String *other)
static void set_stress_type(v8::Testing::StressType stress_type)
static v8::Testing::StressType stress_type()
static v8::Testing::StressType stress_type_
bool IsLockedByCurrentThread()
static void ShutdownPlatform()
static void SetArrayBufferAllocator(v8::ArrayBuffer::Allocator *allocator)
static void InitializePlatform(v8::Platform *platform)
static void FatalProcessOutOfMemory(const char *location, bool take_snapshot=false)
static v8::ArrayBuffer::Allocator * ArrayBufferAllocator()
static void SetReturnAddressLocationResolver(ReturnAddressLocationResolver resolver)
static const char * GetVersion()
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes A file to write the raw context snapshot bytes Write V8 startup blob Print the time it takes to lazily compile hydrogen code stubs dump only objects containing this substring stress the GC compactor to flush out pretty print source code for builtins print C code to recreate TurboFan graphs report heap spill statistics along with enable possessive quantifier syntax for testing Minimal Log code events to the log file without profiling log positions Log statistical profiling Used with turns on browser compatible mode for profiling Enable perf linux profiler(experimental annotate support).") DEFINE_STRING(gc_fake_mmap
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file
enable harmony numeric enable harmony object literal extensions Optimize object size
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions true
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi space(in MBytes)
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes A file to write the raw context snapshot bytes Write V8 startup blob Print the time it takes to lazily compile hydrogen code stubs dump only objects containing this substring stress the GC compactor to flush out pretty print source code for builtins print C code to recreate TurboFan graphs report heap spill statistics along with heap_stats(requires heap_stats)") DEFINE_BOOL(regexp_possessive_quantifier
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the snapshot(mksnapshot only)") DEFINE_STRING(raw_file
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, dst, call, value)
#define CHECK_EQ(expected, value)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
#define V8_2PART_UINT64_C(a, b)
#define STATIC_ASSERT(test)
Local< String > NewString(Isolate *v8_isolate, const char *location, const char *env, const Char *data, String::NewStringType type, int length)
static i::ElementsKind GetElementsKindFromExternalArrayType(ExternalArrayType array_type)
void PrepareExternalArrayElements(i::Handle< i::JSObject > object, void *data, ExternalArrayType array_type, int length)
int StringLength(const uint16_t *string)
static RandomNumberGenerator::EntropySource entropy_source
IN DWORD64 OUT PDWORD64 OUT PIMAGEHLP_SYMBOL64 Symbol
static void Parse(Handle< JSFunction > function, CompilationInfoWithZone *info)
static LifetimePosition Max(LifetimePosition a, LifetimePosition b)
static LifetimePosition Min(LifetimePosition a, LifetimePosition b)
void DeleteArray(T *array)
T * NewArray(size_t size)
kSerializedDataOffset kPrototypeTemplateOffset kIndexedPropertyHandlerOffset kInstanceCallHandlerOffset internal_field_count
bool InitializeICU(const char *icu_data_file)
PerIsolateAssertScope< JAVASCRIPT_EXECUTION_ASSERT, true > AllowJavascriptExecution
static bool IsInt32Double(double value)
unsigned int FastD2UI(double x)
const size_t kMaximalCodeRangeSize
int ToNumber(Register reg)
@ OBJECT_TEMPLATE_INFO_TYPE
@ FUNCTION_TEMPLATE_INFO_TYPE
Handle< T > handle(T *t, Isolate *isolate)
const int kHandleBlockSize
PerIsolateAssertScope< JAVASCRIPT_EXECUTION_THROWS, false > ThrowOnJavascriptExecution
DISABLE_ASAN uintptr_t GetCurrentStackPosition()
const bool kRequiresCodeRange
PerIsolateAssertScope< JAVASCRIPT_EXECUTION_ASSERT, false > DisallowJavascriptExecution
void InvokeFunctionCallback(const v8::FunctionCallbackInfo< v8::Value > &info, v8::FunctionCallback callback)
void SetNativesFromFile(StartupData *natives_blob)
Read the Natives (library sources) blob, as generated by js2c + the build system.
static int ArchiveSpacePerThread()
kFeedbackVectorOffset kHiddenPrototypeBit kReadOnlyPrototypeBit do_not_cache
@ kDescriptorBitmaskCompare
@ kDescriptorPointerDereference
@ kDescriptorPointerShift
@ kDescriptorObjectDereference
@ kDescriptorPrimitiveValue
@ kDescriptorReturnObject
@ kDescriptorPointerCompare
kSerializedDataOffset prototype_template
double FastUI2D(unsigned x)
static bool IsMinusZero(double value)
void FatalProcessOutOfMemory(const char *message)
const uint32_t kMaxUInt32
void InvokeAccessorGetterCallback(v8::Local< v8::Name > property, const v8::PropertyCallbackInfo< v8::Value > &info, v8::AccessorNameGetterCallback getter)
int StrLength(const char *string)
void MemCopy(void *dest, const void *src, size_t size)
void SetSnapshotFromFile(StartupData *snapshot_blob)
PerIsolateAssertScope< JAVASCRIPT_EXECUTION_THROWS, true > NoThrowOnJavascriptExecution
static intptr_t Free(PagedSpace *space, FreeList *free_list, Address start, int size)
Debugger support for the V8 JavaScript engine.
JitCodeEventOptions
Option flags passed to the SetJitCodeEventHandler function.
void(* GCPrologueCallback)(GCType type, GCCallbackFlags flags)
static void SetFlagsFromString(const char *flags)
static int Utf8Length(i::String *str, i::Isolate *isolate)
static bool CheckConstructor(i::Isolate *isolate, i::Handle< i::JSObject > obj, const char *class_name)
void(* FailedAccessCheckCallback)(Local< Object > target, AccessType type, Local< Value > data)
static i::Handle< i::Context > CreateEnvironment(i::Isolate *isolate, v8::ExtensionConfiguration *extensions, v8::Handle< ObjectTemplate > global_template, v8::Handle< Value > maybe_global_proxy)
void(* LogEventCallback)(const char *name, int event)
void(* MemoryAllocationCallback)(ObjectSpace space, AllocationAction action, int size)
void(* MessageCallback)(Handle< Message > message, Handle< Value > error)
i::Handle< i::JSTypedArray > NewTypedArray(i::Isolate *isolate, Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
static bool RecursivelySerializeToUtf8(i::String *current, Utf8WriterVisitor *writer, int recursion_budget)
AccessControl
Access control specifications.
static i::Handle< i::TemplateInfo > GetTemplateInfo(i::Isolate *isolate, Template *template_obj)
static Local< FunctionTemplate > FunctionTemplateNew(i::Isolate *isolate, FunctionCallback callback, v8::Handle< Value > data, v8::Handle< Signature > signature, int length, bool do_not_cache)
static void TemplateSet(i::Isolate *isolate, v8::Template *templ, int length, v8::Handle< v8::Data > *data)
void(* JitCodeEventHandler)(const JitCodeEvent *event)
Callback function passed to SetJitCodeEventHandler.
static MUST_USE_RESULT i::MaybeHandle< i::Object > CallV8HeapFunction(const char *name, i::Handle< i::Object > recv, int argc, i::Handle< i::Object > argv[])
void SetResourceConstraints(i::Isolate *isolate, const ResourceConstraints &constraints)
DeclaredAccessorDescriptorDataType
void(* AccessorNameSetterCallback)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
void(* IndexedPropertyGetterCallback)(uint32_t index, const PropertyCallbackInfo< Value > &info)
Returns the value of the property if the getter intercepts the request.
void(* GCEpilogueCallback)(GCType type, GCCallbackFlags flags)
void(* IndexedPropertySetterCallback)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Returns the value if the setter intercepts the request.
static Local< String > getStringProperty(const StackFrame *f, const char *propertyName)
static i::Smi * EncodeAlignedAsSmi(void *value, const char *location)
void(* NamedPropertyGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
NamedProperty[Getter|Setter] are used as interceptors on object.
static i::Handle< i::FunctionTemplateInfo > EnsureConstructor(i::Isolate *isolate, ObjectTemplate *object_template)
bool(* AllowCodeGenerationFromStringsCallback)(Local< Context > context)
Callback to check if code generation from strings is allowed.
void(* IndexedPropertyDeleterCallback)(uint32_t index, const PropertyCallbackInfo< Boolean > &info)
Returns a non-empty handle if the deleter intercepts the request.
static bool InternalFieldOK(i::Handle< i::JSObject > obj, int index, const char *location)
void(* AddHistogramSampleCallback)(void *histogram, int sample)
static const uintptr_t kAlignmentMask
int *(* CounterLookupCallback)(const char *name)
void(* NamedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Returns an array containing the names of the properties the named property getter intercepts.
static i::MaybeHandle< i::String > NewExternalOneByteStringHandle(i::Isolate *isolate, v8::String::ExternalOneByteStringResource *resource)
static i::Handle< i::AccessorInfo > SetAccessorInfoProperties(i::Handle< i::AccessorInfo > obj, v8::Handle< Name > name, v8::AccessControl settings, v8::PropertyAttribute attributes, v8::Handle< AccessorSignature > signature)
void(* MicrotaskCallback)(void *data)
static Local< DeclaredAccessorDescriptor > NewBitmaskCompare(Isolate *isolate, T bitmask, T compare_value, RawOperationDescriptor *operation)
static void InitializeTemplate(i::Handle< i::TemplateInfo > that, int type)
void(* AccessorGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
Accessor[Getter|Setter] are used as callback functions when setting|getting a particular property.
static i::MaybeHandle< i::String > NewExternalStringHandle(i::Isolate *isolate, v8::String::ExternalStringResource *resource)
static void * ExternalValue(i::Object *obj)
uintptr_t(* ReturnAddressLocationResolver)(uintptr_t return_addr_location)
ReturnAddressLocationResolver is used as a callback function when v8 is resolving the location of a r...
void(* CallCompletedCallback)()
static int WriteHelper(const String *string, CharType *buffer, int start, int length, int options)
void(* AccessorSetterCallback)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
void(* AccessorNameGetterCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
void(* NamedPropertySetterCallback)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Returns the value if the setter intercepts the request.
void(* IndexedPropertyQueryCallback)(uint32_t index, const PropertyCallbackInfo< Integer > &info)
Returns a non-empty handle if the interceptor intercepts the request.
static i::Handle< i::FixedArray > EmbedderDataFor(Context *context, int index, bool can_grow, const char *location)
static const uint16_t * Align(const uint16_t *chars)
void(* FunctionCallback)(const FunctionCallbackInfo< Value > &info)
static bool getBoolProperty(const StackFrame *f, const char *propertyName)
static bool IsExecutionTerminatingCheck(i::Isolate *isolate)
void RegisterExtension(Extension *that)
static i::HeapGraphEdge * ToInternal(const HeapGraphEdge *edge)
void(* NamedPropertyDeleterCallback)(Local< String > property, const PropertyCallbackInfo< Boolean > &info)
Returns a non-empty handle if the deleter intercepts the request.
@ kExternalUint8ClampedArray
static i::Handle< i::String > RegExpFlagsToString(RegExp::Flags flags)
void *(* CreateHistogramCallback)(const char *name, int min, int max, size_t buckets)
CompressedStartupDataItems
@ kCompressedStartupDataCount
bool(* NamedSecurityCallback)(Local< Object > host, Local< Value > key, AccessType type, Local< Value > data)
Returns true if cross-context access should be allowed to the named property with the given key on th...
bool(* EntropySource)(unsigned char *buffer, size_t length)
EntropySource is used as a callback function when v8 needs a source of entropy.
static Local< Value > GetPropertyByLookup(i::LookupIterator *it)
void(* FatalErrorCallback)(const char *location, const char *message)
REGEXP_FLAG_ASSERT_EQ(kNone, NONE)
static Local< Symbol > GetWellKnownSymbol(Isolate *isolate, const char *name)
GCType
Applications can register callback functions which will be called before and after a garbage collecti...
void(* NamedPropertyQueryCallback)(Local< String > property, const PropertyCallbackInfo< Integer > &info)
Returns a non-empty handle if the interceptor intercepts the request.
static bool TemplateSetAccessor(Template *template_obj, v8::Local< Name > name, Getter getter, Setter setter, Data data, AccessControl settings, PropertyAttribute attribute, v8::Local< AccessorSignature > signature)
Handle< Boolean > True(Isolate *isolate)
static Local< Operation > NewDescriptor(Isolate *isolate, const i::DeclaredAccessorDescriptorData &data, Data *previous_descriptor)
static bool ObjectSetAccessor(Object *obj, Handle< Name > name, Getter getter, Setter setter, Data data, AccessControl settings, PropertyAttribute attributes)
static const uintptr_t kOneByteMask
void(* IndexedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Returns an array containing the indices of the properties the indexed property getter intercepts.
static void SetupArrayBufferView(i::Isolate *isolate, i::Handle< i::JSArrayBufferView > obj, i::Handle< i::JSArrayBuffer > buffer, size_t byte_offset, size_t byte_length)
static i::Handle< i::AccessorInfo > MakeAccessorInfo(v8::Handle< Name > name, Getter getter, Setter setter, v8::Handle< Value > data, v8::AccessControl settings, v8::PropertyAttribute attributes, v8::Handle< AccessorSignature > signature)
static bool Unaligned(const uint16_t *chars)
static void InitializeFunctionTemplate(i::Handle< i::FunctionTemplateInfo > info)
bool(* IndexedSecurityCallback)(Local< Object > host, uint32_t index, AccessType type, Local< Value > data)
Returns true if cross-context access should be allowed to the indexed property with the given index o...
static i::Handle< i::Symbol > SymbolFor(i::Isolate *isolate, i::Handle< i::String > name, i::Handle< i::String > part)
static void AddPropertyToTemplate(i::Handle< i::TemplateInfo > info, i::Handle< i::AccessorInfo > obj)
void(* InterruptCallback)(Isolate *isolate, void *data)
static void * DecodeSmiToAligned(i::Object *value, const char *location)
Handle< Primitive > Undefined(Isolate *isolate)
static int getIntProperty(const StackFrame *f, const char *propertyName, int defaultValue)
Initial configuration parameters for a new Isolate.
ResourceConstraints constraints
ResourceConstraints to use for the new Isolate.
bool enable_serializer
This flag currently renders the Isolate unusable.
JitCodeEventHandler code_event_handler
Allows the host application to provide the address of a function that is notified each time code is a...
FunctionEntryHook entry_hook
The optional entry_hook allows the host application to provide the address of a function that's invok...
A simple Maybe type, representing an object which may or may not have a value.
Compilation data that the embedder can cache and pass back to speed up future compilations.
struct BitmaskCompareDescriptor bitmask_compare_descriptor
struct PrimitiveValueDescriptor primitive_value_descriptor
struct PointerCompareDescriptor pointer_compare_descriptor
struct PointerShiftDescriptor pointer_shift_descriptor
struct ObjectDerefenceDescriptor object_dereference_descriptor
AccessorDescriptorType type
internal::Object ** limit
v8::DeclaredAccessorDescriptorDataType data_type
SmartPointer< Parser > parser
SmartPointer< CompilationInfo > info
#define T(name, string, precedence)
#define STATIC_CHAR_VECTOR(x)