32 #include "../include/v8-debug.h"
33 #include "../include/v8-profiler.h"
34 #include "../include/v8-testing.h"
51 #ifdef COMPRESS_STARTUP_DATA_BZ2
71 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr))
73 #define ENTER_V8(isolate) \
74 ASSERT((isolate)->IsInitialized()); \
75 i::VMState<i::OTHER> __state__((isolate))
79 #define ON_BAILOUT(isolate, location, code) \
80 if (IsExecutionTerminatingCheck(isolate)) { \
86 #define EXCEPTION_PREAMBLE(isolate) \
87 (isolate)->handle_scope_implementer()->IncrementCallDepth(); \
88 ASSERT(!(isolate)->external_caught_exception()); \
89 bool has_pending_exception = false
92 #define EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, do_callback) \
94 i::HandleScopeImplementer* handle_scope_implementer = \
95 (isolate)->handle_scope_implementer(); \
96 handle_scope_implementer->DecrementCallDepth(); \
97 if (has_pending_exception) { \
98 bool call_depth_is_zero = handle_scope_implementer->CallDepthIsZero(); \
99 (isolate)->OptionalRescheduleException(call_depth_is_zero); \
107 #define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value) \
108 EXCEPTION_BAILOUT_CHECK_GENERIC( \
109 isolate, value, i::V8::FireCallCompletedCallback(isolate);)
112 #define EXCEPTION_BAILOUT_CHECK(isolate, value) \
113 EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, ;)
132 int new_space_capacity;
134 intptr_t old_pointer_space_size;
136 intptr_t old_pointer_space_capacity;
138 intptr_t old_data_space_size;
140 intptr_t old_data_space_capacity;
142 intptr_t code_space_size;
144 intptr_t code_space_capacity;
146 intptr_t map_space_size;
148 intptr_t map_space_capacity;
150 intptr_t cell_space_size;
152 intptr_t cell_space_capacity;
154 intptr_t property_cell_space_size;
156 intptr_t property_cell_space_capacity;
158 intptr_t lo_space_size;
160 int global_handle_count;
162 int weak_global_handle_count;
164 int pending_global_handle_count;
166 int near_death_global_handle_count;
168 int free_global_handle_count;
170 intptr_t memory_allocator_size;
172 intptr_t memory_allocator_capacity;
174 int objects_per_type[
LAST_TYPE + 1] = {0};
188 Utils::ApiCheck(
false, location,
"Allocation failed - process out of memory");
190 FATAL(
"API fatal error handler returned after process out of memory");
194 void Utils::ReportApiFailure(
const char* location,
const char*
message) {
197 if (callback ==
NULL) {
202 callback(location, message);
214 static inline bool IsExecutionTerminatingCheck(
i::Isolate* isolate) {
218 isolate->
heap()->termination_exception();
227 static bool InitializeHelper(
i::Isolate* isolate) {
238 static inline bool EnsureInitializedForIsolate(
i::Isolate* isolate,
239 const char* location) {
243 "Error initializing V8");
254 static inline i::Isolate* EnterIsolateIfNeeded() {
255 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
260 isolate = i::Isolate::Current();
266 : raw_data(i::
NewArray<char*>(
V8::GetCompressedStartupDataCount())) {
284 i::NewArray<StartupData>(compressed_data_count);
286 for (
int i = 0; i < compressed_data_count; ++i) {
287 char* decompressed = raw_data[i] =
288 i::NewArray<char>(compressed_data[i].
raw_size);
289 if (compressed_data[i].compressed_size != 0) {
291 &compressed_data[i].raw_size,
292 compressed_data[i].data,
293 compressed_data[i].compressed_size);
294 if (result != 0)
return result;
296 ASSERT_EQ(0, compressed_data[i].raw_size);
298 compressed_data[i].
data = decompressed;
307 #ifdef COMPRESS_STARTUP_DATA_BZ2
325 #ifdef COMPRESS_STARTUP_DATA_BZ2
334 #ifdef COMPRESS_STARTUP_DATA_BZ2
348 reinterpret_cast<const char*
>(libraries_source.
start());
355 reinterpret_cast<const char*
>(exp_libraries_source.
start());
357 exp_libraries_source.
length();
365 #ifdef COMPRESS_STARTUP_DATA_BZ2
368 reinterpret_cast<const i::byte*>(decompressed_data[
kSnapshot].data));
373 reinterpret_cast<const i::byte*>(
395 isolate->set_exception_behavior(that);
402 isolate->set_allow_code_gen_callback(callback);
407 i::FlagList::SetFlagsFromString(str, length);
412 i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags);
420 : extension_(extension) { }
424 that->next_ = first_extension_;
425 first_extension_ = that;
451 source_length_(source_length >= 0 ?
453 (source ? static_cast<int>(strlen(source)) : 0)),
454 source_(source, source_length_),
455 dep_count_(dep_count),
457 auto_enable_(
false) {
458 CHECK(source !=
NULL || source_length_ == 0);
463 : max_young_space_size_(0),
464 max_old_space_size_(0),
465 max_executable_size_(0),
467 max_available_threads_(0) { }
470 uint32_t number_of_processors) {
475 const uint64_t low_limit = 512ul *
i::MB;
476 const uint64_t medium_limit = 1ul *
i::GB;
477 const uint64_t high_limit = 2ul *
i::GB;
479 const uint64_t low_limit = 512ul *
i::MB;
480 const uint64_t medium_limit = 768ul *
i::MB;
481 const uint64_t high_limit = 1ul *
i::GB;
486 if (physical_memory <= low_limit) {
490 }
else if (physical_memory <= medium_limit) {
494 }
else if (physical_memory <= high_limit) {
514 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) {
519 max_executable_size);
520 if (!result)
return false;
523 uintptr_t limit =
reinterpret_cast<uintptr_t
>(constraints->
stack_limit());
533 LOG_API(isolate,
"Persistent::New");
538 return result.location();
547 return result.location();
553 WeakCallback weak_callback) {
563 void V8::DisposeGlobal(
i::Object** obj) {
568 void V8::Eternalize(Isolate* v8_isolate, Value* value,
int* index) {
575 Local<Value> V8::GetEternal(Isolate* v8_isolate,
int index) {
596 "HandleScope::HandleScope",
597 "Entering the V8 API without proper locking in place");
599 isolate_ = internal_isolate;
600 prev_next_ = current->next;
601 prev_limit_ = current->limit;
607 i::HandleScope::CloseScope(isolate_, prev_next_, prev_limit_);
613 reinterpret_cast<i::Isolate*>(isolate));
624 ASSERT(heap_object->IsHeapObject());
639 "EscapeableHandleScope::Escape",
640 "Escape value set twice");
641 if (escape_value ==
NULL) {
642 *escape_slot_ = heap->undefined_value();
645 *escape_slot_ = *escape_value;
667 "v8::Context::Exit()",
668 "Cannot exit non-entered context")) {
676 static void* DecodeSmiToAligned(
i::Object* value,
const char* location) {
678 return reinterpret_cast<void*
>(value);
682 static i::Smi* EncodeAlignedAsSmi(
void* value,
const char* location) {
692 const char* location) {
697 "Not a native context") &&
701 if (index < data->length())
return data;
705 int new_size =
i::Max(index, data->length() << 1) + 1;
706 data = env->GetIsolate()->factory()->CopySizeFixedArray(data, new_size);
707 env->set_embedder_data(*data);
713 const char* location =
"v8::Context::GetEmbedderData()";
715 if (data.
is_null())
return Local<Value>();
722 const char* location =
"v8::Context::SetEmbedderData()";
726 data->set(index, *val);
732 void* Context::SlowGetAlignedPointerFromEmbedderData(
int index) {
733 const char* location =
"v8::Context::GetAlignedPointerFromEmbedderData()";
736 return DecodeSmiToAligned(data->get(index), location);
741 const char* location =
"v8::Context::SetAlignedPointerInEmbedderData()";
743 data->set(index, EncodeAlignedAsSmi(value, location));
757 EnsureInitializedForIsolate(isolate,
"v8::Nowhere");
761 value_->set_elements(*elements);
783 return obj_.
get(offset + 1);
795 if (length == size - 1) {
796 i::Factory* factory = i::Isolate::Current()->factory();
798 for (
int i = 0; i <
length; i++)
799 new_elms->set(i + 1,
get(i));
800 obj_.
value()->set_elements(*new_elms);
802 obj_.
set(length + 1, *value);
808 if (index < 0 || index >= this->
length())
return;
809 obj_.
set(index + 1, value);
826 if (list->IsUndefined()) {
827 list = NeanderArray(isolate).value();
830 NeanderArray array(list);
832 for (
int i = 0; i < length; i++) {
853 TemplateSet(isolate,
this, kSize, data);
876 TemplateSet(isolate,
this, kSize, data);
881 static void InitializeFunctionTemplate(
893 if (result->IsUndefined()) {
898 return ToApiHandle<ObjectTemplate>(result);
920 InitializeFunctionTemplate(obj);
921 obj->set_do_not_cache(do_not_cache);
922 int next_serial_number = 0;
924 next_serial_number = isolate->next_serial_number() + 1;
925 isolate->set_next_serial_number(next_serial_number);
930 data =
v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
934 obj->set_length(length);
935 obj->set_undetectable(
false);
936 obj->set_needs_access_check(
false);
949 EnsureInitializedForIsolate(i_isolate,
"v8::FunctionTemplate::New()");
950 LOG_API(i_isolate,
"FunctionTemplate::New");
952 return FunctionTemplateNew(
953 i_isolate, callback, data, signature, length,
false);
961 EnsureInitializedForIsolate(i_isolate,
"v8::Signature::New()");
962 LOG_API(i_isolate,
"Signature::New");
971 for (
int i = 0; i < argc; i++) {
972 if (!argv[i].IsEmpty())
975 obj->set_args(*args);
988 template<
typename Operation>
992 Data* previous_descriptor) {
996 if (previous_descriptor !=
NULL) {
998 static_cast<DeclaredAccessorDescriptor*>(previous_descriptor));
1002 return Utils::Convert<i::DeclaredAccessorDescriptor, Operation>(descriptor);
1006 Local<RawOperationDescriptor>
1009 int internal_field) {
1013 return NewDescriptor<RawOperationDescriptor>(isolate, data,
NULL);
1023 return NewDescriptor<RawOperationDescriptor>(isolate, data,
this);
1031 return NewDescriptor<DeclaredAccessorDescriptor>(isolate, data,
this);
1039 return NewDescriptor<RawOperationDescriptor>(isolate, data,
this);
1045 void* compare_value) {
1049 return NewDescriptor<DeclaredAccessorDescriptor>(isolate, data,
this);
1056 uint8_t bool_offset) {
1061 return NewDescriptor<DeclaredAccessorDescriptor>(isolate, data,
this);
1065 template<
typename T>
1076 return NewDescriptor<DeclaredAccessorDescriptor>(isolate, data, operation);
1083 uint8_t compare_value) {
1084 return NewBitmaskCompare(isolate, bitmask, compare_value,
this);
1092 return NewBitmaskCompare(isolate, bitmask, compare_value,
this);
1099 uint32_t compare_value) {
1100 return NewBitmaskCompare(isolate, bitmask, compare_value,
this);
1112 EnsureInitializedForIsolate(isolate,
"v8::TypeSwitch::New()");
1113 LOG_API(isolate,
"TypeSwitch::New");
1116 for (
int i = 0; i < argc; i++)
1122 obj->set_types(*vector);
1129 LOG_API(isolate,
"TypeSwitch::match");
1134 for (
int i = 0; i < types->
length(); i++) {
1142 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \
1143 i::Handle<i::Object> foreign = FromCData(obj->GetIsolate(), cdata); \
1144 (obj)->setter(*foreign); \
1159 data =
v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
1173 if (settings &
ALL_CAN_READ) obj->set_all_can_read(
true);
1176 obj->set_property_attributes(static_cast<PropertyAttributes>(attributes));
1184 template<
typename Getter,
typename Setter>
1199 data =
v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
1202 return SetAccessorInfoProperties(obj, name, settings, attributes, signature);
1209 void* setter_ignored,
1219 return SetAccessorInfoProperties(obj, name, settings, attributes, signature);
1226 "v8::FunctionTemplate::InstanceTemplate()",
1227 "Reading from empty handle")) {
1232 if (handle->instance_template()->IsUndefined()) {
1294 EnsureInitializedForIsolate(isolate,
"v8::ObjectTemplate::New()");
1295 LOG_API(isolate,
"ObjectTemplate::New");
1313 ObjectTemplate* object_template) {
1315 if (!obj ->IsUndefined()) {
1319 Local<FunctionTemplate> templ =
1328 static inline void AddPropertyToTemplate(
1333 if (list->IsUndefined()) {
1334 list = NeanderArray(isolate).value();
1335 info->set_property_accessors(*list);
1337 NeanderArray array(list);
1344 Template* template_obj) {
1352 ObjectTemplate* object_template) {
1353 EnsureConstructor(isolate, object_template);
1358 template<
typename Setter,
typename Getter,
typename Data,
typename Template>
1359 static bool TemplateSetAccessor(
1360 Template* template_obj,
1372 name, getter, setter, data, settings, attribute, signature);
1373 if (obj.
is_null())
return false;
1375 AddPropertyToTemplate(info, obj);
1387 return TemplateSetAccessor(
1388 this, name, descriptor, null, null, settings, attribute, signature);
1399 TemplateSetAccessor(
1400 this, name, getter, setter, data, settings, attribute, signature);
1411 TemplateSetAccessor(
1412 this, name, getter, setter, data, settings, attribute, signature);
1426 EnsureConstructor(isolate,
this);
1442 data =
v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
1445 cons->set_named_property_handler(*obj);
1453 EnsureConstructor(isolate,
this);
1457 cons->set_undetectable(
true);
1465 bool turned_on_by_default) {
1469 EnsureConstructor(isolate,
this);
1480 data =
v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
1487 cons->set_access_check_info(*info);
1488 cons->set_needs_access_check(turned_on_by_default);
1502 EnsureConstructor(isolate,
this);
1518 data =
v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
1521 cons->set_indexed_property_handler(*obj);
1530 EnsureConstructor(isolate,
this);
1540 data =
v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
1543 cons->set_instance_call_handler(*obj);
1555 "v8::ObjectTemplate::SetInternalFieldCount()",
1556 "Invalid internal field count")) {
1564 EnsureConstructor(isolate,
this);
1576 if (str->IsExternalTwoByteString()) {
1589 if (length %
sizeof(
unsigned) != 0) {
1594 int deserialized_data_length = length /
sizeof(unsigned);
1596 if (reinterpret_cast<intptr_t>(data) %
sizeof(unsigned) == 0) {
1600 unsigned* deserialized_data = i::NewArray<unsigned>(deserialized_data_length);
1601 i::CopyBytes(reinterpret_cast<char*>(deserialized_data),
1602 data, static_cast<size_t>(length));
1617 : data(data_), length(length_), buffer_policy(buffer_policy_) {}
1621 if (buffer_policy == BufferOwned) {
1633 obj->GetIsolate()->factory()->NewFunctionFromSharedFunctionInfo(
1634 function_info, obj->GetIsolate()->global_context());
1635 return ToApiHandle<Script>(
function);
1643 ON_BAILOUT(isolate,
"v8::UnboundScript::GetId()",
return -1);
1644 LOG_API(isolate,
"v8::UnboundScript::GetId");
1650 return script->id()->value();
1659 ON_BAILOUT(isolate,
"v8::UnboundScript::GetLineNumber()",
return -1);
1660 LOG_API(isolate,
"UnboundScript::GetLineNumber");
1661 if (obj->IsScript()) {
1674 ON_BAILOUT(isolate,
"v8::UnboundScript::GetName()",
1676 LOG_API(isolate,
"UnboundScript::GetName");
1677 if (obj->IsScript()) {
1694 LOG_API(isolate,
"Script::Run");
1696 i::Logger::TimerEventScope timer_scope(
1697 isolate, i::Logger::TimerEventScope::v8_execute);
1707 isolate, fun, receiver, 0,
NULL, &has_pending_exception);
1709 raw_result = *result;
1718 return ToApiHandle<UnboundScript>(
1732 if (source->cached_data) {
1736 delete source->cached_data;
1737 source->cached_data =
NULL;
1739 }
else if (source->cached_data) {
1743 reinterpret_cast<const char*>(source->cached_data->
data),
1744 source->cached_data->
length));
1752 delete script_data_impl;
1753 script_data_impl =
NULL;
1754 delete source->cached_data;
1755 source->cached_data =
NULL;
1761 ON_BAILOUT(isolate,
"v8::ScriptCompiler::CompileUnbound()",
1763 LOG_API(isolate,
"ScriptCompiler::CompileUnbound");
1768 int line_offset = 0;
1769 int column_offset = 0;
1770 bool is_shared_cross_origin =
false;
1771 if (!source->resource_name.
IsEmpty()) {
1774 if (!source->resource_line_offset.IsEmpty()) {
1775 line_offset =
static_cast<int>(source->resource_line_offset->Value());
1777 if (!source->resource_column_offset.IsEmpty()) {
1779 static_cast<int>(source->resource_column_offset->Value());
1781 if (!source->resource_is_shared_cross_origin.IsEmpty()) {
1783 is_shared_cross_origin =
1784 source->resource_is_shared_cross_origin ==
v8::True(v8_isolate);
1792 is_shared_cross_origin,
1798 has_pending_exception = result.
is_null();
1800 raw_result = *result;
1801 if ((options & kProduceDataToCache) && script_data_impl !=
NULL) {
1805 reinterpret_cast<const uint8_t*>(script_data_impl->Data()),
1807 script_data_impl->owns_store_ =
false;
1809 delete script_data_impl;
1812 return ToApiHandle<UnboundScript>(result);
1821 ON_BAILOUT(isolate,
"v8::ScriptCompiler::Compile()",
1823 LOG_API(isolate,
"ScriptCompiler::CompiletBound()");
1828 return generic->BindToCurrentContext();
1839 reinterpret_cast<const uint8_t*>(script_data->
Data()),
1845 reinterpret_cast<v8::Isolate*>(str->GetIsolate()),
1850 reinterpret_cast<v8::Isolate*>(str->GetIsolate()),
1858 return Compile(source, &origin);
1866 : isolate_(i::
Isolate::Current()),
1867 next_(isolate_->try_catch_handler_address()),
1869 can_continue_(
true),
1870 capture_message_(
true),
1872 has_terminated_(
false) {
1879 ASSERT(isolate_ == i::Isolate::Current());
1884 if (HasCaught() && capture_message_) {
1889 isolate_->thread_local_top()->rethrowing_message_ =
true;
1890 isolate_->RestorePendingMessageFromTryCatch(
this);
1892 isolate_->UnregisterTryCatchHandler(
this);
1893 reinterpret_cast<Isolate*
>(isolate_)->ThrowException(exc);
1894 ASSERT(!isolate_->thread_local_top()->rethrowing_message_);
1896 isolate_->UnregisterTryCatchHandler(
this);
1902 return !
reinterpret_cast<i::Object*
>(exception_)->IsTheHole();
1907 return can_continue_;
1912 return has_terminated_;
1919 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate_));
1924 ASSERT(isolate_ == i::Isolate::Current());
1936 ASSERT(isolate_ == i::Isolate::Current());
1954 ASSERT(isolate_ == i::Isolate::Current());
1956 ASSERT(message->IsJSMessageObject() || message->IsTheHole());
1957 if (HasCaught() && !message->IsTheHole()) {
1966 ASSERT(isolate_ == i::Isolate::Current());
1967 i::Object* the_hole = isolate_->heap()->the_hole_value();
1968 exception_ = the_hole;
1969 message_obj_ = the_hole;
1970 message_script_ = the_hole;
1971 message_start_pos_ = 0;
1972 message_end_pos_ = 0;
1977 is_verbose_ = value;
1982 capture_message_ = value;
1997 return scope.
Escape(result);
2035 bool* has_pending_exception) {
2044 isolate, fun, recv, argc, argv, has_pending_exception);
2051 bool* has_pending_exception) {
2053 return CallV8HeapFunction(name,
2054 i::Isolate::Current()->js_builtins_object(),
2057 has_pending_exception);
2070 &has_pending_exception);
2072 return static_cast<int>(result->Number());
2082 return message->start_position();
2092 return message->end_position();
2103 "GetPositionInLine",
2105 &has_pending_exception);
2107 return static_cast<int>(start_col_obj->Number());
2118 "GetPositionInLine",
2120 &has_pending_exception);
2124 int start = message->start_position();
2125 int end = message->end_position();
2126 return static_cast<int>(start_col_obj->Number()) + (end - start);
2151 &has_pending_exception);
2153 if (result->IsString()) {
2216 if (!line->IsSmi()) {
2229 if (!column->IsSmi()) {
2242 if (!scriptId->IsSmi()) {
2255 if (!name->IsString()) {
2268 if (!name->IsString()) {
2281 if (!name->IsString()) {
2294 return is_eval->IsTrue();
2304 return is_constructor->IsTrue();
2312 EnsureInitializedForIsolate(isolate,
"v8::JSON::Parse");
2319 if (source->IsSeqOneByteString()) {
2320 result = i::JsonParser<true>::Parse(source);
2322 result = i::JsonParser<false>::Parse(source);
2324 has_pending_exception = result.
is_null();
2333 bool Value::FullIsUndefined()
const {
2340 bool Value::FullIsNull()
const {
2362 bool Value::FullIsString()
const {
2394 #define VALUE_IS_TYPED_ARRAY(Type, typeName, TYPE, ctype, size) \
2395 bool Value::Is##Type##Array() const { \
2396 i::Handle<i::Object> obj = Utils::OpenHandle(this); \
2397 return obj->IsJSTypedArray() && \
2398 i::JSTypedArray::cast(*obj)->type() == kExternal##Type##Array; \
2403 #undef VALUE_IS_TYPED_ARRAY
2433 if (obj->IsSmi())
return true;
2434 if (obj->IsNumber()) {
2435 return i::IsInt32Double(obj->Number());
2444 if (obj->IsNumber()) {
2445 double value = obj->Number();
2446 return !i::IsMinusZero(value) &&
2458 return obj->HasSpecificClassOf(isolate->
heap()->Date_string());
2465 return obj->HasSpecificClassOf(isolate->
heap()->String_string());
2474 return obj->HasSpecificClassOf(isolate->
heap()->Symbol_string());
2481 return obj->HasSpecificClassOf(isolate->
heap()->Number_string());
2486 const char* builtin_name) {
2490 return builtins->GetPropertyNoExceptionThrown(*
string);
2494 static bool CheckConstructor(
i::Isolate* isolate,
2496 const char* class_name) {
2497 i::Object* constr = obj->map()->constructor();
2498 if (!constr->IsJSFunction())
return false;
2500 return func->shared()->native() &&
2501 constr == LookupBuiltin(isolate, class_name);
2508 if (obj->IsJSObject()) {
2510 return CheckConstructor(isolate, js_obj,
"$Error") ||
2511 CheckConstructor(isolate, js_obj,
"$EvalError") ||
2512 CheckConstructor(isolate, js_obj,
"$RangeError") ||
2513 CheckConstructor(isolate, js_obj,
"$ReferenceError") ||
2514 CheckConstructor(isolate, js_obj,
"$SyntaxError") ||
2515 CheckConstructor(isolate, js_obj,
"$TypeError") ||
2516 CheckConstructor(isolate, js_obj,
"$URIError");
2526 return obj->HasSpecificClassOf(isolate->
heap()->Boolean_string());
2532 return obj->IsJSRegExp();
2539 if (obj->IsString()) {
2549 return ToApiHandle<String>(str);
2556 if (obj->IsString()) {
2560 LOG_API(isolate,
"ToDetailString");
2566 return ToApiHandle<String>(str);
2573 if (obj->IsJSObject()) {
2583 return ToApiHandle<Object>(val);
2589 if (obj->IsBoolean()) {
2590 return ToApiHandle<Boolean>(
obj);
2593 LOG_API(isolate,
"ToBoolean");
2597 return ToApiHandle<Boolean>(val);
2605 if (obj->IsNumber()) {
2615 return ToApiHandle<Number>(num);
2626 LOG_API(isolate,
"ToInteger");
2632 return ToApiHandle<Integer>(num);
2641 "v8::internal::Internals::CheckInitialized()",
2642 "Isolate is not initialized or V8 has died");
2646 void External::CheckCast(
v8::Value* that) {
2648 "v8::External::Cast()",
2649 "Could not convert to external");
2653 void v8::Object::CheckCast(Value* that) {
2656 "v8::Object::Cast()",
2657 "Could not convert to object");
2661 void v8::Function::CheckCast(Value* that) {
2664 "v8::Function::Cast()",
2665 "Could not convert to function");
2669 void v8::String::CheckCast(
v8::Value* that) {
2672 "v8::String::Cast()",
2673 "Could not convert to string");
2677 void v8::Symbol::CheckCast(
v8::Value* that) {
2680 "v8::Symbol::Cast()",
2681 "Could not convert to symbol");
2685 void v8::Number::CheckCast(
v8::Value* that) {
2688 "v8::Number::Cast()",
2689 "Could not convert to number");
2693 void v8::Integer::CheckCast(
v8::Value* that) {
2696 "v8::Integer::Cast()",
2697 "Could not convert to number");
2701 void v8::Array::CheckCast(Value* that) {
2704 "v8::Array::Cast()",
2705 "Could not convert to array");
2709 void v8::Promise::CheckCast(Value* that) {
2711 "v8::Promise::Cast()",
2712 "Could not convert to promise");
2716 void v8::Promise::Resolver::CheckCast(Value* that) {
2718 "v8::Promise::Resolver::Cast()",
2719 "Could not convert to promise resolver");
2723 void v8::ArrayBuffer::CheckCast(Value* that) {
2726 "v8::ArrayBuffer::Cast()",
2727 "Could not convert to ArrayBuffer");
2731 void v8::ArrayBufferView::CheckCast(Value* that) {
2734 "v8::ArrayBufferView::Cast()",
2735 "Could not convert to ArrayBufferView");
2739 void v8::TypedArray::CheckCast(Value* that) {
2742 "v8::TypedArray::Cast()",
2743 "Could not convert to TypedArray");
2747 #define CHECK_TYPED_ARRAY_CAST(Type, typeName, TYPE, ctype, size) \
2748 void v8::Type##Array::CheckCast(Value* that) { \
2749 i::Handle<i::Object> obj = Utils::OpenHandle(that); \
2750 Utils::ApiCheck(obj->IsJSTypedArray() && \
2751 i::JSTypedArray::cast(*obj)->type() == \
2752 kExternal##Type##Array, \
2753 "v8::" #Type "Array::Cast()", \
2754 "Could not convert to " #Type "Array"); \
2760 #undef CHECK_TYPED_ARRAY_CAST
2763 void v8::DataView::CheckCast(Value* that) {
2766 "v8::DataView::Cast()",
2767 "Could not convert to DataView");
2771 void v8::Date::CheckCast(
v8::Value* that) {
2776 "Could not convert to date");
2780 void v8::StringObject::CheckCast(
v8::Value* that) {
2784 "v8::StringObject::Cast()",
2785 "Could not convert to StringObject");
2789 void v8::SymbolObject::CheckCast(
v8::Value* that) {
2793 "v8::SymbolObject::Cast()",
2794 "Could not convert to SymbolObject");
2798 void v8::NumberObject::CheckCast(
v8::Value* that) {
2802 "v8::NumberObject::Cast()",
2803 "Could not convert to NumberObject");
2807 void v8::BooleanObject::CheckCast(
v8::Value* that) {
2811 "v8::BooleanObject::Cast()",
2812 "Could not convert to BooleanObject");
2816 void v8::RegExp::CheckCast(
v8::Value* that) {
2819 "v8::RegExp::Cast()",
2820 "Could not convert to regular expression");
2832 if (obj->IsNumber()) {
2836 LOG_API(isolate,
"NumberValue");
2842 return num->Number();
2849 if (obj->IsNumber()) {
2853 LOG_API(isolate,
"IntegerValue");
2862 return static_cast<int64_t
>(num->Number());
2880 return ToApiHandle<Int32>(num);
2897 return ToApiHandle<Uint32>(num);
2908 LOG_API(isolate,
"ToArrayIndex");
2916 if (str->AsArrayIndex(&index)) {
2935 LOG_API(isolate,
"Int32Value (slow)");
2944 return static_cast<int32_t>(num->Number());
2953 "v8::Value::Equals()",
2954 "Reading from empty handle")) {
2964 if (obj->IsJSObject() && other->IsJSObject()) {
2965 return *obj == *other;
2970 CallV8HeapFunction(
"EQUALS", obj,
ARRAY_SIZE(args), args,
2971 &has_pending_exception);
2980 "v8::Value::StrictEquals()",
2981 "Reading from empty handle")) {
2984 LOG_API(isolate,
"StrictEquals");
2988 if (obj->IsHeapNumber()) {
2989 if (!other->IsNumber())
return false;
2990 double x = obj->Number();
2991 double y = other->Number();
2994 }
else if (*obj == *other) {
2996 }
else if (obj->IsSmi()) {
2997 return other->IsNumber() && obj->Number() == other->Number();
2998 }
else if (obj->IsString()) {
2999 return other->IsString() &&
3001 }
else if (obj->IsUndefined() || obj->IsUndetectableObject()) {
3002 return other->IsUndefined() || other->IsUndetectableObject();
3012 "v8::Value::SameValue()",
3013 "Reading from empty handle")) {
3016 LOG_API(isolate,
"SameValue");
3019 return obj->SameValue(*other);
3029 LOG_API(isolate,
"Uint32Value");
3038 return static_cast<uint32_t
>(num->Number());
3047 ON_BAILOUT(isolate,
"v8::Object::Set()",
return false);
3059 static_cast<PropertyAttributes>(attribs),
3061 has_pending_exception = obj.
is_null();
3069 ON_BAILOUT(isolate,
"v8::Object::Set()",
return false);
3081 has_pending_exception = obj.
is_null();
3091 ON_BAILOUT(isolate,
"v8::Object::ForceSet()",
return false);
3102 static_cast<PropertyAttributes>(attribs));
3103 has_pending_exception = obj.
is_null();
3117 ON_BAILOUT(isolate,
"v8::Object::ForceDelete()",
return false);
3127 if (self->IsJSGlobalProxy() ||
self->IsGlobalObject()) {
3133 has_pending_exception = obj.
is_null();
3135 return obj->IsTrue();
3147 has_pending_exception = result.
is_null();
3160 has_pending_exception = result.
is_null();
3173 ON_BAILOUT(isolate,
"v8::Object::GetPropertyAttribute()",
3174 return static_cast<PropertyAttribute>(
NONE));
3179 if (!key_obj->IsName()) {
3194 ON_BAILOUT(isolate,
"v8::Object::GetPrototype()",
3205 ON_BAILOUT(isolate,
"v8::Object::SetPrototype()",
return false);
3214 has_pending_exception = result.
is_null();
3224 "v8::Object::FindInstanceInPrototypeChain()",
3240 ON_BAILOUT(isolate,
"v8::Object::GetPropertyNames()",
3261 ON_BAILOUT(isolate,
"v8::Object::GetOwnPropertyNames()",
3283 ON_BAILOUT(i_isolate,
"v8::Object::ObjectProtoToString()",
3295 if (!name->IsString()) {
3302 const char* prefix =
"[object ";
3304 const char* postfix =
"]";
3310 int buf_len = prefix_len + str_len + postfix_len;
3314 char* ptr = buf.
start();
3323 i::OS::MemCopy(ptr, postfix, postfix_len * v8::internal::kCharSize);
3336 ON_BAILOUT(isolate,
"v8::Object::GetConstructor()",
3347 ON_BAILOUT(isolate,
"v8::Object::GetConstructorName()",
3358 ON_BAILOUT(isolate,
"v8::Object::Delete()",
return false);
3365 has_pending_exception = obj.
is_null();
3367 return obj->IsTrue();
3378 ON_BAILOUT(isolate,
"v8::Object::Has()",
return false);
3384 has_pending_exception = obj.
is_null();
3386 return obj->IsTrue();
3397 ON_BAILOUT(isolate,
"v8::Object::DeleteProperty()",
3400 HandleScope scope(reinterpret_cast<Isolate*>(isolate));
3408 ON_BAILOUT(isolate,
"v8::Object::HasProperty()",
return false);
3414 template<
typename Setter,
typename Getter,
typename Data>
3415 static inline bool ObjectSetAccessor(
Object* obj,
3423 ON_BAILOUT(isolate,
"v8::Object::SetAccessor()",
return false);
3428 name, getter, setter, data, settings, attributes, signature);
3429 if (info.
is_null())
return false;
3433 if (result.
is_null() || result->IsUndefined())
return false;
3445 return ObjectSetAccessor(
3446 this, name, getter, setter, data, settings, attributes);
3455 return ObjectSetAccessor(
3456 this, name, descriptor, null, null, settings, attributes);
3466 ON_BAILOUT(isolate,
"v8::Object::SetAccessorProperty()",
return);
3471 if (setter_i.
is_null()) setter_i = isolate->
factory()->null_value();
3476 static_cast<PropertyAttributes>(attribute),
3483 ON_BAILOUT(isolate,
"v8::Object::HasOwnProperty()",
3492 ON_BAILOUT(isolate,
"v8::Object::HasRealNamedProperty()",
3501 ON_BAILOUT(isolate,
"v8::Object::HasRealIndexedProperty()",
3510 "v8::Object::HasRealNamedCallbackProperty()",
3520 ON_BAILOUT(isolate,
"v8::Object::HasNamedLookupInterceptor()",
3528 ON_BAILOUT(isolate,
"v8::Object::HasIndexedLookupInterceptor()",
3537 i::LookupResult* lookup) {
3538 if (!lookup->IsProperty()) {
3550 has_pending_exception = result.
is_null();
3561 "v8::Object::GetRealNamedPropertyInPrototypeChain()",
3566 i::LookupResult lookup(isolate);
3567 self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup);
3568 return GetPropertyByLookup(isolate, self_obj, key_obj, &lookup);
3574 ON_BAILOUT(isolate,
"v8::Object::GetRealNamedProperty()",
3579 i::LookupResult lookup(isolate);
3580 self_obj->LookupRealNamedProperty(*key_obj, &lookup);
3581 return GetPropertyByLookup(isolate, self_obj, key_obj, &lookup);
3590 ON_BAILOUT(isolate,
"v8::Object::TurnOnAccessCheck()",
return);
3601 new_map->set_is_access_check_needed(
true);
3602 obj->set_map(*new_map);
3618 has_pending_exception = result.
is_null();
3625 i::Object* constructor =
object->map()->constructor();
3627 if (!constructor->IsJSFunction()) {
3630 ASSERT(object->IsJSFunction());
3635 return function->context()->native_context();
3645 i::Context* context = GetCreationContext(*
self);
3652 ON_BAILOUT(isolate,
"v8::Object::GetIdentityHash()",
return 0);
3664 ON_BAILOUT(isolate,
"v8::Object::SetHiddenValue()",
return false);
3665 if (value.
IsEmpty())
return DeleteHiddenValue(key);
3675 return *result == *
self;
3681 ON_BAILOUT(isolate,
"v8::Object::GetHiddenValue()",
3696 ON_BAILOUT(isolate,
"v8::DeleteHiddenValue()",
return false);
3712 switch (array_type) {
3713 #define ARRAY_TYPE_TO_ELEMENTS_KIND(Type, type, TYPE, ctype, size) \
3714 case kExternal##Type##Array: \
3715 return i::EXTERNAL_##TYPE##_ELEMENTS;
3718 #undef ARRAY_TYPE_TO_ELEMENTS_KIND
3736 GetElementsKindFromExternalArrayType(array_type));
3738 object->set_map(*external_array_map);
3739 object->set_elements(*array);
3747 ON_BAILOUT(isolate,
"v8::SetElementsToPixelData()",
return);
3752 "v8::Object::SetIndexedPropertiesToPixelData()",
3753 "length exceeds max acceptable value")) {
3758 "v8::Object::SetIndexedPropertiesToPixelData()",
3759 "JSArray is not supported")) {
3768 ON_BAILOUT(self->GetIsolate(),
"v8::HasIndexedPropertiesInPixelData()",
3770 return self->HasExternalUint8ClampedElements();
3776 ON_BAILOUT(self->GetIsolate(),
"v8::GetIndexedPropertiesPixelData()",
3778 if (self->HasExternalUint8ClampedElements()) {
3780 external_uint8_clamped_pointer();
3789 ON_BAILOUT(self->GetIsolate(),
"v8::GetIndexedPropertiesPixelDataLength()",
3791 if (self->HasExternalUint8ClampedElements()) {
3804 ON_BAILOUT(isolate,
"v8::SetIndexedPropertiesToExternalArrayData()",
return);
3808 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3809 "length exceeds max acceptable value")) {
3814 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3815 "JSArray is not supported")) {
3818 PrepareExternalArrayElements(
self, data, array_type, length);
3825 "v8::HasIndexedPropertiesInExternalArrayData()",
3827 return self->HasExternalArrayElements();
3834 "v8::GetIndexedPropertiesExternalArrayData()",
3836 if (self->HasExternalArrayElements()) {
3847 "v8::GetIndexedPropertiesExternalArrayDataType()",
3849 switch (self->elements()->map()->instance_type()) {
3850 #define INSTANCE_TYPE_TO_ARRAY_TYPE(Type, type, TYPE, ctype, size) \
3851 case i::EXTERNAL_##TYPE##_ARRAY_TYPE: \
3852 return kExternal##Type##Array;
3854 #undef INSTANCE_TYPE_TO_ARRAY_TYPE
3864 "v8::GetIndexedPropertiesExternalArrayDataLength()",
3866 if (self->HasExternalArrayElements()) {
3876 ON_BAILOUT(isolate,
"v8::Object::IsCallable()",
return false);
3880 return obj->IsCallable();
3888 ON_BAILOUT(isolate,
"v8::Object::CallAsFunction()",
3890 LOG_API(isolate,
"Object::CallAsFunction");
3892 i::Logger::TimerEventScope timer_scope(
3893 isolate, i::Logger::TimerEventScope::v8_execute);
3900 if (obj->IsJSFunction()) {
3905 isolate, obj, &has_pending_exception);
3912 isolate, fun, recv_obj, argc, args, &has_pending_exception,
true);
3921 ON_BAILOUT(isolate,
"v8::Object::CallAsConstructor()",
3923 LOG_API(isolate,
"Object::CallAsConstructor");
3925 i::Logger::TimerEventScope timer_scope(
3926 isolate, i::Logger::TimerEventScope::v8_execute);
3931 if (obj->IsJSFunction()) {
3942 isolate, obj, &has_pending_exception);
3944 if (!delegate->IsUndefined()) {
3948 isolate, fun, obj, argc, args, &has_pending_exception);
3950 ASSERT(!delegate->IsUndefined());
3962 LOG_API(isolate,
"Function::New");
3964 return FunctionTemplateNew(
3978 ON_BAILOUT(isolate,
"v8::Function::NewInstance()",
3980 LOG_API(isolate,
"Function::NewInstance");
3982 i::Logger::TimerEventScope timer_scope(
3983 isolate, i::Logger::TimerEventScope::v8_execute);
4000 LOG_API(isolate,
"Function::Call");
4002 i::Logger::TimerEventScope timer_scope(
4003 isolate, i::Logger::TimerEventScope::v8_execute);
4013 isolate, fun, recv_obj, argc, args, &has_pending_exception,
true);
4015 raw_result = *returned;
4034 func->GetIsolate()));
4041 func->GetIsolate()));
4047 ON_BAILOUT(isolate,
"v8::Function::GetDisplayName()",
4048 return ToApiHandle<Primitive>(
4049 isolate->
factory()->undefined_value()));
4055 i::LookupResult lookup(isolate);
4056 func->LookupRealNamedProperty(*property_name, &lookup);
4057 if (lookup.IsFound()) {
4058 i::Object* value = lookup.GetLazyValue();
4059 if (value && value->IsString()) {
4064 return ToApiHandle<Primitive>(isolate->
factory()->undefined_value());
4070 if (func->shared()->script()->IsScript()) {
4089 if (func->shared()->script()->IsScript()) {
4099 if (func->shared()->script()->IsScript()) {
4109 return func->IsBuiltin();
4115 if (!func->shared()->script()->IsScript()) {
4119 return script->id()->value();
4125 if (!func->shared()->bound()) {
4126 return v8::Undefined(reinterpret_cast<v8::Isolate*>(func->GetIsolate()));
4132 func->GetIsolate());
4139 return str->length();
4145 return str->HasOnlyOneByteChars();
4152 static const uint32_t value = 0xFF00FF00;
4158 static const uintptr_t kAlignmentMask =
sizeof(uintptr_t) - 1;
4159 static inline bool Unaligned(
const uint16_t* chars) {
4160 return reinterpret_cast<const uintptr_t
>(chars) & kAlignmentMask;
4165 return reinterpret_cast<uint16_t*
>(
4166 reinterpret_cast<uintptr_t
>(chars) & ~kAlignmentMask);
4174 if (cons_string ==
NULL)
return is_one_byte_;
4175 return CheckCons(cons_string);
4184 const uint16_t* end = chars + length;
4185 while (Unaligned(chars) && chars != end) {
4190 const uint16_t* aligned_end = Align(end);
4191 const int increment =
sizeof(uintptr_t)/
sizeof(
uint16_t);
4192 const int inner_loops = 16;
4193 while (chars + inner_loops*increment < aligned_end) {
4194 for (
int i = 0; i < inner_loops; i++) {
4195 acc |= *
reinterpret_cast<const uintptr_t*
>(chars);
4199 if ((acc & kOneByteMask) != 0) {
4200 is_one_byte_ =
false;
4205 while (chars != end) {
4209 if ((acc & kOneByteMask) != 0) is_one_byte_ =
false;
4219 if (!is_one_byte_)
return false;
4224 if (!is_one_byte_)
return false;
4226 if (left_as_cons !=
NULL && right_as_cons !=
NULL) {
4228 CheckCons(left_as_cons);
4229 cons_string = right_as_cons;
4231 CheckCons(right_as_cons);
4232 cons_string = left_as_cons;
4235 if (!is_one_byte_)
return false;
4239 if (left_as_cons !=
NULL) {
4240 cons_string = left_as_cons;
4244 if (right_as_cons !=
NULL) {
4245 cons_string = right_as_cons;
4251 return is_one_byte_;
4260 if (str->HasOnlyOneByteChars())
return true;
4262 return helper.
Check(*str);
4294 int utf8_length = 0;
4296 for (
int i = 0; i < length; i++) {
4297 utf8_length += *chars++ >> 7;
4300 utf8_length_ = utf8_length + length;
4305 int utf8_length = 0;
4307 for (
int i = 0; i < length; i++) {
4312 utf8_length_ = utf8_length;
4328 *length = visitor.utf8_length_;
4329 *state = visitor.state_;
4336 DISALLOW_COPY_AND_ASSIGN(
Visitor);
4341 uint8_t leaf_state) {
4345 *state |= kLeftmostEdgeIsCalculated
4346 | (edge_surrogate ? kLeftmostEdgeIsSurrogate : 0);
4359 uint8_t leaf_state) {
4363 *state |= (kRightmostEdgeIsCalculated
4364 | (edge_surrogate ? kRightmostEdgeIsSurrogate : 0));
4377 uint8_t* state_out) {
4389 using namespace internal;
4390 int total_length = 0;
4395 uint8_t right_leaf_state;
4396 uint8_t left_leaf_state;
4398 ConsString* left_as_cons =
4400 if (left_as_cons ==
NULL) {
4401 total_length += leaf_length;
4404 ConsString* right_as_cons =
4406 if (right_as_cons ==
NULL) {
4407 total_length += leaf_length;
4409 if (left_as_cons !=
NULL) {
4411 current = left_as_cons;
4416 return total_length;
4418 }
else if (left_as_cons ==
NULL) {
4420 current = right_as_cons;
4426 total_length +=
Calculate(left_as_cons, &left_leaf_state);
4428 current = right_as_cons;
4430 total_length +=
Calculate(right_as_cons, &right_leaf_state);
4432 current = left_as_cons;
4450 int length = str->
length();
4451 if (length == 0)
return 0;
4455 if (cons_string ==
NULL)
return length;
4463 return v8::Utf8Length(*str, isolate);
4472 bool skip_capacity_check,
4473 bool replace_invalid_utf8)
4474 : early_termination_(
false),
4475 last_character_(unibrow::Utf16::kNoPreviousCharacter),
4478 capacity_(capacity),
4479 skip_capacity_check_(capacity == -1 || skip_capacity_check),
4480 replace_invalid_utf8_(replace_invalid_utf8),
4481 utf16_chars_read_(0) {
4488 bool replace_invalid_utf8) {
4489 using namespace unibrow;
4494 if (Utf16::IsSurrogatePair(last_character, character)) {
4495 int written = Utf8::Encode(buffer,
4498 replace_invalid_utf8);
4503 char temp_buffer[Utf8::kMaxEncodedSize];
4505 int written = Utf8::Encode(temp_buffer,
4507 Utf16::kNoPreviousCharacter,
4508 replace_invalid_utf8);
4510 if (written > remaining)
return 0;
4512 for (
int j = 0; j < written; j++) {
4513 buffer[j] = temp_buffer[j];
4528 template<
typename Char>
4529 void Visit(
const Char* chars,
const int length) {
4530 using namespace unibrow;
4531 ASSERT(!early_termination_);
4532 if (length == 0)
return;
4534 char* buffer = buffer_;
4535 int last_character =
4536 sizeof(Char) == 1 ? Utf16::kNoPreviousCharacter : last_character_;
4541 if (skip_capacity_check_) {
4542 fast_length = length;
4544 int remaining_capacity = capacity_ -
static_cast<int>(buffer - start_);
4546 STATIC_ASSERT(Utf16::kMaxExtraUtf8BytesForOneUtf16CodeUnit == 3);
4547 int max_size_per_char =
sizeof(Char) == 1 ? 2 : 3;
4548 int writable_length =
4549 (remaining_capacity - max_size_per_char)/max_size_per_char;
4551 if (writable_length <= 0)
break;
4552 fast_length = i + writable_length;
4553 if (fast_length > length) fast_length = length;
4556 if (
sizeof(Char) == 1) {
4557 for (; i < fast_length; i++) {
4559 Utf8::EncodeOneByte(buffer, static_cast<uint8_t>(*chars++));
4560 ASSERT(capacity_ == -1 || (buffer - start_) <= capacity_);
4563 for (; i < fast_length; i++) {
4565 buffer += Utf8::Encode(buffer,
4568 replace_invalid_utf8_);
4569 last_character = character;
4570 ASSERT(capacity_ == -1 || (buffer - start_) <= capacity_);
4574 if (fast_length == length) {
4576 last_character_ = last_character;
4578 utf16_chars_read_ += length;
4582 ASSERT(!skip_capacity_check_);
4584 int remaining_capacity = capacity_ -
static_cast<int>(buffer - start_);
4585 ASSERT(remaining_capacity >= 0);
4586 for (; i < length && remaining_capacity > 0; i++) {
4590 if (replace_invalid_utf8_ && Utf16::IsLeadSurrogate(character)) {
4591 early_termination_ =
true;
4594 int written = WriteEndCharacter(character,
4598 replace_invalid_utf8_);
4600 early_termination_ =
true;
4604 remaining_capacity -= written;
4605 last_character = character;
4608 last_character_ = last_character;
4610 utf16_chars_read_ += i;
4614 return early_termination_;
4618 Visit(chars, length);
4622 Visit(chars, length);
4627 if (utf16_chars_read_out !=
NULL) {
4628 *utf16_chars_read_out = utf16_chars_read_;
4632 !early_termination_ &&
4633 (capacity_ == -1 || (buffer_ - start_) < capacity_)) {
4636 return static_cast<int>(buffer_ - start_);
4640 bool early_termination_;
4641 int last_character_;
4645 bool const skip_capacity_check_;
4646 bool const replace_invalid_utf8_;
4647 int utf16_chars_read_;
4652 static bool RecursivelySerializeToUtf8(
i::String* current,
4653 Utf8WriterVisitor* writer,
4654 int recursion_budget) {
4655 while (!writer->IsDone()) {
4657 if (cons_string ==
NULL)
return true;
4658 if (recursion_budget <= 0)
return false;
4661 bool success = RecursivelySerializeToUtf8(first,
4663 recursion_budget - 1);
4664 if (!success)
return false;
4666 current = cons_string->
second();
4675 int options)
const {
4677 LOG_API(isolate,
"String::WriteUtf8");
4680 if (options & HINT_MANY_WRITES_EXPECTED) {
4683 const int string_length = str->length();
4684 bool write_null = !(options & NO_NULL_TERMINATION);
4685 bool replace_invalid_utf8 = (options & REPLACE_INVALID_UTF8);
4688 if (capacity == -1 || capacity / max16BitCodeUnitSize >= string_length) {
4690 const int kMaxRecursion = 100;
4691 bool success = RecursivelySerializeToUtf8(*str, &writer, kMaxRecursion);
4692 if (success)
return writer.
CompleteWrite(write_null, nchars_ref);
4693 }
else if (capacity >= string_length) {
4695 int utf8_bytes = v8::Utf8Length(*str, str->GetIsolate());
4696 if (utf8_bytes <= capacity) {
4698 if (utf8_bytes == string_length) {
4699 WriteOneByte(reinterpret_cast<uint8_t*>(buffer), 0, capacity, options);
4700 if (nchars_ref !=
NULL) *nchars_ref = string_length;
4701 if (write_null && (utf8_bytes+1 <= capacity)) {
4702 return string_length + 1;
4704 return string_length;
4706 if (write_null && (utf8_bytes+1 > capacity)) {
4707 options |= NO_NULL_TERMINATION;
4712 return WriteUtf8(buffer, -1, nchars_ref, options);
4723 template<
typename CharType>
4724 static inline int WriteHelper(
const String*
string,
4730 LOG_API(isolate,
"String::Write");
4732 ASSERT(start >= 0 && length >= -1);
4740 int end = start + length;
4741 if ((length == -1) || (length > str->length() - start) )
4742 end = str->length();
4743 if (end < 0)
return 0;
4746 (length == -1 || end - start < length)) {
4747 buffer[end - start] =
'\0';
4756 int options)
const {
4757 return WriteHelper(
this, buffer, start, length, options);
4764 int options)
const {
4765 return WriteHelper(
this, buffer, start, length, options);
4771 EnsureInitializedForIsolate(str->GetIsolate(),
"v8::String::IsExternal()");
4772 return i::StringShape(*str).IsExternalTwoByte();
4778 return i::StringShape(*str).IsExternalAscii();
4782 void v8::String::VerifyExternalStringResource(
4786 if (i::StringShape(*str).IsExternalTwoByte()) {
4787 const void* resource =
4789 expected =
reinterpret_cast<const ExternalStringResource*
>(resource);
4796 void v8::String::VerifyExternalStringResourceBase(
4800 Encoding expectedEncoding;
4801 if (i::StringShape(*str).IsExternalAscii()) {
4802 const void* resource =
4804 expected =
reinterpret_cast<const ExternalStringResourceBase*
>(resource);
4805 expectedEncoding = ASCII_ENCODING;
4806 }
else if (i::StringShape(*str).IsExternalTwoByte()) {
4807 const void* resource =
4809 expected =
reinterpret_cast<const ExternalStringResourceBase*
>(resource);
4810 expectedEncoding = TWO_BYTE_ENCODING;
4813 expectedEncoding = str->IsOneByteRepresentation() ? ASCII_ENCODING
4814 : TWO_BYTE_ENCODING;
4817 CHECK_EQ(expectedEncoding, encoding);
4823 if (i::StringShape(*str).IsExternalAscii()) {
4824 const void* resource =
4841 return reinterpret_cast<const Symbol*
>(
this)->Name();
4847 return obj->Number();
4853 return obj->IsTrue();
4862 return static_cast<int64_t
>(obj->Number());
4872 return static_cast<int32_t>(obj->Number());
4882 return static_cast<uint32_t
>(obj->Number());
4889 return obj->GetInternalFieldCount();
4895 const char* location) {
4898 "Internal field out of bounds");
4902 Local<Value> v8::Object::SlowGetInternalField(
int index) {
4904 const char* location =
"v8::Object::GetInternalField()";
4905 if (!InternalFieldOK(obj, index, location))
return Local<Value>();
4913 const char* location =
"v8::Object::SetInternalField()";
4914 if (!InternalFieldOK(obj, index, location))
return;
4916 obj->SetInternalField(index, *val);
4917 ASSERT_EQ(value, GetInternalField(index));
4921 void* v8::Object::SlowGetAlignedPointerFromInternalField(
int index) {
4923 const char* location =
"v8::Object::GetAlignedPointerFromInternalField()";
4924 if (!InternalFieldOK(obj, index, location))
return NULL;
4925 return DecodeSmiToAligned(obj->GetInternalField(index), location);
4931 const char* location =
"v8::Object::SetAlignedPointerInInternalField()";
4932 if (!InternalFieldOK(obj, index, location))
return;
4933 obj->SetInternalField(index, EncodeAlignedAsSmi(value, location));
4934 ASSERT_EQ(value, GetAlignedPointerFromInternalField(index));
4938 static void* ExternalValue(
i::Object* obj) {
4940 if (obj->IsUndefined())
return NULL;
4950 #ifdef V8_USE_DEFAULT_PLATFORM
4951 FATAL(
"Can't override v8::Platform when using default implementation");
4959 #ifdef V8_USE_DEFAULT_PLATFORM
4960 FATAL(
"Can't override v8::Platform when using default implementation");
4968 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
4972 return InitializeHelper(isolate);
4977 i::RandomNumberGenerator::SetEntropySource(entropy_source);
5021 "v8::V8::SetArrayBufferAllocator",
5022 "ArrayBufferAllocator might only be set once"))
5031 "v8::V8::Dispose()",
5032 "Use v8::Isolate::Dispose() for non-default isolate.")) {
5041 total_heap_size_executable_(0),
5042 total_physical_size_(0),
5044 heap_size_limit_(0) { }
5056 : visitor_(visitor) {}
5082 ASSERT(isolate == i::Isolate::Current());
5096 if (!i::FLAG_use_idle_notification)
return true;
5139 if (!global_template.
IsEmpty()) {
5141 global_constructor = EnsureConstructor(isolate, *global_template);
5145 reinterpret_cast<v8::Isolate*>(isolate));
5146 proxy_constructor = EnsureConstructor(isolate, *proxy_template);
5150 proxy_constructor->set_prototype_template(
5156 if (!global_constructor->access_check_info()->IsUndefined()) {
5157 proxy_constructor->set_access_check_info(
5158 global_constructor->access_check_info());
5159 proxy_constructor->set_needs_access_check(
5160 global_constructor->needs_access_check());
5161 global_constructor->set_needs_access_check(
false);
5162 global_constructor->set_access_check_info(
5163 isolate->
heap()->undefined_value());
5174 if (!global_template.
IsEmpty()) {
5177 global_constructor->set_access_check_info(
5178 proxy_constructor->access_check_info());
5179 global_constructor->set_needs_access_check(
5180 proxy_constructor->needs_access_check());
5194 EnsureInitializedForIsolate(isolate,
"v8::Context::New()");
5195 LOG_API(isolate,
"Context::New");
5199 if (extensions ==
NULL) extensions = &no_extensions;
5201 CreateEnvironment(isolate, extensions, global_template, global_object);
5212 env->set_security_token(*token_handle);
5220 env->set_security_token(env->global_object());
5227 i::Object* security_token = env->security_token();
5235 return reinterpret_cast<Isolate*
>(env->GetIsolate());
5246 global)->IsDetachedFrom(context->global_object())) {
5265 context->set_allow_code_gen_from_strings(
5266 allow ? isolate->
heap()->true_value() : isolate->
heap()->false_value());
5272 return !context->allow_code_gen_from_strings()->IsFalse();
5280 context->set_error_message_for_code_gen_from_strings(*error_handle);
5286 ON_BAILOUT(isolate,
"v8::ObjectTemplate::NewInstance()",
5288 LOG_API(isolate,
"ObjectTemplate::NewInstance");
5293 &has_pending_exception);
5301 ON_BAILOUT(isolate,
"v8::FunctionTemplate::GetFunction()",
5303 LOG_API(isolate,
"FunctionTemplate::GetFunction");
5308 &has_pending_exception);
5315 ON_BAILOUT(i::Isolate::Current(),
"v8::FunctionTemplate::HasInstanceOf()",
5325 EnsureInitializedForIsolate(i_isolate,
"v8::External::New()");
5326 LOG_API(i_isolate,
"External::New");
5341 inline int StringLength(
const char*
string) {
5346 inline int StringLength(
const uint8_t*
string) {
5347 return i::StrLength(reinterpret_cast<const char*>(
string));
5351 inline int StringLength(
const uint16_t*
string) {
5353 while (
string[length] !=
'\0')
5389 template<
typename Char>
5390 inline Local<String> NewString(Isolate* v8_isolate,
5391 const char* location,
5396 i::Isolate* isolate =
reinterpret_cast<internal::Isolate*
>(v8_isolate);
5397 EnsureInitializedForIsolate(isolate, location);
5403 if (length == -1) length = StringLength(data);
5409 result->MarkAsUndetectable();
5421 return NewString(isolate,
5422 "v8::String::NewFromUtf8()",
5423 "String::NewFromUtf8",
5431 const uint8_t* data,
5434 return NewString(isolate,
5435 "v8::String::NewFromOneByte()",
5436 "String::NewFromOneByte",
5447 return NewString(isolate,
5448 "v8::String::NewFromTwoByte()",
5449 "String::NewFromTwoByte",
5458 i::Isolate* isolate = left_string->GetIsolate();
5459 EnsureInitializedForIsolate(isolate,
"v8::String::New()");
5460 LOG_API(isolate,
"String::New(char)");
5497 EnsureInitializedForIsolate(i_isolate,
"v8::String::NewExternal()");
5498 LOG_API(i_isolate,
"String::NewExternal");
5510 if (i::StringShape(*obj).IsExternalTwoByte()) {
5522 bool result = obj->MakeExternal(resource);
5524 ASSERT(obj->IsExternalString());
5535 EnsureInitializedForIsolate(i_isolate,
"v8::String::NewExternal()");
5536 LOG_API(i_isolate,
"String::NewExternal");
5540 NewExternalAsciiStringHandle(i_isolate, resource);
5550 if (i::StringShape(*obj).IsExternalTwoByte()) {
5562 bool result = obj->MakeExternal(resource);
5564 ASSERT(obj->IsExternalString());
5572 if (!internal::FLAG_clever_optimizations)
return false;
5582 int size = obj->Size();
5584 i::StringShape shape(*obj);
5585 return !shape.IsExternal();
5591 EnsureInitializedForIsolate(i_isolate,
"v8::Object::New()");
5592 LOG_API(i_isolate,
"Object::New");
5602 EnsureInitializedForIsolate(i_isolate,
"v8::NumberObject::New()");
5603 LOG_API(i_isolate,
"NumberObject::New");
5613 LOG_API(isolate,
"NumberObject::NumberValue");
5616 return jsvalue->value()->Number();
5622 EnsureInitializedForIsolate(isolate,
"v8::BooleanObject::New()");
5623 LOG_API(isolate,
"BooleanObject::New");
5626 ? isolate->
heap()->true_value()
5627 : isolate->
heap()->false_value(),
5636 LOG_API(isolate,
"BooleanObject::BooleanValue");
5639 return jsvalue->value()->IsTrue();
5645 EnsureInitializedForIsolate(isolate,
"v8::StringObject::New()");
5646 LOG_API(isolate,
"StringObject::New");
5656 LOG_API(isolate,
"StringObject::StringValue");
5666 EnsureInitializedForIsolate(i_isolate,
"v8::SymbolObject::New()");
5667 LOG_API(i_isolate,
"SymbolObject::New");
5677 LOG_API(isolate,
"SymbolObject::SymbolValue");
5687 EnsureInitializedForIsolate(i_isolate,
"v8::Date::New()");
5688 LOG_API(i_isolate,
"Date::New");
5704 LOG_API(isolate,
"Date::NumberValue");
5707 return jsdate->value()->Number();
5713 ON_BAILOUT(i_isolate,
"v8::Date::DateTimeConfigurationChangeNotification()",
5715 LOG_API(i_isolate,
"Date::DateTimeConfigurationChangeNotification");
5727 ASSERT_EQ(1, date_cache_version->length());
5728 CHECK(date_cache_version->get(0)->IsSmi());
5729 date_cache_version->set(
5737 uint8_t flags_buf[3];
5751 EnsureInitializedForIsolate(isolate,
"v8::RegExp::New()");
5752 LOG_API(isolate,
"RegExp::New");
5757 RegExpFlagsToString(flags),
5758 &has_pending_exception);
5771 #define REGEXP_FLAG_ASSERT_EQ(api_flag, internal_flag) \
5772 STATIC_ASSERT(static_cast<int>(v8::RegExp::api_flag) == \
5773 static_cast<int>(i::JSRegExp::internal_flag))
5778 #undef REGEXP_FLAG_ASSERT_EQ
5788 EnsureInitializedForIsolate(i_isolate,
"v8::Array::New()");
5789 LOG_API(i_isolate,
"Array::New");
5791 int real_length = length > 0 ? length : 0;
5795 obj->set_length(*length_obj);
5803 if (length->IsSmi()) {
5806 return static_cast<uint32_t
>(length->
Number());
5815 if (!self->HasFastObjectElements()) {
5820 if (!paragon->IsJSObject()) {
5827 has_pending_exception = result.
is_null();
5835 if (!val->IsJSObject())
return false;
5838 LOG_API(isolate,
"IsPromise");
5846 isolate->
factory()->undefined_value(),
5848 &has_pending_exception,
5851 return b->BooleanValue();
5857 LOG_API(isolate,
"Promise::Resolver::New");
5864 isolate->
factory()->undefined_value(),
5866 &has_pending_exception,
5882 LOG_API(isolate,
"Promise::Resolver::Resolve");
5890 isolate->
factory()->undefined_value(),
5892 &has_pending_exception,
5901 LOG_API(isolate,
"Promise::Resolver::Reject");
5909 isolate->
factory()->undefined_value(),
5911 &has_pending_exception,
5920 LOG_API(isolate,
"Promise::Chain");
5930 &has_pending_exception,
5940 LOG_API(isolate,
"Promise::Catch");
5950 &has_pending_exception,
5965 "v8::ArrayBuffer::Externalize",
5966 "ArrayBuffer already externalized");
5967 obj->set_is_external(
true);
5968 size_t byte_length =
static_cast<size_t>(obj->byte_length()->Number());
5970 contents.data_ = obj->backing_store();
5971 contents.byte_length_ = byte_length;
5980 "v8::ArrayBuffer::Neuter",
5981 "Only externalized ArrayBuffers can be neutered");
5982 LOG_API(obj->GetIsolate(),
"v8::ArrayBuffer::Neuter()");
5990 return static_cast<size_t>(obj->byte_length()->Number());
5996 EnsureInitializedForIsolate(i_isolate,
"v8::ArrayBuffer::New(size_t)");
5997 LOG_API(i_isolate,
"v8::ArrayBuffer::New(size_t)");
6007 size_t byte_length) {
6009 EnsureInitializedForIsolate(i_isolate,
"v8::ArrayBuffer::New(void*, size_t)");
6010 LOG_API(i_isolate,
"v8::ArrayBuffer::New(void*, size_t)");
6022 if (obj->IsJSDataView()) {
6024 ASSERT(data_view->buffer()->IsJSArrayBuffer());
6027 ASSERT(obj->IsJSTypedArray());
6036 return static_cast<size_t>(obj->byte_offset()->Number());
6042 return static_cast<size_t>(obj->byte_length()->Number());
6048 return static_cast<size_t>(obj->length()->Number());
6052 static inline void SetupArrayBufferView(
6057 size_t byte_length) {
6058 ASSERT(byte_offset + byte_length <=
6059 static_cast<size_t>(buffer->byte_length()->Number()));
6061 obj->set_buffer(*buffer);
6063 obj->set_weak_next(buffer->weak_first_view());
6064 buffer->set_weak_first_view(*obj);
6068 obj->set_byte_offset(*byte_offset_object);
6072 obj->set_byte_length(*byte_length_object);
6075 template<
typename ElementType,
6085 ASSERT(byte_offset %
sizeof(ElementType) == 0);
6087 CHECK(length <= (std::numeric_limits<size_t>::max() /
sizeof(ElementType)));
6088 size_t byte_length = length *
sizeof(ElementType);
6089 SetupArrayBufferView(
6090 isolate, obj, buffer, byte_offset, byte_length);
6094 obj->set_length(*length_object);
6098 static_cast<int>(length), array_type,
6099 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset);
6102 obj->set_map_and_elements(*map, *elements);
6107 #define TYPED_ARRAY_NEW(Type, type, TYPE, ctype, size) \
6108 Local<Type##Array> Type##Array::New(Handle<ArrayBuffer> array_buffer, \
6109 size_t byte_offset, size_t length) { \
6110 i::Isolate* isolate = i::Isolate::Current(); \
6111 EnsureInitializedForIsolate(isolate, \
6112 "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)"); \
6114 "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)"); \
6115 ENTER_V8(isolate); \
6116 i::Handle<i::JSTypedArray> obj = \
6117 NewTypedArray<ctype, v8::kExternal##Type##Array, \
6118 i::EXTERNAL_##TYPE##_ELEMENTS>( \
6119 isolate, array_buffer, byte_offset, length); \
6120 return Utils::ToLocal##Type##Array(obj); \
6125 #undef TYPED_ARRAY_NEW
6128 size_t byte_offset,
size_t byte_length) {
6130 EnsureInitializedForIsolate(
6131 isolate,
"v8::DataView::New(void*, size_t, size_t)");
6132 LOG_API(isolate,
"v8::DataView::New(void*, size_t, size_t)");
6136 SetupArrayBufferView(
6137 isolate, obj, buffer, byte_offset, byte_length);
6144 EnsureInitializedForIsolate(i_isolate,
"v8::Symbol::New()");
6145 LOG_API(i_isolate,
"Symbol::New()");
6161 if (!symbol->IsSymbol()) {
6162 ASSERT(symbol->IsUndefined());
6179 if (!symbol->IsSymbol()) {
6180 ASSERT(symbol->IsUndefined());
6191 EnsureInitializedForIsolate(i_isolate,
"v8::Private::New()");
6192 LOG_API(i_isolate,
"Private::New()");
6209 if (!symbol->IsSymbol()) {
6210 ASSERT(symbol->IsUndefined());
6249 bool fits_into_int32_t = (value & (1 << 31)) == 0;
6250 if (fits_into_int32_t) {
6251 return Integer::New(isolate, static_cast<int32_t>(value));
6261 EnsureInitializedForIsolate(isolate,
"v8::V8::AddMessageListener()");
6262 ON_BAILOUT(isolate,
"v8::V8::AddMessageListener()",
return false);
6268 obj.set(1, data.
IsEmpty() ? isolate->
heap()->undefined_value()
6270 listeners.add(obj.value());
6277 EnsureInitializedForIsolate(isolate,
"v8::V8::RemoveMessageListener()");
6278 ON_BAILOUT(isolate,
"v8::V8::RemoveMessageListeners()",
return);
6282 for (
int i = 0; i < listeners.length(); i++) {
6283 if (listeners.get(i)->IsUndefined())
continue;
6287 if (callback_obj->foreign_address() ==
FUNCTION_ADDR(that)) {
6288 listeners.set(i, isolate->
heap()->undefined_value());
6298 i::Isolate::Current()->SetCaptureStackTraceForUncaughtExceptions(
6306 i::Isolate* isolate = EnterIsolateIfNeeded();
6312 i::Isolate* isolate = EnterIsolateIfNeeded();
6320 i::Isolate* isolate = EnterIsolateIfNeeded();
6322 SetAddHistogramSampleFunction(callback);
6333 int64_t change_in_bytes) {
6341 reinterpret_cast<i::Isolate*
>(
this)->heap_profiler();
6348 reinterpret_cast<i::Isolate*
>(
this)->cpu_profiler();
6349 return reinterpret_cast<CpuProfiler*
>(cpu_profiler);
6396 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
6422 reinterpret_cast<i::HeapObject**>(parent_location),
6456 reinterpret_cast<v8::Isolate::GCPrologueCallback>(callback),
6465 reinterpret_cast<v8::Isolate::GCPrologueCallback>(callback));
6472 reinterpret_cast<v8::Isolate::GCEpilogueCallback>(callback),
6481 reinterpret_cast<v8::Isolate::GCEpilogueCallback>(callback));
6490 callback, space, action);
6502 if (callback ==
NULL)
return;
6522 reinterpret_cast<i::Isolate*
>(isolate)->set_autorun_microtasks(autorun);
6533 if (isolate !=
NULL) {
6543 reinterpret_cast<i::Isolate*
>(isolate) : i::Isolate::Current();
6544 return IsExecutionTerminatingCheck(i_isolate);
6555 reinterpret_cast<i::Isolate*
>(
this)->stack_guard()->RequestInterrupt(
6561 reinterpret_cast<i::Isolate*
>(
this)->stack_guard()->ClearInterrupt();
6566 CHECK(i::FLAG_expose_gc);
6567 if (type == kMinorGarbageCollection) {
6572 ASSERT_EQ(kFullGarbageCollection, type);
6581 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
6582 return reinterpret_cast<Isolate*
>(isolate);
6588 return reinterpret_cast<Isolate*
>(isolate);
6595 "v8::Isolate::Dispose()",
6596 "Disposing the isolate that is entered by a thread.")) {
6618 : on_failure_(on_failure) {
6621 internal_ =
reinterpret_cast<void*
>(
6625 internal_ =
reinterpret_cast<void*
>(
6632 if (on_failure_ == CRASH_ON_FAILURE) {
6643 internal_assert_ =
reinterpret_cast<void*
>(
6645 internal_throws_ =
reinterpret_cast<void*
>(
6659 heap_statistics->total_heap_size_ = 0;
6660 heap_statistics->total_heap_size_executable_ = 0;
6661 heap_statistics->total_physical_size_ = 0;
6662 heap_statistics->used_heap_size_ = 0;
6663 heap_statistics->heap_size_limit_ = 0;
6668 heap_statistics->total_heap_size_executable_ =
6672 heap_statistics->heap_size_limit_ = heap->
MaxReserved();
6678 isolate->set_event_logger(that);
6682 : str_(
NULL), length_(0) {
6691 length_ = v8::Utf8Length(*i_str, isolate);
6692 str_ = i::NewArray<char>(length_ + 1);
6703 : str_(
NULL), length_(0) {
6712 str_ = i::NewArray<uint16_t>(length_ + 1);
6724 LOG_API(isolate,
"RangeError");
6741 LOG_API(isolate,
"ReferenceError");
6759 LOG_API(isolate,
"SyntaxError");
6776 LOG_API(isolate,
"TypeError");
6810 #ifdef ENABLE_DEBUGGER_SUPPORT
6814 EnsureInitializedForIsolate(isolate,
"v8::Debug::SetDebugEventListener2()");
6815 ON_BAILOUT(isolate,
"v8::Debug::SetDebugEventListener2()",
return false);
6822 isolate->debugger()->SetEventListener(foreign,
6829 Handle<Value> data) {
6831 ON_BAILOUT(isolate,
"v8::Debug::SetDebugEventListener()",
return false);
6841 if (isolate !=
NULL) {
6842 reinterpret_cast<i::Isolate*
>(isolate)->stack_guard()->DebugBreak();
6851 if (isolate !=
NULL) {
6862 if (isolate !=
NULL) {
6864 internal_isolate->debugger()->EnqueueDebugCommand(data);
6866 i::Isolate::GetDefaultIsolateDebugger()->EnqueueDebugCommand(data);
6873 EnsureInitializedForIsolate(isolate,
"v8::Debug::SetMessageHandler");
6875 isolate->debugger()->SetMessageHandler(handler);
6882 ClientData* client_data) {
6884 internal_isolate->debugger()->ProcessCommand(
6890 ClientData* client_data,
6893 if (isolate !=
NULL) {
6895 internal_isolate->debugger()->ProcessCommand(
6898 i::Isolate::GetDefaultIsolateDebugger()->ProcessCommand(
6907 EnsureInitializedForIsolate(isolate,
"v8::Debug::SetHostDispatchHandler");
6909 isolate->debugger()->SetHostDispatchHandler(
6910 handler, i::TimeDelta::FromMilliseconds(period));
6915 DebugMessageDispatchHandler handler,
bool provide_locker) {
6917 EnsureInitializedForIsolate(isolate,
6918 "v8::Debug::SetDebugMessageDispatchHandler");
6920 isolate->debugger()->SetDebugMessageDispatchHandler(
6921 handler, provide_locker);
6929 ON_BAILOUT(isolate,
"v8::Debug::Call()",
return Local<Value>());
6935 isolate->
factory()->undefined_value(),
6936 &has_pending_exception);
6940 &has_pending_exception);
6950 ON_BAILOUT(isolate,
"v8::Debug::GetMirror()",
return Local<Value>());
6953 i::Debug* isolate_debug = isolate->debug();
6954 isolate_debug->Load();
6961 const int kArgc = 1;
6967 return scope.Escape(result);
6972 return i::Isolate::Current()->debugger()->StartAgent(name, port,
6973 wait_for_connection);
6978 return i::Isolate::Current()->debugger()->StopAgent();
6983 i::Execution::ProcessDebugMessages(i::Isolate::Current(),
true);
6989 EnsureInitializedForIsolate(isolate,
"v8::Debug::GetDebugContext()");
6991 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext());
6997 i::Debugger* debugger;
6998 if (isolate !=
NULL) {
7000 debugger = internal_isolate->debugger();
7002 debugger = i::Isolate::GetDefaultIsolateDebugger();
7004 debugger->set_live_edit_enabled(enable);
7008 #endif // ENABLE_DEBUGGER_SUPPORT
7016 return ToApiHandle<String>(
7024 return ToApiHandle<String>(cons);
7045 return reinterpret_cast<const i::ProfileNode*
>(
this)->entry()->line_number();
7051 entry()->column_number();
7062 return reinterpret_cast<const i::ProfileNode*
>(
this)->self_ticks();
7067 return reinterpret_cast<const i::ProfileNode*
>(
this)->entry()->GetCallUid();
7077 return reinterpret_cast<const i::ProfileNode*
>(
this)->children()->length();
7083 reinterpret_cast<const i::ProfileNode*
>(
this)->children()->at(index);
7092 profiler->
DeleteProfile(reinterpret_cast<i::CpuProfile*>(
this));
7118 return (profile->
start_time() - i::Time::UnixEpoch()).InMicroseconds();
7124 return (profile->
end_time() - i::Time::UnixEpoch()).InMicroseconds();
7129 return reinterpret_cast<const i::CpuProfile*
>(
this)->samples_count();
7135 return reinterpret_cast<i::CpuProfiler*
>(
this)->set_sampling_interval(
7136 i::TimeDelta::FromMicroseconds(us));
7147 StartProfiling(title, record_samples);
7159 return StopProfiling(title);
7169 isolate->set_current_vm_state(
i::IDLE);
7170 }
else if (state ==
i::IDLE) {
7176 static i::HeapGraphEdge* ToInternal(
const HeapGraphEdge* edge) {
7177 return const_cast<i::HeapGraphEdge*
>(
7178 reinterpret_cast<const i::HeapGraphEdge*
>(edge));
7189 i::HeapGraphEdge* edge = ToInternal(
this);
7190 switch (edge->type()) {
7191 case i::HeapGraphEdge::kContextVariable:
7192 case i::HeapGraphEdge::kInternal:
7193 case i::HeapGraphEdge::kProperty:
7194 case i::HeapGraphEdge::kShortcut:
7195 case i::HeapGraphEdge::kWeak:
7196 return ToApiHandle<String>(
7198 case i::HeapGraphEdge::kElement:
7199 case i::HeapGraphEdge::kHidden:
7200 return ToApiHandle<Number>(
7204 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
7209 const i::HeapEntry* from = ToInternal(
this)->from();
7215 const i::HeapEntry* to = ToInternal(
this)->to();
7220 static i::HeapEntry* ToInternal(
const HeapGraphNode* entry) {
7221 return const_cast<i::HeapEntry*
>(
7222 reinterpret_cast<const i::HeapEntry*
>(entry));
7233 return ToApiHandle<String>(
7239 return ToInternal(
this)->id();
7243 int HeapGraphNode::GetSelfSize()
const {
7244 size_t size = ToInternal(
this)->self_size();
7246 return static_cast<int>(
size);
7251 return ToInternal(
this)->self_size();
7256 return ToInternal(
this)->children().length();
7262 ToInternal(
this)->children()[index]);
7275 ToInternal(
this)->Delete();
7284 return ToInternal(
this)->uid();
7290 return ToApiHandle<String>(
7296 return reinterpret_cast<const HeapGraphNode*
>(ToInternal(
this)->root());
7302 ToInternal(
this)->GetEntryById(
id));
7307 return ToInternal(
this)->entries().length();
7313 &ToInternal(
this)->entries().at(index));
7318 return ToInternal(
this)->max_snapshot_js_object_id();
7325 "v8::HeapSnapshot::Serialize",
7326 "Unknown serialization format");
7328 "v8::HeapSnapshot::Serialize",
7329 "Invalid stream chunk size");
7331 serializer.Serialize(stream);
7348 return reinterpret_cast<i::HeapProfiler*
>(
this)->GetSnapshotObjectId(obj);
7387 return reinterpret_cast<i::HeapProfiler*
>(
this)->PushHeapObjectsStats(stream);
7397 WrapperInfoCallback callback) {
7398 reinterpret_cast<i::HeapProfiler*
>(
this)->DefineWrapperClass(class_id,
7405 GetMemorySizeUsedByProfiler();
7411 reinterpret_cast<i::HeapProfiler*
>(
this)->SetRetainedObjectInfo(
id, info);
7425 if (internal::FLAG_stress_runs != 0)
return internal::FLAG_stress_runs;
7436 static void SetFlagsFromString(
const char* flags) {
7442 static const char* kLazyOptimizations =
7443 "--prepare-always-opt "
7444 "--max-inlined-source-size=999999 "
7445 "--max-inlined-nodes=999999 "
7446 "--max-inlined-nodes-cumulative=999999 "
7448 static const char* kForcedOptimizations =
"--always-opt";
7452 static const char* kDeoptEvery13Times =
"--deopt-every-n-times=13";
7454 internal::FLAG_deopt_every_n_times == 0) {
7455 SetFlagsFromString(kDeoptEvery13Times);
7461 if (run == GetStressRuns() - 1) {
7462 SetFlagsFromString(kForcedOptimizations);
7464 SetFlagsFromString(kLazyOptimizations);
7467 if (run == GetStressRuns() - 1) {
7468 SetFlagsFromString(kForcedOptimizations);
7469 }
else if (run != GetStressRuns() - 2) {
7470 SetFlagsFromString(kLazyOptimizations);
7484 namespace internal {
7487 void HandleScopeImplementer::FreeThreadResources() {
7492 char* HandleScopeImplementer::ArchiveThread(
char* storage) {
7494 handle_scope_data_ = *current;
7495 OS::MemCopy(storage,
this,
sizeof(*
this));
7497 ResetAfterArchive();
7500 return storage + ArchiveSpacePerThread();
7504 int HandleScopeImplementer::ArchiveSpacePerThread() {
7509 char* HandleScopeImplementer::RestoreThread(
char* storage) {
7510 OS::MemCopy(
this, storage,
sizeof(*
this));
7511 *isolate_->handle_scope_data() = handle_scope_data_;
7512 return storage + ArchiveSpacePerThread();
7516 void HandleScopeImplementer::IterateThis(ObjectVisitor* v) {
7518 bool found_block_before_deferred =
false;
7521 for (
int i = blocks()->length() - 2; i >= 0; --i) {
7522 Object** block = blocks()->at(i);
7523 if (last_handle_before_deferred_block_ !=
NULL &&
7525 (last_handle_before_deferred_block_ >= block)) {
7526 v->VisitPointers(block, last_handle_before_deferred_block_);
7527 ASSERT(!found_block_before_deferred);
7529 found_block_before_deferred =
true;
7532 v->VisitPointers(block, &block[kHandleBlockSize]);
7536 ASSERT(last_handle_before_deferred_block_ ==
NULL ||
7537 found_block_before_deferred);
7540 if (!blocks()->is_empty()) {
7541 v->VisitPointers(blocks()->last(), handle_scope_data_.next);
7544 List<Context*>* context_lists[2] = { &saved_contexts_, &entered_contexts_};
7545 for (
unsigned i = 0; i <
ARRAY_SIZE(context_lists); i++) {
7546 if (context_lists[i]->is_empty())
continue;
7547 Object** start =
reinterpret_cast<Object**
>(&context_lists[i]->first());
7548 v->VisitPointers(start, start + context_lists[i]->length());
7553 void HandleScopeImplementer::Iterate(ObjectVisitor* v) {
7555 handle_scope_data_ = *current;
7560 char* HandleScopeImplementer::Iterate(ObjectVisitor* v,
char* storage) {
7563 scope_implementer->IterateThis(v);
7564 return storage + ArchiveSpacePerThread();
7572 while (!blocks_.is_empty()) {
7573 Object** block_start = blocks_.last();
7576 ASSERT(prev_limit == block_limit ||
7577 !(block_start <= prev_limit && prev_limit <= block_limit));
7578 if (prev_limit == block_limit)
break;
7579 deferred->blocks_.Add(blocks_.last());
7580 blocks_.RemoveLast();
7587 ASSERT(prev_limit ==
NULL || !blocks_.is_empty());
7589 ASSERT(!blocks_.is_empty() && prev_limit !=
NULL);
7590 ASSERT(last_handle_before_deferred_block_ !=
NULL);
7591 last_handle_before_deferred_block_ =
NULL;
7596 void HandleScopeImplementer::BeginDeferredScope() {
7597 ASSERT(last_handle_before_deferred_block_ ==
NULL);
7598 last_handle_before_deferred_block_ = isolate()->handle_scope_data()->next;
7602 DeferredHandles::~DeferredHandles() {
7603 isolate_->UnlinkDeferredHandles(
this);
7605 for (
int i = 0; i < blocks_.length(); i++) {
7606 #ifdef ENABLE_HANDLE_ZAPPING
7607 HandleScope::ZapRange(blocks_[i], &blocks_[i][kHandleBlockSize]);
7609 isolate_->handle_scope_implementer()->ReturnBlock(blocks_[i]);
7614 void DeferredHandles::Iterate(ObjectVisitor* v) {
7615 ASSERT(!blocks_.is_empty());
7617 ASSERT((first_block_limit_ >= blocks_.first()) &&
7618 (first_block_limit_ <= &(blocks_.first())[kHandleBlockSize]));
7620 v->VisitPointers(blocks_.first(), first_block_limit_);
7622 for (
int i = 1; i < blocks_.length(); i++) {
7623 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7634 Address getter_address =
reinterpret_cast<Address>(
reinterpret_cast<intptr_t
>(
7637 ExternalCallbackScope call_scope(isolate, getter_address);
7638 getter(property, info);
7646 reinterpret_cast<Address>(
reinterpret_cast<intptr_t
>(callback));
7648 ExternalCallbackScope call_scope(isolate, callback_address);
static void MergeLeafRight(int *length, uint8_t *state, uint8_t leaf_state)
void SaveContext(Context *context)
void DeleteAllHeapSnapshots()
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 >())
void VisitOneByteString(const uint8_t *chars, int length)
void RequestInterrupt(InterruptCallback callback, void *data)
static Local< Signature > New(Isolate *isolate, Handle< FunctionTemplate > receiver=Handle< FunctionTemplate >(), int argc=0, Handle< FunctionTemplate > argv[]=0)
static Isolate * GetCurrent()
static Handle< 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)
void SetLength(int length)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
V8_INLINE Local< Value > GetEmbedderData(int index)
static V8_INLINE Local< T > New(Isolate *isolate, Handle< T > that)
static void set_stress_type(v8::Testing::StressType stress_type)
static Handle< Object > New(Handle< JSFunction > func, int argc, Handle< Object > argv[], bool *pending_exception)
void DeleteProfile(CpuProfile *profile)
Handle< Context > LastEnteredContext()
RegisteredExtension * next()
static Local< Symbol > ForApi(Isolate *isolate, Local< String > name)
static void SetLiveEditEnabled(bool enable, Isolate *isolate=NULL)
double NumberValue() const
static bool Initialize(Deserializer *des)
static T ** CreateHandle(Isolate *isolate, T *value)
const HeapGraphEdge * GetChild(int index) const
static const byte * data()
static void Destroy(Object **location)
int GetLineNumber() const
void FlattenString(Handle< String > string)
static void AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type_filter=kGCTypeAll)
int WriteUtf8(char *buffer, int length=-1, int *nchars_ref=NULL, int options=NO_OPTIONS) const
static void SetAllowCodeGenerationFromStringsCallback(AllowCodeGenerationFromStringsCallback that)
bool HasRealIndexedProperty(uint32_t index)
void(* MemoryAllocationCallback)(ObjectSpace space, AllocationAction action, int size)
void set_max_young_space_size(int value)
Handle< JSObject > NewJSObject(Handle< JSFunction > constructor, PretenureFlag pretenure=NOT_TENURED)
Handle< String > NewExternalStringFromAscii(const ExternalAsciiString::Resource *resource)
#define CHECK_EQ(expected, value)
bool IsTypedArray() const
uint8_t * GetIndexedPropertiesPixelData()
static bool IsExecutionTerminating(Isolate *isolate=NULL)
static const int kMaxLength
const char * title() const
CpuProfiler * GetCpuProfiler()
static int NumberOfHandles(Isolate *isolate)
const char * bailout_reason() const
Local< Value > Call(Handle< Value > recv, int argc, Handle< Value > argv[])
static internal::Object ** CreateHandle(internal::Isolate *isolate, internal::Object *value)
void StopTrackingHeapObjects()
bool DeleteHiddenValue(Handle< String > key)
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, ScriptDataImpl **cached_data, CachedDataMode cached_data_mode, NativesFlag is_natives_code)
Local< String > GetSource() const
const ExternalAsciiStringResource * GetExternalAsciiStringResource() const
static int GetStressRuns()
void(* CallCompletedCallback)()
void SetEventLogger(LogEventCallback that)
void RecordWrite(Handle< String > string)
intptr_t * old_pointer_space_size
void SetWrapperClassInfoProvider(uint16_t class_id, WrapperInfoCallback callback)
intptr_t * cell_space_size
const HeapGraphNode * GetFromNode() const
Handle< String > InternalizeString(Handle< String > str)
static void SetArrayBufferAllocator(v8::ArrayBuffer::Allocator *allocator)
SnapshotObjectId GetObjectId(Handle< Value > value)
void CollectAllGarbage(int flags, const char *gc_reason=NULL, const GCCallbackFlags gc_callback_flags=kNoGCCallbackFlags)
static Local< Private > ForApi(Isolate *isolate, Local< String > name)
static Local< Value > New(bool value)
void SetSecurityToken(Handle< Value > token)
Extension(const char *name, const char *source=0, int dep_count=0, const char **deps=0, int source_length=-1)
Local< Value > Exception() const
static Handle< Object > ToNumber(Isolate *isolate, Handle< Object > obj, bool *exc)
static String * cast(Object *obj)
void ScheduleThrow(Object *exception)
void AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback, GCType gc_type_filter, bool pass_isolate=true)
Handle< Value > FindObjectById(SnapshotObjectId id)
static void DeleteHiddenProperty(Handle< JSObject > object, Handle< Name > key)
HandleScopeImplementer * handle_scope_implementer()
ProfileNode * root() const
static void CancelTerminateExecution(Isolate *isolate)
v8::internal::Handle< v8::internal::JSObject > value()
Handle< Context > GetCallingNativeContext()
void set(int index, v8::internal::Object *value)
void SetAccessorProperty(Local< String > name, Local< Function > getter, Handle< Function > setter=Handle< Function >(), PropertyAttribute attribute=None, AccessControl settings=DEFAULT)
Local< Object > CloneElementAt(uint32_t index)
void(* FunctionCallback)(const FunctionCallbackInfo< Value > &info)
static Local< Number > NumberToLocal(v8::internal::Handle< v8::internal::Object > obj)
bool StrictEquals(Handle< Value > that) const
V8_INLINE Isolate * GetIsolate() const
int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes)
static Handle< Object > ToObject(Isolate *isolate, Handle< Object > obj, bool *exc)
static void SetAddHistogramSampleFunction(AddHistogramSampleCallback)
Local< Value > Get(Handle< Value > key)
void RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback)
static Smi * FromInt(int value)
ContainsOnlyOneByteHelper()
bool IsNativeError() const
PerIsolateAssertScope< JAVASCRIPT_EXECUTION_ASSERT, true > AllowJavascriptExecution
void SetObjectGroupId(const Persistent< T > &object, UniqueId id)
void V8_EXPORT RegisterExtension(Extension *extension)
Local< Object > NewInstance()
PropertyAttribute GetPropertyAttributes(Handle< Value > key)
Handle< JSObject > GetSymbolRegistry()
Local< Array > GetOwnPropertyNames()
void SetCaptureMessage(bool value)
static int WriteEndCharacter(uint16_t character, int last_character, int remaining, char *const buffer, bool replace_invalid_utf8)
static ObjectTemplateInfo * cast(Object *obj)
Handle< Value > GetName() const
static Local< RawOperationDescriptor > NewInternalFieldDereference(Isolate *isolate, int internal_field)
NeanderArray(v8::internal::Isolate *isolate)
static Local< AccessorSignature > AccessorSignatureToLocal(v8::internal::Handle< v8::internal::FunctionTemplateInfo > obj)
const char * GetBailoutReason() const
bool SameValue(Handle< Value > that) const
Handle< String > NewStringFromOneByte(Vector< const uint8_t > str, PretenureFlag pretenure=NOT_TENURED)
static void MergeTerminal(int *length, uint8_t state, uint8_t *state_out)
StatsTable * stats_table()
Handle< String > GetName() const
AccessorDescriptorType type
SnapshotObjectId GetId() const
bool IsBooleanObject() const
Local< DeclaredAccessorDescriptor > NewPrimitiveValue(Isolate *isolate, DeclaredAccessorDescriptorDataType data_type, uint8_t bool_offset=0)
static Handle< T > cast(Handle< S > that)
Local< String > Get() const
static void SetCaptureStackTraceForUncaughtExceptions(bool capture, int frame_limit=10, StackTrace::StackTraceOptions options=StackTrace::kOverview)
void AllowCodeGenerationFromStrings(bool allow)
Handle< JSDataView > NewJSDataView()
void AddString(String *string)
bool DeletePrivate(Handle< Private > key)
Local< Context > GetEnteredContext()
int64_t GetStartTime() const
const CpuProfileNode * GetChild(int index) const
static void ShutdownPlatform()
V8_INLINE void * GetAlignedPointerFromEmbedderData(int index)
static bool HasRealElementProperty(Handle< JSObject > object, uint32_t index)
void VisitExternalResources(v8::ExternalResourceVisitor *visitor)
bool(* IndexedSecurityCallback)(Local< Object > host, uint32_t index, AccessType type, Local< Value > data)
void Initialize(Isolate *isolate)
Local< String > GetConstructorName()
bool SetDeclaredAccessor(Local< String > name, Local< DeclaredAccessorDescriptor > descriptor, PropertyAttribute attribute=None, AccessControl settings=DEFAULT)
bool InitializeICU(const char *icu_data_file)
Local< ObjectTemplate > InstanceTemplate()
Local< Int32 > ToInt32() const
void set_function_entry_hook(FunctionEntryHook function_entry_hook)
kSerializedDataOffset Object
bool IsSymbolObject() const
static Handle< Object > SetPrototype(Handle< JSObject > object, Handle< Object > value, bool skip_hidden_prototypes=false)
#define ARRAY_TYPE_TO_ELEMENTS_KIND(Type, type, TYPE, ctype, size)
Local< Context > CreationContext()
static bool HasRealNamedProperty(Handle< JSObject > object, Handle< Name > key)
void Visit(const Char *chars, const int length)
Handle< Symbol > NewPrivateSymbol()
Local< Value > ThrowException(Local< Value > exception)
static void AddMemoryAllocationCallback(MemoryAllocationCallback callback, ObjectSpace space, AllocationAction action)
v8::DeclaredAccessorDescriptorDataType data_type
void(* MessageCallback)(Handle< Message > message, Handle< Value > error)
Handle< JSArray > NewJSArrayWithElements(Handle< FixedArrayBase > elements, ElementsKind elements_kind, int length, PretenureFlag pretenure=NOT_TENURED)
Handle< Object > DeleteProperty(Handle< JSObject > object, Handle< Object > key)
static void SetReturnAddressLocationResolver(ReturnAddressLocationResolver return_address_resolver)
bool HasRealNamedCallbackProperty(Handle< String > key)
Local< Value > GetHiddenValue(Handle< String > key)
static bool HasRealNamedCallbackProperty(Handle< JSObject > object, Handle< Name > key)
Bootstrapper * bootstrapper()
Handle< String > GetScriptResourceName() const
void VisitOneByteString(const uint8_t *chars, int length)
const HeapGraphNode * GetNodeById(SnapshotObjectId id) const
static Local< Context > GetDebugContext()
static void EnqueueMicrotask(Isolate *isolate, Handle< Function > microtask)
static Foreign * cast(Object *obj)
int GetStartPosition() const
static const unsigned kMax16BitCodeUnitSize
CodeEntry * entry() const
static const int kNoColumnInfo
int *(* CounterLookupCallback)(const char *name)
struct ObjectDerefenceDescriptor object_dereference_descriptor
static Handle< Object > GetElementNoExceptionThrown(Isolate *isolate, Handle< Object > object, uint32_t index)
const HeapGraphNode * GetNode(int index) const
static Local< Value > Error(Handle< String > message)
intptr_t * code_space_size
bool SetPrivate(Handle< Private > key, Handle< Value > value)
static void set_context_raw_data(const byte *context_raw_data)
static Handle< String > GetMessage(Isolate *isolate, Handle< Object > data)
V8_INLINE Local< T > Escape(Local< T > value)
Local< Array > GetPropertyNames()
ExternalArrayType GetIndexedPropertiesExternalArrayDataType()
HandleScopeData * handle_scope_data()
void SetReferenceFromGroup(UniqueId id, Object **child)
static Local< String > NewFromOneByte(Isolate *isolate, const uint8_t *data, NewStringType type=kNormalString, int length=-1)
ProfileNode * sample(int index) const
unsigned GetNodeId() const
static Handle< Object > SetHiddenProperty(Handle< JSObject > object, Handle< Name > key, Handle< Object > value)
static Handle< Object > NewDate(Isolate *isolate, double time, bool *exc)
static const int kLineOffsetNotFound
Local< Context > GetCurrentContext()
#define ENTER_V8(isolate)
void AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type_filter=kGCTypeAll)
Utf8Value(Handle< v8::Value > obj)
void(* IndexedPropertyDeleterCallback)(uint32_t index, const PropertyCallbackInfo< Boolean > &info)
#define ASSERT(condition)
void Create(Isolate *isolate, Object *object, int *index)
static Vector< const byte > GetScriptsSource()
static void PrintCurrentStackTrace(Isolate *isolate, FILE *out)
void(* GCPrologueCallback)(GCType type, GCCallbackFlags flags)
Local< Number > ToNumber() const
void SetFailedAccessCheckCallback(v8::FailedAccessCheckCallback callback)
void UseDefaultSecurityToken()
static StackGuard * GetDefaultIsolateStackGuard()
DisallowJavascriptExecutionScope(Isolate *isolate, OnFailure on_failure)
static Handle< Object > TryGetFunctionDelegate(Isolate *isolate, Handle< Object > object, bool *has_pending_exception)
static Script * cast(Object *obj)
Handle< Value > GetDisplayName() const
i::Handle< i::JSTypedArray > NewTypedArray(i::Isolate *isolate, Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
void(* MessageHandler2)(const Message &message)
void(* AccessorSetterCallback)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
void * GetIndexedPropertiesExternalArrayData()
static Handle< Object > ToDetailString(Isolate *isolate, Handle< Object > obj, bool *exc)
static void SetDecompressedStartupData(StartupData *decompressed_data)
size_t GetShallowSize() const
Handle< Object > NewRangeError(const char *message, Vector< Handle< Object > > args)
#define EXCEPTION_BAILOUT_CHECK(isolate, value)
ThreadManager * thread_manager()
static Local< Integer > New(Isolate *isolate, int32_t value)
static SharedFunctionInfo * cast(Object *obj)
static Handle< Object > SetAccessor(Handle< JSObject > object, Handle< AccessorInfo > info)
virtual int DecompressData(char *raw_data, int *raw_data_size, const char *compressed_data, int compressed_data_size)=0
void(* FatalErrorCallback)(const char *location, const char *message)
static Local< Private > New(Isolate *isolate, Local< String > name=Local< String >())
Local< String > ToString() const
static const int kNoLineNumberInfo
intptr_t CommittedMemoryExecutable()
static v8::ArrayBuffer::Allocator * ArrayBufferAllocator()
Handle< Object > NewNumber(double value, PretenureFlag pretenure=NOT_TENURED)
static const int kShortSize
Handle< Context > CreateEnvironment(Handle< Object > global_object, v8::Handle< v8::ObjectTemplate > global_template, v8::ExtensionConfiguration *extensions)
StartupDataDecompressor()
int GetScriptColumnNumber(Handle< Script > script, int code_pos)
Local< Script > BindToCurrentContext()
int GetLineNumber(int code_pos)
void SetSamplingInterval(int us)
static const int kNoScriptIdInfo
Local< Value > CallAsConstructor(int argc, Handle< Value > argv[])
void(* IndexedPropertySetterCallback)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info)
void SetVerbose(bool value)
Handle< Object > GetProperty(Handle< JSReceiver > obj, const char *name)
static Local< StackTrace > CurrentStackTrace(Isolate *isolate, int frame_limit, StackTraceOptions options=kOverview)
void Set(Handle< String > name, Handle< Data > value, PropertyAttribute attributes=None)
static void MergeLeafLeft(int *length, uint8_t *state, uint8_t leaf_state)
void SetCallHandler(FunctionCallback callback, Handle< Value > data=Handle< Value >())
static void NeuterArrayBuffer(Handle< JSArrayBuffer > array_buffer)
Local< DeclaredAccessorDescriptor > NewHandleDereference(Isolate *isolate)
NeanderObject(v8::internal::Isolate *isolate, int size)
void(* IndexedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage message
void VisitTwoByteString(const uint16_t *chars, int length)
Handle< Value > GetName() const
int * pending_global_handle_count
static void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback)
void SetIndexedPropertiesToExternalArrayData(void *data, ExternalArrayType array_type, int number_of_elements)
virtual const uint16_t * data() const =0
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in name
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object size
Local< Uint32 > ToUint32() const
bool Equals(Handle< Value > that) const
void RemoveGCEpilogueCallback(GCEpilogueCallback callback)
static void VisitExternalResources(ExternalResourceVisitor *visitor)
#define SET_FIELD_WRAPPED(obj, setter, cdata)
REGEXP_FLAG_ASSERT_EQ(kNone, NONE)
bool IsDefaultIsolate() const
static Symbol * cast(Object *obj)
Handle< String > GetFunctionName() const
Local< DeclaredAccessorDescriptor > NewBitmaskCompare32(Isolate *isolate, uint32_t bitmask, uint32_t compare_value)
kSerializedDataOffset kPrototypeTemplateOffset kIndexedPropertyHandlerOffset kInstanceCallHandlerOffset internal_field_count
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage including flags
static bool HasElement(Handle< JSReceiver > object, uint32_t index)
static void GetCompressedStartupData(StartupData *compressed_data)
void SetCounterFunction(CounterLookupCallback f)
Local< Value > GetConstructor()
Handle< Value > GetScriptResourceName() const
static void AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type_filter=kGCTypeAll)
static Smi * cast(Object *object)
void(* FailedAccessCheckCallback)(Local< Object > target, AccessType type, Local< Value > data)
Value(Handle< v8::Value > obj)
Handle< String > FlattenGetString(Handle< String > string)
Handle< Object > ForceDeleteProperty(Handle< JSObject > object, Handle< Object > key)
v8::internal::Handle< v8::internal::JSObject > value()
bool HasIndexedPropertiesInExternalArrayData()
bool HasPrivate(Handle< Private > key)
Local< DeclaredAccessorDescriptor > NewPointerCompare(Isolate *isolate, void *compare_value)
Handle< Object > HasProperty(Handle< JSReceiver > obj, Handle< Object > key)
v8::Isolate * GetIsolate()
bool Equals(String *other)
static Local< UnboundScript > CompileUnbound(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions)
bool SetDeclaredAccessor(Local< String > name, Local< DeclaredAccessorDescriptor > descriptor, PropertyAttribute attribute=None, Local< AccessorSignature > signature=Local< AccessorSignature >(), AccessControl settings=DEFAULT)
~AllowJavascriptExecutionScope()
void GetHeapStatistics(HeapStatistics *heap_statistics)
void VisitOneByteString(const uint8_t *chars, int length)
void SetNamedPropertyHandler(NamedPropertyGetterCallback getter, NamedPropertySetterCallback setter=0, NamedPropertyQueryCallback query=0, NamedPropertyDeleterCallback deleter=0, NamedPropertyEnumeratorCallback enumerator=0, Handle< Value > data=Handle< Value >())
void SetInternalField(int index, Handle< Value > value)
static Local< StackFrame > StackFrameToLocal(v8::internal::Handle< v8::internal::JSObject > obj)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage including on console Map counters to a file Enable debugger compile events enable GDBJIT enable GDBJIT interface for all code objects dump only objects containing this substring stress the GC compactor to flush out pretty print source code print source AST function name where to insert a breakpoint print scopes for builtins trace contexts operations print stuff during garbage collection report code statistics after GC report handles after GC trace cache state transitions print interface inference details prints when objects are turned into dictionaries report heap spill statistics along with heap_stats(requires heap_stats)") DEFINE_bool(trace_isolates
void SetClassName(Handle< String > name)
void SetAlignedPointerInInternalField(int index, void *value)
StackGuard * stack_guard()
void(* LogEventCallback)(const char *name, int event)
Object * GetInternalField(int index)
bool HasTerminated() const
Handle< Context > global_context()
void StartCpuProfiling(Handle< String > title, bool record_samples=false)
static void DebugBreakForCommand(ClientData *data=NULL, Isolate *isolate=NULL)
V8_INLINE Handle< Boolean > True(Isolate *isolate)
Local< StackFrame > GetFrame(uint32_t index) const
GlobalObject * global_object()
static const char * GetVersion()
Local< Value > GetRealNamedProperty(Handle< String > key)
int NotifyContextDisposed()
bool IsExternalAscii() const
static void TerminateExecution(Isolate *isolate=NULL)
void(* AccessorGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
bool IsStringObject() const
bool MakeExternal(ExternalStringResource *resource)
Handle< String > NewStringFromUtf8(Vector< const char > str, PretenureFlag pretenure=NOT_TENURED)
void(* IndexedPropertyGetterCallback)(uint32_t index, const PropertyCallbackInfo< Value > &info)
int * near_death_global_handle_count
ScriptOrigin GetScriptOrigin() const
void(* FunctionEntryHook)(uintptr_t function, uintptr_t return_addr_location)
static int GetCompressedStartupDataCount()
static void DefineAccessor(Handle< JSObject > object, Handle< Name > name, Handle< Object > getter, Handle< Object > setter, PropertyAttributes attributes, v8::AccessControl access_control=v8::DEFAULT)
static uchar Length(uchar chr, int previous)
unsigned GetCallUid() const
void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback)
static void SetArrayBufferAllocator(ArrayBuffer::Allocator *allocator)
static Local< StackTrace > StackTraceToLocal(v8::internal::Handle< v8::internal::JSArray > obj)
bool IdleNotification(int hint)
static Handle< DeclaredAccessorDescriptor > Create(Isolate *isolate, const DeclaredAccessorDescriptorData &data, Handle< DeclaredAccessorDescriptor > previous)
int GetChildrenCount() const
static void DeoptimizeGlobalObject(JSObject *object)
static bool AddMessageListener(MessageCallback that, Handle< Value > data=Handle< Value >())
const CpuProfile * StopCpuProfiling(Handle< String > title)
static i::ConsString * VisitFlat(i::String *string, int *length, uint8_t *state)
void RemoveGCPrologueCallback(GCPrologueCallback callback)
Handle< JSArrayBuffer > GetBuffer()
bool HasInstance(Handle< Value > object)
static void SetFlagsFromString(const char *str, int length)
virtual const char * Data()=0
static bool SetDebugEventListener(v8::Handle< v8::Object > that, Handle< Value > data=Handle< Value >())
Handle< Map > CopyMap(Handle< Map > map, int extra_inobject_props)
static Local< Message > MessageToLocal(v8::internal::Handle< v8::internal::Object > obj)
void SetEmbedderData(int index, Handle< Value > value)
int max_old_space_size() const
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths true
Local< String > ObjectProtoToString()
static void RemoveCallCompletedCallback(CallCompletedCallback callback)
void *(* CreateHistogramCallback)(const char *name, int min, int max, size_t buckets)
void(* NamedPropertyQueryCallback)(Local< String > property, const PropertyCallbackInfo< Integer > &info)
intptr_t * property_cell_space_capacity
void set_max_old_space_size(int value)
bool ContainsOnlyOneByte() const
v8::internal::Object * get(int index)
Handle< Object > NewReferenceError(const char *message, Vector< Handle< Object > > args)
void(* NamedPropertySetterCallback)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)
static Local< ObjectTemplate > New()
V8_INLINE Isolate * GetIsolate() const
const ProfileTree * top_down() const
bool HasIndexedPropertiesInPixelData()
static void SetJitCodeEventHandler(JitCodeEventOptions options, JitCodeEventHandler event_handler)
#define ON_BAILOUT(isolate, location, code)
static int NumberOfHandles(Isolate *isolate)
Handle< JSObject > NewNeanderObject()
int max_young_space_size() const
Handle< Value > ReThrow()
FunctionEntryHook function_entry_hook()
V8_INLINE Isolate * GetIsolate() const
static void MemCopy(void *dest, const void *src, size_t size)
bool V8_EXPORT SetResourceConstraints(Isolate *isolate, ResourceConstraints *constraints)
StringTracker * string_tracker()
SnapshotObjectId GetMaxSnapshotJSObjectId() const
virtual int GetChunkSize()
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)
Local< Value > GetPrototype()
static int Calculate(i::ConsString *current)
Handle< Object > Create(Object *value)
static bool IsValid(intptr_t value)
static Local< Uint32 > Uint32ToLocal(v8::internal::Handle< v8::internal::Object > obj)
Local< Promise > GetPromise()
void VisitTwoByteString(const uint16_t *chars, int length)
void set_context(Context *context)
static int context_raw_size()
static void SetHostDispatchHandler(HostDispatchHandler handler, int period=100)
void CollectAllAvailableGarbage(const char *gc_reason=NULL)
bool ForceDelete(Handle< Value > key)
bool(* AllowCodeGenerationFromStringsCallback)(Local< Context > context)
EscapableHandleScope(Isolate *isolate)
JSObject * global_proxy()
static void EnterDefaultIsolate()
static Handle< Map > GetElementsTransitionMap(Handle< JSObject > object, ElementsKind to_kind)
int64_t GetEndTime() const
Handle< String > GetTitle() const
struct PointerShiftDescriptor pointer_shift_descriptor
PerIsolateAssertScope< JAVASCRIPT_EXECUTION_THROWS, true > NoThrowOnJavascriptExecution
void TerminateExecution()
MemoryAllocator * memory_allocator()
bool LastEnteredContextWas(Handle< Context > context)
virtual void VisitEmbedderReference(i::Object **p, uint16_t class_id)
MaybeObject * scheduled_exception()
Handle< Object > NewTypeError(const char *message, Vector< Handle< Object > > args)
static Local< External > New(Isolate *isolate, void *value)
T * NewArray(size_t size)
EternalHandles * eternal_handles()
void FatalProcessOutOfMemory(const char *message)
int * global_handle_count
void SetInternalFieldCount(int value)
unsigned int FastD2UI(double x)
Handle< Object > ToBoolean(bool value)
#define LOG_API(isolate, expr)
Local< Value > GetPrivate(Handle< Private > key)
Handle< ExecutableAccessorInfo > NewExecutableAccessorInfo()
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf map
Handle< JSArrayBuffer > NewJSArrayBuffer()
static Handle< JSObject > Copy(Handle< JSObject > object)
static void SetFatalErrorHandler(FatalErrorCallback that)
bool HasIndexedLookupInterceptor()
intptr_t * cell_space_capacity
Object * GetPrototype(Isolate *isolate)
intptr_t * memory_allocator_size
uintptr_t(* ReturnAddressLocationResolver)(uintptr_t return_addr_location)
void PrintCurrentStackTrace(FILE *out)
bool IsArrayBufferView() const
static int ContextDisposedNotification()
static void ShutdownPlatform()
static int GetRawScriptsSize()
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName)
Handle< JSArray > CaptureCurrentStackTrace(int frame_limit, StackTrace::StackTraceOptions options)
Handle< JSTypedArray > NewJSTypedArray(ExternalArrayType type)
static Local< FunctionTemplate > New(Isolate *isolate, FunctionCallback callback=0, Handle< Value > data=Handle< Value >(), Handle< Signature > signature=Handle< Signature >(), int length=0)
GlobalHandles * global_handles()
int32_t Int32Value() const
static void RemoveCallCompletedCallback(CallCompletedCallback callback)
static Local< Script > Compile(Handle< String > source, ScriptOrigin *origin=NULL, ScriptData *script_data=NULL)
Local< Object > NewInstance() const
static void TransformToFastProperties(Handle< JSObject > object, int unused_property_fields)
intptr_t * code_space_capacity
PerIsolateAssertScope< JAVASCRIPT_EXECUTION_THROWS, false > ThrowOnJavascriptExecution
bool IsSharedCrossOrigin() const
bool Check(i::String *string)
bool IsConstructor() const
static Local< Value > New(Isolate *isolate, Handle< Symbol > value)
Handle< JSObject > NewExternal(void *value)
static Handle< Object > GetOrCreateIdentityHash(Handle< JSReceiver > object)
Handle< String > NewStringFromTwoByte(Vector< const uc16 > str, PretenureFlag pretenure=NOT_TENURED)
Handle< ExternalArray > NewExternalArray(int length, ExternalArrayType array_type, void *external_pointer, PretenureFlag pretenure=NOT_TENURED)
static void * ClearWeakness(Object **location)
static FunctionTemplateInfo * cast(Object *obj)
static Handle< Object > CopyGlobal(Object **location)
void SetIndexedPropertiesToPixelData(uint8_t *data, int length)
static Local< ArrayBuffer > New(Isolate *isolate, size_t byte_length)
static void DeoptimizeAll(Isolate *isolate)
static PropertyAttributes GetPropertyAttribute(Handle< JSReceiver > object, Handle< Name > name)
Handle< FixedArray > NewFixedArray(int size, PretenureFlag pretenure=NOT_TENURED)
static Handle< Object > ToInteger(Isolate *isolate, Handle< Object > obj, bool *exc)
static JSTypedArray * cast(Object *obj)
VisitorAdapter(PersistentHandleVisitor *visitor)
OldSpace * old_pointer_space()
static void SetStressRunType(StressType type)
int GetScriptColumnNumber() const
bool ConfigureHeap(int max_semispace_size, intptr_t max_old_gen_size, intptr_t max_executable_size)
intptr_t * map_space_size
Handle< FixedArray > GetKeysInFixedArrayFor(Handle< JSReceiver > object, KeyCollectionType type, bool *threw)
static const uint8_t kInitialState
Local< DeclaredAccessorDescriptor > NewBitmaskCompare8(Isolate *isolate, uint8_t bitmask, uint8_t compare_value)
static void RemoveMessageListeners(MessageCallback that)
const char * resource_name() const
size_t GetProfilerMemorySize()
static const char * GetVersion()
static Handle< Object > TryGetConstructorDelegate(Isolate *isolate, Handle< Object > object, bool *has_pending_exception)
void(* AddHistogramSampleCallback)(void *histogram, int sample)
void CancelTerminateExecution()
static Handle< JSRegExp > NewJSRegExp(Handle< String > pattern, Handle< String > flags, bool *exc)
static Local< Integer > IntegerToLocal(v8::internal::Handle< v8::internal::Object > obj)
bool SetHiddenValue(Handle< String > key, Handle< Value > value)
Local< String > ToDetailString() const
void SetAlignedPointerInEmbedderData(int index, void *value)
Handle< DeclaredAccessorInfo > NewDeclaredAccessorInfo()
Local< Symbol > ValueOf() const
static void EnqueueMicrotask(Isolate *isolate, Handle< Object > microtask)
Local< String > GetScriptNameOrSourceURL() const
void SetReference(HeapObject **parent, Object **child)
#define V8_2PART_UINT64_C(a, b)
double FastUI2D(unsigned x)
bool HasNamedLookupInterceptor()
Handle< JSBuiltinsObject > js_builtins_object()
bool BooleanValue() const
static Local< Number > New(Isolate *isolate, double value)
static void UnregisterAll()
uint32_t * stack_limit() const
struct PointerCompareDescriptor pointer_compare_descriptor
static bool EnableAgent(const char *name, int port, bool wait_for_connection=false)
static Local< String > NewFromTwoByte(Isolate *isolate, const uint16_t *data, NewStringType type=kNormalString, int length=-1)
Handle< Object > ToObject(Handle< Object > object)
PerIsolateAssertScope< JAVASCRIPT_EXECUTION_ASSERT, false > DisallowJavascriptExecution
bool SetPrototype(Handle< Value > prototype)
#define STATIC_ASCII_VECTOR(x)
static Local< Array > New(Isolate *isolate, int length=0)
static ExternalUint8ClampedArray * cast(Object *obj)
int GetLineNumber() const
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage including on console Map counters to a file Enable debugger compile events enable GDBJIT enable GDBJIT interface for all code objects dump only objects containing this substring stress the GC compactor to flush out pretty print source code print source AST function name where to insert a breakpoint print scopes for builtins trace contexts operations print stuff during garbage collection report code statistics after GC report handles after GC trace cache state transitions print interface inference details prints when objects are turned into dictionaries report heap spill statistics along with trace isolate state changes trace regexp bytecode execution Minimal Log all events to the log file Log API events to the log file Log heap samples on garbage collection for the hp2ps tool log positions Log suspect operations Used with turns on browser compatible mode for profiling v8 Specify the name of the log file Enable low level linux profiler Enable perf linux profiler(experimental annotate support).") DEFINE_string(gc_fake_mmap
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
V8_INLINE Handle< Primitive > Undefined(Isolate *isolate)
static Local< Value > RangeError(Handle< String > message)
int * free_global_handle_count
static V8_INLINE Local< T > Cast(Local< S > that)
void SetHiddenPrototype(bool value)
#define INSTANCE_TYPE_TO_ARRAY_TYPE(Type, type, TYPE, ctype, size)
Handle< FixedArray > CopyFixedArray(Handle< FixedArray > array)
void DeleteAllSnapshots()
static const int kAbortIncrementalMarkingMask
void IterateAllRootsWithClassIds(ObjectVisitor *v)
void(* IndexedPropertyQueryCallback)(uint32_t index, const PropertyCallbackInfo< Integer > &info)
bool CollectGarbage(AllocationSpace space, const char *gc_reason=NULL, const GCCallbackFlags gc_callback_flags=kNoGCCallbackFlags)
MUST_USE_RESULT MaybeObject * GetProperty(Name *key)
static ScriptDataImpl * PreParse(Isolate *isolate, Utf16CharacterStream *source)
virtual void VisitPointers(i::Object **start, i::Object **end)
int StrLength(const char *string)
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
intptr_t CommittedMemory()
static Local< Object > New(Isolate *isolate)
const char * name() const
#define T(name, string, precedence)
void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo *info)
static void AddCallCompletedCallback(CallCompletedCallback callback)
Local< Promise > Catch(Handle< Function > handler)
RegisteredExtension(Extension *extension)
bool IsArrayBuffer() const
bool IsLockedByCurrentThread()
Local< String > GetScriptName() const
static bool SetFunctionEntryHook(Isolate *isolate, FunctionEntryHook entry_hook)
int64_t IntegerValue() const
SnapshotObjectId GetHeapStats(OutputStream *stream)
void(* NamedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
int GetSamplesCount() const
static bool HasProperty(Handle< JSReceiver > object, Handle< Name > name)
AllowJavascriptExecutionScope(Isolate *isolate)
static Local< Value > New(Isolate *isolate, double value)
void(* GCEpilogueCallback)(GCType type, GCCallbackFlags flags)
void SetName(Handle< String > name)
#define EXCEPTION_PREAMBLE(isolate)
static Local< Value > New(Isolate *isolate, double time)
Handle< Object > NewNumberFromInt(int32_t value, PretenureFlag pretenure=NOT_TENURED)
const HeapSnapshot * TakeHeapSnapshot(Handle< String > title, ActivityControl *control=NULL, ObjectNameResolver *global_object_name_resolver=NULL)
bool IsCodeGenerationFromStringsAllowed()
static Local< Context > New(Isolate *isolate, ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
static Local< Value > ReferenceError(Handle< String > message)
void SetReferenceFromGroup(UniqueId id, const Persistent< T > &child)
void StartProfiling(Handle< String > title, bool record_samples=false)
void(* JitCodeEventHandler)(const JitCodeEvent *event)
static JSDataView * cast(Object *obj)
Local< Value > StackTrace() const
bool IsFreshUnusedString(Handle< String > string)
static void SetMessageHandler2(MessageHandler2 handler)
int GetScriptLineNumber(Handle< Script > script, int code_pos)
int CompleteWrite(bool write_null, int *utf16_chars_read_out)
static Local< DataView > New(Handle< ArrayBuffer > array_buffer, size_t byte_offset, size_t length)
intptr_t * old_data_space_capacity
Handle< Object > NewSyntaxError(const char *message, Handle< JSArray > args)
HeapProfiler * heap_profiler() const
static Handle< JSFunction > InstantiateFunction(Handle< FunctionTemplateInfo > data, bool *exc)
static Local< RegExp > New(Handle< String > pattern, Flags flags)
int GetEndPosition() const
const CpuProfileNode * GetTopDownRoot() const
Local< Context > GetCallingContext()
Handle< String > InternalizeTwoByteString(Vector< const uc16 > str)
void add(v8::internal::Handle< v8::internal::Object > value)
static void SetAutorunMicrotasks(Isolate *source, bool autorun)
int max_executable_size() const
void RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback)
static void WriteToFlat(String *source, sinkchar *sink, int from, int to)
void VisitTwoByteString(const uint16_t *chars, int length)
int GetIndexedPropertiesExternalArrayDataLength()
Local< RawOperationDescriptor > NewRawDereference(Isolate *isolate)
Handle< String > NewExternalStringFromTwoByte(const ExternalTwoByteString::Resource *resource)
uint32_t Uint32Value() const
Local< Promise > Chain(Handle< Function > handler)
Handle< String > InternalizeOneByteString(Vector< const uint8_t > str)
static double nan_value()
void set_max_available_threads(int value)
enable upcoming ES6 features enable harmony block scoping enable harmony symbols(a.k.a.private names)") DEFINE_bool(harmony_proxies
static void SetDebugMessageDispatchHandler(DebugMessageDispatchHandler handler, bool provide_locker=false)
int * weak_global_handle_count
void SetReference(const Persistent< T > &parent, const Persistent< S > &child)
static Handle< Object > Call(Isolate *isolate, Handle< Object > callable, Handle< Object > receiver, int argc, Handle< Object > argv[], bool *pending_exception, bool convert_receiver=false)
const HeapSnapshot * GetHeapSnapshot(int index)
void Continue(InterruptFlag after_what)
static Handle< Object > SetProperty(Handle< JSReceiver > object, Handle< Name > key, Handle< Object > value, PropertyAttributes attributes, StrictMode strict_mode, StoreFromKeyed store_mode=MAY_BE_STORE_FROM_KEYED)
static void SetEntropySource(EntropySource source)
Handle< T > handle(T *t, Isolate *isolate)
static Handle< Object > ToInt32(Isolate *isolate, Handle< Object > obj, bool *exc)
V8_INLINE bool IsEmpty() const
static void CancelDebugBreak(Isolate *isolate=NULL)
CpuProfiler * cpu_profiler() const
void DetachGlobal(Handle< Context > env)
Handle< Object > Get(int index)
void SetCallAsFunctionHandler(FunctionCallback callback, Handle< Value > data=Handle< Value >())
Handle< String > GetTitle() const
uint32_t SnapshotObjectId
ExternalStringTable * external_string_table()
size_t CommittedPhysicalMemory()
Local< Function > GetFunction()
bool ForceSet(Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None)
Handle< Symbol > NewSymbol()
Utf8WriterVisitor(char *buffer, int capacity, bool skip_capacity_check, bool replace_invalid_utf8)
static void set_raw_data(const byte *raw_data)
int GetNodesCount() const
static Local< Value > SyntaxError(Handle< String > message)
Local< ArrayBuffer > Buffer()
static ConsString * VisitFlat(Visitor *visitor, String *string, int offset, int length, int32_t type)
static void AddCallCompletedCallback(CallCompletedCallback callback)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function info
void(* NamedPropertyGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
static Local< String > NewExternal(Isolate *isolate, ExternalStringResource *resource)
int GetChildrenCount() const
static void MakeWeak(Object **location, void *parameter, WeakCallback weak_callback)
Handle< String > InternalizeUtf8String(Vector< const char > str)
virtual const char * data() const =0
static void DisableAgent()
#define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value)
void CopyBytes(uint8_t *target, uint8_t *source)
Local< Value > GetBoundFunction() const
static int context_size()
Handle< Object > GetScriptNameOrSourceURL(Handle< Script > script)
static const unsigned kBytesSavedByCombiningSurrogates
void InvokeAccessorGetterCallback(v8::Local< v8::String > property, const v8::PropertyCallbackInfo< v8::Value > &info, v8::AccessorGetterCallback getter)
const HeapGraphNode * GetRoot() const
static bool SetDebugEventListener2(EventCallback2 that, Handle< Value > data=Handle< Value >())
static void PrintError(const char *format,...)
static void SetupArrayBuffer(Isolate *isolate, Handle< JSArrayBuffer > array_buffer, bool is_external, void *data, size_t allocated_length)
int GetColumnNumber() const
Local< Value > Name() const
int GetIndexedPropertiesPixelDataLength()
bool(* NamedSecurityCallback)(Local< Object > host, Local< Value > key, AccessType type, Local< Value > data)
static int Calculate(i::ConsString *current, uint8_t *state_out)
static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback)
Local< ObjectTemplate > PrototypeTemplate()
Handle< Foreign > NewForeign(Address addr, PretenureFlag pretenure=NOT_TENURED)
static void VisitHandlesWithClassIds(PersistentHandleVisitor *visitor)
const int kHandleBlockSize
static bool InitializeICU(const char *icu_data_file=NULL)
void SetObjectGroupId(Object **handle, UniqueId id)
void set(int index, v8::internal::Object *value)
#define ASSERT_EQ(v1, v2)
void MarkAsUndetectable()
static void SetReturnAddressLocationResolver(ReturnAddressLocationResolver resolver)
void(* InterruptCallback)(Isolate *isolate, void *data)
static Local< Value > TypeError(Handle< String > message)
#define TYPED_ARRAY_NEW(Type, type, TYPE, ctype, size)
bool(* EntropySource)(unsigned char *buffer, size_t length)
unsigned GetHitCount() const
Handle< Object > GetSingleton(SingletonHandle singleton)
static Handle< Object > ToUint32(Isolate *isolate, Handle< Object > obj, bool *exc)
static void Register(RegisteredExtension *that)
Context * RestoreContext()
int GetScriptLineNumber() const
static Local< Resolver > New(Isolate *isolate)
static Handle< JSObject > InstantiateObject(Handle< ObjectTemplateInfo > data, bool *exc)
virtual void VisitPersistentHandle(Persistent< Value > *value, uint16_t class_id)
static void RemoveGCEpilogueCallback(GCEpilogueCallback callback)
static void PrepareStressRun(int run)
Handle< StackTrace > GetStackTrace() const
bool IsTemplateFor(Object *object)
static void VisitHandlesForPartialDependence(Isolate *isolate, PersistentHandleVisitor *visitor)
DeclaredAccessorDescriptorDataType
static void SetCreateHistogramFunction(CreateHistogramCallback)
bool IsNumberObject() const
static FixedArray * cast(Object *obj)
void InitializeLoggingAndCounters()
static Local< Value > Call(v8::Handle< v8::Function > fun, Handle< Value > data=Handle< Value >())
static void RemoveGCPrologueCallback(GCPrologueCallback callback)
static bool EndsWithSurrogate(uint8_t state)
static bool SetupArrayBufferAllocatingData(Isolate *isolate, Handle< JSArrayBuffer > array_buffer, size_t allocated_length, bool initialize=true)
Local< UnboundScript > GetUnboundScript()
Failure * TerminateExecution()
void IterateAllRootsInNewSpaceWithClassIds(ObjectVisitor *v)
Local< Value > GetRealNamedPropertyInPrototypeChain(Handle< String > key)
#define VALUE_IS_TYPED_ARRAY(Type, typeName, TYPE, ctype, size)
void SetCreateHistogramFunction(CreateHistogramCallback f)
static const int kBoundFunctionIndex
intptr_t * old_pointer_space_capacity
static Handle< Object > SetObjectProperty(Isolate *isolate, Handle< Object > object, Handle< Object > key, Handle< Object > value, PropertyAttributes attr, StrictMode strict_mode)
bool Has(Handle< Value > key)
static Local< String > Concat(Handle< String > left, Handle< String > right)
static Handle< Object > DeleteElement(Handle< JSReceiver > object, uint32_t index, DeleteMode mode=NORMAL_DELETION)
bool HasOwnProperty(Handle< String > key)
const uint32_t kMaxUInt32
static bool ApiCheck(bool condition, const char *location, const char *message)
static Local< Script > Compile(Isolate *isolate, Source *source, CompileOptions options=kNoCompileOptions)
void StartTrackingHeapObjects(bool track_allocations=false)
void AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type_filter=kGCTypeAll)
void RecordStats(HeapStats *stats, bool take_snapshot=false)
static Handle< Object > GetElement(Isolate *isolate, Handle< Object > object, uint32_t index)
static void InitializePlatform(v8::Platform *platform)
void RegisterTryCatchHandler(v8::TryCatch *that)
bool IsInGCPostProcessing()
static Local< Value > Parse(Local< String > json_string)
static Local< TypeSwitch > New(Handle< FunctionTemplate > type)
Local< Object > ToObject() const
int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes)
Handle< Struct > NewStruct(InstanceType type)
static void RunMicrotasks(Isolate *isolate)
bool has_scheduled_exception()
static void RunMicrotasks(Isolate *isolate)
struct PrimitiveValueDescriptor primitive_value_descriptor
~DisallowJavascriptExecutionScope()
void SetAccessorProperty(Local< String > name, Local< FunctionTemplate > getter=Local< FunctionTemplate >(), Local< FunctionTemplate > setter=Local< FunctionTemplate >(), PropertyAttribute attribute=None, AccessControl settings=DEFAULT)
static bool IsLeadSurrogate(int code)
static void LowMemoryNotification()
void EnterContext(Handle< Context > context)
Handle< Object > ForceSetProperty(Handle< JSObject > object, Handle< Object > key, Handle< Object > value, PropertyAttributes attributes)
Local< Value > Name() const
static bool StartsWithSurrogate(uint8_t state)
static Local< AccessorSignature > New(Isolate *isolate, Handle< FunctionTemplate > receiver=Handle< FunctionTemplate >())
static JSArrayBuffer * cast(Object *obj)
static ScriptData * New(const char *data, int length)
Local< Boolean > ToBoolean() const
void Reject(Handle< Value > value)
Handle< String > NewConsString(Handle< String > left, Handle< String > right)
static Local< Symbol > New(Isolate *isolate, Local< String > name=Local< String >())
Local< Integer > ToInteger() const
static void SendCommand(const uint16_t *command, int length, ClientData *client_data=NULL, Isolate *isolate=NULL)
intptr_t * map_space_capacity
Local< DeclaredAccessorDescriptor > NewBitmaskCompare16(Isolate *isolate, uint16_t bitmask, uint16_t compare_value)
void SetIndexedPropertyHandler(IndexedPropertyGetterCallback getter, IndexedPropertySetterCallback setter=0, IndexedPropertyQueryCallback query=0, IndexedPropertyDeleterCallback deleter=0, IndexedPropertyEnumeratorCallback enumerator=0, Handle< Value > data=Handle< Value >())
size_t ByteLength() const
static bool IsTrailSurrogate(int code)
static void SetFlagsFromCommandLine(int *argc, char **argv, bool remove_flags)
Address foreign_address()
static void DebugBreak(Isolate *isolate=NULL)
static V8_EXPORT void CheckInitializedImpl(v8::Isolate *isolate)
Handle< Object > NewNumberFromSize(size_t value, PretenureFlag pretenure=NOT_TENURED)
Handle< Object > NewError(const char *maker, const char *message, Handle< JSArray > args)
void ConfigureDefaults(uint64_t physical_memory, uint32_t number_of_processors)
Local< Value > CallAsFunction(Handle< Value > recv, int argc, Handle< Value > argv[])
void SetIdle(bool is_idle)
int max_available_threads() const
bool HasRealNamedProperty(Handle< String > key)
#define STATIC_ASSERT(test)
const CpuProfileNode * GetSample(int index) const
static ScriptData * PreCompile(Handle< String > source)
bool Delete(Handle< Value > key)
kSerializedDataOffset prototype_template
static Local< Value > GetMirror(v8::Handle< v8::Value > obj)
void DeleteArray(T *array)
static const int kNoScriptId
intptr_t * memory_allocator_capacity
int GetStartColumn() const
Handle< Value > GetInferredName() const
static void InitializePlatform(Platform *platform)
bool Exists(SingletonHandle singleton)
Local< Object > FindInstanceInPrototypeChain(Handle< FunctionTemplate > tmpl)
static bool Initialize(const char *snapshot_file=NULL)
void SetStackLimit(uintptr_t limit)
bool SetAccessor(Handle< String > name, AccessorGetterCallback getter, AccessorSetterCallback setter=0, Handle< Value > data=Handle< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None)
CompressedStartupDataItems
static void DateTimeConfigurationChangeNotification(Isolate *isolate)
void InvokeFunctionCallback(const v8::FunctionCallbackInfo< v8::Value > &info, v8::FunctionCallback callback)
static FixedArrayBase * cast(Object *object)
void Resolve(Handle< Value > value)
bool has_name_prefix() const
static Local< Function > New(Isolate *isolate, FunctionCallback callback, Local< Value > data=Local< Value >(), int length=0)
static const int kMaxValue
static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorithm()
intptr_t * old_data_space_size
virtual ~StartupDataDecompressor()
#define CHECK_TYPED_ARRAY_CAST(Type, typeName, TYPE, ctype, size)
void RequestGarbageCollectionForTesting(GarbageCollectionType type)
HeapProfiler * GetHeapProfiler()
static void DeoptimizeAll()
const HeapGraphNode * GetToNode() const
Handle< Value > GetSecurityToken()
static void FatalProcessOutOfMemory(const char *location, bool take_snapshot=false)
static Handle< Object > ToString(Isolate *isolate, Handle< Object > obj, bool *exc)
static Local< External > ExternalToLocal(v8::internal::Handle< v8::internal::JSObject > obj)
static void ProcessDebugMessages()
void SetErrorMessageForCodeGenerationFromStrings(Handle< String > message)
static Local< Value > New(Handle< String > value)
Local< String > ValueOf() const
static const byte * context_data()
static V8_INLINE v8::Local< v8::String > Empty(Isolate *isolate)
void(* NamedPropertyDeleterCallback)(Local< String > property, const PropertyCallbackInfo< Boolean > &info)
int match(Handle< Value > value)
void Serialize(OutputStream *stream, SerializationFormat format) const
Local< v8::Message > Message() const
int Write(uint16_t *buffer, int start=0, int length=-1, int options=NO_OPTIONS) const
Local< RawOperationDescriptor > NewRawShift(Isolate *isolate, int16_t byte_offset)
void Inherit(Handle< FunctionTemplate > parent)
CpuProfile * StopProfiling(Handle< String > title)
static JSObject * cast(Object *obj)
void AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback, GCType gc_type_filter, bool pass_isolate=true)
static void SetRawScriptsSource(Vector< const char > raw_source)
Handle< JSArray > NewJSArray(ElementsKind elements_kind, int length, int capacity, ArrayStorageAllocationMode mode=INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, PretenureFlag pretenure=NOT_TENURED)
Local< String > GetFunctionName() const
Local< String > GetSourceLine() const
static const int kNoPreviousCharacter
static void SetCounterFunction(CounterLookupCallback)
v8::internal::Object * get(int index)
Local< Uint32 > ToArrayIndex() const
Handle< T > CloseAndEscape(Handle< T > handle_value)
void AddMemoryAllocationCallback(MemoryAllocationCallback callback, ObjectSpace space, AllocationAction action)
struct BitmaskCompareDescriptor bitmask_compare_descriptor
int GetLineNumber() const
int WriteOneByte(uint8_t *buffer, int start=0, int length=-1, int options=NO_OPTIONS) const
void set_max_executable_size(int value)
const char * name_prefix() const
void SetAccessCheckCallbacks(NamedSecurityCallback named_handler, IndexedSecurityCallback indexed_handler, Handle< Value > data=Handle< Value >(), bool turned_on_by_default=true)
static Local< Integer > NewFromUnsigned(Isolate *isolate, uint32_t value)
bool Set(Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None)
void SetCodeEventHandler(uint32_t options, JitCodeEventHandler event_handler)
intptr_t * property_cell_space_size
int GetFrameCount() const
Handle< Value > GetScriptName()
static Local< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=kNormalString, int length=-1)
static bool IdleNotification(int hint=1000)
static bool HasLocalProperty(Handle< JSReceiver >, Handle< Name > name)
static v8::Testing::StressType stress_type()
static Local< Symbol > For(Isolate *isolate, Local< String > name)
static JSFunction * cast(Object *obj)