32 #include "../include/v8-debug.h"
33 #include "../include/v8-profiler.h"
34 #include "../include/v8-testing.h"
46 #ifdef COMPRESS_STARTUP_DATA_BZ2
63 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr))
65 #define ENTER_V8(isolate) \
66 ASSERT((isolate)->IsInitialized()); \
67 i::VMState __state__((isolate), i::OTHER)
68 #define LEAVE_V8(isolate) \
69 i::VMState __state__((isolate), i::EXTERNAL)
73 #define ON_BAILOUT(isolate, location, code) \
74 if (IsDeadCheck(isolate, location) || \
75 IsExecutionTerminatingCheck(isolate)) { \
81 #define EXCEPTION_PREAMBLE(isolate) \
82 (isolate)->handle_scope_implementer()->IncrementCallDepth(); \
83 ASSERT(!(isolate)->external_caught_exception()); \
84 bool has_pending_exception = false
87 #define EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, do_callback) \
89 i::HandleScopeImplementer* handle_scope_implementer = \
90 (isolate)->handle_scope_implementer(); \
91 handle_scope_implementer->DecrementCallDepth(); \
92 if (has_pending_exception) { \
93 if (handle_scope_implementer->CallDepthIsZero() && \
94 (isolate)->is_out_of_memory()) { \
95 if (!(isolate)->ignore_out_of_memory()) \
96 i::V8::FatalProcessOutOfMemory(NULL); \
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, ;)
116 #define API_ENTRY_CHECK(isolate, msg) \
118 if (v8::Locker::IsActive()) { \
119 ApiCheck(isolate->thread_manager()->IsLockedByCurrentThread(), \
121 "Entering the V8 API without proper locking in place"); \
129 static void DefaultFatalErrorHandler(
const char* location,
131 i::VMState __state__(i::Isolate::Current(), i::OTHER);
138 if (isolate->exception_behavior() ==
NULL) {
139 isolate->set_exception_behavior(DefaultFatalErrorHandler);
141 return isolate->exception_behavior();
158 int new_space_capacity;
160 intptr_t old_pointer_space_size;
162 intptr_t old_pointer_space_capacity;
164 intptr_t old_data_space_size;
166 intptr_t old_data_space_capacity;
168 intptr_t code_space_size;
170 intptr_t code_space_capacity;
172 intptr_t map_space_size;
174 intptr_t map_space_capacity;
176 intptr_t cell_space_size;
178 intptr_t cell_space_capacity;
180 intptr_t lo_space_size;
182 int global_handle_count;
184 int weak_global_handle_count;
186 int pending_global_handle_count;
188 int near_death_global_handle_count;
190 int free_global_handle_count;
192 intptr_t memory_allocator_size;
194 intptr_t memory_allocator_capacity;
196 int objects_per_type[
LAST_TYPE + 1] = {0};
213 callback(location,
"Allocation failed - process out of memory");
222 callback(location, message);
233 static inline bool ApiCheck(
bool condition,
234 const char* location,
240 static bool ReportV8Dead(
const char* location) {
242 callback(location,
"V8 is no longer usable");
247 static bool ReportEmptyHandle(
const char* location) {
249 callback(location,
"Reading from empty handle");
266 static inline bool IsDeadCheck(
i::Isolate* isolate,
const char* location) {
272 static inline bool IsExecutionTerminatingCheck(
i::Isolate* isolate) {
276 isolate->
heap()->termination_exception();
283 return obj.
IsEmpty() ? ReportEmptyHandle(location) :
false;
287 static inline bool EmptyCheck(
const char* location,
const v8::Data* obj) {
288 return (obj == 0) ? ReportEmptyHandle(location) :
false;
294 static bool InitializeHelper() {
300 static inline bool EnsureInitializedForIsolate(
i::Isolate* isolate,
301 const char* location) {
302 if (IsDeadCheck(isolate, location))
return false;
303 if (isolate !=
NULL) {
306 ASSERT(isolate == i::Isolate::Current());
307 return ApiCheck(InitializeHelper(), location,
"Error initializing V8");
317 static inline i::Isolate* EnterIsolateIfNeeded() {
318 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
323 isolate = i::Isolate::Current();
329 : raw_data(i::
NewArray<char*>(
V8::GetCompressedStartupDataCount())) {
347 i::NewArray<StartupData>(compressed_data_count);
349 for (
int i = 0; i < compressed_data_count; ++i) {
350 char* decompressed = raw_data[i] =
351 i::NewArray<char>(compressed_data[i].
raw_size);
352 if (compressed_data[i].compressed_size != 0) {
354 &compressed_data[i].raw_size,
355 compressed_data[i].data,
356 compressed_data[i].compressed_size);
357 if (result != 0)
return result;
359 ASSERT_EQ(0, compressed_data[i].raw_size);
361 compressed_data[i].
data = decompressed;
370 #ifdef COMPRESS_STARTUP_DATA_BZ2
387 #ifdef COMPRESS_STARTUP_DATA_BZ2
396 #ifdef COMPRESS_STARTUP_DATA_BZ2
410 reinterpret_cast<const char*
>(libraries_source.
start());
417 reinterpret_cast<const char*
>(exp_libraries_source.
start());
419 exp_libraries_source.
length();
427 #ifdef COMPRESS_STARTUP_DATA_BZ2
430 reinterpret_cast<const i::byte*>(decompressed_data[
kSnapshot].data));
435 reinterpret_cast<const i::byte*>(
457 isolate->set_exception_behavior(that);
464 isolate->set_allow_code_gen_callback(callback);
469 void ImplementationUtilities::ZapHandleRange(
i::Object** begin,
471 i::HandleScope::ZapRange(begin, end);
488 if (IsDeadCheck(isolate,
"v8::ThrowException()")) {
503 RegisteredExtension* RegisteredExtension::first_extension_ =
NULL;
507 : extension_(extension) { }
511 that->next_ = first_extension_;
512 first_extension_ = that;
538 source_length_(source_length >= 0 ?
540 (source ? static_cast<int>(strlen(source)) : 0)),
541 source_(source, source_length_),
542 dep_count_(dep_count),
544 auto_enable_(
false) {
545 CHECK(source !=
NULL || source_length_ == 0);
551 if (!EnsureInitializedForIsolate(isolate,
"v8::Undefined()")) {
555 isolate->
factory()->undefined_value()));
561 if (!EnsureInitializedForIsolate(isolate,
"v8::Null()")) {
565 ToApi<Primitive>(isolate->
factory()->null_value()));
571 if (!EnsureInitializedForIsolate(isolate,
"v8::True()")) {
575 ToApi<Boolean>(isolate->
factory()->true_value()));
581 if (!EnsureInitializedForIsolate(isolate,
"v8::False()")) {
585 ToApi<Boolean>(isolate->
factory()->false_value()));
590 : max_young_space_size_(0),
591 max_old_space_size_(0),
592 max_executable_size_(0),
593 stack_limit_(
NULL) { }
602 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) {
607 max_executable_size);
608 if (!result)
return false;
611 uintptr_t limit =
reinterpret_cast<uintptr_t
>(constraints->
stack_limit());
620 if (IsDeadCheck(isolate,
"V8::Persistent::New"))
return NULL;
621 LOG_API(isolate,
"Persistent::New");
628 void V8::MakeWeak(
i::Object**
object,
void* parameters,
644 void V8::MarkIndependent(
i::Object**
object) {
646 LOG_API(isolate,
"MakeIndependent");
651 bool V8::IsGlobalIndependent(
i::Object** obj) {
653 LOG_API(isolate,
"IsGlobalIndependent");
659 bool V8::IsGlobalNearDeath(
i::Object** obj) {
661 LOG_API(isolate,
"IsGlobalNearDeath");
669 LOG_API(isolate,
"IsGlobalWeak");
675 void V8::DisposeGlobal(
i::Object** obj) {
677 LOG_API(isolate,
"DisposeGlobal");
691 prev_next_ = current->next;
692 prev_limit_ = current->limit;
705 void HandleScope::Leave() {
706 ASSERT(isolate_ == i::Isolate::Current());
710 ASSERT(current->level >= 0);
711 current->next = prev_next_;
712 if (current->limit != prev_limit_) {
713 current->limit = prev_limit_;
718 i::HandleScope::ZapRange(prev_next_, prev_limit_);
724 EnsureInitializedForIsolate(
725 i::Isolate::Current(),
"HandleScope::NumberOfHandles");
736 ASSERT(value->IsHeapObject());
745 if (IsDeadCheck(isolate,
"v8::Context::Enter()"))
return;
763 "v8::Context::Exit()",
764 "Cannot exit non-entered context")) {
779 if (IsDeadCheck(isolate,
"v8::Context::SetData()"))
return;
781 ASSERT(env->IsNativeContext());
782 if (env->IsNativeContext()) {
783 env->set_data(*raw_data);
791 if (IsDeadCheck(isolate,
"v8::Context::GetData()")) {
794 ASSERT(env->IsNativeContext());
795 if (!env->IsNativeContext()) {
804 if (!ApiCheck(!is_closed_,
805 "v8::HandleScope::Close()",
806 "Local scope has already been closed")) {
809 LOG_API(isolate_,
"CloseHandleScope");
825 return handle.location();
839 EnsureInitializedForIsolate(isolate,
"v8::Nowhere");
843 value_->set_elements(*elements);
865 return obj_.
get(offset + 1);
876 int size = obj_.
size();
877 if (length == size - 1) {
879 for (
int i = 0; i <
length; i++)
880 new_elms->set(i + 1,
get(i));
881 obj_.
value()->set_elements(*new_elms);
883 obj_.
set(length + 1, *value);
889 if (index < 0 || index >= this->
length())
return;
890 obj_.
set(index + 1, value);
905 if (IsDeadCheck(isolate,
"v8::Template::Set()"))
return;
909 if (list->IsUndefined()) {
911 Utils::OpenHandle(
this)->set_property_list(*list);
914 array.
add(Utils::OpenHandle(*name));
915 array.
add(Utils::OpenHandle(*value));
921 static void InitializeFunctionTemplate(
929 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
930 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::PrototypeTemplate()")) {
935 if (result->IsUndefined()) {
937 Utils::OpenHandle(
this)->set_prototype_template(*result);
944 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
945 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::Inherit()"))
return;
947 Utils::OpenHandle(
this)->set_parent_template(*Utils::OpenHandle(*value));
954 EnsureInitializedForIsolate(isolate,
"v8::FunctionTemplate::New()");
955 LOG_API(isolate,
"FunctionTemplate::New");
961 InitializeFunctionTemplate(obj);
962 int next_serial_number = isolate->next_serial_number();
963 isolate->set_next_serial_number(next_serial_number + 1);
969 obj->set_undetectable(
false);
970 obj->set_needs_access_check(
false);
973 obj->set_signature(*Utils::OpenHandle(*signature));
981 EnsureInitializedForIsolate(isolate,
"v8::Signature::New()");
982 LOG_API(isolate,
"Signature::New");
988 if (!receiver.
IsEmpty()) obj->set_receiver(*Utils::OpenHandle(*receiver));
991 for (
int i = 0; i < argc; i++) {
992 if (!argv[i].IsEmpty())
993 args->set(i, *Utils::OpenHandle(*argv[i]));
995 obj->set_args(*args);
1015 EnsureInitializedForIsolate(isolate,
"v8::TypeSwitch::New()");
1016 LOG_API(isolate,
"TypeSwitch::New");
1019 for (
int i = 0; i < argc; i++)
1020 vector->set(i, *Utils::OpenHandle(*types[i]));
1025 obj->set_types(*vector);
1032 LOG_API(isolate,
"TypeSwitch::match");
1037 for (
int i = 0; i < types->
length(); i++) {
1045 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \
1046 i::Handle<i::Object> foreign = FromCData(cdata); \
1047 (obj)->setter(*foreign); \
1053 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1054 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::SetCallHandler()"))
return;
1063 obj->set_data(*Utils::OpenHandle(*data));
1064 Utils::OpenHandle(
this)->set_call_code(*obj);
1080 obj->set_data(*Utils::OpenHandle(*data));
1081 obj->set_name(*Utils::OpenHandle(*name));
1082 if (settings &
ALL_CAN_READ) obj->set_all_can_read(
true);
1085 obj->set_property_attributes(static_cast<PropertyAttributes>(attributes));
1087 obj->set_expected_receiver_type(*Utils::OpenHandle(*signature));
1093 void FunctionTemplate::AddInstancePropertyAccessor(
1101 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1102 if (IsDeadCheck(isolate,
1103 "v8::FunctionTemplate::AddInstancePropertyAccessor()")) {
1110 settings, attributes,
1113 if (list->IsUndefined()) {
1114 list = NeanderArray().value();
1115 Utils::OpenHandle(
this)->set_property_accessors(*list);
1117 NeanderArray array(list);
1123 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1124 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::InstanceTemplate()")
1125 || EmptyCheck(
"v8::FunctionTemplate::InstanceTemplate()",
this))
1131 Utils::OpenHandle(
this)->set_instance_template(*Utils::OpenHandle(*templ));
1140 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1141 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::SetClassName()"))
return;
1143 Utils::OpenHandle(
this)->set_class_name(*Utils::OpenHandle(*name));
1148 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1149 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::SetHiddenPrototype()")) {
1153 Utils::OpenHandle(
this)->set_hidden_prototype(value);
1158 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1159 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::SetPrototypeAttributes()")) {
1163 Utils::OpenHandle(
this)->set_read_only_prototype(
true);
1167 void FunctionTemplate::SetNamedInstancePropertyHandler(
1174 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1175 if (IsDeadCheck(isolate,
1176 "v8::FunctionTemplate::SetNamedInstancePropertyHandler()")) {
1193 obj->set_data(*Utils::OpenHandle(*data));
1194 Utils::OpenHandle(
this)->set_named_property_handler(*obj);
1198 void FunctionTemplate::SetIndexedInstancePropertyHandler(
1204 Handle<Value> data) {
1205 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1206 if (IsDeadCheck(isolate,
1207 "v8::FunctionTemplate::SetIndexedInstancePropertyHandler()")) {
1224 obj->set_data(*Utils::OpenHandle(*data));
1225 Utils::OpenHandle(
this)->set_indexed_property_handler(*obj);
1229 void FunctionTemplate::SetInstanceCallAsFunctionHandler(
1231 Handle<Value> data) {
1232 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1233 if (IsDeadCheck(isolate,
1234 "v8::FunctionTemplate::SetInstanceCallAsFunctionHandler()")) {
1245 obj->set_data(*Utils::OpenHandle(*data));
1246 Utils::OpenHandle(
this)->set_instance_call_handler(*obj);
1261 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::New()")) {
1264 EnsureInitializedForIsolate(isolate,
"v8::ObjectTemplate::New()");
1265 LOG_API(isolate,
"ObjectTemplate::New");
1273 obj->set_constructor(*Utils::OpenHandle(*constructor));
1281 static void EnsureConstructor(ObjectTemplate* object_template) {
1282 if (Utils::OpenHandle(object_template)->constructor()->IsUndefined()) {
1285 constructor->set_instance_template(*Utils::OpenHandle(object_template));
1286 Utils::OpenHandle(object_template)->set_constructor(*constructor);
1298 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1299 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::SetAccessor()"))
return;
1302 EnsureConstructor(
this);
1322 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1323 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::SetNamedPropertyHandler()")) {
1328 EnsureConstructor(
this);
1342 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1343 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::MarkAsUndetectable()"))
return;
1346 EnsureConstructor(
this);
1350 cons->set_undetectable(
true);
1358 bool turned_on_by_default) {
1359 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1360 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::SetAccessCheckCallbacks()")) {
1365 EnsureConstructor(
this);
1376 info->set_data(*Utils::OpenHandle(*data));
1381 cons->set_access_check_info(*info);
1382 cons->set_needs_access_check(turned_on_by_default);
1393 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1394 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::SetIndexedPropertyHandler()")) {
1399 EnsureConstructor(
this);
1414 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1415 if (IsDeadCheck(isolate,
1416 "v8::ObjectTemplate::SetCallAsFunctionHandler()")) {
1421 EnsureConstructor(
this);
1425 Utils::ToLocal(cons)->SetInstanceCallAsFunctionHandler(callback, data);
1430 if (IsDeadCheck(Utils::OpenHandle(
this)->GetIsolate(),
1431 "v8::ObjectTemplate::InternalFieldCount()")) {
1439 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1440 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::SetInternalFieldCount()")) {
1444 "v8::ObjectTemplate::SetInternalFieldCount()",
1445 "Invalid internal field count")) {
1453 EnsureConstructor(
this);
1455 Utils::OpenHandle(
this)->set_internal_field_count(
i::Smi::FromInt(value));
1464 reinterpret_cast<const unsigned char*>(input), length);
1471 if (str->IsExternalTwoByteString()) {
1484 if (length %
sizeof(
unsigned) != 0) {
1489 int deserialized_data_length = length /
sizeof(unsigned);
1491 if (reinterpret_cast<intptr_t>(data) %
sizeof(unsigned) == 0) {
1495 unsigned* deserialized_data = i::NewArray<unsigned>(deserialized_data_length);
1512 LOG_API(isolate,
"Script::New");
1518 int line_offset = 0;
1519 int column_offset = 0;
1520 if (origin !=
NULL) {
1540 pre_data_impl =
NULL;
1550 Utils::OpenHandle(*script_data,
true),
1552 has_pending_exception = result.
is_null();
1554 raw_result = *result;
1564 return New(source, &origin);
1574 LOG_API(isolate,
"Script::Compile");
1577 if (
generic.IsEmpty())
1594 return Compile(source, &origin, 0, script_data);
1601 LOG_API(isolate,
"Script::Run");
1608 if (obj->IsSharedFunctionInfo()) {
1622 raw_result = *result;
1632 if (obj->IsSharedFunctionInfo()) {
1646 LOG_API(isolate,
"Script::Id");
1662 ON_BAILOUT(isolate,
"v8::Script::SetData()",
return);
1663 LOG_API(isolate,
"Script::SetData");
1669 script->set_data(*raw_data);
1678 : isolate_(i::
Isolate::Current()),
1679 next_(isolate_->try_catch_handler_address()),
1680 exception_(isolate_->heap()->the_hole_value()),
1681 message_(i::Smi::FromInt(0)),
1683 can_continue_(
true),
1684 capture_message_(
true),
1691 ASSERT(isolate_ == i::Isolate::Current());
1695 isolate_->UnregisterTryCatchHandler(
this);
1698 isolate_->UnregisterTryCatchHandler(
this);
1704 return !
reinterpret_cast<i::Object*
>(exception_)->IsTheHole();
1709 return can_continue_;
1721 ASSERT(isolate_ == i::Isolate::Current());
1733 ASSERT(isolate_ == i::Isolate::Current());
1751 ASSERT(isolate_ == i::Isolate::Current());
1762 ASSERT(isolate_ == i::Isolate::Current());
1763 exception_ = isolate_->heap()->the_hole_value();
1769 is_verbose_ = value;
1774 capture_message_ = value;
1782 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1789 return scope.
Close(result);
1794 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1795 if (IsDeadCheck(isolate,
"v8::Message::GetScriptResourceName()")) {
1811 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1812 if (IsDeadCheck(isolate,
"v8::Message::GetScriptResourceData()")) {
1828 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1829 if (IsDeadCheck(isolate,
"v8::Message::GetStackTrace()")) {
1848 bool* has_pending_exception) {
1863 bool* has_pending_exception) {
1865 return CallV8HeapFunction(name,
1866 i::Isolate::Current()->js_builtins_object(),
1869 has_pending_exception);
1874 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1881 Utils::OpenHandle(
this),
1882 &has_pending_exception);
1884 return static_cast<int>(result->Number());
1889 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1890 if (IsDeadCheck(isolate,
"v8::Message::GetStartPosition()"))
return 0;
1895 return message->start_position();
1900 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1901 if (IsDeadCheck(isolate,
"v8::Message::GetEndPosition()"))
return 0;
1906 return message->end_position();
1911 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1912 if (IsDeadCheck(isolate,
"v8::Message::GetStartColumn()")) {
1920 "GetPositionInLine",
1922 &has_pending_exception);
1924 return static_cast<int>(start_col_obj->Number());
1929 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1930 if (IsDeadCheck(isolate,
"v8::Message::GetEndColumn()"))
return kNoColumnInfo;
1936 "GetPositionInLine",
1938 &has_pending_exception);
1942 int start = message->start_position();
1943 int end = message->end_position();
1944 return static_cast<int>(start_col_obj->Number()) + (end - start);
1949 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1955 Utils::OpenHandle(
this),
1956 &has_pending_exception);
1958 if (result->IsString()) {
1968 if (IsDeadCheck(isolate,
"v8::Message::PrintCurrentStackTrace()"))
return;
1977 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1978 if (IsDeadCheck(isolate,
"v8::StackTrace::GetFrame()")) {
1991 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
1992 if (IsDeadCheck(isolate,
"v8::StackTrace::GetFrameCount()"))
return -1;
1999 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2000 if (IsDeadCheck(isolate,
"v8::StackTrace::AsArray()"))
Local<Array>();
2009 if (IsDeadCheck(isolate,
"v8::StackTrace::CurrentStackTrace()")) {
2022 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2023 if (IsDeadCheck(isolate,
"v8::StackFrame::GetLineNumber()")) {
2030 if (!line->IsSmi()) {
2038 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2039 if (IsDeadCheck(isolate,
"v8::StackFrame::GetColumn()")) {
2046 if (!column->IsSmi()) {
2054 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2055 if (IsDeadCheck(isolate,
"v8::StackFrame::GetScriptName()")) {
2062 if (!name->IsString()) {
2070 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2071 if (IsDeadCheck(isolate,
"v8::StackFrame::GetScriptNameOrSourceURL()")) {
2078 if (!name->IsString()) {
2086 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2087 if (IsDeadCheck(isolate,
"v8::StackFrame::GetFunctionName()")) {
2094 if (!name->IsString()) {
2102 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2103 if (IsDeadCheck(isolate,
"v8::StackFrame::IsEval()"))
return false;
2108 return is_eval->IsTrue();
2113 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2114 if (IsDeadCheck(isolate,
"v8::StackFrame::IsConstructor()"))
return false;
2119 return is_constructor->IsTrue();
2125 bool Value::FullIsUndefined()
const {
2126 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsUndefined()")) {
2129 bool result = Utils::OpenHandle(
this)->IsUndefined();
2135 bool Value::FullIsNull()
const {
2136 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsNull()"))
return false;
2137 bool result = Utils::OpenHandle(
this)->IsNull();
2144 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsTrue()"))
return false;
2145 return Utils::OpenHandle(
this)->IsTrue();
2150 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsFalse()"))
return false;
2151 return Utils::OpenHandle(
this)->IsFalse();
2156 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsFunction()")) {
2159 return Utils::OpenHandle(
this)->IsJSFunction();
2163 bool Value::FullIsString()
const {
2164 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsString()"))
return false;
2165 bool result = Utils::OpenHandle(
this)->IsString();
2172 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsArray()"))
return false;
2173 return Utils::OpenHandle(
this)->IsJSArray();
2178 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsObject()"))
return false;
2179 return Utils::OpenHandle(
this)->IsJSObject();
2184 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsNumber()"))
return false;
2185 return Utils::OpenHandle(
this)->IsNumber();
2190 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsBoolean()")) {
2193 return Utils::OpenHandle(
this)->IsBoolean();
2198 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsExternal()")) {
2201 return Utils::OpenHandle(
this)->IsForeign();
2206 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsInt32()"))
return false;
2208 if (obj->IsSmi())
return true;
2209 if (obj->IsNumber()) {
2210 double value = obj->Number();
2223 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsUint32()"))
return false;
2226 if (obj->IsNumber()) {
2227 double value = obj->Number();
2241 if (IsDeadCheck(isolate,
"v8::Value::IsDate()"))
return false;
2243 return obj->HasSpecificClassOf(isolate->
heap()->Date_symbol());
2249 if (IsDeadCheck(isolate,
"v8::Value::IsStringObject()"))
return false;
2251 return obj->HasSpecificClassOf(isolate->
heap()->String_symbol());
2257 if (IsDeadCheck(isolate,
"v8::Value::IsNumberObject()"))
return false;
2259 return obj->HasSpecificClassOf(isolate->
heap()->Number_symbol());
2264 const char* builtin_name) {
2268 return builtins->GetPropertyNoExceptionThrown(*symbol);
2272 static bool CheckConstructor(
i::Isolate* isolate,
2274 const char* class_name) {
2275 return obj->map()->constructor() == LookupBuiltin(isolate, class_name);
2281 if (IsDeadCheck(isolate,
"v8::Value::IsNativeError()"))
return false;
2283 if (obj->IsJSObject()) {
2285 return CheckConstructor(isolate, js_obj,
"$Error") ||
2286 CheckConstructor(isolate, js_obj,
"$EvalError") ||
2287 CheckConstructor(isolate, js_obj,
"$RangeError") ||
2288 CheckConstructor(isolate, js_obj,
"$ReferenceError") ||
2289 CheckConstructor(isolate, js_obj,
"$SyntaxError") ||
2290 CheckConstructor(isolate, js_obj,
"$TypeError") ||
2291 CheckConstructor(isolate, js_obj,
"$URIError");
2300 if (IsDeadCheck(isolate,
"v8::Value::IsBooleanObject()"))
return false;
2302 return obj->HasSpecificClassOf(isolate->
heap()->Boolean_symbol());
2307 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsRegExp()"))
return false;
2309 return obj->IsJSRegExp();
2316 if (obj->IsString()) {
2320 if (IsDeadCheck(isolate,
"v8::Value::ToString()")) {
2336 if (obj->IsString()) {
2340 if (IsDeadCheck(isolate,
"v8::Value::ToDetailString()")) {
2343 LOG_API(isolate,
"ToDetailString");
2356 if (obj->IsJSObject()) {
2360 if (IsDeadCheck(isolate,
"v8::Value::ToObject()")) {
2375 if (obj->IsBoolean()) {
2379 if (IsDeadCheck(isolate,
"v8::Value::ToBoolean()")) {
2382 LOG_API(isolate,
"ToBoolean");
2393 if (obj->IsNumber()) {
2397 if (IsDeadCheck(isolate,
"v8::Value::ToNumber()")) {
2417 if (IsDeadCheck(isolate,
"v8::Value::ToInteger()"))
return Local<Integer>();
2418 LOG_API(isolate,
"ToInteger");
2428 void External::CheckCast(
v8::Value* that) {
2429 if (IsDeadCheck(i::Isolate::Current(),
"v8::External::Cast()"))
return;
2431 ApiCheck(obj->IsForeign(),
2432 "v8::External::Cast()",
2433 "Could not convert to external");
2437 void v8::Object::CheckCast(Value* that) {
2438 if (IsDeadCheck(i::Isolate::Current(),
"v8::Object::Cast()"))
return;
2440 ApiCheck(obj->IsJSObject(),
2441 "v8::Object::Cast()",
2442 "Could not convert to object");
2446 void v8::Function::CheckCast(Value* that) {
2447 if (IsDeadCheck(i::Isolate::Current(),
"v8::Function::Cast()"))
return;
2449 ApiCheck(obj->IsJSFunction(),
2450 "v8::Function::Cast()",
2451 "Could not convert to function");
2455 void v8::String::CheckCast(
v8::Value* that) {
2456 if (IsDeadCheck(i::Isolate::Current(),
"v8::String::Cast()"))
return;
2458 ApiCheck(obj->IsString(),
2459 "v8::String::Cast()",
2460 "Could not convert to string");
2464 void v8::Number::CheckCast(
v8::Value* that) {
2465 if (IsDeadCheck(i::Isolate::Current(),
"v8::Number::Cast()"))
return;
2467 ApiCheck(obj->IsNumber(),
2468 "v8::Number::Cast()",
2469 "Could not convert to number");
2473 void v8::Integer::CheckCast(
v8::Value* that) {
2474 if (IsDeadCheck(i::Isolate::Current(),
"v8::Integer::Cast()"))
return;
2476 ApiCheck(obj->IsNumber(),
2477 "v8::Integer::Cast()",
2478 "Could not convert to number");
2482 void v8::Array::CheckCast(Value* that) {
2483 if (IsDeadCheck(i::Isolate::Current(),
"v8::Array::Cast()"))
return;
2485 ApiCheck(obj->IsJSArray(),
2486 "v8::Array::Cast()",
2487 "Could not convert to array");
2491 void v8::Date::CheckCast(
v8::Value* that) {
2493 if (IsDeadCheck(isolate,
"v8::Date::Cast()"))
return;
2495 ApiCheck(obj->HasSpecificClassOf(isolate->
heap()->Date_symbol()),
2497 "Could not convert to date");
2501 void v8::StringObject::CheckCast(
v8::Value* that) {
2503 if (IsDeadCheck(isolate,
"v8::StringObject::Cast()"))
return;
2505 ApiCheck(obj->HasSpecificClassOf(isolate->
heap()->String_symbol()),
2506 "v8::StringObject::Cast()",
2507 "Could not convert to StringObject");
2511 void v8::NumberObject::CheckCast(
v8::Value* that) {
2513 if (IsDeadCheck(isolate,
"v8::NumberObject::Cast()"))
return;
2515 ApiCheck(obj->HasSpecificClassOf(isolate->
heap()->Number_symbol()),
2516 "v8::NumberObject::Cast()",
2517 "Could not convert to NumberObject");
2521 void v8::BooleanObject::CheckCast(
v8::Value* that) {
2523 if (IsDeadCheck(isolate,
"v8::BooleanObject::Cast()"))
return;
2525 ApiCheck(obj->HasSpecificClassOf(isolate->
heap()->Boolean_symbol()),
2526 "v8::BooleanObject::Cast()",
2527 "Could not convert to BooleanObject");
2531 void v8::RegExp::CheckCast(
v8::Value* that) {
2532 if (IsDeadCheck(i::Isolate::Current(),
"v8::RegExp::Cast()"))
return;
2534 ApiCheck(obj->IsJSRegExp(),
2535 "v8::RegExp::Cast()",
2536 "Could not convert to regular expression");
2542 if (obj->IsBoolean()) {
2543 return obj->IsTrue();
2546 if (IsDeadCheck(isolate,
"v8::Value::BooleanValue()"))
return false;
2547 LOG_API(isolate,
"BooleanValue");
2550 return value->IsTrue();
2558 if (obj->IsNumber()) {
2562 if (IsDeadCheck(isolate,
"v8::Value::NumberValue()")) {
2565 LOG_API(isolate,
"NumberValue");
2571 return num->Number();
2578 if (obj->IsNumber()) {
2582 if (IsDeadCheck(isolate,
"v8::Value::IntegerValue()"))
return 0;
2583 LOG_API(isolate,
"IntegerValue");
2592 return static_cast<int64_t
>(num->Number());
2604 if (IsDeadCheck(isolate,
"v8::Value::ToInt32()"))
return Local<Int32>();
2622 if (IsDeadCheck(isolate,
"v8::Value::ToUint32()"))
return Local<Uint32>();
2640 if (IsDeadCheck(isolate,
"v8::Value::ToArrayIndex()"))
return Local<Uint32>();
2641 LOG_API(isolate,
"ToArrayIndex");
2649 if (str->AsArrayIndex(&index)) {
2668 if (IsDeadCheck(isolate,
"v8::Value::Int32Value()"))
return 0;
2669 LOG_API(isolate,
"Int32Value (slow)");
2678 return static_cast<int32_t>(num->Number());
2686 if (IsDeadCheck(isolate,
"v8::Value::Equals()")
2687 || EmptyCheck(
"v8::Value::Equals()",
this)
2688 || EmptyCheck(
"v8::Value::Equals()", that)) {
2698 if (obj->IsJSObject() && other->IsJSObject()) {
2699 return *obj == *other;
2704 CallV8HeapFunction(
"EQUALS", obj,
ARRAY_SIZE(args), args,
2705 &has_pending_exception);
2713 if (IsDeadCheck(isolate,
"v8::Value::StrictEquals()")
2714 || EmptyCheck(
"v8::Value::StrictEquals()",
this)
2715 || EmptyCheck(
"v8::Value::StrictEquals()", that)) {
2718 LOG_API(isolate,
"StrictEquals");
2722 if (obj->IsHeapNumber()) {
2723 if (!other->IsNumber())
return false;
2724 double x = obj->Number();
2725 double y = other->Number();
2728 }
else if (*obj == *other) {
2730 }
else if (obj->IsSmi()) {
2731 return other->IsNumber() && obj->Number() == other->Number();
2732 }
else if (obj->IsString()) {
2733 return other->IsString() &&
2735 }
else if (obj->IsUndefined() || obj->IsUndetectableObject()) {
2736 return other->IsUndefined() || other->IsUndetectableObject();
2749 if (IsDeadCheck(isolate,
"v8::Value::Uint32Value()"))
return 0;
2750 LOG_API(isolate,
"Uint32Value");
2759 return static_cast<uint32_t
>(num->Number());
2767 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2768 ON_BAILOUT(isolate,
"v8::Object::Set()",
return false);
2779 static_cast<PropertyAttributes>(attribs),
2781 has_pending_exception = obj.
is_null();
2788 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2789 ON_BAILOUT(isolate,
"v8::Object::Set()",
return false);
2801 has_pending_exception = obj.
is_null();
2810 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2811 ON_BAILOUT(isolate,
"v8::Object::ForceSet()",
return false);
2822 static_cast<PropertyAttributes>(attribs));
2823 has_pending_exception = obj.
is_null();
2830 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2831 ON_BAILOUT(isolate,
"v8::Object::ForceDelete()",
return false);
2841 if (self->IsJSGlobalProxy() ||
self->IsGlobalObject()) {
2847 has_pending_exception = obj.
is_null();
2849 return obj->IsTrue();
2854 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2861 has_pending_exception = result.
is_null();
2868 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2874 has_pending_exception = result.
is_null();
2881 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2882 ON_BAILOUT(isolate,
"v8::Object::GetPropertyAttribute()",
2883 return static_cast<PropertyAttribute>(
NONE));
2888 if (!key_obj->IsString()) {
2901 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2902 ON_BAILOUT(isolate,
"v8::Object::GetPrototype()",
2912 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2913 ON_BAILOUT(isolate,
"v8::Object::SetPrototype()",
return false);
2922 has_pending_exception = result.
is_null();
2930 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2932 "v8::Object::FindInstanceInPrototypeChain()",
2947 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2948 ON_BAILOUT(isolate,
"v8::Object::GetPropertyNames()",
2968 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2969 ON_BAILOUT(isolate,
"v8::Object::GetOwnPropertyNames()",
2989 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
2990 ON_BAILOUT(isolate,
"v8::Object::ObjectProtoToString()",
3002 if (!name->IsString()) {
3011 const char* prefix =
"[object ";
3013 const char* postfix =
"]";
3016 int str_len = str->
Length();
3019 int buf_len = prefix_len + str_len + postfix_len;
3023 char* ptr = buf.
start();
3032 memcpy(ptr, postfix, postfix_len * v8::internal::kCharSize);
3043 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3044 ON_BAILOUT(isolate,
"v8::Object::GetConstructor()",
3054 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3055 ON_BAILOUT(isolate,
"v8::Object::GetConstructorName()",
3065 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3066 ON_BAILOUT(isolate,
"v8::Object::Delete()",
return false);
3076 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3077 ON_BAILOUT(isolate,
"v8::Object::Has()",
return false);
3081 return self->HasProperty(*key_obj);
3086 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3087 ON_BAILOUT(isolate,
"v8::Object::DeleteProperty()",
3097 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3098 ON_BAILOUT(isolate,
"v8::Object::HasProperty()",
return false);
3100 return self->HasElement(index);
3110 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3111 ON_BAILOUT(isolate,
"v8::Object::SetAccessor()",
return false);
3116 settings, attributes,
3118 bool fast = Utils::OpenHandle(
this)->HasFastProperties();
3120 if (result.
is_null() || result->IsUndefined())
return false;
3127 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3128 ON_BAILOUT(isolate,
"v8::Object::HasOwnProperty()",
3130 return Utils::OpenHandle(
this)->HasLocalProperty(
3131 *Utils::OpenHandle(*key));
3136 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3137 ON_BAILOUT(isolate,
"v8::Object::HasRealNamedProperty()",
3139 return Utils::OpenHandle(
this)->HasRealNamedProperty(
3140 *Utils::OpenHandle(*key));
3145 ON_BAILOUT(Utils::OpenHandle(
this)->GetIsolate(),
3146 "v8::Object::HasRealIndexedProperty()",
3148 return Utils::OpenHandle(
this)->HasRealElementProperty(index);
3153 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3155 "v8::Object::HasRealNamedCallbackProperty()",
3158 return Utils::OpenHandle(
this)->HasRealNamedCallbackProperty(
3159 *Utils::OpenHandle(*key));
3164 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3165 ON_BAILOUT(isolate,
"v8::Object::HasNamedLookupInterceptor()",
3167 return Utils::OpenHandle(
this)->HasNamedInterceptor();
3172 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3173 ON_BAILOUT(isolate,
"v8::Object::HasIndexedLookupInterceptor()",
3175 return Utils::OpenHandle(
this)->HasIndexedInterceptor();
3182 i::LookupResult* lookup) {
3183 if (!lookup->IsProperty()) {
3195 has_pending_exception = result.
is_null();
3204 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3206 "v8::Object::GetRealNamedPropertyInPrototypeChain()",
3211 i::LookupResult lookup(isolate);
3212 self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup);
3213 return GetPropertyByLookup(isolate, self_obj, key_obj, &lookup);
3218 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3219 ON_BAILOUT(isolate,
"v8::Object::GetRealNamedProperty()",
3224 i::LookupResult lookup(isolate);
3225 self_obj->LookupRealNamedProperty(*key_obj, &lookup);
3226 return GetPropertyByLookup(isolate, self_obj, key_obj, &lookup);
3234 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3235 ON_BAILOUT(isolate,
"v8::Object::TurnOnAccessCheck()",
return);
3246 new_map->set_is_access_check_needed(
true);
3247 obj->set_map(*new_map);
3252 return Utils::OpenHandle(
this)->IsDirty();
3257 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3263 has_pending_exception = result.
is_null();
3270 i::Object* constructor =
object->map()->constructor();
3272 if (!constructor->IsJSFunction()) {
3275 ASSERT(object->IsJSFunction());
3280 return function->context()->native_context();
3285 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3290 i::Context* context = GetCreationContext(*
self);
3296 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3297 ON_BAILOUT(isolate,
"v8::Object::GetIdentityHash()",
return 0);
3307 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3308 ON_BAILOUT(isolate,
"v8::Object::SetHiddenValue()",
return false);
3309 if (value.
IsEmpty())
return DeleteHiddenValue(key);
3318 return *result == *
self;
3323 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3324 ON_BAILOUT(isolate,
"v8::Object::GetHiddenValue()",
3337 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3338 ON_BAILOUT(isolate,
"v8::DeleteHiddenValue()",
return false);
3344 self->DeleteHiddenProperty(*key_symbol);
3353 switch (array_type) {
3398 GetElementsKindFromExternalArrayType(array_type));
3400 object->set_map(*external_array_map);
3401 object->set_elements(*array);
3408 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3409 ON_BAILOUT(isolate,
"v8::SetElementsToPixelData()",
return);
3413 "v8::Object::SetIndexedPropertiesToPixelData()",
3414 "length exceeds max acceptable value")) {
3418 if (!ApiCheck(!self->IsJSArray(),
3419 "v8::Object::SetIndexedPropertiesToPixelData()",
3420 "JSArray is not supported")) {
3429 ON_BAILOUT(self->GetIsolate(),
"v8::HasIndexedPropertiesInPixelData()",
3431 return self->HasExternalPixelElements();
3437 ON_BAILOUT(self->GetIsolate(),
"v8::GetIndexedPropertiesPixelData()",
3439 if (self->HasExternalPixelElements()) {
3441 external_pixel_pointer();
3450 ON_BAILOUT(self->GetIsolate(),
"v8::GetIndexedPropertiesPixelDataLength()",
3452 if (self->HasExternalPixelElements()) {
3464 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3465 ON_BAILOUT(isolate,
"v8::SetIndexedPropertiesToExternalArrayData()",
return);
3469 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3470 "length exceeds max acceptable value")) {
3474 if (!ApiCheck(!self->IsJSArray(),
3475 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3476 "JSArray is not supported")) {
3479 PrepareExternalArrayElements(
self, data, array_type, length);
3486 "v8::HasIndexedPropertiesInExternalArrayData()",
3488 return self->HasExternalArrayElements();
3495 "v8::GetIndexedPropertiesExternalArrayData()",
3497 if (self->HasExternalArrayElements()) {
3508 "v8::GetIndexedPropertiesExternalArrayDataType()",
3510 switch (self->elements()->map()->instance_type()) {
3538 "v8::GetIndexedPropertiesExternalArrayDataLength()",
3540 if (self->HasExternalArrayElements()) {
3549 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3550 ON_BAILOUT(isolate,
"v8::Object::IsCallable()",
return false);
3554 if (obj->IsJSFunction())
return true;
3562 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3563 ON_BAILOUT(isolate,
"v8::Object::CallAsFunction()",
3565 LOG_API(isolate,
"Object::CallAsFunction");
3573 if (obj->IsJSFunction()) {
3593 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3594 ON_BAILOUT(isolate,
"v8::Object::CallAsConstructor()",
3596 LOG_API(isolate,
"Object::CallAsConstructor");
3602 if (obj->IsJSFunction()) {
3615 if (!delegate->IsUndefined()) {
3621 ASSERT(!delegate->IsUndefined());
3635 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3636 ON_BAILOUT(isolate,
"v8::Function::NewInstance()",
3638 LOG_API(isolate,
"Function::NewInstance");
3654 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3656 LOG_API(isolate,
"Function::Call");
3669 raw_result = *returned;
3677 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3681 func->shared()->set_name(*Utils::OpenHandle(*name));
3699 if (func->shared()->script()->IsScript()) {
3716 if (func->shared()->script()->IsScript()) {
3726 if (func->shared()->script()->IsScript()) {
3735 if (!func->shared()->script()->IsScript())
3743 if (IsDeadCheck(str->GetIsolate(),
"v8::String::Length()"))
return 0;
3744 return str->length();
3750 if (IsDeadCheck(str->GetIsolate(),
"v8::String::Utf8Length()"))
return 0;
3756 static int RecursivelySerializeToUtf8(
i::String*
string,
3760 int recursion_budget,
3768 return utf8_bytes + end - start;
3770 switch (i::StringShape(
string).representation_tag()) {
3773 ExternalTwoByteStringGetData(0);
3774 char* current = buffer;
3775 for (
int i = start; i < end; i++) {
3779 previous_character = character;
3781 *last_character = previous_character;
3782 return static_cast<int>(utf8_bytes + current - buffer);
3787 char* current = buffer;
3788 for (
int i = start; i < end; i++) {
3792 previous_character = character;
3794 *last_character = previous_character;
3795 return static_cast<int>(utf8_bytes + current - buffer);
3799 unsigned offset = slice->
offset();
3800 string = slice->
parent();
3808 int boundary = first->
length();
3809 if (start >= boundary) {
3811 string = cons_string->
second();
3815 }
else if (end <= boundary) {
3819 if (recursion_budget == 0)
return -1;
3820 int extra_utf8_bytes =
3821 RecursivelySerializeToUtf8(first,
3825 recursion_budget - 1,
3827 &previous_character);
3828 if (extra_utf8_bytes < 0)
return extra_utf8_bytes;
3829 buffer += extra_utf8_bytes;
3830 utf8_bytes += extra_utf8_bytes;
3831 string = cons_string->
second();
3845 if (IsDeadCheck(str->GetIsolate(),
"v8::String::MayContainNonAscii()")) {
3848 return !str->HasOnlyAsciiChars();
3855 int options)
const {
3856 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3857 if (IsDeadCheck(isolate,
"v8::String::WriteUtf8()"))
return 0;
3858 LOG_API(isolate,
"String::WriteUtf8");
3864 int string_length = str->length();
3865 if (str->IsAsciiRepresentation()) {
3867 if (capacity == -1) {
3868 capacity = str->length() + 1;
3869 len = string_length;
3871 len = i::Min(capacity, str->length());
3874 if (nchars_ref !=
NULL) *nchars_ref = len;
3882 if (capacity == -1 || capacity / 3 >= string_length) {
3884 const int kMaxRecursion = 100;
3886 RecursivelySerializeToUtf8(*str,
3893 if (utf8_bytes >= 0) {
3896 (capacity > utf8_bytes || capacity == -1)) {
3897 buffer[utf8_bytes++] =
'\0';
3899 if (nchars_ref !=
NULL) *nchars_ref = string_length;
3905 return WriteUtf8(buffer, capacity, nchars_ref, options);
3906 }
else if (capacity >= string_length) {
3912 if (utf8_bytes <= capacity) {
3913 return WriteUtf8(buffer, -1, nchars_ref, options);
3921 write_input_buffer.
Reset(0, *str);
3922 int len = str->length();
3931 for (i = 0; i < len && (capacity == -1 || pos < fast_end); i++) {
3943 for (; i < len && pos < capacity; i++) {
3961 if (pos + written <= capacity) {
3962 for (
int j = 0; j < written; j++) {
3963 buffer[pos + j] = intermediate[j];
3975 if (nchars_ref !=
NULL) *nchars_ref = nchars;
3977 (i == len && (capacity == -1 || pos < capacity))) {
3978 buffer[pos++] =
'\0';
3987 int options)
const {
3988 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
3989 if (IsDeadCheck(isolate,
"v8::String::WriteAscii()"))
return 0;
3990 LOG_API(isolate,
"String::WriteAscii");
3992 ASSERT(start >= 0 && length >= -1);
3999 if (str->IsAsciiRepresentation()) {
4001 if (length == -1) length = str->length() + 1;
4002 int len = i::Min(length, str->length() - start);
4005 for (
int i = 0; i < len; i++) {
4006 if (buffer[i] ==
'\0') buffer[i] =
' ';
4017 if ((length == -1) || (length > str->length() - start)) {
4018 end = str->length() - start;
4020 if (end < 0)
return 0;
4021 write_input_buffer.
Reset(start, *str);
4023 for (i = 0; i < end; i++) {
4024 char c =
static_cast<char>(write_input_buffer.
GetNext());
4038 int options)
const {
4039 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
4040 if (IsDeadCheck(isolate,
"v8::String::Write()"))
return 0;
4041 LOG_API(isolate,
"String::Write");
4043 ASSERT(start >= 0 && length >= -1);
4051 int end = start + length;
4052 if ((length == -1) || (length > str->length() - start) )
4053 end = str->length();
4054 if (end < 0)
return 0;
4057 (length == -1 || end - start < length)) {
4058 buffer[end - start] =
'\0';
4066 if (IsDeadCheck(str->GetIsolate(),
"v8::String::IsExternal()")) {
4069 EnsureInitializedForIsolate(str->GetIsolate(),
"v8::String::IsExternal()");
4070 return i::StringShape(*str).IsExternalTwoByte();
4076 if (IsDeadCheck(str->GetIsolate(),
"v8::String::IsExternalAscii()")) {
4079 return i::StringShape(*str).IsExternalAscii();
4083 void v8::String::VerifyExternalStringResource(
4087 if (i::StringShape(*str).IsExternalTwoByte()) {
4088 const void* resource =
4090 expected =
reinterpret_cast<const ExternalStringResource*
>(resource);
4097 void v8::String::VerifyExternalStringResourceBase(
4101 Encoding expectedEncoding;
4102 if (i::StringShape(*str).IsExternalAscii()) {
4103 const void* resource =
4105 expected =
reinterpret_cast<const ExternalStringResourceBase*
>(resource);
4106 expectedEncoding = ASCII_ENCODING;
4107 }
else if (i::StringShape(*str).IsExternalTwoByte()) {
4108 const void* resource =
4110 expected =
reinterpret_cast<const ExternalStringResourceBase*
>(resource);
4111 expectedEncoding = TWO_BYTE_ENCODING;
4114 expectedEncoding = str->IsAsciiRepresentation() ? ASCII_ENCODING
4115 : TWO_BYTE_ENCODING;
4118 CHECK_EQ(expectedEncoding, encoding);
4124 if (IsDeadCheck(str->GetIsolate(),
4125 "v8::String::GetExternalAsciiStringResource()")) {
4128 if (i::StringShape(*str).IsExternalAscii()) {
4129 const void* resource =
4139 if (IsDeadCheck(i::Isolate::Current(),
"v8::Number::Value()"))
return 0;
4141 return obj->Number();
4146 if (IsDeadCheck(i::Isolate::Current(),
"v8::Boolean::Value()"))
return false;
4148 return obj->IsTrue();
4153 if (IsDeadCheck(i::Isolate::Current(),
"v8::Integer::Value()"))
return 0;
4158 return static_cast<int64_t
>(obj->Number());
4164 if (IsDeadCheck(i::Isolate::Current(),
"v8::Int32::Value()"))
return 0;
4169 return static_cast<int32_t>(obj->Number());
4175 if (IsDeadCheck(i::Isolate::Current(),
"v8::Uint32::Value()"))
return 0;
4180 return static_cast<uint32_t
>(obj->Number());
4187 if (IsDeadCheck(obj->GetIsolate(),
"v8::Object::InternalFieldCount()")) {
4190 return obj->GetInternalFieldCount();
4194 Local<Value> v8::Object::CheckedGetInternalField(
int index) {
4196 if (IsDeadCheck(obj->GetIsolate(),
"v8::Object::GetInternalField()")) {
4199 if (!ApiCheck(index < obj->GetInternalFieldCount(),
4200 "v8::Object::GetInternalField()",
4201 "Reading internal field out of bounds")) {
4202 return Local<Value>();
4207 Local<Value> unchecked = UncheckedGetInternalField(index);
4208 ASSERT(unchecked.IsEmpty() || (unchecked == result));
4217 if (IsDeadCheck(isolate,
"v8::Object::SetInternalField()")) {
4220 if (!ApiCheck(index < obj->GetInternalFieldCount(),
4221 "v8::Object::SetInternalField()",
4222 "Writing internal field out of bounds")) {
4227 obj->SetInternalField(index, *val);
4231 static bool CanBeEncodedAsSmi(
void* ptr) {
4232 const uintptr_t address =
reinterpret_cast<uintptr_t
>(ptr);
4237 static i::Smi* EncodeAsSmi(
void* ptr) {
4238 ASSERT(CanBeEncodedAsSmi(ptr));
4239 const uintptr_t address =
reinterpret_cast<uintptr_t
>(ptr);
4249 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
4251 if (CanBeEncodedAsSmi(value)) {
4252 Utils::OpenHandle(
this)->SetInternalField(index, EncodeAsSmi(value));
4257 reinterpret_cast<i::Address>(value),
i::TENURED);
4259 Utils::OpenHandle(
this)->SetInternalField(index, *foreign);
4262 ASSERT_EQ(value, GetPointerFromInternalField(index));
4270 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
4274 return InitializeHelper();
4306 "v8::V8::Dispose()",
4307 "Use v8::Isolate::Dispose() for a non-default isolate.")) {
4316 total_heap_size_executable_(0),
4318 heap_size_limit_(0) { }
4322 if (!i::Isolate::Current()->IsInitialized()) {
4324 heap_statistics->set_total_heap_size(0);
4325 heap_statistics->set_total_heap_size_executable(0);
4326 heap_statistics->set_used_heap_size(0);
4327 heap_statistics->set_heap_size_limit(0);
4331 i::Heap* heap = i::Isolate::Current()->heap();
4333 heap_statistics->set_total_heap_size_executable(
4336 heap_statistics->set_heap_size_limit(heap->
MaxReserved());
4342 IsDeadCheck(isolate,
"v8::V8::VisitExternalResources");
4349 IsDeadCheck(isolate,
"v8::V8::VisitHandlesWithClassId");
4353 class VisitorAdapter :
public i::ObjectVisitor {
4356 : visitor_(visitor) {}
4366 } visitor_adapter(visitor);
4401 if (templ->constructor()->IsUndefined()) {
4403 Utils::OpenHandle(*constructor)->set_instance_template(*templ);
4404 templ->set_constructor(*Utils::OpenHandle(*constructor));
4417 EnsureInitializedForIsolate(isolate,
"v8::Context::New()");
4418 LOG_API(isolate,
"Context::New");
4429 if (!global_template.
IsEmpty()) {
4431 global_constructor =
4432 EnsureConstructor(Utils::OpenHandle(*global_template));
4437 EnsureConstructor(Utils::OpenHandle(*proxy_template));
4441 proxy_constructor->set_prototype_template(
4442 *Utils::OpenHandle(*global_template));
4447 if (!global_constructor->access_check_info()->IsUndefined()) {
4448 proxy_constructor->set_access_check_info(
4449 global_constructor->access_check_info());
4450 proxy_constructor->set_needs_access_check(
4451 global_constructor->needs_access_check());
4452 global_constructor->set_needs_access_check(
false);
4453 global_constructor->set_access_check_info(
4454 isolate->
heap()->undefined_value());
4461 Utils::OpenHandle(*global_object,
true),
4466 if (!global_template.
IsEmpty()) {
4469 global_constructor->set_access_check_info(
4470 proxy_constructor->access_check_info());
4471 global_constructor->set_needs_access_check(
4472 proxy_constructor->needs_access_check());
4487 if (IsDeadCheck(isolate,
"v8::Context::SetSecurityToken()")) {
4493 env->set_security_token(*token_handle);
4499 if (IsDeadCheck(isolate,
4500 "v8::Context::UseDefaultSecurityToken()")) {
4505 env->set_security_token(env->global_object());
4511 if (IsDeadCheck(isolate,
"v8::Context::GetSecurityToken()")) {
4515 i::Object* security_token = env->security_token();
4523 return env->has_out_of_memory();
4528 return i::Isolate::Current()->context() !=
NULL;
4534 if (!EnsureInitializedForIsolate(isolate,
"v8::Context::GetEntered()")) {
4547 if (IsDeadCheck(isolate,
"v8::Context::GetCurrent()")) {
4559 if (IsDeadCheck(isolate,
"v8::Context::GetCalling()")) {
4571 if (IsDeadCheck(i::Isolate::Current(),
"v8::Context::Global()")) {
4584 if (IsDeadCheck(isolate,
"v8::Context::DetachGlobal()"))
return;
4595 if (IsDeadCheck(isolate,
"v8::Context::ReattachGlobal()"))
return;
4608 if (IsDeadCheck(isolate,
"v8::Context::AllowCodeGenerationFromStrings()")) {
4615 context->set_allow_code_gen_from_strings(
4616 allow ? isolate->
heap()->true_value() : isolate->
heap()->false_value());
4622 if (IsDeadCheck(isolate,
4623 "v8::Context::IsCodeGenerationFromStringsAllowed()")) {
4630 return !context->allow_code_gen_from_strings()->IsFalse();
4637 if (IsDeadCheck(isolate,
4638 "v8::Context::SetErrorMessageForCodeGenerationFromStrings()")) {
4646 context->set_error_message_for_code_gen_from_strings(*error_handle);
4662 ON_BAILOUT(isolate,
"v8::ObjectTemplate::NewInstance()",
4664 LOG_API(isolate,
"ObjectTemplate::NewInstance");
4669 &has_pending_exception);
4677 ON_BAILOUT(isolate,
"v8::FunctionTemplate::GetFunction()",
4679 LOG_API(isolate,
"FunctionTemplate::GetFunction");
4684 &has_pending_exception);
4691 ON_BAILOUT(i::Isolate::Current(),
"v8::FunctionTemplate::HasInstanceOf()",
4693 i::Object* obj = *Utils::OpenHandle(*value);
4710 EnsureInitializedForIsolate(isolate,
"v8::External::Wrap()");
4711 LOG_API(isolate,
"External::Wrap");
4723 void* v8::Object::SlowGetPointerFromInternalField(
int index) {
4725 i::Object* value = obj->GetInternalField(index);
4726 if (value->IsSmi()) {
4728 }
else if (value->IsForeign()) {
4737 if (IsDeadCheck(i::Isolate::Current(),
"v8::External::Unwrap()"))
return 0;
4742 }
else if (obj->IsForeign()) {
4743 result = ExternalValueImpl(obj);
4747 ASSERT_EQ(result, QuickUnwrap(wrapper));
4755 EnsureInitializedForIsolate(isolate,
"v8::External::New()");
4756 LOG_API(isolate,
"External::New");
4758 return ExternalNewImpl(data);
4763 if (IsDeadCheck(i::Isolate::Current(),
"v8::External::Value()"))
return 0;
4765 return ExternalValueImpl(obj);
4771 if (!EnsureInitializedForIsolate(isolate,
"v8::String::Empty()")) {
4774 LOG_API(isolate,
"String::Empty()");
4781 EnsureInitializedForIsolate(isolate,
"v8::String::New()");
4782 LOG_API(isolate,
"String::New(char)");
4783 if (length == 0)
return Empty();
4795 i::Isolate* isolate = left_string->GetIsolate();
4796 EnsureInitializedForIsolate(isolate,
"v8::String::New()");
4797 LOG_API(isolate,
"String::New(char)");
4808 EnsureInitializedForIsolate(isolate,
"v8::String::NewUndetectable()");
4809 LOG_API(isolate,
"String::NewUndetectable(char)");
4815 result->MarkAsUndetectable();
4820 static int TwoByteStringLength(
const uint16_t* data) {
4822 while (data[length] !=
'\0') length++;
4829 EnsureInitializedForIsolate(isolate,
"v8::String::New()");
4830 LOG_API(isolate,
"String::New(uint16_)");
4831 if (length == 0)
return Empty();
4833 if (length == -1) length = TwoByteStringLength(data);
4843 EnsureInitializedForIsolate(isolate,
"v8::String::NewUndetectable()");
4844 LOG_API(isolate,
"String::NewUndetectable(uint16_)");
4846 if (length == -1) length = TwoByteStringLength(data);
4850 result->MarkAsUndetectable();
4874 EnsureInitializedForIsolate(isolate,
"v8::String::NewExternal()");
4875 LOG_API(isolate,
"String::NewExternal");
4887 if (IsDeadCheck(isolate,
"v8::String::MakeExternal()"))
return false;
4888 if (i::StringShape(*obj).IsExternalTwoByte()) {
4899 bool result = obj->MakeExternal(resource);
4900 if (result && !obj->IsSymbol()) {
4910 EnsureInitializedForIsolate(isolate,
"v8::String::NewExternal()");
4911 LOG_API(isolate,
"String::NewExternal");
4924 if (IsDeadCheck(isolate,
"v8::String::MakeExternal()"))
return false;
4925 if (i::StringShape(*obj).IsExternalTwoByte()) {
4936 bool result = obj->MakeExternal(resource);
4937 if (result && !obj->IsSymbol()) {
4945 if (!internal::FLAG_clever_optimizations)
return false;
4948 if (IsDeadCheck(isolate,
"v8::String::CanMakeExternal()"))
return false;
4950 int size = obj->Size();
4952 i::StringShape shape(*obj);
4953 return !shape.IsExternal();
4959 EnsureInitializedForIsolate(isolate,
"v8::Object::New()");
4960 LOG_API(isolate,
"Object::New");
4970 EnsureInitializedForIsolate(isolate,
"v8::NumberObject::New()");
4971 LOG_API(isolate,
"NumberObject::New");
4981 if (IsDeadCheck(isolate,
"v8::NumberObject::NumberValue()"))
return 0;
4982 LOG_API(isolate,
"NumberObject::NumberValue");
4985 return jsvalue->value()->Number();
4991 EnsureInitializedForIsolate(isolate,
"v8::BooleanObject::New()");
4992 LOG_API(isolate,
"BooleanObject::New");
4995 : isolate->
heap()->false_value());
5003 if (IsDeadCheck(isolate,
"v8::BooleanObject::BooleanValue()"))
return 0;
5004 LOG_API(isolate,
"BooleanObject::BooleanValue");
5007 return jsvalue->value()->IsTrue();
5013 EnsureInitializedForIsolate(isolate,
"v8::StringObject::New()");
5014 LOG_API(isolate,
"StringObject::New");
5024 if (IsDeadCheck(isolate,
"v8::StringObject::StringValue()")) {
5027 LOG_API(isolate,
"StringObject::StringValue");
5037 EnsureInitializedForIsolate(isolate,
"v8::Date::New()");
5038 LOG_API(isolate,
"Date::New");
5054 if (IsDeadCheck(isolate,
"v8::Date::NumberValue()"))
return 0;
5055 LOG_API(isolate,
"Date::NumberValue");
5058 return jsdate->value()->Number();
5064 ON_BAILOUT(isolate,
"v8::Date::DateTimeConfigurationChangeNotification()",
5066 LOG_API(isolate,
"Date::DateTimeConfigurationChangeNotification");
5075 i::MaybeObject* result =
5078 if (!result->ToObject(&object_func)) {
5082 if (object_func->IsJSFunction()) {
5087 bool caught_exception =
false;
5111 i::Isolate* isolate = Utils::OpenHandle(*pattern)->GetIsolate();
5112 EnsureInitializedForIsolate(isolate,
"v8::RegExp::New()");
5113 LOG_API(isolate,
"RegExp::New");
5117 Utils::OpenHandle(*pattern),
5118 RegExpFlagsToString(flags),
5119 &has_pending_exception);
5126 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
5127 if (IsDeadCheck(isolate,
"v8::RegExp::GetSource()")) {
5136 #define REGEXP_FLAG_ASSERT_EQ(api_flag, internal_flag) \
5137 STATIC_ASSERT(static_cast<int>(v8::RegExp::api_flag) == \
5138 static_cast<int>(i::JSRegExp::internal_flag))
5143 #undef REGEXP_FLAG_ASSERT_EQ
5146 if (IsDeadCheck(i::Isolate::Current(),
"v8::RegExp::GetFlags()")) {
5156 EnsureInitializedForIsolate(isolate,
"v8::Array::New()");
5157 LOG_API(isolate,
"Array::New");
5159 int real_length = length > 0 ? length : 0;
5163 obj->set_length(*length_obj);
5169 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
5170 if (IsDeadCheck(isolate,
"v8::Array::Length()"))
return 0;
5173 if (length->IsSmi()) {
5176 return static_cast<uint32_t
>(length->
Number());
5182 i::Isolate* isolate = Utils::OpenHandle(
this)->GetIsolate();
5185 if (!self->HasFastObjectElements()) {
5190 if (!paragon->IsJSObject()) {
5197 has_pending_exception = result.
is_null();
5205 EnsureInitializedForIsolate(isolate,
"v8::String::NewSymbol()");
5206 LOG_API(isolate,
"String::NewSymbol(char)");
5217 EnsureInitializedForIsolate(isolate,
"v8::Number::New()");
5229 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5230 EnsureInitializedForIsolate(isolate,
"v8::Integer::New()");
5237 EnsureInitializedForIsolate(isolate,
"v8::Integer::NewFromUnsigned()");
5258 bool fits_into_int32_t = (value & (1 << 31)) == 0;
5259 if (fits_into_int32_t) {
5260 return Integer::New(static_cast<int32_t>(value), isolate);
5275 EnsureInitializedForIsolate(isolate,
"v8::V8::AddMessageListener()");
5276 ON_BAILOUT(isolate,
"v8::V8::AddMessageListener()",
return false);
5287 EnsureInitializedForIsolate(isolate,
"v8::V8::RemoveMessageListener()");
5288 ON_BAILOUT(isolate,
"v8::V8::RemoveMessageListeners()",
return);
5292 for (
int i = 0; i < listeners.length(); i++) {
5293 if (listeners.get(i)->IsUndefined())
continue;
5296 if (callback_obj->foreign_address() ==
FUNCTION_ADDR(that)) {
5297 listeners.set(i, isolate->
heap()->undefined_value());
5307 i::Isolate::Current()->SetCaptureStackTraceForUncaughtExceptions(
5315 i::Isolate* isolate = EnterIsolateIfNeeded();
5316 if (IsDeadCheck(isolate,
"v8::V8::SetCounterFunction()"))
return;
5321 i::Isolate* isolate = EnterIsolateIfNeeded();
5322 if (IsDeadCheck(isolate,
"v8::V8::SetCreateHistogramFunction()"))
return;
5329 i::Isolate* isolate = EnterIsolateIfNeeded();
5330 if (IsDeadCheck(isolate,
"v8::V8::SetAddHistogramSampleFunction()"))
return;
5337 if (IsDeadCheck(isolate,
"v8::V8::EnableSlidingStateWindow()"))
return;
5345 if (IsDeadCheck(isolate,
"v8::V8::SetFailedAccessCheckCallbackFunction()")) {
5355 if (IsDeadCheck(isolate,
"v8::V8::AddObjectGroup()"))
return;
5358 reinterpret_cast<i::Object***>(objects), length, info);
5366 if (IsDeadCheck(isolate,
"v8::V8::AddImplicitReferences()"))
return;
5370 reinterpret_cast<i::Object***>(children), length);
5375 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5377 IsDeadCheck(isolate,
"v8::V8::AdjustAmountOfExternalAllocatedMemory()")) {
5387 if (IsDeadCheck(isolate,
"v8::V8::SetGlobalGCPrologueCallback()"))
return;
5394 if (IsDeadCheck(isolate,
"v8::V8::SetGlobalGCEpilogueCallback()"))
return;
5401 if (IsDeadCheck(isolate,
"v8::V8::AddGCPrologueCallback()"))
return;
5408 if (IsDeadCheck(isolate,
"v8::V8::RemoveGCPrologueCallback()"))
return;
5415 if (IsDeadCheck(isolate,
"v8::V8::AddGCEpilogueCallback()"))
return;
5422 if (IsDeadCheck(isolate,
"v8::V8::RemoveGCEpilogueCallback()"))
return;
5431 if (IsDeadCheck(isolate,
"v8::V8::AddMemoryAllocationCallback()"))
return;
5433 callback, space, action);
5439 if (IsDeadCheck(isolate,
"v8::V8::RemoveMemoryAllocationCallback()"))
return;
5446 if (callback ==
NULL)
return;
5449 if (IsDeadCheck(isolate,
"v8::V8::AddLeaveScriptCallback()"))
return;
5457 if (IsDeadCheck(isolate,
"v8::V8::RemoveLeaveScriptCallback()"))
return;
5482 EnsureInitializedForIsolate(isolate,
"V8::GetCurrentThreadId()");
5495 if (isolate->
thread_id().Equals(internal_tid)) {
5505 if (isolate !=
NULL) {
5515 reinterpret_cast<i::Isolate*
>(isolate) : i::Isolate::Current();
5516 return IsExecutionTerminatingCheck(i_isolate);
5521 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5522 return reinterpret_cast<Isolate*
>(isolate);
5528 return reinterpret_cast<Isolate*
>(isolate);
5534 if (!ApiCheck(!isolate->
IsInUse(),
5535 "v8::Isolate::Dispose()",
5536 "Disposing the isolate that is entered by a thread.")) {
5556 : str_(
NULL), length_(0) {
5558 if (IsDeadCheck(isolate,
"v8::String::Utf8Value::Utf8Value()"))
return;
5567 str_ = i::NewArray<char>(length_ + 1);
5568 str->WriteUtf8(str_);
5578 : str_(
NULL), length_(0) {
5580 if (IsDeadCheck(isolate,
"v8::String::AsciiValue::AsciiValue()"))
return;
5587 length_ = str->Length();
5588 str_ = i::NewArray<char>(length_ + 1);
5589 str->WriteAscii(str_);
5599 : str_(
NULL), length_(0) {
5601 if (IsDeadCheck(isolate,
"v8::String::Value::Value()"))
return;
5608 length_ = str->Length();
5609 str_ = i::NewArray<uint16_t>(length_ + 1);
5620 LOG_API(isolate,
"RangeError");
5636 LOG_API(isolate,
"ReferenceError");
5653 LOG_API(isolate,
"SyntaxError");
5669 LOG_API(isolate,
"TypeError");
5702 #ifdef ENABLE_DEBUGGER_SUPPORT
5706 if (isolate->debug_event_callback() !=
NULL) {
5707 isolate->debug_event_callback()(event_details.
GetEvent(),
5717 EnsureInitializedForIsolate(isolate,
"v8::Debug::SetDebugEventListener()");
5718 ON_BAILOUT(isolate,
"v8::Debug::SetDebugEventListener()",
return false);
5721 isolate->set_debug_event_callback(that);
5729 isolate->debugger()->SetEventListener(foreign,
5730 Utils::OpenHandle(*data,
true));
5737 EnsureInitializedForIsolate(isolate,
"v8::Debug::SetDebugEventListener2()");
5738 ON_BAILOUT(isolate,
"v8::Debug::SetDebugEventListener2()",
return false);
5745 isolate->debugger()->SetEventListener(foreign,
5746 Utils::OpenHandle(*data,
true));
5752 Handle<Value> data) {
5754 ON_BAILOUT(isolate,
"v8::Debug::SetDebugEventListener()",
return false);
5756 isolate->debugger()->SetEventListener(Utils::OpenHandle(*that),
5757 Utils::OpenHandle(*data,
true));
5764 if (isolate !=
NULL) {
5765 reinterpret_cast<i::Isolate*
>(isolate)->stack_guard()->DebugBreak();
5774 if (isolate !=
NULL) {
5785 if (isolate !=
NULL) {
5787 internal_isolate->debugger()->EnqueueDebugCommand(data);
5789 i::Isolate::GetDefaultIsolateDebugger()->EnqueueDebugCommand(data);
5796 if (isolate->message_handler()) {
5798 (isolate->message_handler())(*json, json.length(), message.
GetClientData());
5804 bool message_handler_thread) {
5806 EnsureInitializedForIsolate(isolate,
"v8::Debug::SetMessageHandler");
5811 CHECK(!message_handler_thread);
5814 isolate->set_message_handler(handler);
5815 if (handler !=
NULL) {
5816 isolate->debugger()->SetMessageHandler(MessageHandlerWrapper);
5818 isolate->debugger()->SetMessageHandler(
NULL);
5825 EnsureInitializedForIsolate(isolate,
"v8::Debug::SetMessageHandler");
5827 isolate->debugger()->SetMessageHandler(handler);
5832 ClientData* client_data,
5835 if (isolate !=
NULL) {
5837 internal_isolate->debugger()->ProcessCommand(
5840 i::Isolate::GetDefaultIsolateDebugger()->ProcessCommand(
5849 EnsureInitializedForIsolate(isolate,
"v8::Debug::SetHostDispatchHandler");
5851 isolate->debugger()->SetHostDispatchHandler(handler, period);
5856 DebugMessageDispatchHandler handler,
bool provide_locker) {
5858 EnsureInitializedForIsolate(isolate,
5859 "v8::Debug::SetDebugMessageDispatchHandler");
5861 isolate->debugger()->SetDebugMessageDispatchHandler(
5862 handler, provide_locker);
5870 ON_BAILOUT(isolate,
"v8::Debug::Call()",
return Local<Value>());
5875 result = isolate->debugger()->Call(Utils::OpenHandle(*fun),
5876 isolate->
factory()->undefined_value(),
5877 &has_pending_exception);
5879 result = isolate->debugger()->Call(Utils::OpenHandle(*fun),
5880 Utils::OpenHandle(*data),
5881 &has_pending_exception);
5891 ON_BAILOUT(isolate,
"v8::Debug::GetMirror()",
return Local<Value>());
5894 i::Debug* isolate_debug = isolate->debug();
5895 isolate_debug->Load();
5902 const int kArgc = 1;
5909 return scope.
Close(result);
5914 return i::Isolate::Current()->debugger()->StartAgent(name, port,
5915 wait_for_connection);
5920 return i::Isolate::Current()->debugger()->StopAgent();
5925 i::Execution::ProcessDebugMessages(
true);
5931 EnsureInitializedForIsolate(isolate,
"v8::Debug::GetDebugContext()");
5933 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext());
5939 i::Debugger* debugger;
5940 if (isolate !=
NULL) {
5942 debugger = internal_isolate->debugger();
5944 debugger = i::Isolate::GetDefaultIsolateDebugger();
5946 debugger->set_live_edit_enabled(enable);
5950 #endif // ENABLE_DEBUGGER_SUPPORT
5955 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetFunctionName");
5958 if (!entry->has_name_prefix()) {
5971 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetScriptResourceName");
5974 node->entry()->resource_name())));
5980 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetLineNumber");
5981 return reinterpret_cast<const i::ProfileNode*
>(
this)->entry()->line_number();
5987 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetTotalTime");
5988 return reinterpret_cast<const i::ProfileNode*
>(
this)->GetTotalMillis();
5994 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetSelfTime");
5995 return reinterpret_cast<const i::ProfileNode*
>(
this)->GetSelfMillis();
6001 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetTotalSamplesCount");
6002 return reinterpret_cast<const i::ProfileNode*
>(
this)->total_ticks();
6008 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetSelfSamplesCount");
6009 return reinterpret_cast<const i::ProfileNode*
>(
this)->self_ticks();
6015 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetCallUid");
6016 return reinterpret_cast<const i::ProfileNode*
>(
this)->entry()->GetCallUid();
6022 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetChildrenCount");
6023 return reinterpret_cast<const i::ProfileNode*
>(
this)->children()->length();
6029 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetChild");
6031 reinterpret_cast<const i::ProfileNode*
>(
this)->children()->at(index);
6038 IsDeadCheck(isolate,
"v8::CpuProfile::Delete");
6050 IsDeadCheck(isolate,
"v8::CpuProfile::GetUid");
6057 IsDeadCheck(isolate,
"v8::CpuProfile::GetTitle");
6060 profile->title())));
6066 IsDeadCheck(isolate,
"v8::CpuProfile::GetBottomUpRoot");
6068 return reinterpret_cast<const CpuProfileNode*
>(profile->bottom_up()->root());
6074 IsDeadCheck(isolate,
"v8::CpuProfile::GetTopDownRoot");
6076 return reinterpret_cast<const CpuProfileNode*
>(profile->top_down()->root());
6082 IsDeadCheck(isolate,
"v8::CpuProfiler::GetProfilesCount");
6090 IsDeadCheck(isolate,
"v8::CpuProfiler::GetProfile");
6093 security_token.
IsEmpty() ?
NULL : *Utils::OpenHandle(*security_token),
6101 IsDeadCheck(isolate,
"v8::CpuProfiler::FindProfile");
6104 security_token.
IsEmpty() ?
NULL : *Utils::OpenHandle(*security_token),
6111 IsDeadCheck(isolate,
"v8::CpuProfiler::StartProfiling");
6119 IsDeadCheck(isolate,
"v8::CpuProfiler::StopProfiling");
6122 security_token.
IsEmpty() ?
NULL : *Utils::OpenHandle(*security_token),
6123 *Utils::OpenHandle(*title)));
6129 IsDeadCheck(isolate,
"v8::CpuProfiler::DeleteAllProfiles");
6134 static i::HeapGraphEdge* ToInternal(
const HeapGraphEdge* edge) {
6135 return const_cast<i::HeapGraphEdge*
>(
6136 reinterpret_cast<const i::HeapGraphEdge*
>(edge));
6142 IsDeadCheck(isolate,
"v8::HeapGraphEdge::GetType");
6149 IsDeadCheck(isolate,
"v8::HeapGraphEdge::GetName");
6150 i::HeapGraphEdge* edge = ToInternal(
this);
6151 switch (edge->type()) {
6152 case i::HeapGraphEdge::kContextVariable:
6153 case i::HeapGraphEdge::kInternal:
6154 case i::HeapGraphEdge::kProperty:
6155 case i::HeapGraphEdge::kShortcut:
6158 case i::HeapGraphEdge::kElement:
6159 case i::HeapGraphEdge::kHidden:
6170 IsDeadCheck(isolate,
"v8::HeapGraphEdge::GetFromNode");
6171 const i::HeapEntry* from = ToInternal(
this)->from();
6178 IsDeadCheck(isolate,
"v8::HeapGraphEdge::GetToNode");
6179 const i::HeapEntry* to = ToInternal(
this)->to();
6184 static i::HeapEntry* ToInternal(
const HeapGraphNode* entry) {
6185 return const_cast<i::HeapEntry*
>(
6186 reinterpret_cast<const i::HeapEntry*
>(entry));
6192 IsDeadCheck(isolate,
"v8::HeapGraphNode::GetType");
6199 IsDeadCheck(isolate,
"v8::HeapGraphNode::GetName");
6201 ToInternal(
this)->name())));
6207 IsDeadCheck(isolate,
"v8::HeapGraphNode::GetId");
6208 return ToInternal(
this)->id();
6214 IsDeadCheck(isolate,
"v8::HeapGraphNode::GetSelfSize");
6215 return ToInternal(
this)->self_size();
6221 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetChildrenCount");
6222 return ToInternal(
this)->children().length();
6228 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetChild");
6230 ToInternal(
this)->children()[index]);
6236 IsDeadCheck(isolate,
"v8::HeapGraphNode::GetHeapValue");
6239 ToApi<Value>(object) : ToApi<Value>(
6240 isolate->
factory()->undefined_value()));
6252 IsDeadCheck(isolate,
"v8::HeapSnapshot::Delete");
6254 ToInternal(
this)->Delete();
6264 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetType");
6271 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetUid");
6272 return ToInternal(
this)->uid();
6278 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetTitle");
6280 ToInternal(
this)->title())));
6286 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetHead");
6287 return reinterpret_cast<const HeapGraphNode*
>(ToInternal(
this)->root());
6293 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetNodeById");
6295 ToInternal(
this)->GetEntryById(
id));
6301 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetNodesCount");
6302 return ToInternal(
this)->entries().length();
6308 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetNode");
6310 &ToInternal(
this)->entries().at(index));
6316 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetMaxSnapshotJSObjectId");
6317 return ToInternal(
this)->max_snapshot_js_object_id();
6324 IsDeadCheck(isolate,
"v8::HeapSnapshot::Serialize");
6325 ApiCheck(format == kJSON,
6326 "v8::HeapSnapshot::Serialize",
6327 "Unknown serialization format");
6329 "v8::HeapSnapshot::Serialize",
6330 "Unsupported output encoding");
6332 "v8::HeapSnapshot::Serialize",
6333 "Invalid stream chunk size");
6335 serializer.Serialize(stream);
6341 IsDeadCheck(isolate,
"v8::HeapProfiler::GetSnapshotsCount");
6348 IsDeadCheck(isolate,
"v8::HeapProfiler::GetSnapshot");
6356 IsDeadCheck(isolate,
"v8::HeapProfiler::FindSnapshot");
6364 IsDeadCheck(isolate,
"v8::HeapProfiler::GetSnapshotObjectId");
6374 IsDeadCheck(isolate,
"v8::HeapProfiler::TakeSnapshot");
6385 *Utils::OpenHandle(*title), internal_type, control));
6391 IsDeadCheck(isolate,
"v8::HeapProfiler::StartHeapObjectsTracking");
6398 IsDeadCheck(isolate,
"v8::HeapProfiler::StopHeapObjectsTracking");
6405 IsDeadCheck(isolate,
"v8::HeapProfiler::PushHeapObjectsStats");
6412 IsDeadCheck(isolate,
"v8::HeapProfiler::DeleteAllSnapshots");
6418 WrapperInfoCallback callback) {
6419 i::Isolate::Current()->heap_profiler()->DefineWrapperClass(class_id,
6444 if (internal::FLAG_stress_runs != 0)
return internal::FLAG_stress_runs;
6455 static void SetFlagsFromString(
const char* flags) {
6461 static const char* kLazyOptimizations =
6462 "--prepare-always-opt "
6463 "--max-inlined-source-size=999999 "
6464 "--max-inlined-nodes=999999 "
6465 "--max-inlined-nodes-cumulative=999999 "
6467 static const char* kForcedOptimizations =
"--always-opt";
6471 static const char* kDeoptEvery13Times =
"--deopt-every-n-times=13";
6473 internal::FLAG_deopt_every_n_times == 0) {
6474 SetFlagsFromString(kDeoptEvery13Times);
6480 if (run == GetStressRuns() - 1) {
6481 SetFlagsFromString(kForcedOptimizations);
6483 SetFlagsFromString(kLazyOptimizations);
6486 if (run == GetStressRuns() - 1) {
6487 SetFlagsFromString(kForcedOptimizations);
6488 }
else if (run != GetStressRuns() - 2) {
6489 SetFlagsFromString(kLazyOptimizations);
6500 namespace internal {
6503 void HandleScopeImplementer::FreeThreadResources() {
6508 char* HandleScopeImplementer::ArchiveThread(
char* storage) {
6510 isolate_->handle_scope_data();
6511 handle_scope_data_ = *current;
6512 memcpy(storage,
this,
sizeof(*
this));
6514 ResetAfterArchive();
6515 current->Initialize();
6517 return storage + ArchiveSpacePerThread();
6521 int HandleScopeImplementer::ArchiveSpacePerThread() {
6526 char* HandleScopeImplementer::RestoreThread(
char* storage) {
6527 memcpy(
this, storage,
sizeof(*
this));
6528 *isolate_->handle_scope_data() = handle_scope_data_;
6529 return storage + ArchiveSpacePerThread();
6533 void HandleScopeImplementer::IterateThis(ObjectVisitor* v) {
6535 bool found_block_before_deferred =
false;
6538 for (
int i = blocks()->length() - 2; i >= 0; --i) {
6539 Object** block = blocks()->at(i);
6540 if (last_handle_before_deferred_block_ !=
NULL &&
6542 (last_handle_before_deferred_block_ >= block)) {
6543 v->VisitPointers(block, last_handle_before_deferred_block_);
6544 ASSERT(!found_block_before_deferred);
6546 found_block_before_deferred =
true;
6549 v->VisitPointers(block, &block[kHandleBlockSize]);
6553 ASSERT(last_handle_before_deferred_block_ ==
NULL ||
6554 found_block_before_deferred);
6557 if (!blocks()->is_empty()) {
6558 v->VisitPointers(blocks()->last(), handle_scope_data_.next);
6561 if (!saved_contexts_.is_empty()) {
6562 Object** start =
reinterpret_cast<Object**
>(&saved_contexts_.first());
6563 v->VisitPointers(start, start + saved_contexts_.length());
6568 void HandleScopeImplementer::Iterate(ObjectVisitor* v) {
6570 isolate_->handle_scope_data();
6571 handle_scope_data_ = *current;
6576 char* HandleScopeImplementer::Iterate(ObjectVisitor* v,
char* storage) {
6577 HandleScopeImplementer* scope_implementer =
6578 reinterpret_cast<HandleScopeImplementer*
>(storage);
6579 scope_implementer->IterateThis(v);
6580 return storage + ArchiveSpacePerThread();
6584 DeferredHandles* HandleScopeImplementer::Detach(
Object** prev_limit) {
6585 DeferredHandles* deferred =
6586 new DeferredHandles(isolate()->handle_scope_data()->next, isolate());
6588 while (!blocks_.is_empty()) {
6589 Object** block_start = blocks_.last();
6593 ASSERT(prev_limit == block_limit ||
6594 !(block_start <= prev_limit && prev_limit <= block_limit));
6595 if (prev_limit == block_limit)
break;
6596 deferred->blocks_.Add(blocks_.last());
6597 blocks_.RemoveLast();
6604 ASSERT(prev_limit ==
NULL || !blocks_.is_empty());
6606 ASSERT(!blocks_.is_empty() && prev_limit !=
NULL);
6607 ASSERT(last_handle_before_deferred_block_ !=
NULL);
6608 last_handle_before_deferred_block_ =
NULL;
6613 void HandleScopeImplementer::BeginDeferredScope() {
6614 ASSERT(last_handle_before_deferred_block_ ==
NULL);
6615 last_handle_before_deferred_block_ = isolate()->handle_scope_data()->next;
6619 DeferredHandles::~DeferredHandles() {
6620 isolate_->UnlinkDeferredHandles(
this);
6622 for (
int i = 0; i < blocks_.length(); i++) {
6624 HandleScope::ZapRange(blocks_[i], &blocks_[i][kHandleBlockSize]);
6626 isolate_->handle_scope_implementer()->ReturnBlock(blocks_[i]);
6631 void DeferredHandles::Iterate(ObjectVisitor* v) {
6632 ASSERT(!blocks_.is_empty());
6634 ASSERT((first_block_limit_ >= blocks_.first()) &&
6635 (first_block_limit_ <= &(blocks_.first())[kHandleBlockSize]));
6637 v->VisitPointers(blocks_.first(), first_block_limit_);
6639 for (
int i = 1; i < blocks_.length(); i++) {
6640 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
void API_Fatal(const char *location, const char *format,...)
static Local< Context > GetCurrent()
static CpuProfile * FindProfile(Object *security_token, unsigned uid)
void SaveContext(Context *context)
int Utf8Length(Handle< String > str)
static Isolate * GetCurrent()
void SetCallAsFunctionHandler(InvocationCallback callback, Handle< Value > data=Handle< Value >())
static void DeleteAllSnapshots()
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)
Handle< Array >(* NamedPropertyEnumerator)(const AccessorInfo &info)
Handle< Value > GetScriptData() const
static void DeleteProfile(CpuProfile *profile)
static Handle< Object > DeleteElement(Handle< JSObject > obj, uint32_t index)
RegisteredExtension * next()
double GetSelfTime() const
V8EXPORT int Length() const
static void SetLiveEditEnabled(bool enable, Isolate *isolate=NULL)
V8EXPORT double NumberValue() const
static bool Initialize(Deserializer *des)
const HeapGraphEdge * GetChild(int index) const
static const byte * data()
void Destroy(Object **location)
static Local< Script > Compile(Handle< String > source, ScriptOrigin *origin=NULL, ScriptData *pre_data=NULL, Handle< String > script_data=Handle< String >())
int GetLineNumber() const
void FlattenString(Handle< String > string)
static void AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type_filter=kGCTypeAll)
V8EXPORT int WriteUtf8(char *buffer, int length=-1, int *nchars_ref=NULL, int options=NO_OPTIONS) const
static int NumberOfHandles()
static void SetAllowCodeGenerationFromStringsCallback(AllowCodeGenerationFromStringsCallback that)
V8EXPORT bool HasRealIndexedProperty(uint32_t index)
static ScriptDataImpl * PreParse(Utf16CharacterStream *source, v8::Extension *extension, int flags)
void(* MemoryAllocationCallback)(ObjectSpace space, AllocationAction action, int size)
static HeapSnapshot * GetSnapshot(int index)
Handle< JSObject > NewJSObject(Handle< JSFunction > constructor, PretenureFlag pretenure=NOT_TENURED)
Handle< String > NewExternalStringFromAscii(const ExternalAsciiString::Resource *resource)
V8EXPORT bool BooleanValue() const
#define CHECK_EQ(expected, value)
V8EXPORT bool IsTrue() const
V8EXPORT uint8_t * GetIndexedPropertiesPixelData()
static bool IsExecutionTerminating(Isolate *isolate=NULL)
static const int kMaxLength
Handle< JSFunction > NewFunctionFromSharedFunctionInfo(Handle< SharedFunctionInfo > function_info, Handle< Context > context, PretenureFlag pretenure=TENURED)
static Local< FunctionTemplate > New(InvocationCallback callback=0, Handle< Value > data=Handle< Value >(), Handle< Signature > signature=Handle< Signature >())
static Handle< Object > TryCall(Handle< JSFunction > func, Handle< Object > receiver, int argc, Handle< Object > argv[], bool *caught_exception)
V8EXPORT bool DeleteHiddenValue(Handle< String > key)
Handle< Boolean > V8EXPORT True()
V8EXPORT Local< String > GetSource() const
V8EXPORT const ExternalAsciiStringResource * GetExternalAsciiStringResource() const
static SnapshotObjectId PushHeapObjectsStats(OutputStream *stream)
static int GetStressRuns()
void(* CallCompletedCallback)()
static const HeapSnapshot * TakeSnapshot(Handle< String > title, HeapSnapshot::Type type=HeapSnapshot::kFull, ActivityControl *control=NULL)
Handle< Value >(* NamedPropertySetter)(Local< String > property, Local< Value > value, const AccessorInfo &info)
void RecordWrite(Handle< String > string)
static Handle< Object > ToUint32(Handle< Object > obj, bool *exc)
intptr_t * old_pointer_space_size
intptr_t * cell_space_size
const HeapGraphNode * GetFromNode() const
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 String * cast(Object *obj)
void ScheduleThrow(Object *exception)
static int GetSnapshotsCount()
const int kPointerToSmiShift
HandleScopeImplementer * handle_scope_implementer()
v8::internal::Handle< v8::internal::JSObject > value()
Handle< Context > GetCallingNativeContext()
void set(int index, v8::internal::Object *value)
V8EXPORT Local< Object > CloneElementAt(uint32_t index)
static Local< Number > NumberToLocal(v8::internal::Handle< v8::internal::Object > obj)
V8EXPORT bool StrictEquals(Handle< Value > that) const
static void SetAddHistogramSampleFunction(AddHistogramSampleCallback)
bool HasOutOfMemoryException()
V8EXPORT Local< Value > Get(Handle< Value > key)
static Smi * FromInt(int value)
Handle< Integer > ResourceLineOffset() const
V8EXPORT bool IsNativeError() const
virtual Handle< Object > GetEventData() const =0
void V8EXPORT RegisterExtension(Extension *extension)
Local< Object > NewInstance()
V8EXPORT PropertyAttribute GetPropertyAttributes(Handle< Value > key)
double GetTotalTime() const
V8EXPORT Local< Array > GetOwnPropertyNames()
void SetCaptureMessage(bool value)
static ObjectTemplateInfo * cast(Object *obj)
Handle< Value > GetName() const
static Local< AccessorSignature > AccessorSignatureToLocal(v8::internal::Handle< v8::internal::FunctionTemplateInfo > obj)
StatsTable * stats_table()
Handle< JSArray > NewJSArray(int capacity, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND, PretenureFlag pretenure=NOT_TENURED)
Handle< String > GetName() const
static void SetFatalError()
SnapshotObjectId GetId() const
V8EXPORT bool IsBooleanObject() const
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)
void AddString(String *string)
static V8EXPORT Local< String > New(const char *data, int length=-1)
void AddGCPrologueCallback(GCPrologueCallback callback, GCType gc_type_filter)
void SetData(Handle< String > data)
void AddImplicitReferences(HeapObject **parent, Object ***children, size_t length)
bool IsAsciiRepresentation()
const CpuProfileNode * GetChild(int index) const
static ExternalTwoByteString * cast(Object *obj)
#define API_ENTRY_CHECK(isolate, msg)
void VisitExternalResources(v8::ExternalResourceVisitor *visitor)
V8EXPORT bool IsExternal() const
bool(* IndexedSecurityCallback)(Local< Object > host, uint32_t index, AccessType type, Local< Value > data)
static V8EXPORT Local< String > NewSymbol(const char *data, int length=-1)
V8EXPORT Local< String > GetConstructorName()
Local< ObjectTemplate > InstanceTemplate()
V8EXPORT Local< Int32 > ToInt32() const
static Handle< Object > ToInteger(Handle< Object > obj, bool *exc)
Handle< Primitive > V8EXPORT Null()
static Handle< Object > ToObject(Handle< Object > obj, bool *exc)
V8EXPORT Local< Context > CreationContext()
void SetGlobalGCPrologueCallback(GCCallback callback)
static void AddMemoryAllocationCallback(MemoryAllocationCallback callback, ObjectSpace space, AllocationAction action)
void(* MessageCallback)(Handle< Message > message, Handle< Value > error)
static void SetReturnAddressLocationResolver(ReturnAddressLocationResolver return_address_resolver)
V8EXPORT bool HasRealNamedCallbackProperty(Handle< String > key)
virtual Handle< Value > GetCallbackData() const =0
V8EXPORT Local< Value > GetHiddenValue(Handle< String > key)
v8::HandleScope::Data HandleScopeData
Bootstrapper * bootstrapper()
Handle< String > GetScriptResourceName() const
static bool IsNearDeath(Object **location)
const HeapGraphNode * GetNodeById(SnapshotObjectId id) const
static Local< Context > GetDebugContext()
static Foreign * cast(Object *obj)
int GetStartPosition() const
static CpuProfile * StopProfiling(const char *title)
static const int kNoColumnInfo
int *(* CounterLookupCallback)(const char *name)
const HeapGraphNode * GetNode(int index) const
void ReattachGlobal(Handle< Object > global_object)
static Local< Value > Error(Handle< String > message)
intptr_t * code_space_size
void SetIndexedPropertyHandler(IndexedPropertyGetter getter, IndexedPropertySetter setter=0, IndexedPropertyQuery query=0, IndexedPropertyDeleter deleter=0, IndexedPropertyEnumerator enumerator=0, Handle< Value > data=Handle< Value >())
void AddGCEpilogueCallback(GCEpilogueCallback callback, GCType gc_type_filter)
Handle< Object > SetAccessor(Handle< JSObject > obj, Handle< AccessorInfo > info)
static void set_context_raw_data(const byte *context_raw_data)
V8EXPORT Local< Array > GetPropertyNames()
V8EXPORT ExternalArrayType GetIndexedPropertiesExternalArrayDataType()
virtual DebugEvent GetEvent() const =0
V8EXPORT Local< Value > Call(Handle< Object > recv, int argc, Handle< Value > argv[])
V8EXPORT bool IsRegExp() const
static V8EXPORT const int kLineOffsetNotFound
#define ENTER_V8(isolate)
Utf8Value(Handle< v8::Value > obj)
static Handle< Object > ToInt32(Handle< Object > obj, bool *exc)
#define ASSERT(condition)
static Vector< const byte > GetScriptsSource()
void(* GCPrologueCallback)(GCType type, GCCallbackFlags flags)
V8EXPORT bool MayContainNonAscii() const
void ClearWeakness(Object **location)
V8EXPORT Local< Number > ToNumber() const
void SetFailedAccessCheckCallback(v8::FailedAccessCheckCallback callback)
void UseDefaultSecurityToken()
static int GetSnapshotsCount()
void EnterContext(Handle< Object > context)
static bool SetFunctionEntryHook(FunctionEntryHook entry_hook)
static StackGuard * GetDefaultIsolateStackGuard()
static bool AddMessageListener(MessageCallback that)
static Script * cast(Object *obj)
void(* MessageHandler2)(const Message &message)
V8EXPORT void * GetIndexedPropertiesExternalArrayData()
V8EXPORT bool IsCallable()
static void DeoptimizeAll()
static void SetDecompressedStartupData(StartupData *decompressed_data)
Handle< Value > ResourceName() const
static V8EXPORT Local< Value > Wrap(void *data)
#define EXCEPTION_BAILOUT_CHECK(isolate, value)
ThreadManager * thread_manager()
kPropertyAccessorsOffset kNamedPropertyHandlerOffset instance_template
static SharedFunctionInfo * cast(Object *obj)
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)
V8EXPORT Local< String > ToString() const
static const int kNoLineNumberInfo
static void DefineWrapperClass(uint16_t class_id, WrapperInfoCallback callback)
intptr_t CommittedMemoryExecutable()
Handle< Object > NewNumber(double value, PretenureFlag pretenure=NOT_TENURED)
static const int kShortSize
Handle< Value >(* IndexedPropertySetter)(uint32_t index, Local< Value > value, const AccessorInfo &info)
StartupDataDecompressor()
int GetScriptColumnNumber(Handle< Script > script, int code_pos)
static const CpuProfile * FindProfile(unsigned uid, Handle< Value > security_token=Handle< Value >())
V8EXPORT Local< Value > CallAsConstructor(int argc, Handle< Value > argv[])
static Handle< Object > ToDetailString(Handle< Object > obj, bool *exc)
static intptr_t AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes)
void SetVerbose(bool value)
static CpuProfile * GetProfile(Object *security_token, int index)
Handle< Object > GetProperty(Handle< JSReceiver > obj, const char *name)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit 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 SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available 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 MIPS FPU instructions if expose natives in global object expose gc extension number of stack frames to capture disable builtin natives files print a stack trace if an assertion failure occurs use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations prepare for turning on always opt minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions automatically set the debug break flag when debugger commands are in the queue always cause a debug break before aborting 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 more details following each garbage collection print amount of external allocated memory after each time it is adjusted flush code that we expect not to use again before full gc do incremental marking steps track object counts and memory usage use caching Perform compaction on every full GC Never perform compaction on full GC testing only Compact code space on full incremental collections Default seed for initializing random allows verbose printing trace parsing and preparsing Check icache flushes in ARM and MIPS simulator Stack alingment in bytes in print stack trace when throwing exceptions randomize hashes to avoid predictable hash Fixed seed to use to hash property activate a timer that switches between V8 threads testing_bool_flag float flag Seed used for threading test randomness A filename with extra code to be included in the Print usage including flags
virtual ClientData * GetClientData() const =0
V8EXPORT bool CanMakeExternal()
void Set(Handle< String > name, Handle< Data > value, PropertyAttribute attributes=None)
static bool HasDetachedProfiles()
void AddObjectGroup(Object ***handles, size_t length, v8::RetainedObjectInfo *info)
V8EXPORT Handle< Value > GetName() const
int * pending_global_handle_count
static void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback)
static V8EXPORT Local< String > NewUndetectable(const char *data, int length=-1)
Handle< String > LookupAsciiSymbol(Vector< const char > str)
V8EXPORT void SetIndexedPropertiesToExternalArrayData(void *data, ExternalArrayType array_type, int number_of_elements)
const CpuProfileNode * GetBottomUpRoot() const
static const unsigned kMaxEncodedSize
virtual const uint16_t * data() const =0
static Handle< Object > SetHiddenProperty(Handle< JSObject > obj, Handle< String > key, Handle< Object > value)
V8EXPORT Local< Uint32 > ToUint32() const
V8EXPORT bool Equals(Handle< Value > that) const
Handle< Object > NewSyntaxError(const char *type, Handle< JSArray > args)
V8EXPORT Handle< Value > GetScriptId() const
static void VisitExternalResources(ExternalResourceVisitor *visitor)
#define SET_FIELD_WRAPPED(obj, setter, cdata)
REGEXP_FLAG_ASSERT_EQ(kNone, NONE)
bool IsDefaultIsolate() const
Handle< String > GetFunctionName() const
static void GetCompressedStartupData(StartupData *compressed_data)
Handle< Object > LastEnteredContext()
void SetCounterFunction(CounterLookupCallback f)
V8EXPORT 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< Object > ForceDeleteProperty(Handle< JSObject > object, Handle< Object > key)
V8EXPORT bool IsExternal() const
v8::internal::Handle< v8::internal::JSObject > value()
V8EXPORT bool HasIndexedPropertiesInExternalArrayData()
static bool IdleNotification(int hint)
bool Equals(String *other)
static void SetEntropySource(EntropySource source)
V8EXPORT void SetInternalField(int index, Handle< Value > value)
static Local< StackFrame > StackFrameToLocal(v8::internal::Handle< v8::internal::JSObject > obj)
V8EXPORT void SetPointerInInternalField(int index, void *value)
void SetClassName(Handle< String > name)
static V8EXPORT Local< Integer > NewFromUnsigned(uint32_t value)
StackGuard * stack_guard()
void set_context_exit_happened(bool context_exit_happened)
double GetSelfSamplesCount() const
Handle< Context > global_context()
Handle< Value >(* IndexedPropertyGetter)(uint32_t index, const AccessorInfo &info)
static void DebugBreakForCommand(ClientData *data=NULL, Isolate *isolate=NULL)
Local< StackFrame > GetFrame(uint32_t index) const
static const char * GetVersion()
V8EXPORT Local< Value > GetRealNamedProperty(Handle< String > key)
int NotifyContextDisposed()
#define LEAVE_V8(isolate)
V8EXPORT bool IsExternalAscii() const
void TerminateExecution(ThreadId thread_id)
const uint16_t * SeqTwoByteStringGetData(unsigned start)
Handle< Map > GetElementsTransitionMap(Handle< JSObject > object, ElementsKind elements_kind)
V8EXPORT bool IsStringObject() const
V8EXPORT bool MakeExternal(ExternalStringResource *resource)
Handle< String > NewStringFromUtf8(Vector< const char > str, PretenureFlag pretenure=NOT_TENURED)
int * near_death_global_handle_count
V8EXPORT ScriptOrigin GetScriptOrigin() const
void(* FunctionEntryHook)(uintptr_t function, uintptr_t return_addr_location)
static Local< Script > New(Handle< String > source, ScriptOrigin *origin=NULL, ScriptData *pre_data=NULL, Handle< String > script_data=Handle< String >())
static int GetCompressedStartupDataCount()
unsigned GetCallUid() const
Handle< Object > NewRangeError(const char *type, Vector< Handle< Object > > args)
void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback)
V8EXPORT bool IsUint32() const
static Local< StackTrace > StackTraceToLocal(v8::internal::Handle< v8::internal::JSArray > obj)
static bool SetDebugEventListener(EventCallback that, Handle< Value > data=Handle< Value >())
V8EXPORT int InternalFieldCount()
static bool HasSmiTag(internal::Object *value)
int GetChildrenCount() const
static void DeoptimizeGlobalObject(JSObject *object)
Handle< Value >(* InvocationCallback)(const Arguments &args)
static ScriptData * PreCompile(const char *input, int length)
Handle< Value >(* NamedPropertyGetter)(Local< String > property, const AccessorInfo &info)
Object * GetElementNoExceptionThrown(uint32_t index)
bool HasInstance(Handle< Value > object)
static void SetFlagsFromString(const char *str, int length)
static void AddObjectGroup(Persistent< Value > *objects, size_t length, RetainedObjectInfo *info=NULL)
Handle< Map > CopyMap(Handle< Map > map, int extra_inobject_props)
static Local< Message > MessageToLocal(v8::internal::Handle< v8::internal::Object > obj)
int max_old_space_size() const
static void EnsureDefaultIsolate()
V8EXPORT void * Value() const
V8EXPORT Local< String > ObjectProtoToString()
static V8EXPORT void DateTimeConfigurationChangeNotification()
static const CpuProfile * GetProfile(int index, Handle< Value > security_token=Handle< Value >())
static const HeapSnapshot * FindSnapshot(unsigned uid)
static Handle< Object > ToBoolean(Handle< Object > obj)
static void RemoveCallCompletedCallback(CallCompletedCallback callback)
void *(* CreateHistogramCallback)(const char *name, int min, int max, size_t buckets)
v8::internal::Object * get(int index)
static Local< ObjectTemplate > New()
V8EXPORT bool HasIndexedPropertiesInPixelData()
static void SetJitCodeEventHandler(JitCodeEventOptions options, JitCodeEventHandler event_handler)
#define ON_BAILOUT(isolate, location, code)
void SetCallHandler(InvocationCallback callback, Handle< Value > data=Handle< Value >())
Handle< JSObject > NewNeanderObject()
int max_young_space_size() const
Handle< Value > ReThrow()
static void StopHeapObjectsTracking()
void RemoveGCEpilogueCallback(GCEpilogueCallback callback)
static size_t GetMemorySizeUsedByProfiler()
static SlicedString * cast(Object *obj)
static void MemCopy(void *dest, const void *src, size_t size)
StringTracker * string_tracker()
RuntimeProfiler * runtime_profiler()
SnapshotObjectId GetMaxSnapshotJSObjectId() const
Handle< Integer >(* NamedPropertyQuery)(Local< String > property, const AccessorInfo &info)
virtual int GetChunkSize()
V8EXPORT Local< Value > GetPrototype()
static void StartProfiling(Handle< String > title)
static void GetHeapStatistics(HeapStatistics *heap_statistics)
Handle< Object > Create(Object *value)
static bool IsValid(intptr_t value)
static Local< Uint32 > Uint32ToLocal(v8::internal::Handle< v8::internal::Object > obj)
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)
virtual Handle< Object > GetExecutionState() const =0
V8EXPORT bool ForceDelete(Handle< Value > key)
bool(* AllowCodeGenerationFromStringsCallback)(Local< Context > context)
static uint16_t GetWrapperClassId(Object **location)
JSObject * global_proxy()
static void EnterDefaultIsolate()
Handle< String > GetTitle() const
void TerminateExecution()
MemoryAllocator * memory_allocator()
V8EXPORT int Utf8Length() const
MaybeObject * scheduled_exception()
T * NewArray(size_t size)
void SetAccessor(Handle< String > name, AccessorGetter getter, AccessorSetter setter=0, Handle< Value > data=Handle< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None, Handle< AccessorSignature > signature=Handle< AccessorSignature >())
Handle< Object > SetProperty(Handle< Object > object, Handle< Object > key, Handle< Object > value, PropertyAttributes attributes, StrictModeFlag strict_mode)
static void ResumeProfiler()
int * global_handle_count
void SetInternalFieldCount(int value)
unsigned int FastD2UI(double x)
#define LOG_API(isolate, expr)
static void SetFatalErrorHandler(FatalErrorCallback that)
V8EXPORT bool HasIndexedLookupInterceptor()
intptr_t * cell_space_capacity
intptr_t * memory_allocator_size
Handle< Integer >(* IndexedPropertyQuery)(uint32_t index, const AccessorInfo &info)
uintptr_t(* ReturnAddressLocationResolver)(uintptr_t return_addr_location)
void PrintCurrentStackTrace(FILE *out)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit 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 SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available 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 MIPS FPU instructions if expose natives in global object expose gc extension number of stack frames to capture disable builtin natives files print a stack trace if an assertion failure occurs use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations prepare for turning on always opt minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions automatically set the debug break flag when debugger commands are in the queue always cause a debug break before aborting 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 more details following each garbage collection print amount of external allocated memory after each time it is adjusted flush code that we expect not to use again before full gc do incremental marking steps track object counts and memory usage use caching Perform compaction on every full GC Never perform compaction on full GC testing only Compact code space on full incremental collections Default seed for initializing random allows verbose printing trace parsing and preparsing Check icache flushes in ARM and MIPS simulator Stack alingment in bytes in print stack trace when throwing exceptions randomize hashes to avoid predictable hash Fixed seed to use to hash property activate a timer that switches between V8 threads testing_bool_flag float flag Seed used for threading test randomness A filename with extra code to be included in the Print usage message
Handle< String > LookupSymbol(Vector< const char > str)
static SnapshotObjectId PushHeapObjectsStats(OutputStream *stream)
static int ContextDisposedNotification()
static int GetRawScriptsSize()
static bool SetFunctionEntryHook(FunctionEntryHook entry_hook)
Handle< JSArray > CaptureCurrentStackTrace(int frame_limit, StackTrace::StackTraceOptions options)
static void TerminateExecution(int thread_id)
GlobalHandles * global_handles()
V8EXPORT int32_t Int32Value() const
static void RemoveCallCompletedCallback(CallCompletedCallback callback)
void(* AccessorSetter)(Local< String > property, Local< Value > value, const AccessorInfo &info)
static int GetProfilesCount()
V8EXPORT bool IsBoolean() const
V8EXPORT Local< Object > NewInstance() const
static void TransformToFastProperties(Handle< JSObject > object, int unused_property_fields)
intptr_t * code_space_capacity
bool IsConstructor() const
static bool IsIndependent(Object **location)
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 FunctionTemplateInfo * cast(Object *obj)
V8EXPORT void SetIndexedPropertiesToPixelData(uint8_t *data, int length)
Handle< FixedArray > NewFixedArray(int size, PretenureFlag pretenure=NOT_TENURED)
V8EXPORT void TurnOnAccessCheck()
static void PrintCurrentStackTrace(FILE *out)
v8::ImplementationUtilities::HandleScopeData * handle_scope_data()
static void SetStressRunType(StressType type)
V8EXPORT 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 void RemoveMessageListeners(MessageCallback that)
static MUST_USE_RESULT Handle< Object > SetElement(Handle< JSObject > object, uint32_t index, Handle< Object > value, PropertyAttributes attr, StrictModeFlag strict_mode, SetPropertyMode set_mode=SET_PROPERTY)
V8EXPORT bool Has(Handle< String > key)
static ExternalPixelArray * cast(Object *obj)
static bool IsProfilerPaused()
static const char * GetVersion()
void(* AddHistogramSampleCallback)(void *histogram, int sample)
static Handle< JSRegExp > NewJSRegExp(Handle< String > pattern, Handle< String > flags, bool *exc)
static Local< Integer > IntegerToLocal(v8::internal::Handle< v8::internal::Object > obj)
V8EXPORT bool SetHiddenValue(Handle< String > key, Handle< Value > value)
intptr_t AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes)
V8EXPORT Local< String > ToDetailString() const
virtual Handle< String > GetJSON() const =0
static Handle< String > GetMessage(Handle< Object > data)
int max_executable_size()
static void SetWrapperClassId(Object **location, uint16_t class_id)
static Local< T > New(Handle< T > that)
Local< String > GetScriptNameOrSourceURL() const
double FastUI2D(unsigned x)
static Handle< Object > NewDate(double time, bool *exc)
V8EXPORT bool HasNamedLookupInterceptor()
Handle< JSBuiltinsObject > js_builtins_object()
activate correct semantics for inheriting readonliness false
static int GetIdentityHash(Handle< JSObject > obj)
V8EXPORT bool BooleanValue() const
static void UnregisterAll()
uint32_t * stack_limit() const
static bool EnableAgent(const char *name, int port, bool wait_for_connection=false)
Handle< Object > ToObject(Handle< Object > object)
static Local< Context > GetCalling()
V8EXPORT bool SetPrototype(Handle< Value > prototype)
void EnableSlidingStateWindow()
void(* WeakReferenceCallback)(Persistent< Value > object, void *parameter)
int GetLineNumber() const
V8EXPORT bool IsFunction() const
static Local< Value > RangeError(Handle< String > message)
int * free_global_handle_count
static void SetMessageHandler(MessageHandler handler, bool message_handler_thread=false)
void(* MessageHandler)(const uint16_t *message, int length, ClientData *client_data)
Handle< Boolean > V8EXPORT False()
void SetHiddenPrototype(bool value)
Handle< FixedArray > CopyFixedArray(Handle< FixedArray > array)
static Handle< Object > Call(Handle< Object > callable, Handle< Object > receiver, int argc, Handle< Object > argv[], bool *pending_exception, bool convert_receiver=false)
static void DeleteAllSnapshots()
static SnapshotObjectId GetSnapshotObjectId(Handle< Object > obj)
void IterateAllRootsWithClassIds(ObjectVisitor *v)
void RemoveGCPrologueCallback(GCPrologueCallback callback)
Vector< const char > CStrVector(const char *data)
static unsigned Encode(char *out, uchar c, int previous)
int StrLength(const char *string)
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
void SetNamedPropertyHandler(NamedPropertyGetter getter, NamedPropertySetter setter=0, NamedPropertyQuery query=0, NamedPropertyDeleter deleter=0, NamedPropertyEnumerator enumerator=0, Handle< Value > data=Handle< Value >())
intptr_t CommittedMemory()
static void AddCallCompletedCallback(CallCompletedCallback callback)
RegisteredExtension(Extension *extension)
Handle< Context > CreateEnvironment(Isolate *isolate, Handle< Object > global_object, v8::Handle< v8::ObjectTemplate > global_template, v8::ExtensionConfiguration *extensions)
Local< String > GetScriptName() const
V8EXPORT int64_t IntegerValue() const
Handle< JSArray > NewJSArrayWithElements(Handle< FixedArrayBase > elements, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND, PretenureFlag pretenure=NOT_TENURED)
static SeqTwoByteString * cast(Object *obj)
V8EXPORT bool IsObject() const
void(* GCEpilogueCallback)(GCType type, GCCallbackFlags flags)
V8EXPORT void SetName(Handle< String > name)
#define EXCEPTION_PREAMBLE(isolate)
Handle< Object > NewNumberFromInt(int32_t value, PretenureFlag pretenure=NOT_TENURED)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit 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 SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available 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 MIPS FPU instructions if expose natives in global object expose gc extension number of stack frames to capture disable builtin natives files print a stack trace if an assertion failure occurs use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations prepare for turning on always opt minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions automatically set the debug break flag when debugger commands are in the queue always cause a debug break before aborting 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 more details following each garbage collection print amount of external allocated memory after each time it is adjusted flush code that we expect not to use again before full gc do incremental marking steps track object counts and memory usage use caching Perform compaction on every full GC Never perform compaction on full GC testing only Compact code space on full incremental collections Default seed for initializing random allows verbose printing trace parsing and preparsing Check icache flushes in ARM and MIPS simulator Stack alingment in bytes in print stack trace when throwing exceptions randomize hashes to avoid predictable hash Fixed seed to use to hash property activate a timer that switches between V8 threads testing_bool_flag float flag Seed used for threading test randomness A filename with extra code to be included in the snapshot(mksnapshot only)") DEFINE_bool(help
V8EXPORT double Value() const
bool IsCodeGenerationFromStringsAllowed()
static Local< Value > ReferenceError(Handle< String > message)
void(* JitCodeEventHandler)(const JitCodeEvent *event)
Local< Value > StackTrace() const
bool IsFreshUnusedString(Handle< String > string)
static void SetMessageHandler2(MessageHandler2 handler)
static V8EXPORT v8::Local< v8::String > Empty()
int GetScriptLineNumber(Handle< Script > script, int code_pos)
intptr_t * old_data_space_capacity
static void StopHeapObjectsTracking()
static Handle< JSFunction > InstantiateFunction(Handle< FunctionTemplateInfo > data, bool *exc)
V8EXPORT Local< Value > CallAsFunction(Handle< Object > recv, int argc, Handle< Value > argv[])
int GetEndPosition() const
const CpuProfileNode * GetTopDownRoot() const
V8EXPORT bool IsDate() const
static Local< Context > GetEntered()
void add(v8::internal::Handle< v8::internal::Object > value)
Handle< Integer > ResourceColumnOffset() const
static int NumberOfHandles()
static void WriteToFlat(String *source, sinkchar *sink, int from, int to)
static Handle< SharedFunctionInfo > Compile(Handle< String > source, Handle< Object > script_name, int line_offset, int column_offset, Handle< Context > context, v8::Extension *extension, ScriptDataImpl *pre_data, Handle< Object > script_data, NativesFlag is_natives_code)
V8EXPORT int GetIndexedPropertiesExternalArrayDataLength()
static internal::Object ** CreateHandle(internal::Object *value)
static size_t GetMemorySizeUsedByProfiler()
Handle< String > NewExternalStringFromTwoByte(const ExternalTwoByteString::Resource *resource)
V8EXPORT uint32_t Uint32Value() const
static double nan_value()
static Local< AccessorSignature > New(Handle< FunctionTemplate > receiver=Handle< FunctionTemplate >())
static void * GetExternalPointerFromSmi(internal::Object *value)
static void SetDebugMessageDispatchHandler(DebugMessageDispatchHandler handler, bool provide_locker=false)
int * weak_global_handle_count
void Continue(InterruptFlag after_what)
static void SetEntropySource(EntropySource source)
Handle< Object > NewReferenceError(const char *type, Vector< Handle< Object > > args)
void SetGlobalGCEpilogueCallback(GCCallback callback)
V8EXPORT bool IsNumber() const
static void CancelDebugBreak(Isolate *isolate=NULL)
static int SetFlagsFromString(const char *str, int len)
void DetachGlobal(Handle< Context > env)
Handle< String > GetTitle() const
uint32_t SnapshotObjectId
void FatalProcessOutOfMemory(const char *message)
ExternalStringTable * external_string_table()
static void DeleteAllProfiles()
V8EXPORT Local< String > StringValue() const
Local< Function > GetFunction()
static Handle< Object > DeleteProperty(Handle< JSObject > obj, Handle< String > name)
V8EXPORT bool ForceSet(Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None)
V8EXPORT bool Delete(Handle< String > key)
static int GetCurrentThreadId()
static void set_raw_data(const byte *raw_data)
int GetNodesCount() const
static Local< Value > SyntaxError(Handle< String > message)
Handle< Object > NewTypeError(const char *type, Vector< Handle< Object > > args)
static ThreadId FromInteger(int id)
static void AddCallCompletedCallback(CallCompletedCallback callback)
static Handle< Object > GetFunctionDelegate(Handle< Object > object)
int GetChildrenCount() const
V8EXPORT Local< Object > Clone()
virtual const char * data() const =0
static void DisableAgent()
#define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value)
static int context_size()
i::Handle< i::String > NewExternalStringHandle(i::Isolate *isolate, v8::String::ExternalStringResource *resource)
const HeapGraphNode * GetRoot() const
static bool SetDebugEventListener2(EventCallback2 that, Handle< Value > data=Handle< Value >())
V8EXPORT bool SetAccessor(Handle< String > name, AccessorGetter getter, AccessorSetter setter=0, Handle< Value > data=Handle< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None)
V8EXPORT int GetIndexedPropertiesPixelDataLength()
bool(* NamedSecurityCallback)(Local< Object > host, Local< Value > key, AccessType type, Local< Value > data)
static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback)
Local< ObjectTemplate > PrototypeTemplate()
Handle< Foreign > NewForeign(Address addr, PretenureFlag pretenure=NOT_TENURED)
V8EXPORT bool IsFalse() const
static void VisitHandlesWithClassIds(PersistentHandleVisitor *visitor)
const int kHandleBlockSize
V8EXPORT Flags GetFlags() const
void set(int index, v8::internal::Object *value)
MUST_USE_RESULT MaybeObject * GetProperty(String *key)
#define ASSERT_EQ(v1, v2)
void MarkAsUndetectable()
static void SetReturnAddressLocationResolver(ReturnAddressLocationResolver resolver)
static Local< Value > TypeError(Handle< String > message)
static int GetProfilesCount()
bool(* EntropySource)(unsigned char *buffer, size_t length)
static Local< Signature > New(Handle< FunctionTemplate > receiver=Handle< FunctionTemplate >(), int argc=0, Handle< FunctionTemplate > argv[]=0)
static void Register(RegisteredExtension *that)
static void SetGlobalGCPrologueCallback(GCCallback)
static Handle< Object > ToNumber(Handle< Object > obj, bool *exc)
Context * RestoreContext()
void set_ignore_out_of_memory(bool value)
static V8EXPORT Local< Integer > New(int32_t value)
V8EXPORT int GetScriptLineNumber() const
static Handle< JSObject > InstantiateObject(Handle< ObjectTemplateInfo > data, bool *exc)
static void StartProfiling(const char *title)
static void RemoveGCEpilogueCallback(GCEpilogueCallback callback)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit 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 SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available 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 MIPS FPU instructions if NULL
static void PrepareStressRun(int run)
Handle< StackTrace > GetStackTrace() const
V8EXPORT int64_t Value() const
static void SetCreateHistogramFunction(CreateHistogramCallback)
Local< T > Close(Handle< T > value)
V8EXPORT bool IsNumberObject() const
void MarkIndependent(Object **location)
static FixedArray * cast(Object *obj)
void InitializeLoggingAndCounters()
V8EXPORT int WriteAscii(char *buffer, int start=0, int length=-1, int options=NO_OPTIONS) const
static Local< Value > Call(v8::Handle< v8::Function > fun, Handle< Value > data=Handle< Value >())
static bool IsWeak(Object **location)
static void RemoveGCPrologueCallback(GCPrologueCallback callback)
Failure * TerminateExecution()
static bool ReportApiFailure(const char *location, const char *message)
Handle< Primitive > V8EXPORT Undefined()
V8EXPORT Local< Value > GetRealNamedPropertyInPrototypeChain(Handle< String > key)
static void EnableSlidingStateWindow()
static V8EXPORT Local< Number > New(double value)
void SetCreateHistogramFunction(CreateHistogramCallback f)
intptr_t * old_pointer_space_capacity
static Handle< Object > GetElement(Handle< Object > object, uint32_t index)
static HeapSnapshot * FindSnapshot(unsigned uid)
static V8EXPORT Local< String > Concat(Handle< String > left, Handle< String > right)
V8EXPORT double NumberValue() const
V8EXPORT bool HasOwnProperty(Handle< String > key)
void SetData(Handle< Value > data)
i::Handle< i::String > NewExternalAsciiStringHandle(i::Isolate *isolate, v8::String::ExternalAsciiStringResource *resource)
static int GetPersistentHandleCount()
static Handle< Object > ToString(Handle< Object > obj, bool *exc)
static void DeleteAllProfiles()
Handle< Value > GetHeapValue() const
void RecordStats(HeapStats *stats, bool take_snapshot=false)
static Persistent< Context > New(ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
void RegisterTryCatchHandler(v8::TryCatch *that)
bool IsInstanceOf(FunctionTemplateInfo *type)
bool IsInGCPostProcessing()
static Local< StackTrace > CurrentStackTrace(int frame_limit, StackTraceOptions options=kOverview)
static Local< TypeSwitch > New(Handle< FunctionTemplate > type)
V8EXPORT Local< Object > ToObject() const
V8EXPORT bool IsArray() const
const uintptr_t kEncodablePointerMask
Handle< Struct > NewStruct(InstanceType type)
bool has_scheduled_exception()
static bool IsLeadSurrogate(int code)
static void LowMemoryNotification()
V8EXPORT uint32_t Length() const
Handle< Object > ForceSetProperty(Handle< JSObject > object, Handle< Object > key, Handle< Object > value, PropertyAttributes attributes)
Handle< Context > native_context()
static ScriptData * New(const char *data, int length)
static const CpuProfile * StopProfiling(Handle< String > title, Handle< Value > security_token=Handle< Value >())
V8EXPORT Local< Boolean > ToBoolean() const
StringInputBuffer * write_input_buffer()
V8EXPORT 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
static bool IsTrailSurrogate(int code)
static void SetFlagsFromCommandLine(int *argc, char **argv, bool remove_flags)
Address foreign_address()
void ReattachGlobal(Handle< Context > env, Handle< JSGlobalProxy > global_proxy)
static V8EXPORT Local< External > New(void *value)
static void DebugBreak(Isolate *isolate=NULL)
static const HeapSnapshot * GetSnapshot(int index)
AsciiValue(Handle< v8::Value > obj)
Handle< Boolean >(* IndexedPropertyDeleter)(uint32_t index, const AccessorInfo &info)
void MakeWeak(Object **location, void *parameter, WeakReferenceCallback callback)
V8EXPORT bool IsInt32() const
Handle< Object > SetPrototype(Handle< JSFunction > function, Handle< Object > prototype)
V8EXPORT bool HasRealNamedProperty(Handle< String > key)
#define STATIC_ASSERT(test)
static void StartHeapObjectsTracking()
static void StartHeapObjectsTracking()
static V8EXPORT Local< String > NewExternal(ExternalStringResource *resource)
static Local< Value > GetMirror(v8::Handle< v8::Value > obj)
void DeleteArray(T *array)
bool V8EXPORT SetResourceConstraints(ResourceConstraints *constraints)
intptr_t * memory_allocator_capacity
int GetStartColumn() const
V8EXPORT Handle< Value > GetInferredName() const
static ConsString * cast(Object *obj)
static Handle< Object > TryGetConstructorDelegate(Handle< Object > object, bool *has_pending_exception)
V8EXPORT Local< Object > FindInstanceInPrototypeChain(Handle< FunctionTemplate > tmpl)
static bool Initialize(const char *snapshot_file=NULL)
void SetStackLimit(uintptr_t limit)
CompressedStartupDataItems
static FixedArrayBase * cast(Object *object)
Handle< Value > V8EXPORT ThrowException(Handle< Value > exception)
static SnapshotObjectId GetSnapshotObjectId(Handle< Value > value)
Handle< String > NewConsString(Handle< String > first, Handle< String > second)
static const int kMaxValue
static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorithm()
intptr_t * old_data_space_size
virtual ~StartupDataDecompressor()
static void DeoptimizeAll()
const HeapGraphNode * GetToNode() const
Handle< Value > GetSecurityToken()
Handle< Array >(* IndexedPropertyEnumerator)(const AccessorInfo &info)
static void FatalProcessOutOfMemory(const char *location, bool take_snapshot=false)
V8EXPORT int32_t Value() const
Handle< Value >(* AccessorGetter)(Local< String > property, const AccessorInfo &info)
static void ProcessDebugMessages()
void SetErrorMessageForCodeGenerationFromStrings(Handle< String > message)
static const byte * context_data()
int match(Handle< Value > value)
static void PauseProfiler()
void Serialize(OutputStream *stream, SerializationFormat format) const
Local< v8::Message > Message() const
V8EXPORT int Write(uint16_t *buffer, int start=0, int length=-1, int options=NO_OPTIONS) const
static int SetFlagsFromCommandLine(int *argc, char **argv, bool remove_flags)
static Handle< Object > TryGetFunctionDelegate(Handle< Object > object, bool *has_pending_exception)
void Inherit(Handle< FunctionTemplate > parent)
static HeapSnapshot * TakeSnapshot(const char *name, int type, v8::ActivityControl *control)
static void AddImplicitReferences(Persistent< Object > parent, Persistent< Value > *children, size_t length)
static JSObject * cast(Object *obj)
static void SetRawScriptsSource(Vector< const char > raw_source)
Local< String > GetFunctionName() const
Local< String > GetSourceLine() const
static V8EXPORT Local< Object > New()
int NumberOfGlobalHandles()
static const int kNoPreviousCharacter
static void SetCounterFunction(CounterLookupCallback)
v8::internal::Object * get(int index)
V8EXPORT Local< Uint32 > ToArrayIndex() const
Handle< T > CloseAndEscape(Handle< T > handle_value)
void AddMemoryAllocationCallback(MemoryAllocationCallback callback, ObjectSpace space, AllocationAction action)
Handle< Object > NewError(const char *maker, const char *type, Handle< JSArray > args)
int GetLineNumber() const
static void SetGlobalGCEpilogueCallback(GCCallback)
static void DeleteExtensions(Isolate *isolate)
V8EXPORT uint32_t Value() const
V8EXPORT int GetIdentityHash()
static T ** CreateHandle(T *value, Isolate *isolate)
virtual OutputEncoding GetOutputEncoding()
void SetAccessCheckCallbacks(NamedSecurityCallback named_handler, IndexedSecurityCallback indexed_handler, Handle< Value > data=Handle< Value >(), bool turned_on_by_default=true)
Handle< Boolean >(* NamedPropertyDeleter)(Local< String > property, const AccessorInfo &info)
V8EXPORT bool Value() const
V8EXPORT bool Set(Handle< Value > key, Handle< Value > value, PropertyAttribute attribs=None)
double GetTotalSamplesCount() const
void SetCodeEventHandler(uint32_t options, JitCodeEventHandler event_handler)
int GetFrameCount() const
Handle< JSObject > Copy(Handle< JSObject > obj)
static bool IdleNotification(int hint=1000)
V8EXPORT double NumberValue() const
static v8::Testing::StressType stress_type()
static void IgnoreOutOfMemoryException()
static JSFunction * cast(Object *obj)