32 #include "../include/v8-debug.h"
33 #include "../include/v8-profiler.h"
34 #include "../include/v8-testing.h"
45 #ifdef COMPRESS_STARTUP_DATA_BZ2
62 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr))
64 #define ENTER_V8(isolate) \
65 ASSERT((isolate)->IsInitialized()); \
66 i::VMState __state__((isolate), i::OTHER)
67 #define LEAVE_V8(isolate) \
68 i::VMState __state__((isolate), i::EXTERNAL)
72 #define ON_BAILOUT(isolate, location, code) \
73 if (IsDeadCheck(isolate, location) || \
74 IsExecutionTerminatingCheck(isolate)) { \
80 #define EXCEPTION_PREAMBLE(isolate) \
81 (isolate)->handle_scope_implementer()->IncrementCallDepth(); \
82 ASSERT(!(isolate)->external_caught_exception()); \
83 bool has_pending_exception = false
86 #define EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, do_callback) \
88 i::HandleScopeImplementer* handle_scope_implementer = \
89 (isolate)->handle_scope_implementer(); \
90 handle_scope_implementer->DecrementCallDepth(); \
91 if (has_pending_exception) { \
92 if (handle_scope_implementer->CallDepthIsZero() && \
93 (isolate)->is_out_of_memory()) { \
94 if (!(isolate)->ignore_out_of_memory()) \
95 i::V8::FatalProcessOutOfMemory(NULL); \
97 bool call_depth_is_zero = handle_scope_implementer->CallDepthIsZero(); \
98 (isolate)->OptionalRescheduleException(call_depth_is_zero); \
106 #define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value) \
107 EXCEPTION_BAILOUT_CHECK_GENERIC( \
108 isolate, value, i::V8::FireCallCompletedCallback(isolate);)
111 #define EXCEPTION_BAILOUT_CHECK(isolate, value) \
112 EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, ;)
115 #define API_ENTRY_CHECK(isolate, msg) \
117 if (v8::Locker::IsActive()) { \
118 ApiCheck(isolate->thread_manager()->IsLockedByCurrentThread(), \
120 "Entering the V8 API without proper locking in place"); \
128 static void DefaultFatalErrorHandler(
const char* location,
129 const char* message) {
130 i::VMState __state__(i::Isolate::Current(), i::OTHER);
137 if (isolate->exception_behavior() ==
NULL) {
138 isolate->set_exception_behavior(DefaultFatalErrorHandler);
140 return isolate->exception_behavior();
157 int new_space_capacity;
159 intptr_t old_pointer_space_size;
161 intptr_t old_pointer_space_capacity;
163 intptr_t old_data_space_size;
165 intptr_t old_data_space_capacity;
167 intptr_t code_space_size;
169 intptr_t code_space_capacity;
171 intptr_t map_space_size;
173 intptr_t map_space_capacity;
175 intptr_t cell_space_size;
177 intptr_t cell_space_capacity;
179 intptr_t lo_space_size;
181 int global_handle_count;
183 int weak_global_handle_count;
185 int pending_global_handle_count;
187 int near_death_global_handle_count;
189 int free_global_handle_count;
191 intptr_t memory_allocator_size;
193 intptr_t memory_allocator_capacity;
195 int objects_per_type[
LAST_TYPE + 1] = {0};
212 callback(location,
"Allocation failed - process out of memory");
221 callback(location, message);
232 static inline bool ApiCheck(
bool condition,
233 const char* location,
234 const char* message) {
239 static bool ReportV8Dead(
const char* location) {
241 callback(location,
"V8 is no longer usable");
246 static bool ReportEmptyHandle(
const char* location) {
248 callback(location,
"Reading from empty handle");
265 static inline bool IsDeadCheck(
i::Isolate* isolate,
const char* location) {
271 static inline bool IsExecutionTerminatingCheck(
i::Isolate* isolate) {
275 isolate->
heap()->termination_exception();
282 return obj.
IsEmpty() ? ReportEmptyHandle(location) :
false;
286 static inline bool EmptyCheck(
const char* location,
const v8::Data* obj) {
287 return (obj == 0) ? ReportEmptyHandle(location) :
false;
293 static bool InitializeHelper() {
299 static inline bool EnsureInitializedForIsolate(
i::Isolate* isolate,
300 const char* location) {
301 if (IsDeadCheck(isolate, location))
return false;
302 if (isolate !=
NULL) {
305 ASSERT(isolate == i::Isolate::Current());
306 return ApiCheck(InitializeHelper(), location,
"Error initializing V8");
316 static inline i::Isolate* EnterIsolateIfNeeded() {
317 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
322 isolate = i::Isolate::Current();
328 : raw_data(i::
NewArray<char*>(
V8::GetCompressedStartupDataCount())) {
346 i::NewArray<StartupData>(compressed_data_count);
348 for (
int i = 0; i < compressed_data_count; ++i) {
349 char* decompressed = raw_data[i] =
350 i::NewArray<char>(compressed_data[i].
raw_size);
351 if (compressed_data[i].compressed_size != 0) {
353 &compressed_data[i].raw_size,
354 compressed_data[i].data,
355 compressed_data[i].compressed_size);
356 if (result != 0)
return result;
358 ASSERT_EQ(0, compressed_data[i].raw_size);
360 compressed_data[i].
data = decompressed;
369 #ifdef COMPRESS_STARTUP_DATA_BZ2
386 #ifdef COMPRESS_STARTUP_DATA_BZ2
395 #ifdef COMPRESS_STARTUP_DATA_BZ2
409 reinterpret_cast<const char*
>(libraries_source.
start());
416 reinterpret_cast<const char*
>(exp_libraries_source.
start());
418 exp_libraries_source.
length();
426 #ifdef COMPRESS_STARTUP_DATA_BZ2
429 reinterpret_cast<const i::byte*>(decompressed_data[
kSnapshot].data));
434 reinterpret_cast<const i::byte*>(
456 isolate->set_exception_behavior(that);
463 isolate->set_allow_code_gen_callback(callback);
468 void ImplementationUtilities::ZapHandleRange(
i::Object** begin,
470 i::HandleScope::ZapRange(begin, end);
476 i::FlagList::SetFlagsFromString(str, length);
481 i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags);
487 if (IsDeadCheck(isolate,
"v8::ThrowException()")) {
502 RegisteredExtension* RegisteredExtension::first_extension_ =
NULL;
506 : extension_(extension) { }
510 that->next_ = first_extension_;
511 first_extension_ = that;
537 source_length_(source_length >= 0 ?
539 (source ? static_cast<int>(strlen(source)) : 0)),
540 source_(source, source_length_),
541 dep_count_(dep_count),
543 auto_enable_(
false) { }
548 if (!EnsureInitializedForIsolate(isolate,
"v8::Undefined()")) {
552 isolate->
factory()->undefined_value()));
558 if (!EnsureInitializedForIsolate(isolate,
"v8::Null()")) {
562 ToApi<Primitive>(isolate->
factory()->null_value()));
568 if (!EnsureInitializedForIsolate(isolate,
"v8::True()")) {
572 ToApi<Boolean>(isolate->
factory()->true_value()));
578 if (!EnsureInitializedForIsolate(isolate,
"v8::False()")) {
582 ToApi<Boolean>(isolate->
factory()->false_value()));
587 : max_young_space_size_(0),
588 max_old_space_size_(0),
589 max_executable_size_(0),
590 stack_limit_(
NULL) { }
599 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) {
604 max_executable_size);
605 if (!result)
return false;
608 uintptr_t limit =
reinterpret_cast<uintptr_t
>(constraints->
stack_limit());
617 if (IsDeadCheck(isolate,
"V8::Persistent::New"))
return NULL;
618 LOG_API(isolate,
"Persistent::New");
625 void V8::MakeWeak(
i::Object**
object,
void* parameters,
641 void V8::MarkIndependent(
i::Object**
object) {
643 LOG_API(isolate,
"MakeIndependent");
648 bool V8::IsGlobalNearDeath(
i::Object** obj) {
650 LOG_API(isolate,
"IsGlobalNearDeath");
658 LOG_API(isolate,
"IsGlobalWeak");
664 void V8::DisposeGlobal(
i::Object** obj) {
666 LOG_API(isolate,
"DisposeGlobal");
680 prev_next_ = current->next;
681 prev_limit_ = current->limit;
694 void HandleScope::Leave() {
695 ASSERT(isolate_ == i::Isolate::Current());
699 ASSERT(current->level >= 0);
700 current->next = prev_next_;
701 if (current->limit != prev_limit_) {
702 current->limit = prev_limit_;
707 i::HandleScope::ZapRange(prev_next_, prev_limit_);
713 EnsureInitializedForIsolate(
714 i::Isolate::Current(),
"HandleScope::NumberOfHandles");
725 ASSERT(value->IsHeapObject());
734 if (IsDeadCheck(isolate,
"v8::Context::Enter()"))
return;
752 "v8::Context::Exit()",
753 "Cannot exit non-entered context")) {
768 if (IsDeadCheck(isolate,
"v8::Context::SetData()"))
return;
770 ASSERT(env->IsGlobalContext());
771 if (env->IsGlobalContext()) {
772 env->set_data(*raw_data);
780 if (IsDeadCheck(isolate,
"v8::Context::GetData()")) {
784 ASSERT(env->IsGlobalContext());
785 if (env->IsGlobalContext()) {
786 raw_result = env->data();
796 if (!ApiCheck(!is_closed_,
797 "v8::HandleScope::Close()",
798 "Local scope has already been closed")) {
801 LOG_API(isolate_,
"CloseHandleScope");
817 return handle.location();
831 EnsureInitializedForIsolate(isolate,
"v8::Nowhere");
835 value_->set_elements(*elements);
857 return obj_.
get(offset + 1);
868 int size = obj_.
size();
869 if (length == size - 1) {
871 for (
int i = 0; i <
length; i++)
872 new_elms->set(i + 1,
get(i));
873 obj_.
value()->set_elements(*new_elms);
875 obj_.
set(length + 1, *value);
881 if (index < 0 || index >= this->
length())
return;
882 obj_.
set(index + 1, value);
897 if (IsDeadCheck(isolate,
"v8::Template::Set()"))
return;
901 if (list->IsUndefined()) {
913 static void InitializeFunctionTemplate(
922 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::PrototypeTemplate()")) {
927 if (result->IsUndefined()) {
937 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::Inherit()"))
return;
946 EnsureInitializedForIsolate(isolate,
"v8::FunctionTemplate::New()");
947 LOG_API(isolate,
"FunctionTemplate::New");
953 InitializeFunctionTemplate(obj);
954 int next_serial_number = isolate->next_serial_number();
955 isolate->set_next_serial_number(next_serial_number + 1);
961 obj->set_undetectable(
false);
962 obj->set_needs_access_check(
false);
973 EnsureInitializedForIsolate(isolate,
"v8::Signature::New()");
974 LOG_API(isolate,
"Signature::New");
983 for (
int i = 0; i < argc; i++) {
984 if (!argv[i].IsEmpty())
987 obj->set_args(*args);
1007 EnsureInitializedForIsolate(isolate,
"v8::TypeSwitch::New()");
1008 LOG_API(isolate,
"TypeSwitch::New");
1011 for (
int i = 0; i < argc; i++)
1017 obj->set_types(*vector);
1024 LOG_API(isolate,
"TypeSwitch::match");
1029 for (
int i = 0; i < types->
length(); i++) {
1037 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \
1038 i::Handle<i::Object> foreign = FromCData(cdata); \
1039 (obj)->setter(*foreign); \
1046 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::SetCallHandler()"))
return;
1075 if (settings &
ALL_CAN_READ) obj->set_all_can_read(
true);
1078 obj->set_property_attributes(static_cast<PropertyAttributes>(attributes));
1086 void FunctionTemplate::AddInstancePropertyAccessor(
1095 if (IsDeadCheck(isolate,
1096 "v8::FunctionTemplate::AddInstancePropertyAccessor()")) {
1103 settings, attributes,
1106 if (list->IsUndefined()) {
1107 list = NeanderArray().value();
1110 NeanderArray array(list);
1117 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::InstanceTemplate()")
1118 || EmptyCheck(
"v8::FunctionTemplate::InstanceTemplate()",
this))
1134 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::SetClassName()"))
return;
1142 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::SetHiddenPrototype()")) {
1152 if (IsDeadCheck(isolate,
"v8::FunctionTemplate::SetPrototypeAttributes()")) {
1160 void FunctionTemplate::SetNamedInstancePropertyHandler(
1168 if (IsDeadCheck(isolate,
1169 "v8::FunctionTemplate::SetNamedInstancePropertyHandler()")) {
1191 void FunctionTemplate::SetIndexedInstancePropertyHandler(
1197 Handle<Value> data) {
1199 if (IsDeadCheck(isolate,
1200 "v8::FunctionTemplate::SetIndexedInstancePropertyHandler()")) {
1222 void FunctionTemplate::SetInstanceCallAsFunctionHandler(
1224 Handle<Value> data) {
1226 if (IsDeadCheck(isolate,
1227 "v8::FunctionTemplate::SetInstanceCallAsFunctionHandler()")) {
1254 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::New()")) {
1257 EnsureInitializedForIsolate(isolate,
"v8::ObjectTemplate::New()");
1258 LOG_API(isolate,
"ObjectTemplate::New");
1274 static void EnsureConstructor(ObjectTemplate* object_template) {
1292 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::SetAccessor()"))
return;
1295 EnsureConstructor(
this);
1316 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::SetNamedPropertyHandler()")) {
1321 EnsureConstructor(
this);
1336 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::MarkAsUndetectable()"))
return;
1339 EnsureConstructor(
this);
1343 cons->set_undetectable(
true);
1351 bool turned_on_by_default) {
1353 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::SetAccessCheckCallbacks()")) {
1358 EnsureConstructor(
this);
1374 cons->set_access_check_info(*info);
1375 cons->set_needs_access_check(turned_on_by_default);
1387 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::SetIndexedPropertyHandler()")) {
1392 EnsureConstructor(
this);
1408 if (IsDeadCheck(isolate,
1409 "v8::ObjectTemplate::SetCallAsFunctionHandler()")) {
1414 EnsureConstructor(
this);
1418 Utils::ToLocal(cons)->SetInstanceCallAsFunctionHandler(callback, data);
1424 "v8::ObjectTemplate::InternalFieldCount()")) {
1433 if (IsDeadCheck(isolate,
"v8::ObjectTemplate::SetInternalFieldCount()")) {
1437 "v8::ObjectTemplate::SetInternalFieldCount()",
1438 "Invalid internal field count")) {
1446 EnsureConstructor(
this);
1457 reinterpret_cast<const unsigned char*>(input), length);
1464 if (str->IsExternalTwoByteString()) {
1477 if (length %
sizeof(
unsigned) != 0) {
1482 int deserialized_data_length = length /
sizeof(unsigned);
1484 if (reinterpret_cast<intptr_t>(data) %
sizeof(unsigned) == 0) {
1488 unsigned* deserialized_data = i::NewArray<unsigned>(deserialized_data_length);
1505 LOG_API(isolate,
"Script::New");
1511 int line_offset = 0;
1512 int column_offset = 0;
1513 if (origin !=
NULL) {
1533 pre_data_impl =
NULL;
1544 has_pending_exception = result.
is_null();
1546 raw_result = *result;
1556 return New(source, &origin);
1566 LOG_API(isolate,
"Script::Compile");
1569 if (
generic.IsEmpty())
1586 return Compile(source, &origin, 0, script_data);
1593 LOG_API(isolate,
"Script::Run");
1600 if (obj->IsSharedFunctionInfo()) {
1614 raw_result = *result;
1624 if (obj->IsSharedFunctionInfo()) {
1638 LOG_API(isolate,
"Script::Id");
1654 ON_BAILOUT(isolate,
"v8::Script::SetData()",
return);
1655 LOG_API(isolate,
"Script::SetData");
1661 script->set_data(*raw_data);
1670 : isolate_(i::
Isolate::Current()),
1671 next_(isolate_->try_catch_handler_address()),
1672 exception_(isolate_->heap()->the_hole_value()),
1673 message_(i::Smi::FromInt(0)),
1675 can_continue_(
true),
1676 capture_message_(
true),
1683 ASSERT(isolate_ == i::Isolate::Current());
1687 isolate_->UnregisterTryCatchHandler(
this);
1690 isolate_->UnregisterTryCatchHandler(
this);
1696 return !
reinterpret_cast<i::Object*
>(exception_)->IsTheHole();
1701 return can_continue_;
1713 ASSERT(isolate_ == i::Isolate::Current());
1725 ASSERT(isolate_ == i::Isolate::Current());
1743 ASSERT(isolate_ == i::Isolate::Current());
1754 ASSERT(isolate_ == i::Isolate::Current());
1755 exception_ = isolate_->heap()->the_hole_value();
1761 is_verbose_ = value;
1766 capture_message_ = value;
1781 return scope.
Close(result);
1787 if (IsDeadCheck(isolate,
"v8::Message::GetScriptResourceName()")) {
1804 if (IsDeadCheck(isolate,
"v8::Message::GetScriptResourceData()")) {
1821 if (IsDeadCheck(isolate,
"v8::Message::GetStackTrace()")) {
1840 bool* has_pending_exception) {
1855 bool* has_pending_exception) {
1857 return CallV8HeapFunction(name,
1858 i::Isolate::Current()->js_builtins_object(),
1861 has_pending_exception);
1874 &has_pending_exception);
1876 return static_cast<int>(result->Number());
1882 if (IsDeadCheck(isolate,
"v8::Message::GetStartPosition()"))
return 0;
1887 return message->start_position();
1893 if (IsDeadCheck(isolate,
"v8::Message::GetEndPosition()"))
return 0;
1898 return message->end_position();
1904 if (IsDeadCheck(isolate,
"v8::Message::GetStartColumn()")) {
1912 "GetPositionInLine",
1914 &has_pending_exception);
1916 return static_cast<int>(start_col_obj->Number());
1922 if (IsDeadCheck(isolate,
"v8::Message::GetEndColumn()"))
return kNoColumnInfo;
1928 "GetPositionInLine",
1930 &has_pending_exception);
1934 int start = message->start_position();
1935 int end = message->end_position();
1936 return static_cast<int>(start_col_obj->Number()) + (end - start);
1948 &has_pending_exception);
1950 if (result->IsString()) {
1960 if (IsDeadCheck(isolate,
"v8::Message::PrintCurrentStackTrace()"))
return;
1970 if (IsDeadCheck(isolate,
"v8::StackTrace::GetFrame()")) {
1984 if (IsDeadCheck(isolate,
"v8::StackTrace::GetFrameCount()"))
return -1;
1992 if (IsDeadCheck(isolate,
"v8::StackTrace::AsArray()"))
Local<Array>();
2001 if (IsDeadCheck(isolate,
"v8::StackTrace::CurrentStackTrace()")) {
2015 if (IsDeadCheck(isolate,
"v8::StackFrame::GetLineNumber()")) {
2022 if (!line->IsSmi()) {
2031 if (IsDeadCheck(isolate,
"v8::StackFrame::GetColumn()")) {
2038 if (!column->IsSmi()) {
2047 if (IsDeadCheck(isolate,
"v8::StackFrame::GetScriptName()")) {
2054 if (!name->IsString()) {
2063 if (IsDeadCheck(isolate,
"v8::StackFrame::GetScriptNameOrSourceURL()")) {
2070 if (!name->IsString()) {
2079 if (IsDeadCheck(isolate,
"v8::StackFrame::GetFunctionName()")) {
2086 if (!name->IsString()) {
2095 if (IsDeadCheck(isolate,
"v8::StackFrame::IsEval()"))
return false;
2100 return is_eval->IsTrue();
2106 if (IsDeadCheck(isolate,
"v8::StackFrame::IsConstructor()"))
return false;
2111 return is_constructor->IsTrue();
2117 bool Value::FullIsUndefined()
const {
2118 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsUndefined()")) {
2127 bool Value::FullIsNull()
const {
2128 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsNull()"))
return false;
2136 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsTrue()"))
return false;
2142 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsFalse()"))
return false;
2148 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsFunction()")) {
2155 bool Value::FullIsString()
const {
2156 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsString()"))
return false;
2164 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsArray()"))
return false;
2170 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsObject()"))
return false;
2176 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsNumber()"))
return false;
2182 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsBoolean()")) {
2190 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsExternal()")) {
2198 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsInt32()"))
return false;
2200 if (obj->IsSmi())
return true;
2201 if (obj->IsNumber()) {
2202 double value = obj->Number();
2215 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsUint32()"))
return false;
2218 if (obj->IsNumber()) {
2219 double value = obj->Number();
2233 if (IsDeadCheck(isolate,
"v8::Value::IsDate()"))
return false;
2235 return obj->HasSpecificClassOf(isolate->
heap()->Date_symbol());
2241 if (IsDeadCheck(isolate,
"v8::Value::IsStringObject()"))
return false;
2243 return obj->HasSpecificClassOf(isolate->
heap()->String_symbol());
2249 if (IsDeadCheck(isolate,
"v8::Value::IsNumberObject()"))
return false;
2251 return obj->HasSpecificClassOf(isolate->
heap()->Number_symbol());
2256 const char* builtin_name) {
2260 return builtins->GetPropertyNoExceptionThrown(*symbol);
2264 static bool CheckConstructor(
i::Isolate* isolate,
2266 const char* class_name) {
2267 return obj->map()->constructor() == LookupBuiltin(isolate, class_name);
2273 if (IsDeadCheck(isolate,
"v8::Value::IsNativeError()"))
return false;
2275 if (obj->IsJSObject()) {
2277 return CheckConstructor(isolate, js_obj,
"$Error") ||
2278 CheckConstructor(isolate, js_obj,
"$EvalError") ||
2279 CheckConstructor(isolate, js_obj,
"$RangeError") ||
2280 CheckConstructor(isolate, js_obj,
"$ReferenceError") ||
2281 CheckConstructor(isolate, js_obj,
"$SyntaxError") ||
2282 CheckConstructor(isolate, js_obj,
"$TypeError") ||
2283 CheckConstructor(isolate, js_obj,
"$URIError");
2292 if (IsDeadCheck(isolate,
"v8::Value::IsBooleanObject()"))
return false;
2294 return obj->HasSpecificClassOf(isolate->
heap()->Boolean_symbol());
2299 if (IsDeadCheck(i::Isolate::Current(),
"v8::Value::IsRegExp()"))
return false;
2301 return obj->IsJSRegExp();
2308 if (obj->IsString()) {
2312 if (IsDeadCheck(isolate,
"v8::Value::ToString()")) {
2328 if (obj->IsString()) {
2332 if (IsDeadCheck(isolate,
"v8::Value::ToDetailString()")) {
2335 LOG_API(isolate,
"ToDetailString");
2348 if (obj->IsJSObject()) {
2352 if (IsDeadCheck(isolate,
"v8::Value::ToObject()")) {
2367 if (obj->IsBoolean()) {
2371 if (IsDeadCheck(isolate,
"v8::Value::ToBoolean()")) {
2374 LOG_API(isolate,
"ToBoolean");
2385 if (obj->IsNumber()) {
2389 if (IsDeadCheck(isolate,
"v8::Value::ToNumber()")) {
2409 if (IsDeadCheck(isolate,
"v8::Value::ToInteger()"))
return Local<Integer>();
2410 LOG_API(isolate,
"ToInteger");
2420 void External::CheckCast(
v8::Value* that) {
2421 if (IsDeadCheck(i::Isolate::Current(),
"v8::External::Cast()"))
return;
2423 ApiCheck(obj->IsForeign(),
2424 "v8::External::Cast()",
2425 "Could not convert to external");
2429 void v8::Object::CheckCast(Value* that) {
2430 if (IsDeadCheck(i::Isolate::Current(),
"v8::Object::Cast()"))
return;
2432 ApiCheck(obj->IsJSObject(),
2433 "v8::Object::Cast()",
2434 "Could not convert to object");
2438 void v8::Function::CheckCast(Value* that) {
2439 if (IsDeadCheck(i::Isolate::Current(),
"v8::Function::Cast()"))
return;
2441 ApiCheck(obj->IsJSFunction(),
2442 "v8::Function::Cast()",
2443 "Could not convert to function");
2447 void v8::String::CheckCast(
v8::Value* that) {
2448 if (IsDeadCheck(i::Isolate::Current(),
"v8::String::Cast()"))
return;
2450 ApiCheck(obj->IsString(),
2451 "v8::String::Cast()",
2452 "Could not convert to string");
2456 void v8::Number::CheckCast(
v8::Value* that) {
2457 if (IsDeadCheck(i::Isolate::Current(),
"v8::Number::Cast()"))
return;
2459 ApiCheck(obj->IsNumber(),
2460 "v8::Number::Cast()",
2461 "Could not convert to number");
2465 void v8::Integer::CheckCast(
v8::Value* that) {
2466 if (IsDeadCheck(i::Isolate::Current(),
"v8::Integer::Cast()"))
return;
2468 ApiCheck(obj->IsNumber(),
2469 "v8::Integer::Cast()",
2470 "Could not convert to number");
2474 void v8::Array::CheckCast(Value* that) {
2475 if (IsDeadCheck(i::Isolate::Current(),
"v8::Array::Cast()"))
return;
2477 ApiCheck(obj->IsJSArray(),
2478 "v8::Array::Cast()",
2479 "Could not convert to array");
2483 void v8::Date::CheckCast(
v8::Value* that) {
2485 if (IsDeadCheck(isolate,
"v8::Date::Cast()"))
return;
2487 ApiCheck(obj->HasSpecificClassOf(isolate->
heap()->Date_symbol()),
2489 "Could not convert to date");
2493 void v8::StringObject::CheckCast(
v8::Value* that) {
2495 if (IsDeadCheck(isolate,
"v8::StringObject::Cast()"))
return;
2497 ApiCheck(obj->HasSpecificClassOf(isolate->
heap()->String_symbol()),
2498 "v8::StringObject::Cast()",
2499 "Could not convert to StringObject");
2503 void v8::NumberObject::CheckCast(
v8::Value* that) {
2505 if (IsDeadCheck(isolate,
"v8::NumberObject::Cast()"))
return;
2507 ApiCheck(obj->HasSpecificClassOf(isolate->
heap()->Number_symbol()),
2508 "v8::NumberObject::Cast()",
2509 "Could not convert to NumberObject");
2513 void v8::BooleanObject::CheckCast(
v8::Value* that) {
2515 if (IsDeadCheck(isolate,
"v8::BooleanObject::Cast()"))
return;
2517 ApiCheck(obj->HasSpecificClassOf(isolate->
heap()->Boolean_symbol()),
2518 "v8::BooleanObject::Cast()",
2519 "Could not convert to BooleanObject");
2523 void v8::RegExp::CheckCast(
v8::Value* that) {
2524 if (IsDeadCheck(i::Isolate::Current(),
"v8::RegExp::Cast()"))
return;
2526 ApiCheck(obj->IsJSRegExp(),
2527 "v8::RegExp::Cast()",
2528 "Could not convert to regular expression");
2534 if (obj->IsBoolean()) {
2535 return obj->IsTrue();
2538 if (IsDeadCheck(isolate,
"v8::Value::BooleanValue()"))
return false;
2539 LOG_API(isolate,
"BooleanValue");
2542 return value->IsTrue();
2550 if (obj->IsNumber()) {
2554 if (IsDeadCheck(isolate,
"v8::Value::NumberValue()")) {
2557 LOG_API(isolate,
"NumberValue");
2563 return num->Number();
2570 if (obj->IsNumber()) {
2574 if (IsDeadCheck(isolate,
"v8::Value::IntegerValue()"))
return 0;
2575 LOG_API(isolate,
"IntegerValue");
2584 return static_cast<int64_t
>(num->Number());
2596 if (IsDeadCheck(isolate,
"v8::Value::ToInt32()"))
return Local<Int32>();
2614 if (IsDeadCheck(isolate,
"v8::Value::ToUint32()"))
return Local<Uint32>();
2632 if (IsDeadCheck(isolate,
"v8::Value::ToArrayIndex()"))
return Local<Uint32>();
2633 LOG_API(isolate,
"ToArrayIndex");
2641 if (str->AsArrayIndex(&index)) {
2660 if (IsDeadCheck(isolate,
"v8::Value::Int32Value()"))
return 0;
2661 LOG_API(isolate,
"Int32Value (slow)");
2670 return static_cast<int32_t>(num->Number());
2678 if (IsDeadCheck(isolate,
"v8::Value::Equals()")
2679 || EmptyCheck(
"v8::Value::Equals()",
this)
2680 || EmptyCheck(
"v8::Value::Equals()", that)) {
2690 if (obj->IsJSObject() && other->IsJSObject()) {
2691 return *obj == *other;
2696 CallV8HeapFunction(
"EQUALS", obj,
ARRAY_SIZE(args), args,
2697 &has_pending_exception);
2705 if (IsDeadCheck(isolate,
"v8::Value::StrictEquals()")
2706 || EmptyCheck(
"v8::Value::StrictEquals()",
this)
2707 || EmptyCheck(
"v8::Value::StrictEquals()", that)) {
2710 LOG_API(isolate,
"StrictEquals");
2714 if (obj->IsHeapNumber()) {
2715 if (!other->IsNumber())
return false;
2716 double x = obj->Number();
2717 double y = other->Number();
2720 }
else if (*obj == *other) {
2722 }
else if (obj->IsSmi()) {
2723 return other->IsNumber() && obj->Number() == other->Number();
2724 }
else if (obj->IsString()) {
2725 return other->IsString() &&
2727 }
else if (obj->IsUndefined() || obj->IsUndetectableObject()) {
2728 return other->IsUndefined() || other->IsUndetectableObject();
2741 if (IsDeadCheck(isolate,
"v8::Value::Uint32Value()"))
return 0;
2742 LOG_API(isolate,
"Uint32Value");
2751 return static_cast<uint32_t
>(num->Number());
2760 ON_BAILOUT(isolate,
"v8::Object::Set()",
return false);
2771 static_cast<PropertyAttributes>(attribs),
2773 has_pending_exception = obj.
is_null();
2781 ON_BAILOUT(isolate,
"v8::Object::Set()",
return false);
2793 has_pending_exception = obj.
is_null();
2803 ON_BAILOUT(isolate,
"v8::Object::ForceSet()",
return false);
2814 static_cast<PropertyAttributes>(attribs));
2815 has_pending_exception = obj.
is_null();
2823 ON_BAILOUT(isolate,
"v8::Object::ForceDelete()",
return false);
2833 if (self->IsJSGlobalProxy() ||
self->IsGlobalObject()) {
2839 has_pending_exception = obj.
is_null();
2841 return obj->IsTrue();
2853 has_pending_exception = result.
is_null();
2866 has_pending_exception = result.
is_null();
2874 ON_BAILOUT(isolate,
"v8::Object::GetPropertyAttribute()",
2875 return static_cast<PropertyAttribute>(
NONE));
2880 if (!key_obj->IsString()) {
2894 ON_BAILOUT(isolate,
"v8::Object::GetPrototype()",
2905 ON_BAILOUT(isolate,
"v8::Object::SetPrototype()",
return false);
2914 has_pending_exception = result.
is_null();
2924 "v8::Object::FindInstanceInPrototypeChain()",
2940 ON_BAILOUT(isolate,
"v8::Object::GetPropertyNames()",
2961 ON_BAILOUT(isolate,
"v8::Object::GetOwnPropertyNames()",
2982 ON_BAILOUT(isolate,
"v8::Object::ObjectProtoToString()",
2994 if (!name->IsString()) {
3003 const char* prefix =
"[object ";
3005 const char* postfix =
"]";
3008 int str_len = str->Length();
3011 int buf_len = prefix_len + str_len + postfix_len;
3015 char* ptr = buf.
start();
3020 str->WriteAscii(ptr, 0, str_len);
3024 memcpy(ptr, postfix, postfix_len * v8::internal::kCharSize);
3036 ON_BAILOUT(isolate,
"v8::Object::GetConstructorName()",
3047 ON_BAILOUT(isolate,
"v8::Object::Delete()",
return false);
3058 ON_BAILOUT(isolate,
"v8::Object::Has()",
return false);
3062 return self->HasProperty(*key_obj);
3068 ON_BAILOUT(isolate,
"v8::Object::DeleteProperty()",
3079 ON_BAILOUT(isolate,
"v8::Object::HasProperty()",
return false);
3081 return self->HasElement(index);
3092 ON_BAILOUT(isolate,
"v8::Object::SetAccessor()",
return false);
3097 settings, attributes,
3101 if (result.
is_null() || result->IsUndefined())
return false;
3109 ON_BAILOUT(isolate,
"v8::Object::HasOwnProperty()",
3118 ON_BAILOUT(isolate,
"v8::Object::HasRealNamedProperty()",
3127 "v8::Object::HasRealIndexedProperty()",
3136 "v8::Object::HasRealNamedCallbackProperty()",
3146 ON_BAILOUT(isolate,
"v8::Object::HasNamedLookupInterceptor()",
3154 ON_BAILOUT(isolate,
"v8::Object::HasIndexedLookupInterceptor()",
3163 i::LookupResult* lookup) {
3164 if (!lookup->IsProperty()) {
3176 has_pending_exception = result.
is_null();
3187 "v8::Object::GetRealNamedPropertyInPrototypeChain()",
3192 i::LookupResult lookup(isolate);
3193 self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup);
3194 return GetPropertyByLookup(isolate, self_obj, key_obj, &lookup);
3200 ON_BAILOUT(isolate,
"v8::Object::GetRealNamedProperty()",
3205 i::LookupResult lookup(isolate);
3206 self_obj->LookupRealNamedProperty(*key_obj, &lookup);
3207 return GetPropertyByLookup(isolate, self_obj, key_obj, &lookup);
3216 ON_BAILOUT(isolate,
"v8::Object::TurnOnAccessCheck()",
return);
3227 new_map->set_is_access_check_needed(
true);
3228 obj->set_map(*new_map);
3244 has_pending_exception = result.
is_null();
3251 i::Object* constructor =
object->map()->constructor();
3253 if (!constructor->IsJSFunction()) {
3256 ASSERT(object->IsJSFunction());
3261 return function->context()->global_context();
3271 i::Context* context = GetCreationContext(*
self);
3278 ON_BAILOUT(isolate,
"v8::Object::GetIdentityHash()",
return 0);
3289 ON_BAILOUT(isolate,
"v8::Object::SetHiddenValue()",
return false);
3297 return *result == *
self;
3303 ON_BAILOUT(isolate,
"v8::Object::GetHiddenValue()",
3316 ON_BAILOUT(isolate,
"v8::DeleteHiddenValue()",
return false);
3321 self->DeleteHiddenProperty(*key_obj);
3330 switch (array_type) {
3375 GetElementsKindFromExternalArrayType(array_type));
3377 object->set_map(*external_array_map);
3378 object->set_elements(*array);
3386 ON_BAILOUT(isolate,
"v8::SetElementsToPixelData()",
return);
3390 "v8::Object::SetIndexedPropertiesToPixelData()",
3391 "length exceeds max acceptable value")) {
3395 if (!ApiCheck(!self->IsJSArray(),
3396 "v8::Object::SetIndexedPropertiesToPixelData()",
3397 "JSArray is not supported")) {
3406 ON_BAILOUT(self->GetIsolate(),
"v8::HasIndexedPropertiesInPixelData()",
3408 return self->HasExternalPixelElements();
3414 ON_BAILOUT(self->GetIsolate(),
"v8::GetIndexedPropertiesPixelData()",
3416 if (self->HasExternalPixelElements()) {
3418 external_pixel_pointer();
3427 ON_BAILOUT(self->GetIsolate(),
"v8::GetIndexedPropertiesPixelDataLength()",
3429 if (self->HasExternalPixelElements()) {
3442 ON_BAILOUT(isolate,
"v8::SetIndexedPropertiesToExternalArrayData()",
return);
3446 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3447 "length exceeds max acceptable value")) {
3451 if (!ApiCheck(!self->IsJSArray(),
3452 "v8::Object::SetIndexedPropertiesToExternalArrayData()",
3453 "JSArray is not supported")) {
3456 PrepareExternalArrayElements(
self, data, array_type, length);
3463 "v8::HasIndexedPropertiesInExternalArrayData()",
3465 return self->HasExternalArrayElements();
3472 "v8::GetIndexedPropertiesExternalArrayData()",
3474 if (self->HasExternalArrayElements()) {
3485 "v8::GetIndexedPropertiesExternalArrayDataType()",
3487 switch (self->elements()->map()->instance_type()) {
3515 "v8::GetIndexedPropertiesExternalArrayDataLength()",
3517 if (self->HasExternalArrayElements()) {
3527 ON_BAILOUT(isolate,
"v8::Object::IsCallable()",
return false);
3531 if (obj->IsJSFunction())
return true;
3540 ON_BAILOUT(isolate,
"v8::Object::CallAsFunction()",
3542 LOG_API(isolate,
"Object::CallAsFunction");
3550 if (obj->IsJSFunction()) {
3571 ON_BAILOUT(isolate,
"v8::Object::CallAsConstructor()",
3573 LOG_API(isolate,
"Object::CallAsConstructor");
3579 if (obj->IsJSFunction()) {
3592 if (!delegate->IsUndefined()) {
3598 ASSERT(!delegate->IsUndefined());
3613 ON_BAILOUT(isolate,
"v8::Function::NewInstance()",
3615 LOG_API(isolate,
"Function::NewInstance");
3633 LOG_API(isolate,
"Function::Call");
3646 raw_result = *returned;
3676 if (func->shared()->script()->IsScript()) {
3693 if (func->shared()->script()->IsScript()) {
3703 if (func->shared()->script()->IsScript()) {
3712 if (!func->shared()->script()->IsScript())
3720 if (IsDeadCheck(str->GetIsolate(),
"v8::String::Length()"))
return 0;
3721 return str->length();
3727 if (IsDeadCheck(str->GetIsolate(),
"v8::String::Utf8Length()"))
return 0;
3733 static int RecursivelySerializeToUtf8(
i::String*
string,
3737 int recursion_budget,
3745 return utf8_bytes + end - start;
3747 switch (i::StringShape(
string).representation_tag()) {
3750 ExternalTwoByteStringGetData(0);
3751 char* current = buffer;
3752 for (
int i = start; i < end; i++) {
3756 previous_character = character;
3758 *last_character = previous_character;
3759 return static_cast<int>(utf8_bytes + current - buffer);
3764 char* current = buffer;
3765 for (
int i = start; i < end; i++) {
3769 previous_character = character;
3771 *last_character = previous_character;
3772 return static_cast<int>(utf8_bytes + current - buffer);
3776 unsigned offset = slice->
offset();
3777 string = slice->
parent();
3785 int boundary = first->
length();
3786 if (start >= boundary) {
3788 string = cons_string->
second();
3792 }
else if (end <= boundary) {
3796 if (recursion_budget == 0)
return -1;
3797 int extra_utf8_bytes =
3798 RecursivelySerializeToUtf8(first,
3802 recursion_budget - 1,
3804 &previous_character);
3805 if (extra_utf8_bytes < 0)
return extra_utf8_bytes;
3806 buffer += extra_utf8_bytes;
3807 utf8_bytes += extra_utf8_bytes;
3808 string = cons_string->
second();
3822 if (IsDeadCheck(str->GetIsolate(),
"v8::String::MayContainNonAscii()")) {
3825 return !str->HasOnlyAsciiChars();
3832 int options)
const {
3834 if (IsDeadCheck(isolate,
"v8::String::WriteUtf8()"))
return 0;
3835 LOG_API(isolate,
"String::WriteUtf8");
3838 int string_length = str->length();
3839 if (str->IsAsciiRepresentation()) {
3841 if (capacity == -1) {
3842 capacity = str->length() + 1;
3843 len = string_length;
3845 len = i::Min(capacity, str->length());
3848 if (nchars_ref !=
NULL) *nchars_ref = len;
3856 if (capacity == -1 || capacity / 3 >= string_length) {
3858 const int kMaxRecursion = 100;
3860 RecursivelySerializeToUtf8(*str,
3867 if (utf8_bytes >= 0) {
3870 (capacity > utf8_bytes || capacity == -1)) {
3871 buffer[utf8_bytes++] =
'\0';
3873 if (nchars_ref !=
NULL) *nchars_ref = string_length;
3879 return WriteUtf8(buffer, capacity, nchars_ref, options);
3880 }
else if (capacity >= string_length) {
3886 if (utf8_bytes <= capacity) {
3887 return WriteUtf8(buffer, -1, nchars_ref, options);
3899 write_input_buffer.
Reset(0, *str);
3900 int len = str->length();
3909 for (i = 0; i < len && (capacity == -1 || pos < fast_end); i++) {
3921 for (; i < len && pos < capacity; i++) {
3939 if (pos + written <= capacity) {
3940 for (
int j = 0; j < written; j++)
3941 buffer[pos + j] = intermediate[j];
3952 if (nchars_ref !=
NULL) *nchars_ref = nchars;
3954 (i == len && (capacity == -1 || pos < capacity)))
3955 buffer[pos++] =
'\0';
3963 int options)
const {
3965 if (IsDeadCheck(isolate,
"v8::String::WriteAscii()"))
return 0;
3966 LOG_API(isolate,
"String::WriteAscii");
3969 ASSERT(start >= 0 && length >= -1);
3978 if ( (length == -1) || (length > str->length() - start) )
3979 end = str->length() - start;
3980 if (end < 0)
return 0;
3981 write_input_buffer.
Reset(start, *str);
3983 for (i = 0; i < end; i++) {
3984 char c =
static_cast<char>(write_input_buffer.
GetNext());
3985 if (c ==
'\0') c =
' ';
3997 int options)
const {
3999 if (IsDeadCheck(isolate,
"v8::String::Write()"))
return 0;
4000 LOG_API(isolate,
"String::Write");
4002 ASSERT(start >= 0 && length >= -1);
4010 int end = start + length;
4011 if ((length == -1) || (length > str->length() - start) )
4012 end = str->length();
4013 if (end < 0)
return 0;
4016 (length == -1 || end - start < length)) {
4017 buffer[end - start] =
'\0';
4025 if (IsDeadCheck(str->GetIsolate(),
"v8::String::IsExternal()")) {
4028 EnsureInitializedForIsolate(str->GetIsolate(),
"v8::String::IsExternal()");
4029 return i::StringShape(*str).IsExternalTwoByte();
4035 if (IsDeadCheck(str->GetIsolate(),
"v8::String::IsExternalAscii()")) {
4038 return i::StringShape(*str).IsExternalAscii();
4042 void v8::String::VerifyExternalStringResource(
4046 if (i::StringShape(*str).IsExternalTwoByte()) {
4047 const void* resource =
4049 expected =
reinterpret_cast<const ExternalStringResource*
>(resource);
4060 if (IsDeadCheck(str->GetIsolate(),
4061 "v8::String::GetExternalAsciiStringResource()")) {
4064 if (i::StringShape(*str).IsExternalAscii()) {
4065 const void* resource =
4075 if (IsDeadCheck(i::Isolate::Current(),
"v8::Number::Value()"))
return 0;
4077 return obj->Number();
4082 if (IsDeadCheck(i::Isolate::Current(),
"v8::Boolean::Value()"))
return false;
4084 return obj->IsTrue();
4089 if (IsDeadCheck(i::Isolate::Current(),
"v8::Integer::Value()"))
return 0;
4094 return static_cast<int64_t
>(obj->Number());
4100 if (IsDeadCheck(i::Isolate::Current(),
"v8::Int32::Value()"))
return 0;
4105 return static_cast<int32_t>(obj->Number());
4111 if (IsDeadCheck(i::Isolate::Current(),
"v8::Uint32::Value()"))
return 0;
4116 return static_cast<uint32_t
>(obj->Number());
4123 if (IsDeadCheck(obj->GetIsolate(),
"v8::Object::InternalFieldCount()")) {
4126 return obj->GetInternalFieldCount();
4130 Local<Value> v8::Object::CheckedGetInternalField(
int index) {
4132 if (IsDeadCheck(obj->GetIsolate(),
"v8::Object::GetInternalField()")) {
4135 if (!ApiCheck(index < obj->GetInternalFieldCount(),
4136 "v8::Object::GetInternalField()",
4137 "Reading internal field out of bounds")) {
4138 return Local<Value>();
4143 Local<Value> unchecked = UncheckedGetInternalField(index);
4144 ASSERT(unchecked.IsEmpty() || (unchecked == result));
4153 if (IsDeadCheck(isolate,
"v8::Object::SetInternalField()")) {
4156 if (!ApiCheck(index < obj->GetInternalFieldCount(),
4157 "v8::Object::SetInternalField()",
4158 "Writing internal field out of bounds")) {
4163 obj->SetInternalField(index, *val);
4167 static bool CanBeEncodedAsSmi(
void* ptr) {
4168 const uintptr_t address =
reinterpret_cast<uintptr_t
>(ptr);
4173 static i::Smi* EncodeAsSmi(
void* ptr) {
4174 ASSERT(CanBeEncodedAsSmi(ptr));
4175 const uintptr_t address =
reinterpret_cast<uintptr_t
>(ptr);
4187 if (CanBeEncodedAsSmi(value)) {
4193 reinterpret_cast<i::Address>(value),
i::TENURED);
4197 ASSERT_EQ(value, GetPointerFromInternalField(index));
4205 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
4209 return InitializeHelper();
4227 "v8::V8::Dispose()",
4228 "Use v8::Isolate::Dispose() for a non-default isolate.")) {
4237 total_heap_size_executable_(0),
4239 heap_size_limit_(0) { }
4243 if (!i::Isolate::Current()->IsInitialized()) {
4245 heap_statistics->set_total_heap_size(0);
4246 heap_statistics->set_total_heap_size_executable(0);
4247 heap_statistics->set_used_heap_size(0);
4248 heap_statistics->set_heap_size_limit(0);
4252 i::Heap* heap = i::Isolate::Current()->heap();
4254 heap_statistics->set_total_heap_size_executable(
4257 heap_statistics->set_heap_size_limit(heap->
MaxReserved());
4263 IsDeadCheck(isolate,
"v8::V8::VisitExternalResources");
4298 if (templ->constructor()->IsUndefined()) {
4314 EnsureInitializedForIsolate(isolate,
"v8::Context::New()");
4315 LOG_API(isolate,
"Context::New");
4326 if (!global_template.
IsEmpty()) {
4328 global_constructor =
4338 proxy_constructor->set_prototype_template(
4344 if (!global_constructor->access_check_info()->IsUndefined()) {
4345 proxy_constructor->set_access_check_info(
4346 global_constructor->access_check_info());
4347 proxy_constructor->set_needs_access_check(
4348 global_constructor->needs_access_check());
4349 global_constructor->set_needs_access_check(
false);
4350 global_constructor->set_access_check_info(
4351 isolate->
heap()->undefined_value());
4363 if (!global_template.
IsEmpty()) {
4366 global_constructor->set_access_check_info(
4367 proxy_constructor->access_check_info());
4368 global_constructor->set_needs_access_check(
4369 proxy_constructor->needs_access_check());
4384 if (IsDeadCheck(isolate,
"v8::Context::SetSecurityToken()")) {
4390 env->set_security_token(*token_handle);
4396 if (IsDeadCheck(isolate,
4397 "v8::Context::UseDefaultSecurityToken()")) {
4402 env->set_security_token(env->global());
4408 if (IsDeadCheck(isolate,
"v8::Context::GetSecurityToken()")) {
4412 i::Object* security_token = env->security_token();
4420 return env->has_out_of_memory();
4425 return i::Isolate::Current()->context() !=
NULL;
4431 if (!EnsureInitializedForIsolate(isolate,
"v8::Context::GetEntered()")) {
4444 if (IsDeadCheck(isolate,
"v8::Context::GetCurrent()")) {
4456 if (IsDeadCheck(isolate,
"v8::Context::GetCalling()")) {
4468 if (IsDeadCheck(i::Isolate::Current(),
"v8::Context::Global()")) {
4481 if (IsDeadCheck(isolate,
"v8::Context::DetachGlobal()"))
return;
4492 if (IsDeadCheck(isolate,
"v8::Context::ReattachGlobal()"))
return;
4505 if (IsDeadCheck(isolate,
"v8::Context::AllowCodeGenerationFromStrings()")) {
4512 context->set_allow_code_gen_from_strings(
4513 allow ? isolate->
heap()->true_value() : isolate->
heap()->false_value());
4519 if (IsDeadCheck(isolate,
4520 "v8::Context::IsCodeGenerationFromStringsAllowed()")) {
4527 return !context->allow_code_gen_from_strings()->IsFalse();
4538 ON_BAILOUT(isolate,
"v8::ObjectTemplate::NewInstance()",
4540 LOG_API(isolate,
"ObjectTemplate::NewInstance");
4545 &has_pending_exception);
4553 ON_BAILOUT(isolate,
"v8::FunctionTemplate::GetFunction()",
4555 LOG_API(isolate,
"FunctionTemplate::GetFunction");
4560 &has_pending_exception);
4567 ON_BAILOUT(i::Isolate::Current(),
"v8::FunctionTemplate::HasInstanceOf()",
4586 EnsureInitializedForIsolate(isolate,
"v8::External::Wrap()");
4587 LOG_API(isolate,
"External::Wrap");
4599 void* v8::Object::SlowGetPointerFromInternalField(
int index) {
4601 i::Object* value = obj->GetInternalField(index);
4602 if (value->IsSmi()) {
4604 }
else if (value->IsForeign()) {
4613 if (IsDeadCheck(i::Isolate::Current(),
"v8::External::Unwrap()"))
return 0;
4618 }
else if (obj->IsForeign()) {
4619 result = ExternalValueImpl(obj);
4623 ASSERT_EQ(result, QuickUnwrap(wrapper));
4631 EnsureInitializedForIsolate(isolate,
"v8::External::New()");
4632 LOG_API(isolate,
"External::New");
4634 return ExternalNewImpl(data);
4639 if (IsDeadCheck(i::Isolate::Current(),
"v8::External::Value()"))
return 0;
4641 return ExternalValueImpl(obj);
4647 if (!EnsureInitializedForIsolate(isolate,
"v8::String::Empty()")) {
4650 LOG_API(isolate,
"String::Empty()");
4657 EnsureInitializedForIsolate(isolate,
"v8::String::New()");
4658 LOG_API(isolate,
"String::New(char)");
4659 if (length == 0)
return Empty();
4671 i::Isolate* isolate = left_string->GetIsolate();
4672 EnsureInitializedForIsolate(isolate,
"v8::String::New()");
4673 LOG_API(isolate,
"String::New(char)");
4684 EnsureInitializedForIsolate(isolate,
"v8::String::NewUndetectable()");
4685 LOG_API(isolate,
"String::NewUndetectable(char)");
4691 result->MarkAsUndetectable();
4696 static int TwoByteStringLength(
const uint16_t* data) {
4698 while (data[length] !=
'\0') length++;
4705 EnsureInitializedForIsolate(isolate,
"v8::String::New()");
4706 LOG_API(isolate,
"String::New(uint16_)");
4707 if (length == 0)
return Empty();
4709 if (length == -1) length = TwoByteStringLength(data);
4719 EnsureInitializedForIsolate(isolate,
"v8::String::NewUndetectable()");
4720 LOG_API(isolate,
"String::NewUndetectable(uint16_)");
4722 if (length == -1) length = TwoByteStringLength(data);
4726 result->MarkAsUndetectable();
4750 EnsureInitializedForIsolate(isolate,
"v8::String::NewExternal()");
4751 LOG_API(isolate,
"String::NewExternal");
4762 if (IsDeadCheck(isolate,
"v8::String::MakeExternal()"))
return false;
4763 if (i::StringShape(*obj).IsExternalTwoByte()) {
4773 bool result = obj->MakeExternal(resource);
4774 if (result && !obj->IsSymbol()) {
4784 EnsureInitializedForIsolate(isolate,
"v8::String::NewExternal()");
4785 LOG_API(isolate,
"String::NewExternal");
4797 if (IsDeadCheck(isolate,
"v8::String::MakeExternal()"))
return false;
4798 if (i::StringShape(*obj).IsExternalTwoByte()) {
4808 bool result = obj->MakeExternal(resource);
4809 if (result && !obj->IsSymbol()) {
4817 if (!internal::FLAG_clever_optimizations)
return false;
4820 if (IsDeadCheck(isolate,
"v8::String::CanMakeExternal()"))
return false;
4822 int size = obj->Size();
4824 i::StringShape shape(*obj);
4825 return !shape.IsExternal();
4831 EnsureInitializedForIsolate(isolate,
"v8::Object::New()");
4832 LOG_API(isolate,
"Object::New");
4842 EnsureInitializedForIsolate(isolate,
"v8::NumberObject::New()");
4843 LOG_API(isolate,
"NumberObject::New");
4853 if (IsDeadCheck(isolate,
"v8::NumberObject::NumberValue()"))
return 0;
4854 LOG_API(isolate,
"NumberObject::NumberValue");
4857 return jsvalue->value()->Number();
4863 EnsureInitializedForIsolate(isolate,
"v8::BooleanObject::New()");
4864 LOG_API(isolate,
"BooleanObject::New");
4867 : isolate->
heap()->false_value());
4875 if (IsDeadCheck(isolate,
"v8::BooleanObject::BooleanValue()"))
return 0;
4876 LOG_API(isolate,
"BooleanObject::BooleanValue");
4879 return jsvalue->value()->IsTrue();
4885 EnsureInitializedForIsolate(isolate,
"v8::StringObject::New()");
4886 LOG_API(isolate,
"StringObject::New");
4896 if (IsDeadCheck(isolate,
"v8::StringObject::StringValue()")) {
4899 LOG_API(isolate,
"StringObject::StringValue");
4909 EnsureInitializedForIsolate(isolate,
"v8::Date::New()");
4910 LOG_API(isolate,
"Date::New");
4926 if (IsDeadCheck(isolate,
"v8::Date::NumberValue()"))
return 0;
4927 LOG_API(isolate,
"Date::NumberValue");
4930 return jsdate->value()->Number();
4936 ON_BAILOUT(isolate,
"v8::Date::DateTimeConfigurationChangeNotification()",
4938 LOG_API(isolate,
"Date::DateTimeConfigurationChangeNotification");
4947 i::MaybeObject* result =
4950 if (!result->ToObject(&object_func)) {
4954 if (object_func->IsJSFunction()) {
4959 bool caught_exception =
false;
4984 EnsureInitializedForIsolate(isolate,
"v8::RegExp::New()");
4985 LOG_API(isolate,
"RegExp::New");
4990 RegExpFlagsToString(flags),
4991 &has_pending_exception);
4999 if (IsDeadCheck(isolate,
"v8::RegExp::GetSource()")) {
5008 #define REGEXP_FLAG_ASSERT_EQ(api_flag, internal_flag) \
5009 STATIC_ASSERT(static_cast<int>(v8::RegExp::api_flag) == \
5010 static_cast<int>(i::JSRegExp::internal_flag))
5015 #undef REGEXP_FLAG_ASSERT_EQ
5018 if (IsDeadCheck(i::Isolate::Current(),
"v8::RegExp::GetFlags()")) {
5028 EnsureInitializedForIsolate(isolate,
"v8::Array::New()");
5029 LOG_API(isolate,
"Array::New");
5031 int real_length = length > 0 ? length : 0;
5035 obj->set_length(*length_obj);
5042 if (IsDeadCheck(isolate,
"v8::Array::Length()"))
return 0;
5045 if (length->IsSmi()) {
5048 return static_cast<uint32_t
>(length->
Number());
5057 if (!self->HasFastObjectElements()) {
5062 if (!paragon->IsJSObject()) {
5069 has_pending_exception = result.
is_null();
5077 EnsureInitializedForIsolate(isolate,
"v8::String::NewSymbol()");
5078 LOG_API(isolate,
"String::NewSymbol(char)");
5089 EnsureInitializedForIsolate(isolate,
"v8::Number::New()");
5101 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5102 EnsureInitializedForIsolate(isolate,
"v8::Integer::New()");
5114 bool fits_into_int32_t = (value & (1 << 31)) == 0;
5115 if (fits_into_int32_t) {
5132 EnsureInitializedForIsolate(isolate,
"v8::V8::AddMessageListener()");
5133 ON_BAILOUT(isolate,
"v8::V8::AddMessageListener()",
return false);
5140 isolate->
heap()->undefined_value() :
5142 listeners.add(obj.value());
5149 EnsureInitializedForIsolate(isolate,
"v8::V8::RemoveMessageListener()");
5150 ON_BAILOUT(isolate,
"v8::V8::RemoveMessageListeners()",
return);
5154 for (
int i = 0; i < listeners.length(); i++) {
5155 if (listeners.get(i)->IsUndefined())
continue;
5159 if (callback_obj->foreign_address() ==
FUNCTION_ADDR(that)) {
5160 listeners.set(i, isolate->
heap()->undefined_value());
5170 i::Isolate::Current()->SetCaptureStackTraceForUncaughtExceptions(
5178 i::Isolate* isolate = EnterIsolateIfNeeded();
5179 if (IsDeadCheck(isolate,
"v8::V8::SetCounterFunction()"))
return;
5184 i::Isolate* isolate = EnterIsolateIfNeeded();
5185 if (IsDeadCheck(isolate,
"v8::V8::SetCreateHistogramFunction()"))
return;
5190 i::Isolate* isolate = EnterIsolateIfNeeded();
5191 if (IsDeadCheck(isolate,
"v8::V8::SetAddHistogramSampleFunction()"))
return;
5198 if (IsDeadCheck(isolate,
"v8::V8::EnableSlidingStateWindow()"))
return;
5206 if (IsDeadCheck(isolate,
"v8::V8::SetFailedAccessCheckCallbackFunction()")) {
5216 if (IsDeadCheck(isolate,
"v8::V8::AddObjectGroup()"))
return;
5219 reinterpret_cast<i::Object***>(objects), length, info);
5227 if (IsDeadCheck(isolate,
"v8::V8::AddImplicitReferences()"))
return;
5231 reinterpret_cast<i::Object***>(children), length);
5237 if (IsDeadCheck(isolate,
"v8::V8::AdjustAmountOfExternalAllocatedMemory()")) {
5247 if (IsDeadCheck(isolate,
"v8::V8::SetGlobalGCPrologueCallback()"))
return;
5254 if (IsDeadCheck(isolate,
"v8::V8::SetGlobalGCEpilogueCallback()"))
return;
5261 if (IsDeadCheck(isolate,
"v8::V8::AddGCPrologueCallback()"))
return;
5268 if (IsDeadCheck(isolate,
"v8::V8::RemoveGCPrologueCallback()"))
return;
5275 if (IsDeadCheck(isolate,
"v8::V8::AddGCEpilogueCallback()"))
return;
5282 if (IsDeadCheck(isolate,
"v8::V8::RemoveGCEpilogueCallback()"))
return;
5291 if (IsDeadCheck(isolate,
"v8::V8::AddMemoryAllocationCallback()"))
return;
5293 callback, space, action);
5299 if (IsDeadCheck(isolate,
"v8::V8::RemoveMemoryAllocationCallback()"))
return;
5306 if (callback ==
NULL)
return;
5309 if (IsDeadCheck(isolate,
"v8::V8::AddLeaveScriptCallback()"))
return;
5317 if (IsDeadCheck(isolate,
"v8::V8::RemoveLeaveScriptCallback()"))
return;
5342 EnsureInitializedForIsolate(isolate,
"V8::GetCurrentThreadId()");
5355 if (isolate->
thread_id().Equals(internal_tid)) {
5365 if (isolate !=
NULL) {
5375 reinterpret_cast<i::Isolate*
>(isolate) : i::Isolate::Current();
5376 return IsExecutionTerminatingCheck(i_isolate);
5381 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5382 return reinterpret_cast<Isolate*
>(isolate);
5388 return reinterpret_cast<Isolate*
>(isolate);
5394 if (!ApiCheck(!isolate->
IsInUse(),
5395 "v8::Isolate::Dispose()",
5396 "Disposing the isolate that is entered by a thread.")) {
5416 : str_(
NULL), length_(0) {
5418 if (IsDeadCheck(isolate,
"v8::String::Utf8Value::Utf8Value()"))
return;
5427 str_ = i::NewArray<char>(length_ + 1);
5438 : str_(
NULL), length_(0) {
5440 if (IsDeadCheck(isolate,
"v8::String::AsciiValue::AsciiValue()"))
return;
5448 str_ = i::NewArray<char>(length_ + 1);
5459 : str_(
NULL), length_(0) {
5461 if (IsDeadCheck(isolate,
"v8::String::Value::Value()"))
return;
5469 str_ = i::NewArray<uint16_t>(length_ + 1);
5480 LOG_API(isolate,
"RangeError");
5496 LOG_API(isolate,
"ReferenceError");
5513 LOG_API(isolate,
"SyntaxError");
5529 LOG_API(isolate,
"TypeError");
5562 #ifdef ENABLE_DEBUGGER_SUPPORT
5566 if (isolate->debug_event_callback() !=
NULL) {
5567 isolate->debug_event_callback()(event_details.
GetEvent(),
5577 EnsureInitializedForIsolate(isolate,
"v8::Debug::SetDebugEventListener()");
5578 ON_BAILOUT(isolate,
"v8::Debug::SetDebugEventListener()",
return false);
5581 isolate->set_debug_event_callback(that);
5596 EnsureInitializedForIsolate(isolate,
"v8::Debug::SetDebugEventListener2()");
5597 ON_BAILOUT(isolate,
"v8::Debug::SetDebugEventListener2()",
return false);
5610 Handle<Value> data) {
5612 ON_BAILOUT(isolate,
"v8::Debug::SetDebugEventListener()",
return false);
5622 if (isolate !=
NULL) {
5623 reinterpret_cast<i::Isolate*
>(isolate)->stack_guard()->DebugBreak();
5632 if (isolate !=
NULL) {
5643 if (isolate !=
NULL) {
5645 internal_isolate->debugger()->EnqueueDebugCommand(data);
5647 i::Isolate::GetDefaultIsolateDebugger()->EnqueueDebugCommand(data);
5654 if (isolate->message_handler()) {
5656 (isolate->message_handler())(*json, json.length(), message.
GetClientData());
5662 bool message_handler_thread) {
5664 EnsureInitializedForIsolate(isolate,
"v8::Debug::SetMessageHandler");
5669 CHECK(!message_handler_thread);
5672 isolate->set_message_handler(handler);
5673 if (handler !=
NULL) {
5674 isolate->debugger()->SetMessageHandler(MessageHandlerWrapper);
5676 isolate->debugger()->SetMessageHandler(
NULL);
5683 EnsureInitializedForIsolate(isolate,
"v8::Debug::SetMessageHandler");
5685 isolate->debugger()->SetMessageHandler(handler);
5690 ClientData* client_data,
5693 if (isolate !=
NULL) {
5695 internal_isolate->debugger()->ProcessCommand(
5698 i::Isolate::GetDefaultIsolateDebugger()->ProcessCommand(
5707 EnsureInitializedForIsolate(isolate,
"v8::Debug::SetHostDispatchHandler");
5709 isolate->debugger()->SetHostDispatchHandler(handler, period);
5714 DebugMessageDispatchHandler handler,
bool provide_locker) {
5716 EnsureInitializedForIsolate(isolate,
5717 "v8::Debug::SetDebugMessageDispatchHandler");
5719 isolate->debugger()->SetDebugMessageDispatchHandler(
5720 handler, provide_locker);
5728 ON_BAILOUT(isolate,
"v8::Debug::Call()",
return Local<Value>());
5734 isolate->
factory()->undefined_value(),
5735 &has_pending_exception);
5739 &has_pending_exception);
5749 ON_BAILOUT(isolate,
"v8::Debug::GetMirror()",
return Local<Value>());
5752 i::Debug* isolate_debug = isolate->debug();
5753 isolate_debug->Load();
5760 const int kArgc = 1;
5767 return scope.
Close(result);
5772 return i::Isolate::Current()->debugger()->StartAgent(name, port,
5773 wait_for_connection);
5778 return i::Isolate::Current()->debugger()->StopAgent();
5783 i::Execution::ProcessDebugMessages(
true);
5788 EnsureInitializedForIsolate(isolate,
"v8::Debug::GetDebugContext()");
5790 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext());
5793 #endif // ENABLE_DEBUGGER_SUPPORT
5798 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetFunctionName");
5801 if (!entry->has_name_prefix()) {
5814 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetScriptResourceName");
5817 node->entry()->resource_name())));
5823 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetLineNumber");
5824 return reinterpret_cast<const i::ProfileNode*
>(
this)->entry()->line_number();
5830 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetTotalTime");
5831 return reinterpret_cast<const i::ProfileNode*
>(
this)->GetTotalMillis();
5837 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetSelfTime");
5838 return reinterpret_cast<const i::ProfileNode*
>(
this)->GetSelfMillis();
5844 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetTotalSamplesCount");
5845 return reinterpret_cast<const i::ProfileNode*
>(
this)->total_ticks();
5851 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetSelfSamplesCount");
5852 return reinterpret_cast<const i::ProfileNode*
>(
this)->self_ticks();
5858 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetCallUid");
5859 return reinterpret_cast<const i::ProfileNode*
>(
this)->entry()->GetCallUid();
5865 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetChildrenCount");
5866 return reinterpret_cast<const i::ProfileNode*
>(
this)->children()->length();
5872 IsDeadCheck(isolate,
"v8::CpuProfileNode::GetChild");
5874 reinterpret_cast<const i::ProfileNode*
>(
this)->children()->at(index);
5881 IsDeadCheck(isolate,
"v8::CpuProfile::Delete");
5893 IsDeadCheck(isolate,
"v8::CpuProfile::GetUid");
5900 IsDeadCheck(isolate,
"v8::CpuProfile::GetTitle");
5903 profile->title())));
5909 IsDeadCheck(isolate,
"v8::CpuProfile::GetBottomUpRoot");
5911 return reinterpret_cast<const CpuProfileNode*
>(profile->bottom_up()->root());
5917 IsDeadCheck(isolate,
"v8::CpuProfile::GetTopDownRoot");
5919 return reinterpret_cast<const CpuProfileNode*
>(profile->top_down()->root());
5925 IsDeadCheck(isolate,
"v8::CpuProfiler::GetProfilesCount");
5933 IsDeadCheck(isolate,
"v8::CpuProfiler::GetProfile");
5944 IsDeadCheck(isolate,
"v8::CpuProfiler::FindProfile");
5954 IsDeadCheck(isolate,
"v8::CpuProfiler::StartProfiling");
5962 IsDeadCheck(isolate,
"v8::CpuProfiler::StopProfiling");
5972 IsDeadCheck(isolate,
"v8::CpuProfiler::DeleteAllProfiles");
5977 static i::HeapGraphEdge* ToInternal(
const HeapGraphEdge* edge) {
5978 return const_cast<i::HeapGraphEdge*
>(
5979 reinterpret_cast<const i::HeapGraphEdge*
>(edge));
5985 IsDeadCheck(isolate,
"v8::HeapGraphEdge::GetType");
5992 IsDeadCheck(isolate,
"v8::HeapGraphEdge::GetName");
5993 i::HeapGraphEdge* edge = ToInternal(
this);
5994 switch (edge->type()) {
5995 case i::HeapGraphEdge::kContextVariable:
5996 case i::HeapGraphEdge::kInternal:
5997 case i::HeapGraphEdge::kProperty:
5998 case i::HeapGraphEdge::kShortcut:
6001 case i::HeapGraphEdge::kElement:
6002 case i::HeapGraphEdge::kHidden:
6013 IsDeadCheck(isolate,
"v8::HeapGraphEdge::GetFromNode");
6014 const i::HeapEntry* from = ToInternal(
this)->from();
6021 IsDeadCheck(isolate,
"v8::HeapGraphEdge::GetToNode");
6022 const i::HeapEntry* to = ToInternal(
this)->to();
6027 static i::HeapEntry* ToInternal(
const HeapGraphNode* entry) {
6028 return const_cast<i::HeapEntry*
>(
6029 reinterpret_cast<const i::HeapEntry*
>(entry));
6035 IsDeadCheck(isolate,
"v8::HeapGraphNode::GetType");
6042 IsDeadCheck(isolate,
"v8::HeapGraphNode::GetName");
6044 ToInternal(
this)->
name())));
6050 IsDeadCheck(isolate,
"v8::HeapGraphNode::GetId");
6051 return ToInternal(
this)->id();
6057 IsDeadCheck(isolate,
"v8::HeapGraphNode::GetSelfSize");
6058 return ToInternal(
this)->self_size();
6064 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetChildrenCount");
6065 return ToInternal(
this)->children().length();
6071 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetChild");
6073 ToInternal(
this)->children()[index]);
6079 IsDeadCheck(isolate,
"v8::HeapGraphNode::GetHeapValue");
6082 ToApi<Value>(object) : ToApi<Value>(
6083 isolate->
factory()->undefined_value()));
6095 IsDeadCheck(isolate,
"v8::HeapSnapshot::Delete");
6097 ToInternal(
this)->Delete();
6107 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetType");
6114 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetUid");
6115 return ToInternal(
this)->uid();
6121 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetTitle");
6123 ToInternal(
this)->title())));
6129 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetHead");
6130 return reinterpret_cast<const HeapGraphNode*
>(ToInternal(
this)->root());
6136 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetNodeById");
6138 ToInternal(
this)->GetEntryById(
id));
6144 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetNodesCount");
6145 return ToInternal(
this)->entries().length();
6151 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetNode");
6153 &ToInternal(
this)->entries().at(index));
6159 IsDeadCheck(isolate,
"v8::HeapSnapshot::GetMaxSnapshotJSObjectId");
6160 return ToInternal(
this)->max_snapshot_js_object_id();
6167 IsDeadCheck(isolate,
"v8::HeapSnapshot::Serialize");
6168 ApiCheck(format == kJSON,
6169 "v8::HeapSnapshot::Serialize",
6170 "Unknown serialization format");
6172 "v8::HeapSnapshot::Serialize",
6173 "Unsupported output encoding");
6175 "v8::HeapSnapshot::Serialize",
6176 "Invalid stream chunk size");
6178 serializer.Serialize(stream);
6184 IsDeadCheck(isolate,
"v8::HeapProfiler::GetSnapshotsCount");
6191 IsDeadCheck(isolate,
"v8::HeapProfiler::GetSnapshot");
6199 IsDeadCheck(isolate,
"v8::HeapProfiler::FindSnapshot");
6207 IsDeadCheck(isolate,
"v8::HeapProfiler::GetSnapshotObjectId");
6217 IsDeadCheck(isolate,
"v8::HeapProfiler::TakeSnapshot");
6234 IsDeadCheck(isolate,
"v8::HeapProfiler::StartHeapObjectsTracking");
6241 IsDeadCheck(isolate,
"v8::HeapProfiler::StopHeapObjectsTracking");
6248 IsDeadCheck(isolate,
"v8::HeapProfiler::PushHeapObjectsStats");
6255 IsDeadCheck(isolate,
"v8::HeapProfiler::DeleteAllSnapshots");
6261 WrapperInfoCallback callback) {
6262 i::Isolate::Current()->heap_profiler()->DefineWrapperClass(class_id,
6287 if (internal::FLAG_stress_runs != 0)
return internal::FLAG_stress_runs;
6298 static void SetFlagsFromString(
const char* flags) {
6304 static const char* kLazyOptimizations =
6305 "--prepare-always-opt "
6306 "--max-inlined-source-size=999999 "
6307 "--max-inlined-nodes=999999 "
6308 "--max-inlined-nodes-cumulative=999999 "
6310 static const char* kForcedOptimizations =
"--always-opt";
6314 static const char* kDeoptEvery13Times =
"--deopt-every-n-times=13";
6316 internal::FLAG_deopt_every_n_times == 0) {
6317 SetFlagsFromString(kDeoptEvery13Times);
6323 if (run == GetStressRuns() - 1) {
6324 SetFlagsFromString(kForcedOptimizations);
6326 SetFlagsFromString(kLazyOptimizations);
6329 if (run == GetStressRuns() - 1) {
6330 SetFlagsFromString(kForcedOptimizations);
6331 }
else if (run != GetStressRuns() - 2) {
6332 SetFlagsFromString(kLazyOptimizations);
6343 namespace internal {
6346 void HandleScopeImplementer::FreeThreadResources() {
6351 char* HandleScopeImplementer::ArchiveThread(
char* storage) {
6353 isolate_->handle_scope_data();
6354 handle_scope_data_ = *current;
6355 memcpy(storage,
this,
sizeof(*
this));
6357 ResetAfterArchive();
6358 current->Initialize();
6360 return storage + ArchiveSpacePerThread();
6364 int HandleScopeImplementer::ArchiveSpacePerThread() {
6369 char* HandleScopeImplementer::RestoreThread(
char* storage) {
6370 memcpy(
this, storage,
sizeof(*
this));
6371 *isolate_->handle_scope_data() = handle_scope_data_;
6372 return storage + ArchiveSpacePerThread();
6376 void HandleScopeImplementer::IterateThis(ObjectVisitor* v) {
6378 for (
int i = blocks()->length() - 2; i >= 0; --i) {
6379 Object** block = blocks()->at(i);
6384 if (!blocks()->is_empty()) {
6385 v->VisitPointers(blocks()->last(), handle_scope_data_.next);
6388 if (!saved_contexts_.is_empty()) {
6389 Object** start =
reinterpret_cast<Object**
>(&saved_contexts_.first());
6390 v->VisitPointers(start, start + saved_contexts_.length());
6395 void HandleScopeImplementer::Iterate(ObjectVisitor* v) {
6397 isolate_->handle_scope_data();
6398 handle_scope_data_ = *current;
6403 char* HandleScopeImplementer::Iterate(ObjectVisitor* v,
char* storage) {
6404 HandleScopeImplementer* scope_implementer =
6405 reinterpret_cast<HandleScopeImplementer*
>(storage);
6406 scope_implementer->IterateThis(v);
6407 return storage + ArchiveSpacePerThread();
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
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)
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 true
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()
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)
value format" "after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false, "print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false, "print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false, "report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true, "garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true, "flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true, "use incremental marking") DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps") DEFINE_bool(trace_incremental_marking, false, "trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true, "Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false, "Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true, "use inline caching") DEFINE_bool(native_code_counters, false, "generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false, "Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true, "Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false, "Never perform compaction on full GC-testing only") DEFINE_bool(compact_code_space, true, "Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true, "Flush inline caches prior to mark compact collection and" "flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0, "Default seed for initializing random generator" "(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true, "allows verbose printing") DEFINE_bool(allow_natives_syntax, false, "allow natives syntax") DEFINE_bool(trace_sim, false, "Trace simulator execution") DEFINE_bool(check_icache, false, "Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0, "Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8, "Stack alingment in bytes in simulator(4 or 8, 8 is default)") DEFINE_bool(trace_exception, false, "print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false, "preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true, "randomize hashes to avoid predictable hash collisions" "(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0, "Fixed seed to use to hash property keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false, "activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") DEFINE_int(testing_int_flag, 13, "testing_int_flag") DEFINE_float(testing_float_flag, 2.5, "float-flag") DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") DEFINE_string(testing_serialization_file, "/tmp/serdes", "file in which to serialize heap") DEFINE_bool(help, false, "Print usage message, including flags, on console") DEFINE_bool(dump_counters, false, "Dump counters on exit") DEFINE_string(map_counters, "", "Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT, "Pass all remaining arguments to the script.Alias for\"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#43"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2#define FLAG_MODE_DEFINE_DEFAULTS#1"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flag-definitions.h"1#define FLAG_FULL(ftype, ctype, nam, def, cmt)#define FLAG_READONLY(ftype, ctype, nam, def, cmt)#define DEFINE_implication(whenflag, thenflag)#define DEFINE_bool(nam, def, cmt)#define DEFINE_int(nam, def, cmt)#define DEFINE_float(nam, def, cmt)#define DEFINE_string(nam, def, cmt)#define DEFINE_args(nam, def, cmt)#define FLAG DEFINE_bool(use_strict, false,"enforce strict mode") DEFINE_bool(es5_readonly, false,"activate correct semantics for inheriting readonliness") DEFINE_bool(es52_globals, false,"activate new semantics for global var declarations") DEFINE_bool(harmony_typeof, false,"enable harmony semantics for typeof") DEFINE_bool(harmony_scoping, false,"enable harmony block scoping") DEFINE_bool(harmony_modules, false,"enable harmony modules (implies block scoping)") DEFINE_bool(harmony_proxies, false,"enable harmony proxies") DEFINE_bool(harmony_collections, false,"enable harmony collections (sets, maps, and weak maps)") DEFINE_bool(harmony, false,"enable all harmony features (except typeof)") DEFINE_implication(harmony, harmony_scoping) DEFINE_implication(harmony, harmony_modules) DEFINE_implication(harmony, harmony_proxies) DEFINE_implication(harmony, harmony_collections) DEFINE_implication(harmony_modules, harmony_scoping) DEFINE_bool(packed_arrays, false,"optimizes arrays that have no holes") DEFINE_bool(smi_only_arrays, true,"tracks arrays with only smi values") DEFINE_bool(clever_optimizations, true,"Optimize object size, Array shift, DOM strings and string +") DEFINE_bool(unbox_double_arrays, true,"automatically unbox arrays of doubles") DEFINE_bool(string_slices, true,"use string slices") DEFINE_bool(crankshaft, true,"use crankshaft") DEFINE_string(hydrogen_filter,"","optimization filter") DEFINE_bool(use_range, true,"use hydrogen range analysis") DEFINE_bool(eliminate_dead_phis, true,"eliminate dead phis") DEFINE_bool(use_gvn, true,"use hydrogen global value numbering") DEFINE_bool(use_canonicalizing, true,"use hydrogen instruction canonicalizing") DEFINE_bool(use_inlining, true,"use function inlining") DEFINE_int(max_inlined_source_size, 600,"maximum source size in bytes considered for a single inlining") DEFINE_int(max_inlined_nodes, 196,"maximum number of AST nodes considered for a single inlining") DEFINE_int(max_inlined_nodes_cumulative, 196,"maximum cumulative number of AST nodes considered for inlining") DEFINE_bool(loop_invariant_code_motion, true,"loop invariant code motion") DEFINE_bool(collect_megamorphic_maps_from_stub_cache, true,"crankshaft harvests type feedback from stub cache") DEFINE_bool(hydrogen_stats, false,"print statistics for hydrogen") DEFINE_bool(trace_hydrogen, false,"trace generated hydrogen to file") DEFINE_string(trace_phase,"Z","trace generated IR for specified phases") DEFINE_bool(trace_inlining, false,"trace inlining decisions") DEFINE_bool(trace_alloc, false,"trace register allocator") DEFINE_bool(trace_all_uses, false,"trace all use positions") DEFINE_bool(trace_range, false,"trace range analysis") DEFINE_bool(trace_gvn, false,"trace global value numbering") DEFINE_bool(trace_representation, false,"trace representation types") DEFINE_bool(stress_pointer_maps, false,"pointer map for every instruction") DEFINE_bool(stress_environments, false,"environment for every instruction") DEFINE_int(deopt_every_n_times, 0,"deoptimize every n times a deopt point is passed") DEFINE_bool(trap_on_deopt, false,"put a break point before deoptimizing") DEFINE_bool(deoptimize_uncommon_cases, true,"deoptimize uncommon cases") DEFINE_bool(polymorphic_inlining, true,"polymorphic inlining") DEFINE_bool(use_osr, true,"use on-stack replacement") DEFINE_bool(array_bounds_checks_elimination, false,"perform array bounds checks elimination") DEFINE_bool(array_index_dehoisting, false,"perform array index dehoisting") DEFINE_bool(trace_osr, false,"trace on-stack replacement") DEFINE_int(stress_runs, 0,"number of stress runs") DEFINE_bool(optimize_closures, true,"optimize closures") DEFINE_bool(inline_construct, true,"inline constructor calls") DEFINE_bool(inline_arguments, true,"inline functions with arguments object") DEFINE_int(loop_weight, 1,"loop weight for representation inference") DEFINE_bool(optimize_for_in, true,"optimize functions containing for-in loops") DEFINE_bool(experimental_profiler, true,"enable all profiler experiments") DEFINE_bool(watch_ic_patching, false,"profiler considers IC stability") DEFINE_int(frame_count, 1,"number of stack frames inspected by the profiler") DEFINE_bool(self_optimization, false,"primitive functions trigger their own optimization") DEFINE_bool(direct_self_opt, false,"call recompile stub directly when self-optimizing") DEFINE_bool(retry_self_opt, false,"re-try self-optimization if it failed") DEFINE_bool(count_based_interrupts, false,"trigger profiler ticks based on counting instead of timing") DEFINE_bool(interrupt_at_exit, false,"insert an interrupt check at function exit") DEFINE_bool(weighted_back_edges, false,"weight back edges by jump distance for interrupt triggering") DEFINE_int(interrupt_budget, 5900,"execution budget before interrupt is triggered") DEFINE_int(type_info_threshold, 15,"percentage of ICs that must have type info to allow optimization") DEFINE_int(self_opt_count, 130,"call count before self-optimization") DEFINE_implication(experimental_profiler, watch_ic_patching) DEFINE_implication(experimental_profiler, self_optimization) DEFINE_implication(experimental_profiler, retry_self_opt) DEFINE_implication(experimental_profiler, count_based_interrupts) DEFINE_implication(experimental_profiler, interrupt_at_exit) DEFINE_implication(experimental_profiler, weighted_back_edges) DEFINE_bool(trace_opt_verbose, false,"extra verbose compilation tracing") DEFINE_implication(trace_opt_verbose, trace_opt) DEFINE_bool(debug_code, false,"generate extra code (assertions) for debugging") DEFINE_bool(code_comments, false,"emit comments in code disassembly") DEFINE_bool(enable_sse2, true,"enable use of SSE2 instructions if available") DEFINE_bool(enable_sse3, true,"enable use of SSE3 instructions if available") DEFINE_bool(enable_sse4_1, true,"enable use of SSE4.1 instructions if available") DEFINE_bool(enable_cmov, true,"enable use of CMOV instruction if available") DEFINE_bool(enable_rdtsc, true,"enable use of RDTSC instruction if available") DEFINE_bool(enable_sahf, true,"enable use of SAHF instruction if available (X64 only)") DEFINE_bool(enable_vfp3, true,"enable use of VFP3 instructions if available - this implies ""enabling ARMv7 instructions (ARM only)") DEFINE_bool(enable_armv7, true,"enable use of ARMv7 instructions if available (ARM only)") DEFINE_bool(enable_fpu, true,"enable use of MIPS FPU instructions if available (MIPS only)") DEFINE_string(expose_natives_as, NULL,"expose natives in global object") DEFINE_string(expose_debug_as, NULL,"expose debug in global object") DEFINE_bool(expose_gc, false,"expose gc extension") DEFINE_bool(expose_externalize_string, false,"expose externalize string extension") DEFINE_int(stack_trace_limit, 10,"number of stack frames to capture") DEFINE_bool(builtins_in_stack_traces, false,"show built-in functions in stack traces") DEFINE_bool(disable_native_files, false,"disable builtin natives files") DEFINE_bool(inline_new, true,"use fast inline allocation") DEFINE_bool(stack_trace_on_abort, true,"print a stack trace if an assertion failure occurs") DEFINE_bool(trace, false,"trace function calls") DEFINE_bool(mask_constants_with_cookie, true,"use random jit cookie to mask large constants") DEFINE_bool(lazy, true,"use lazy compilation") DEFINE_bool(trace_opt, false,"trace lazy optimization") DEFINE_bool(trace_opt_stats, false,"trace lazy optimization statistics") DEFINE_bool(opt, true,"use adaptive optimizations") DEFINE_bool(always_opt, false,"always try to optimize functions") DEFINE_bool(prepare_always_opt, false,"prepare for turning on always opt") DEFINE_bool(trace_deopt, false,"trace deoptimization") DEFINE_int(min_preparse_length, 1024,"minimum length for automatic enable preparsing") DEFINE_bool(always_full_compiler, false,"try to use the dedicated run-once backend for all code") DEFINE_bool(trace_bailout, false,"print reasons for falling back to using the classic V8 backend") DEFINE_bool(compilation_cache, true,"enable compilation cache") DEFINE_bool(cache_prototype_transitions, true,"cache prototype transitions") DEFINE_bool(trace_debug_json, false,"trace debugging JSON request/response") DEFINE_bool(debugger_auto_break, true,"automatically set the debug break flag when debugger commands are ""in the queue") DEFINE_bool(enable_liveedit, true,"enable liveedit experimental feature") DEFINE_bool(break_on_abort, true,"always cause a debug break before aborting") DEFINE_int(stack_size, kPointerSize *123,"default size of stack region v8 is allowed to use (in kBytes)") DEFINE_int(max_stack_trace_source_length, 300,"maximum length of function source code printed in a stack trace.") DEFINE_bool(always_inline_smi_code, false,"always inline smi code in non-opt code") DEFINE_int(max_new_space_size, 0,"max size of the new generation (in kBytes)") DEFINE_int(max_old_space_size, 0,"max size of the old generation (in Mbytes)") DEFINE_int(max_executable_size, 0,"max size of executable memory (in Mbytes)") DEFINE_bool(gc_global, false,"always perform global GCs") DEFINE_int(gc_interval,-1,"garbage collect after <n> allocations") DEFINE_bool(trace_gc, false,"print one trace line following each garbage collection") DEFINE_bool(trace_gc_nvp, false,"print one detailed trace line in name=value format ""after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false,"print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false,"print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false,"report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true,"garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true,"flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true,"use incremental marking") DEFINE_bool(incremental_marking_steps, true,"do incremental marking steps") DEFINE_bool(trace_incremental_marking, false,"trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true,"Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false,"Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true,"use inline caching") DEFINE_bool(native_code_counters, false,"generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false,"Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true,"Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false,"Never perform compaction on full GC - testing only") DEFINE_bool(compact_code_space, true,"Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true,"Flush inline caches prior to mark compact collection and ""flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0,"Default seed for initializing random generator ""(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true,"allows verbose printing") DEFINE_bool(allow_natives_syntax, false,"allow natives syntax") DEFINE_bool(trace_sim, false,"Trace simulator execution") DEFINE_bool(check_icache, false,"Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0,"Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8,"Stack alingment in bytes in simulator (4 or 8, 8 is default)") DEFINE_bool(trace_exception, false,"print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false,"preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true,"randomize hashes to avoid predictable hash collisions ""(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0,"Fixed seed to use to hash property keys (0 means random)""(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false,"activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true,"generate optimized regexp code") DEFINE_bool(testing_bool_flag, true,"testing_bool_flag") DEFINE_int(testing_int_flag, 13,"testing_int_flag") DEFINE_float(testing_float_flag, 2.5,"float-flag") DEFINE_string(testing_string_flag,"Hello, world!","string-flag") DEFINE_int(testing_prng_seed, 42,"Seed used for threading test randomness") DEFINE_string(testing_serialization_file,"/tmp/serdes","file in which to serialize heap") DEFINE_bool(help, false,"Print usage message, including flags, on console") DEFINE_bool(dump_counters, false,"Dump counters on exit") DEFINE_string(map_counters,"","Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT,"Pass all remaining arguments to the script. Alias for \"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#47"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2 namespace{struct Flag{enum FlagType{TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_ARGS} name
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 SetData(Handle< String > data)
void AddString(String *string)
static V8EXPORT Local< String > New(const char *data, int length=-1)
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)
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
void RemoveGCPrologueCallback(GCEpilogueCallback callback)
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 StackGuard * GetDefaultIsolateStackGuard()
void AddGCPrologueCallback(GCEpilogueCallback callback, GCType gc_type_filter)
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)
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
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)
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
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)
static bool AddMessageListener(MessageCallback that, Handle< Value > data=Handle< Value >())
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)
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()
#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)
Handle< Map > CopyMapDropTransitions(Handle< Map > map)
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)
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 trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt 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 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
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)
Handle< String > LookupSymbol(Vector< const char > str)
static SnapshotObjectId PushHeapObjectsStats(OutputStream *stream)
static int ContextDisposedNotification()
static int GetRawScriptsSize()
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
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()
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)
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)
V8EXPORT double Value() const
bool IsCodeGenerationFromStringsAllowed()
static Local< Value > ReferenceError(Handle< String > message)
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)
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)
void DetachGlobal(Handle< Context > env)
void ReattachGlobal(Handle< Context > env, Handle< Object > global_object)
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)
static Handle< SharedFunctionInfo > Compile(Handle< String > source, Handle< Object > script_name, int line_offset, int column_offset, v8::Extension *extension, ScriptDataImpl *pre_data, Handle< Object > script_data, NativesFlag is_natives_code)
int GetChildrenCount() const
V8EXPORT Local< Object > Clone()
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
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)
static void PrepareStressRun(int run)
Handle< StackTrace > GetStackTrace() const
V8EXPORT int64_t Value() const
void(* MessageCallback)(Handle< Message > message, Handle< Value > data)
static void SetCreateHistogramFunction(CreateHistogramCallback)
Local< T > Close(Handle< T > value)
V8EXPORT bool IsNumberObject() const
void MarkIndependent(Object **location)
static FixedArray * cast(Object *obj)
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)
i::Handle< i::String > NewExternalAsciiStringHandle(i::Isolate *isolate, v8::String::ExternalAsciiStringResource *resource)
static int GetPersistentHandleCount()
Handle< Context > GetCallingGlobalContext()
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)
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()
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()
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 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
static v8::internal::Handle< v8::internal::TemplateInfo > OpenHandle(const Template *that)
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
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)