63 Atomic32 ThreadId::highest_thread_id_ = 0;
65 int ThreadId::AllocateThreadId() {
71 int ThreadId::GetCurrentThreadId() {
74 thread_id = AllocateThreadId();
81 ThreadLocalTop::ThreadLocalTop() {
86 void ThreadLocalTop::InitializeInternal() {
93 external_callback_scope_ =
NULL;
95 try_catch_handler_address_ =
NULL;
98 external_caught_exception_ =
false;
99 failed_access_check_callback_ =
NULL;
100 save_context_ =
NULL;
102 top_lookup_result_ =
NULL;
106 pending_exception_ =
NULL;
107 has_pending_message_ =
false;
108 rethrowing_message_ =
false;
109 pending_message_obj_ =
NULL;
110 pending_message_script_ =
NULL;
111 scheduled_exception_ =
NULL;
115 void ThreadLocalTop::Initialize() {
116 InitializeInternal();
118 simulator_ = Simulator::current(isolate_);
129 Isolate* Isolate::default_isolate_ =
NULL;
136 Mutex Isolate::process_wide_mutex_;
145 Isolate::ThreadDataTable* Isolate::thread_data_table_ =
NULL;
146 Atomic32 Isolate::isolate_counter_ = 0;
148 Isolate::PerIsolateThreadData*
149 Isolate::FindOrAllocatePerThreadDataForThisThread() {
151 PerIsolateThreadData* per_thread =
NULL;
153 LockGuard<Mutex> lock_guard(&process_wide_mutex_);
154 per_thread = thread_data_table_->Lookup(
this, thread_id);
155 if (per_thread ==
NULL) {
156 per_thread =
new PerIsolateThreadData(
this, thread_id);
157 thread_data_table_->Insert(per_thread);
160 ASSERT(thread_data_table_->Lookup(
this, thread_id) == per_thread);
175 LockGuard<Mutex> lock_guard(&process_wide_mutex_);
176 per_thread = thread_data_table_->Lookup(
this, thread_id);
183 LockGuard<Mutex> lock_guard(&process_wide_mutex_);
190 LockGuard<Mutex> lock_guard(&process_wide_mutex_);
192 if (default_isolate_ ==
NULL) {
199 thread_data_table_ =
new Isolate::ThreadDataTable();
200 default_isolate_ =
new Isolate();
215 #ifdef ENABLE_DEBUGGER_SUPPORT
216 Debugger* Isolate::GetDefaultIsolateDebugger() {
218 return default_isolate_->debugger();
235 if (data ==
NULL || data->
isolate() != default_isolate_) {
236 default_isolate_->Enter();
243 return reinterpret_cast<v8::Isolate*
>(default_isolate_);
248 return isolate_addresses_[
id];
253 ThreadLocalTop* thread =
reinterpret_cast<ThreadLocalTop*
>(thread_storage);
255 return thread_storage +
sizeof(ThreadLocalTop);
260 ThreadLocalTop* thread =
reinterpret_cast<ThreadLocalTop*
>(t);
270 if (thread->pending_exception_->ToObject(&pending)) {
271 v->VisitPointer(&pending);
272 thread->pending_exception_ = pending;
274 v->VisitPointer(&(thread->pending_message_obj_));
275 v->VisitPointer(BitCast<Object**>(&(thread->pending_message_script_)));
276 v->VisitPointer(BitCast<Object**>(&(thread->context_)));
278 if (thread->scheduled_exception_->ToObject(&scheduled)) {
279 v->VisitPointer(&scheduled);
280 thread->scheduled_exception_ = scheduled;
286 v->VisitPointer(BitCast<Object**>(&(block->exception_)));
287 v->VisitPointer(BitCast<Object**>(&(block->message_obj_)));
288 v->VisitPointer(BitCast<Object**>(&(block->message_script_)));
293 it.frame()->Iterate(v);
297 thread->top_lookup_result_->Iterate(v);
310 deferred = deferred->next_) {
311 deferred->Iterate(visitor);
326 deferred = deferred->next_) {
328 for (
int i = 0; i < blocks->length(); i++) {
329 Object** block_limit = (i == 0) ? deferred->first_block_limit_
331 if (blocks->
at(i) <= handle && handle < block_limit)
return true;
354 reinterpret_cast<Address>(that->next_));
361 if (stack_trace_nesting_level_ == 0) {
362 stack_trace_nesting_level_++;
366 incomplete_message_ = &accumulator;
369 incomplete_message_ =
NULL;
370 stack_trace_nesting_level_ = 0;
372 }
else if (stack_trace_nesting_level_ == 1) {
373 stack_trace_nesting_level_++;
375 "\n\nAttempt to print stack while printing stack (double fault)\n");
377 "If you are lucky you may find a partial stack dump on stdout.\n\n");
379 return factory()->empty_string();
383 return factory()->empty_string();
388 void Isolate::PushStackTraceAndDie(
unsigned int magic,
391 unsigned int magic2) {
392 const int kMaxStackTraceSize = 8192;
394 uint8_t buffer[kMaxStackTraceSize];
395 int length =
Min(kMaxStackTraceSize - 1, trace->length());
397 buffer[length] =
'\0';
401 static_cast<void*>(
object), static_cast<void*>(map),
402 reinterpret_cast<char*>(buffer));
413 static bool IsVisibleInStackTrace(
StackFrame* raw_frame,
417 if (!raw_frame->is_java_script())
return false;
419 JSFunction* fun = frame->function();
420 if ((fun == caller) && !(*seen_caller)) {
425 if (!(*seen_caller))
return false;
431 if (!FLAG_builtins_in_stack_traces) {
432 if (frame->receiver()->IsJSBuiltinsObject() ||
433 (fun->IsBuiltin() && !fun->shared()->native())) {
444 limit =
Max(limit, 0);
445 int initial_size =
Min(limit, 10);
451 bool seen_caller = !caller->IsJSFunction();
455 int sloppy_frames = 0;
456 bool encountered_strict_function =
false;
458 !iter.done() && frames_seen < limit;
461 if (IsVisibleInStackTrace(raw_frame, *caller, &seen_caller)) {
468 for (
int i = frames.length() - 1; i >= 0; i--) {
469 if (cursor + 4 > elements->length()) {
473 for (
int i = 0; i < cursor; i++) {
474 new_elements->set(i, elements->get(i));
476 elements = new_elements;
478 ASSERT(cursor + 4 <= elements->length());
488 if (!encountered_strict_function) {
489 if (fun->shared()->strict_mode() ==
STRICT) {
490 encountered_strict_function =
true;
495 elements->set(cursor++, *recv);
496 elements->set(cursor++, *fun);
497 elements->set(cursor++, *code);
498 elements->set(cursor++, *offset);
510 if (capture_stack_trace_for_uncaught_exceptions_) {
514 stack_trace_for_uncaught_exceptions_frame_limit_,
515 stack_trace_for_uncaught_exceptions_options_);
524 int limit =
Max(frame_limit, 0);
547 while (!it.done() && (frames_seen < limit)) {
553 for (
int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) {
561 int script_line_offset = script->line_offset()->value();
562 int position = frames[i].code()->SourcePosition(frames[i].
pc());
565 int relative_line_number = line_number - script_line_offset;
568 int start = (relative_line_number == 0) ? 0 :
569 Smi::cast(line_ends->get(relative_line_number - 1))->value() + 1;
570 int column_offset = position - start;
571 if (relative_line_number == 0) {
574 column_offset += script->column_offset()->value();
579 stack_frame, column_key,
585 stack_frame, line_key,
593 stack_frame, script_id_key, script_id,
601 stack_frame, script_name_key, script_name,
609 stack_frame, script_name_or_source_url_key,
615 if (!fun_name->BooleanValue()) {
620 stack_frame, function_key, fun_name,
NONE));
629 stack_frame, eval_key, is_eval,
NONE));
637 stack_frame, constructor_key,
638 is_constructor,
NONE));
653 if (stack_trace_nesting_level_ == 0) {
654 stack_trace_nesting_level_++;
658 incomplete_message_ = &accumulator;
662 accumulator.
Log(
this);
663 incomplete_message_ =
NULL;
664 stack_trace_nesting_level_ = 0;
665 }
else if (stack_trace_nesting_level_ == 1) {
666 stack_trace_nesting_level_++;
668 "\n\nAttempt to print stack while printing stack (double fault)\n");
670 "If you are lucky you may find a partial stack dump on stdout.\n\n");
676 static void PrintFrames(
Isolate* isolate,
678 StackFrame::PrintMode
mode) {
680 for (
int i = 0; !it.done(); it.Advance()) {
681 it.frame()->Print(accumulator, mode, i++);
689 "\n==== JS stack trace is not available =======================\n\n");
691 "\n==== Isolate for the thread is not initialized =============\n\n");
696 ASSERT(StringStream::IsMentionedObjectCacheClear(
this));
702 "\n==== JS stack trace =========================================\n\n");
703 PrintFrames(
this, accumulator, StackFrame::OVERVIEW);
706 "\n==== Details ================================================\n\n");
707 PrintFrames(
this, accumulator, StackFrame::DETAILS);
710 accumulator->
Add(
"=====================\n\n");
723 ASSERT(receiver->IsAccessCheckNeeded());
728 if (!constructor->shared()->IsApiFunction())
return;
730 constructor->shared()->get_api_func_data()->access_check_info();
731 if (data_obj == heap_.undefined_value())
return;
754 if (isolate->bootstrapper()->IsActive())
return YES;
756 if (receiver->IsJSGlobalProxy()) {
758 if (!receiver_context->IsContext())
return NO;
763 isolate->context()->global_object()->native_context();
764 if (receiver_context == native_context)
return YES;
767 native_context->security_token())
777 ASSERT(receiver->IsJSGlobalProxy() || receiver->IsAccessCheckNeeded());
791 if (decision !=
UNKNOWN)
return decision ==
YES;
795 if (!constructor->shared()->IsApiFunction())
return false;
798 constructor->shared()->get_api_func_data()->access_check_info();
799 if (data_obj == heap_.undefined_value())
return false;
803 v8::ToCData<v8::NamedSecurityCallback>(fun_obj);
805 if (!callback)
return false;
811 LOG(
this, ApiNamedSecurityCheck(key));
828 ASSERT(receiver->IsJSGlobalProxy() || receiver->IsAccessCheckNeeded());
834 if (decision !=
UNKNOWN)
return decision ==
YES;
838 if (!constructor->shared()->IsApiFunction())
return false;
841 constructor->shared()->get_api_func_data()->access_check_info();
842 if (data_obj == heap_.undefined_value())
return false;
846 v8::ToCData<v8::IndexedSecurityCallback>(fun_obj);
848 if (!callback)
return false;
853 LOG(
this, ApiIndexedSecurityCheck(index));
868 "Uncaught RangeError: Maximum call stack size exceeded";
888 double dlimit = stack_trace_limit->Number();
889 int limit =
std::isnan(dlimit) ? 0 :
static_cast<int>(dlimit);
892 exception,
factory()->undefined_value(), limit);
894 factory()->hidden_stack_trace_string(),
930 bool can_be_caught_externally =
false;
939 if (exception->IsFailure())
return exception->ToFailureUnchecked();
945 if (FLAG_stack_trace_on_illegal)
PrintStack(stdout);
946 return Throw(heap_.illegal_access_string());
952 "invalid_string_length", HandleVector<Object>(
NULL, 0)));
960 PropagatePendingExceptionToExternalTryCatch();
972 ASSERT(handler->rethrow_);
973 ASSERT(handler->capture_message_);
975 Object* script =
reinterpret_cast<Object*
>(handler->message_script_);
976 ASSERT(message->IsJSMessageObject() || message->IsTheHole());
977 ASSERT(script->IsScript() || script->IsTheHole());
980 thread_local_top()->pending_message_start_pos_ = handler->message_start_pos_;
999 int pos = frame->LookupCode()->SourcePosition(frame->pc());
1013 if (line->length() > 0) {
1027 Object* script = fun->shared()->script();
1028 if (script->IsScript() &&
1030 int pos = frame->LookupCode()->SourcePosition(frame->pc());
1040 bool catchable_by_javascript) {
1044 while (handler !=
NULL && !handler->is_catch()) {
1045 handler = handler->next();
1050 Address external_handler_address =
1056 *can_be_caught_externally = external_handler_address !=
NULL &&
1057 (handler ==
NULL || handler->address() > external_handler_address ||
1058 !catchable_by_javascript);
1060 if (*can_be_caught_externally) {
1065 return handler ==
NULL;
1071 if (!obj->IsJSObject())
return false;
1075 Object* error_constructor =
1079 prototype = prototype->GetPrototype(
this)) {
1080 if (!prototype->IsJSObject())
return false;
1088 static int fatal_exception_depth = 0;
1098 bool can_be_caught_externally =
false;
1099 bool should_report_exception =
1101 bool report_exception = catchable_by_javascript && should_report_exception;
1102 bool try_catch_needs_message =
1109 #ifdef ENABLE_DEBUGGER_SUPPORT
1111 if (catchable_by_javascript) {
1112 debugger_->OnException(exception_handle, report_exception);
1117 if (report_exception || try_catch_needs_message) {
1119 if (location ==
NULL) {
1122 location = &potential_computed_location;
1127 if (!bootstrapping) {
1129 if (capture_stack_trace_for_uncaught_exceptions_) {
1130 if (IsErrorObject(exception_handle)) {
1132 String* key =
heap()->hidden_stack_trace_string();
1137 if (stack_property->IsJSArray()) {
1141 if (stack_trace_object.
is_null()) {
1144 stack_trace_for_uncaught_exceptions_frame_limit_,
1145 stack_trace_for_uncaught_exceptions_options_);
1153 if (exception_arg->IsJSObject() && !IsErrorObject(exception_arg)) {
1154 bool failed =
false;
1164 "uncaught_exception",
1166 HandleVector<Object>(&exception_arg, 1),
1167 stack_trace_object);
1169 if (location !=
NULL) {
1179 if (fatal_exception_depth == 0 &&
1180 FLAG_abort_on_uncaught_exception &&
1181 (report_exception || can_be_caught_externally)) {
1182 fatal_exception_depth++;
1189 }
else if (location !=
NULL && !location->
script().is_null()) {
1197 if (exception->IsString() && location->
script()->name()->IsString()) {
1199 "Extension or internal compilation error: %s in %s at line %d.\n",
1203 }
else if (location->
script()->name()->IsString()) {
1205 "Extension or internal compilation error in %s at line %d.\n",
1242 Address external_handler_address =
1257 while (handler !=
NULL && handler->address() < external_handler_address) {
1258 ASSERT(!handler->is_catch());
1259 if (handler->is_finally())
return false;
1261 handler = handler->next();
1270 PropagatePendingExceptionToExternalTryCatch();
1273 if (thread_local_top_.pending_exception_ ==
1274 heap()->termination_exception()) {
1278 if (thread_local_top_.has_pending_message_) {
1279 thread_local_top_.has_pending_message_ =
false;
1280 if (!thread_local_top_.pending_message_obj_->IsTheHole()) {
1282 Handle<Object> message_obj(thread_local_top_.pending_message_obj_,
1284 if (!thread_local_top_.pending_message_script_->IsTheHole()) {
1286 Script::cast(thread_local_top_.pending_message_script_));
1287 int start_pos = thread_local_top_.pending_message_start_pos_;
1288 int end_pos = thread_local_top_.pending_message_end_pos_;
1304 if (thread_local_top_.pending_exception_ !=
heap()->termination_exception() &&
1305 thread_local_top_.has_pending_message_ &&
1306 !thread_local_top_.pending_message_obj_->IsTheHole() &&
1307 !thread_local_top_.pending_message_obj_->IsTheHole()) {
1309 Script::cast(thread_local_top_.pending_message_script_));
1310 int start_pos = thread_local_top_.pending_message_start_pos_;
1311 int end_pos = thread_local_top_.pending_message_end_pos_;
1321 PropagatePendingExceptionToExternalTryCatch();
1323 bool is_termination_exception =
1327 bool clear_exception = is_bottom_call;
1329 if (is_termination_exception) {
1330 if (is_bottom_call) {
1340 Address external_handler_address =
1342 JavaScriptFrameIterator it(
this);
1343 if (it.done() || (it.frame()->sp() > external_handler_address)) {
1344 clear_exception =
true;
1349 if (clear_exception) {
1366 capture_stack_trace_for_uncaught_exceptions_ = capture;
1367 stack_trace_for_uncaught_exceptions_frame_limit_ = frame_limit;
1368 stack_trace_for_uncaught_exceptions_options_ = options;
1383 JavaScriptFrameIterator it(
this);
1384 #ifdef ENABLE_DEBUGGER_SUPPORT
1385 if (debug_->InDebugger()) {
1386 while (!it.done()) {
1396 #endif // ENABLE_DEBUGGER_SUPPORT
1406 sizeof(ThreadLocalTop));
1407 InitializeThreadLocal();
1411 return to +
sizeof(ThreadLocalTop);
1417 sizeof(ThreadLocalTop));
1420 #ifdef USE_SIMULATOR
1424 return from +
sizeof(ThreadLocalTop);
1428 Isolate::ThreadDataTable::ThreadDataTable()
1433 Isolate::ThreadDataTable::~ThreadDataTable() {
1442 #if defined(USE_SIMULATOR)
1449 Isolate::ThreadDataTable::Lookup(
Isolate* isolate,
1452 if (data->Matches(isolate, thread_id))
return data;
1458 void Isolate::ThreadDataTable::Insert(Isolate::PerIsolateThreadData* data) {
1459 if (list_ !=
NULL) list_->prev_ = data;
1460 data->next_ = list_;
1465 void Isolate::ThreadDataTable::Remove(PerIsolateThreadData* data) {
1466 if (list_ == data) list_ = data->next_;
1467 if (data->next_ !=
NULL) data->next_->prev_ = data->prev_;
1468 if (data->prev_ !=
NULL) data->prev_->next_ = data->next_;
1473 void Isolate::ThreadDataTable::RemoveAllThreads(Isolate* isolate) {
1474 PerIsolateThreadData* data = list_;
1475 while (data !=
NULL) {
1476 PerIsolateThreadData* next = data->next_;
1477 if (data->isolate() == isolate) Remove(data);
1484 #define TRACE_ISOLATE(tag) \
1486 if (FLAG_trace_isolates) { \
1487 PrintF("Isolate %p (id %d)" #tag "\n", \
1488 reinterpret_cast<void*>(this), id()); \
1492 #define TRACE_ISOLATE(tag)
1498 state_(UNINITIALIZED),
1500 stack_trace_nesting_level_(0),
1501 incomplete_message_(
NULL),
1502 bootstrapper_(
NULL),
1503 runtime_profiler_(
NULL),
1504 compilation_cache_(
NULL),
1507 debugger_initialized_(
false),
1511 deoptimizer_data_(
NULL),
1512 materialized_object_store_(
NULL),
1513 capture_stack_trace_for_uncaught_exceptions_(
false),
1514 stack_trace_for_uncaught_exceptions_frame_limit_(0),
1515 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview),
1516 memory_allocator_(
NULL),
1517 keyed_lookup_cache_(
NULL),
1518 context_slot_cache_(
NULL),
1519 descriptor_lookup_cache_(
NULL),
1520 handle_scope_implementer_(
NULL),
1521 unicode_cache_(
NULL),
1522 runtime_zone_(this),
1523 inner_pointer_to_code_cache_(
NULL),
1524 write_iterator_(
NULL),
1525 global_handles_(
NULL),
1526 eternal_handles_(
NULL),
1527 thread_manager_(
NULL),
1528 has_installed_extensions_(
false),
1529 string_tracker_(
NULL),
1530 regexp_stack_(
NULL),
1532 code_stub_interface_descriptors_(
NULL),
1533 call_descriptors_(
NULL),
1536 random_number_generator_(
NULL),
1537 has_fatal_error_(
false),
1538 use_crankshaft_(
true),
1539 initialized_from_snapshot_(
false),
1540 cpu_profiler_(
NULL),
1541 heap_profiler_(
NULL),
1542 function_entry_hook_(
NULL),
1543 deferred_handles_head_(
NULL),
1544 optimizing_compiler_thread_(
NULL),
1545 sweeper_thread_(
NULL),
1546 num_sweeper_threads_(0),
1547 stress_deopt_count_(0),
1548 next_optimization_id_(0) {
1552 memset(isolate_addresses_, 0,
1553 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1));
1555 heap_.isolate_ =
this;
1556 stack_guard_.isolate_ =
this;
1560 thread_manager_ =
new ThreadManager();
1561 thread_manager_->isolate_ =
this;
1565 memset(&js_spill_information_, 0,
sizeof(js_spill_information_));
1568 #ifdef ENABLE_DEBUGGER_SUPPORT
1573 handle_scope_data_.Initialize();
1575 #define ISOLATE_INIT_EXECUTE(type, name, initial_value) \
1576 name##_ = (initial_value);
1578 #undef ISOLATE_INIT_EXECUTE
1580 #define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length) \
1581 memset(name##_, 0, sizeof(type) * length);
1583 #undef ISOLATE_INIT_ARRAY_EXECUTE
1587 void Isolate::TearDown() {
1595 Isolate* saved_isolate = UncheckedCurrent();
1596 SetIsolateThreadLocals(
this,
NULL);
1600 { LockGuard<Mutex> lock_guard(&process_wide_mutex_);
1601 thread_data_table_->RemoveAllThreads(
this);
1604 if (serialize_partial_snapshot_cache_ !=
NULL) {
1605 delete[] serialize_partial_snapshot_cache_;
1606 serialize_partial_snapshot_cache_ =
NULL;
1609 if (!IsDefaultIsolate()) {
1614 SetIsolateThreadLocals(saved_isolate, saved_data);
1618 void Isolate::GlobalTearDown() {
1619 delete thread_data_table_;
1623 void Isolate::Deinit() {
1624 if (state_ == INITIALIZED) {
1627 #ifdef ENABLE_DEBUGGER_SUPPORT
1628 debugger()->UnloadDebugger();
1631 if (concurrent_recompilation_enabled()) {
1632 optimizing_compiler_thread_->Stop();
1633 delete optimizing_compiler_thread_;
1634 optimizing_compiler_thread_ =
NULL;
1637 for (
int i = 0; i < num_sweeper_threads_; i++) {
1638 sweeper_thread_[i]->Stop();
1639 delete sweeper_thread_[i];
1640 sweeper_thread_[i] =
NULL;
1642 delete[] sweeper_thread_;
1643 sweeper_thread_ =
NULL;
1645 if (FLAG_job_based_sweeping &&
1646 heap_.mark_compact_collector()->IsConcurrentSweepingInProgress()) {
1647 heap_.mark_compact_collector()->WaitUntilSweepingCompleted();
1650 if (FLAG_hydrogen_stats) GetHStatistics()->Print();
1652 if (FLAG_print_deopt_stress) {
1653 PrintF(stdout,
"=== Stress deopt counter: %u\n", stress_deopt_count_);
1657 Sampler* sampler = logger_->sampler();
1658 if (sampler && sampler->IsActive()) sampler->Stop();
1660 delete deoptimizer_data_;
1661 deoptimizer_data_ =
NULL;
1662 builtins_.TearDown();
1663 bootstrapper_->TearDown();
1665 if (runtime_profiler_ !=
NULL) {
1666 delete runtime_profiler_;
1667 runtime_profiler_ =
NULL;
1670 logger_->TearDown();
1672 delete heap_profiler_;
1673 heap_profiler_ =
NULL;
1674 delete cpu_profiler_;
1675 cpu_profiler_ =
NULL;
1683 void Isolate::PushToPartialSnapshotCache(
Object* obj) {
1684 int length = serialize_partial_snapshot_cache_length();
1685 int capacity = serialize_partial_snapshot_cache_capacity();
1687 if (length >= capacity) {
1688 int new_capacity =
static_cast<int>((capacity + 10) * 1.2);
1690 for (
int i = 0; i < length; i++) {
1691 new_array[i] = serialize_partial_snapshot_cache()[i];
1693 if (capacity != 0)
delete[] serialize_partial_snapshot_cache();
1694 set_serialize_partial_snapshot_cache(new_array);
1695 set_serialize_partial_snapshot_cache_capacity(new_capacity);
1698 serialize_partial_snapshot_cache()[length] =
obj;
1699 set_serialize_partial_snapshot_cache_length(length + 1);
1703 void Isolate::SetIsolateThreadLocals(
Isolate* isolate,
1704 PerIsolateThreadData* data) {
1705 Thread::SetThreadLocal(isolate_key_, isolate);
1706 Thread::SetThreadLocal(per_isolate_thread_data_key_, data);
1710 Isolate::~Isolate() {
1714 runtime_zone_.DeleteKeptSegment();
1719 ASSERT(entry_stack_ ==
NULL ||
this == default_isolate_);
1720 ASSERT(entry_stack_ ==
NULL || entry_stack_->previous_item ==
NULL);
1722 delete entry_stack_;
1723 entry_stack_ =
NULL;
1725 delete[] assembler_spare_buffer_;
1726 assembler_spare_buffer_ =
NULL;
1728 delete unicode_cache_;
1729 unicode_cache_ =
NULL;
1734 delete[] code_stub_interface_descriptors_;
1735 code_stub_interface_descriptors_ =
NULL;
1737 delete[] call_descriptors_;
1738 call_descriptors_ =
NULL;
1740 delete regexp_stack_;
1741 regexp_stack_ =
NULL;
1743 delete descriptor_lookup_cache_;
1744 descriptor_lookup_cache_ =
NULL;
1745 delete context_slot_cache_;
1746 context_slot_cache_ =
NULL;
1747 delete keyed_lookup_cache_;
1748 keyed_lookup_cache_ =
NULL;
1752 delete stats_table_;
1753 stats_table_ =
NULL;
1755 delete materialized_object_store_;
1756 materialized_object_store_ =
NULL;
1764 delete handle_scope_implementer_;
1765 handle_scope_implementer_ =
NULL;
1767 delete compilation_cache_;
1768 compilation_cache_ =
NULL;
1769 delete bootstrapper_;
1770 bootstrapper_ =
NULL;
1771 delete inner_pointer_to_code_cache_;
1772 inner_pointer_to_code_cache_ =
NULL;
1773 delete write_iterator_;
1774 write_iterator_ =
NULL;
1776 delete thread_manager_;
1777 thread_manager_ =
NULL;
1779 delete string_tracker_;
1780 string_tracker_ =
NULL;
1782 delete memory_allocator_;
1783 memory_allocator_ =
NULL;
1786 delete global_handles_;
1787 global_handles_ =
NULL;
1788 delete eternal_handles_;
1789 eternal_handles_ =
NULL;
1791 delete string_stream_debug_object_cache_;
1792 string_stream_debug_object_cache_ =
NULL;
1794 delete external_reference_table_;
1795 external_reference_table_ =
NULL;
1797 delete random_number_generator_;
1798 random_number_generator_ =
NULL;
1800 #ifdef ENABLE_DEBUGGER_SUPPORT
1809 void Isolate::InitializeThreadLocal() {
1810 thread_local_top_.isolate_ =
this;
1811 thread_local_top_.Initialize();
1815 void Isolate::PropagatePendingExceptionToExternalTryCatch() {
1816 ASSERT(has_pending_exception());
1818 bool external_caught = IsExternallyCaught();
1819 thread_local_top_.external_caught_exception_ = external_caught;
1821 if (!external_caught)
return;
1823 if (thread_local_top_.pending_exception_ ==
1824 heap()->termination_exception()) {
1825 try_catch_handler()->can_continue_ =
false;
1826 try_catch_handler()->has_terminated_ =
true;
1827 try_catch_handler()->exception_ = heap()->null_value();
1832 ASSERT(!pending_exception()->IsFailure());
1833 ASSERT(thread_local_top_.pending_message_obj_->IsJSMessageObject() ||
1834 thread_local_top_.pending_message_obj_->IsTheHole());
1835 ASSERT(thread_local_top_.pending_message_script_->IsScript() ||
1836 thread_local_top_.pending_message_script_->IsTheHole());
1837 handler->can_continue_ =
true;
1838 handler->has_terminated_ =
false;
1839 handler->exception_ = pending_exception();
1841 if (thread_local_top_.pending_message_obj_->IsTheHole())
return;
1843 handler->message_obj_ = thread_local_top_.pending_message_obj_;
1844 handler->message_script_ = thread_local_top_.pending_message_script_;
1845 handler->message_start_pos_ = thread_local_top_.pending_message_start_pos_;
1846 handler->message_end_pos_ = thread_local_top_.pending_message_end_pos_;
1851 void Isolate::InitializeLoggingAndCounters() {
1852 if (logger_ ==
NULL) {
1853 logger_ =
new Logger(
this);
1855 if (counters_ ==
NULL) {
1861 void Isolate::InitializeDebugger() {
1862 #ifdef ENABLE_DEBUGGER_SUPPORT
1863 LockGuard<RecursiveMutex> lock_guard(debugger_access());
1865 InitializeLoggingAndCounters();
1866 debug_ =
new Debug(
this);
1867 debugger_ =
new Debugger(
this);
1874 ASSERT(state_ != INITIALIZED);
1877 stress_deopt_count_ = FLAG_deopt_every_n_times;
1879 has_fatal_error_ =
false;
1881 use_crankshaft_ = FLAG_crankshaft
1882 && !Serializer::enabled()
1883 && CPU::SupportsCrankshaft();
1885 if (function_entry_hook() !=
NULL) {
1896 InitializeLoggingAndCounters();
1898 InitializeDebugger();
1904 heap_.SetStackLimits();
1906 #define ASSIGN_ELEMENT(CamelName, hacker_name) \
1907 isolate_addresses_[Isolate::k##CamelName##Address] = \
1908 reinterpret_cast<Address>(hacker_name##_address());
1910 #undef ASSIGN_ELEMENT
1913 string_tracker_->isolate_ =
this;
1928 regexp_stack_->isolate_ =
this;
1930 code_stub_interface_descriptors_ =
1938 logger_->SetUp(
this);
1941 #if defined(USE_SIMULATOR)
1942 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS
1943 Simulator::Initialize(
this);
1951 ExecutionAccess lock(
this);
1952 stack_guard_.InitThread(lock);
1956 ASSERT(!heap_.HasBeenSetUp());
1957 if (!heap_.SetUp()) {
1964 const bool create_heap_objects = (des ==
NULL);
1965 if (create_heap_objects && !heap_.CreateHeapObjects()) {
1970 if (create_heap_objects) {
1972 PushToPartialSnapshotCache(heap_.undefined_value());
1975 InitializeThreadLocal();
1977 bootstrapper_->Initialize(create_heap_objects);
1978 builtins_.SetUp(
this, create_heap_objects);
1980 if (FLAG_log_internal_timer_events) {
1981 set_event_logger(Logger::LogInternalEvents);
1983 set_event_logger(Logger::EmptyLogInternalEvents);
1989 if (max_available_threads_ < 1) {
1991 max_available_threads_ =
Max(
Min(CPU::NumberOfProcessorsOnline(), 4), 1);
1994 if (!FLAG_job_based_sweeping) {
1995 num_sweeper_threads_ =
1996 SweeperThread::NumberOfThreads(max_available_threads_);
1999 if (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs) {
2000 PrintF(
"Concurrent recompilation has been disabled for tracing.\n");
2001 }
else if (OptimizingCompilerThread::Enabled(max_available_threads_)) {
2003 optimizing_compiler_thread_->Start();
2006 if (num_sweeper_threads_ > 0) {
2008 for (
int i = 0; i < num_sweeper_threads_; i++) {
2010 sweeper_thread_[i]->Start();
2014 #ifdef ENABLE_DEBUGGER_SUPPORT
2015 debug_->SetUp(create_heap_objects);
2019 if (!create_heap_objects) {
2022 stub_cache_->Initialize();
2025 clear_pending_exception();
2026 clear_pending_message();
2027 clear_scheduled_exception();
2031 heap_.SetStackLimits();
2034 if (!create_heap_objects) Assembler::QuietNaN(heap_.nan_value());
2040 if (!create_heap_objects &&
2043 FLAG_perf_jit_prof ||
2044 FLAG_perf_basic_prof ||
2045 logger_->is_logging_code_events())) {
2047 LOG(
this, LogCodeObjects());
2048 LOG(
this, LogCompiledFunctions());
2053 if (FLAG_perf_jit_prof || FLAG_perf_basic_prof) {
2054 FLAG_compact_code_space =
false;
2058 Internals::kIsolateEmbedderDataOffset);
2060 Internals::kIsolateRootsOffset);
2062 state_ = INITIALIZED;
2063 time_millis_at_init_ = OS::TimeCurrentMillis();
2065 if (!create_heap_objects) {
2070 Deoptimizer::EnsureCodeForDeoptimizationEntry(
2076 if (!Serializer::enabled()) {
2080 CodeStub::GenerateFPStubs(
this);
2081 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(
this);
2082 StubFailureTrampolineStub::GenerateAheadOfTime(
this);
2085 FastCloneShallowArrayStub::InstallDescriptors(
this);
2086 BinaryOpICStub::InstallDescriptors(
this);
2087 BinaryOpWithAllocationSiteStub::InstallDescriptors(
this);
2088 CompareNilICStub::InstallDescriptors(
this);
2089 ToBooleanStub::InstallDescriptors(
this);
2090 ToNumberStub::InstallDescriptors(
this);
2091 ArrayConstructorStubBase::InstallDescriptors(
this);
2092 InternalArrayConstructorStubBase::InstallDescriptors(
this);
2093 FastNewClosureStub::InstallDescriptors(
this);
2094 FastNewContextStub::InstallDescriptors(
this);
2095 NumberToStringStub::InstallDescriptors(
this);
2096 StringAddStub::InstallDescriptors(
this);
2097 RegExpConstructResultStub::InstallDescriptors(
this);
2100 CallDescriptors::InitializeForIsolate(
this);
2102 initialized_from_snapshot_ = (des !=
NULL);
2111 if (stats_table_ ==
NULL) {
2114 return stats_table_;
2118 void Isolate::Enter() {
2120 PerIsolateThreadData* current_data = CurrentPerIsolateThreadData();
2121 if (current_data !=
NULL) {
2122 current_isolate = current_data->isolate_;
2124 if (current_isolate ==
this) {
2125 ASSERT(Current() ==
this);
2127 ASSERT(entry_stack_->previous_thread_data ==
NULL ||
2128 entry_stack_->previous_thread_data->thread_id().Equals(
2129 ThreadId::Current()));
2131 entry_stack_->entry_count++;
2142 if (current_isolate ==
NULL) {
2143 current_isolate = Isolate::UncheckedCurrent();
2146 PerIsolateThreadData* data = FindOrAllocatePerThreadDataForThisThread();
2148 ASSERT(data->isolate_ ==
this);
2150 EntryStackItem* item =
new EntryStackItem(current_data,
2153 entry_stack_ = item;
2155 SetIsolateThreadLocals(
this, data);
2158 set_thread_id(data->thread_id());
2162 void Isolate::Exit() {
2164 ASSERT(entry_stack_->previous_thread_data ==
NULL ||
2165 entry_stack_->previous_thread_data->thread_id().Equals(
2166 ThreadId::Current()));
2168 if (--entry_stack_->entry_count > 0)
return;
2170 ASSERT(CurrentPerIsolateThreadData() !=
NULL);
2171 ASSERT(CurrentPerIsolateThreadData()->isolate_ ==
this);
2174 EntryStackItem* item = entry_stack_;
2175 entry_stack_ = item->previous_item;
2177 PerIsolateThreadData* previous_thread_data = item->previous_thread_data;
2178 Isolate* previous_isolate = item->previous_isolate;
2183 SetIsolateThreadLocals(previous_isolate, previous_thread_data);
2188 deferred->next_ = deferred_handles_head_;
2189 if (deferred_handles_head_ !=
NULL) {
2190 deferred_handles_head_->previous_ = deferred;
2192 deferred_handles_head_ = deferred;
2200 while (deferred_iterator->previous_ !=
NULL) {
2201 deferred_iterator = deferred_iterator->previous_;
2203 ASSERT(deferred_handles_head_ == deferred_iterator);
2205 if (deferred_handles_head_ == deferred) {
2206 deferred_handles_head_ = deferred_handles_head_->next_;
2208 if (deferred->next_ !=
NULL) {
2209 deferred->next_->previous_ = deferred->previous_;
2211 if (deferred->previous_ !=
NULL) {
2212 deferred->previous_->next_ = deferred->next_;
2217 HStatistics* Isolate::GetHStatistics() {
2218 if (hstatistics() ==
NULL) set_hstatistics(
new HStatistics());
2219 return hstatistics();
2223 HTracer* Isolate::GetHTracer() {
2224 if (htracer() ==
NULL) set_htracer(
new HTracer(
id()));
2229 CodeTracer* Isolate::GetCodeTracer() {
2230 if (code_tracer() ==
NULL) set_code_tracer(
new CodeTracer(
id()));
2231 return code_tracer();
2237 Object* maybe_map_array = native_context->js_array_maps();
2238 if (!maybe_map_array->IsUndefined()) {
2239 Object* maybe_transitioned_map =
2240 FixedArray::cast(maybe_map_array)->get(kind);
2241 if (!maybe_transitioned_map->IsUndefined()) {
2242 return Map::cast(maybe_transitioned_map);
2249 bool Isolate::IsFastArrayConstructorPrototypeChainIntact() {
2250 Map* root_array_map =
2253 JSObject* initial_array_proto = JSObject::cast(*initial_array_prototype());
2256 if (root_array_map->prototype() != initial_array_proto)
return false;
2257 if (initial_array_proto->elements() != heap()->empty_fixed_array()) {
2262 JSObject* initial_object_proto = JSObject::cast(*initial_object_prototype());
2264 if (root_array_map_proto != initial_object_proto)
return false;
2265 if (initial_object_proto->elements() != heap()->empty_fixed_array()) {
2274 Isolate::code_stub_interface_descriptor(
int index) {
2275 return code_stub_interface_descriptors_ + index;
2281 ASSERT(0 <= index && index < NUMBER_OF_CALL_DESCRIPTORS);
2282 return &call_descriptors_[index];
2287 return inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer(a);
2292 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2293 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2296 #undef ISOLATE_FIELD_OFFSET
2301 if (heap()->symbol_registry()->IsUndefined()) {
2304 heap()->set_symbol_registry(*registry);
2306 static const char* nested[] = {
2307 "for",
"for_api",
"for_intern",
"keyFor",
"private_api",
"private_intern"
2309 for (
unsigned i = 0; i <
ARRAY_SIZE(nested); ++i) {
2313 JSObject::SetProperty(registry, name, obj,
NONE,
STRICT);
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
#define CHECK_NOT_EMPTY_HANDLE(isolate, call)
Failure * StackOverflow()
static void * GetThreadLocal(LocalStorageKey key)
Handle< JSObject > NewJSObject(Handle< JSFunction > constructor, PretenureFlag pretenure=NOT_TENURED)
#define CHECK_EQ(expected, value)
const char * ToCString(const v8::String::Utf8Value &value)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths true
MaybeObject * pending_exception()
void PrintF(const char *format,...)
void PrintStack(StringStream *accumulator)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf map
static String * cast(Object *obj)
void ScheduleThrow(Object *exception)
PerIsolateThreadData * FindPerThreadDataForThread(ThreadId thread_id)
Handle< Context > GetCallingNativeContext()
Handle< FixedArray > NewFixedArrayWithHoles(int size, PretenureFlag pretenure=NOT_TENURED)
static Smi * FromInt(int value)
#define LOG(isolate, Call)
void ReportFailedAccessCheck(JSObject *receiver, v8::AccessType type)
void Log(Isolate *isolate)
static Handle< T > cast(Handle< S > that)
const int kDeoptTableSerializeEntryCount
bool MayNamedAccess(JSObject *receiver, Object *key, v8::AccessType type)
Address get_address_from_id(AddressId id)
void IterateDeferredHandles(ObjectVisitor *visitor)
bool(* IndexedSecurityCallback)(Local< Object > host, uint32_t index, AccessType type, Local< Value > data)
void DoThrow(Object *exception, MessageLocation *location)
bool IsExternallyCaught()
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage message
Handle< JSArray > NewJSArrayWithElements(Handle< FixedArrayBase > elements, ElementsKind elements_kind, int length, PretenureFlag pretenure=NOT_TENURED)
Bootstrapper * bootstrapper()
static Failure * Exception()
Failure * ReThrow(MaybeObject *exception)
PerIsolateThreadData * FindPerThreadDataForThisThread()
struct v8::internal::StaticInitializer static_initializer
virtual void Summarize(List< FrameSummary > *frames)
static Address handler(ThreadLocalTop *thread)
static Handle< Object > SetHiddenProperty(Handle< JSObject > object, Handle< Name > key, Handle< Object > value)
#define ASSERT(condition)
static PerIsolateThreadData * CurrentPerIsolateThreadData()
void SetFailedAccessCheckCallback(v8::FailedAccessCheckCallback callback)
static Handle< Object > SetLocalPropertyIgnoreAttributes(Handle< JSObject > object, Handle< Name > key, Handle< Object > value, PropertyAttributes attributes, ValueType value_type=OPTIMAL_REPRESENTATION, StoreMode mode=ALLOW_AS_CONSTANT, ExtensibilityCheck extensibility_check=PERFORM_EXTENSIBILITY_CHECK)
static StackGuard * GetDefaultIsolateStackGuard()
static Script * cast(Object *obj)
void clear_pending_exception()
static Context * cast(Object *context)
static Handle< Object > ToDetailString(Isolate *isolate, Handle< Object > obj, bool *exc)
#define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length)
void clear_scheduled_exception()
static void UnregisterCTryCatch()
Handle< Object > GetProperty(Handle< JSReceiver > obj, const char *name)
static void SetCrashIfDefaultIsolateInitialized()
static int GetThreadLocalInt(LocalStorageKey key)
void CaptureAndSetDetailedStackTrace(Handle< JSObject > error_object)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in name
Failure * ThrowInvalidStringLength()
static Smi * cast(Object *object)
void(* FailedAccessCheckCallback)(Local< Object > target, AccessType type, Local< Value > data)
void clear_pending_message()
StackGuard * stack_guard()
void Add(Vector< const char > format, Vector< FmtElm > elms)
static Handle< JSMessageObject > MakeMessageObject(Isolate *isolate, const char *type, MessageLocation *loc, Vector< Handle< Object > > args, Handle< JSArray > stack_frames)
Handle< Context > global_context()
bool OptionalRescheduleException(bool is_bottom_call)
GlobalObject * global_object()
Object * receiver() const
V8_INLINE bool IsNull() const
HANDLE HANDLE LPSTACKFRAME64 StackFrame
Address try_catch_handler_address()
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_string(expose_natives_as
static void EnsureDefaultIsolate()
void ReportPendingMessages()
#define ISOLATE_INIT_LIST(V)
static JSGlobalProxy * cast(Object *obj)
static Address c_entry_fp(ThreadLocalTop *thread)
#define OFFSET_OF(type, field)
static void MemCopy(void *dest, const void *src, size_t size)
v8::TryCatch * try_catch_handler()
static ThreadId Current()
Context * native_context()
void ComputeLocation(MessageLocation *target)
static void EnterDefaultIsolate()
MaybeObject * scheduled_exception()
void FatalProcessOutOfMemory(const char *message)
static LocalStorageKey CreateThreadLocalKey()
static Handle< JSObject > Copy(Handle< JSObject > object)
void PrintCurrentStackTrace(FILE *out)
void IterateThread(ThreadVisitor *v, char *t)
void Iterate(ObjectVisitor *v)
Handle< JSArray > CaptureCurrentStackTrace(int frame_limit, StackTrace::StackTraceOptions options)
void RestorePendingMessageFromTryCatch(v8::TryCatch *handler)
void Deserialize(Isolate *isolate)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
static v8::Isolate * GetDefaultIsolateForLocking()
int GetScriptLineNumberSafe(Handle< Script > script, int code_pos)
Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32 *ptr, Atomic32 increment)
bool has_pending_exception()
void SetCaptureStackTraceForUncaughtExceptions(bool capture, int frame_limit, StackTrace::StackTraceOptions options)
Handle< JSBuiltinsObject > js_builtins_object()
static JavaScriptFrame * cast(StackFrame *frame)
Failure * Throw(Object *exception, MessageLocation *location=NULL)
#define STATIC_ASCII_VECTOR(x)
Handle< Script > script() const
void Release_Store(volatile Atomic32 *ptr, Atomic32 value)
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
static JSArray * cast(Object *obj)
Atomic32 NoBarrier_Load(volatile const Atomic32 *ptr)
#define ISOLATE_INIT_EXECUTE(type, name, initial_value)
int GetScriptLineNumber(Handle< Script > script, int code_pos)
Failure * PromoteScheduledException()
virtual void VisitThread(Isolate *isolate, ThreadLocalTop *top)=0
void PrintMentionedObjectCache(Isolate *isolate)
MessageLocation GetMessageLocation()
static void WriteToFlat(String *source, sinkchar *sink, int from, int to)
Handle< String > InternalizeOneByteString(Vector< const uint8_t > str)
#define FOR_EACH_ISOLATE_ADDRESS_NAME(C)
Handle< T > handle(T *t, Isolate *isolate)
static SmartArrayPointer< char > GetLocalizedMessage(Isolate *isolate, Handle< Object > data)
static AccessCheckInfo * cast(Object *obj)
Handle< JSArray > CaptureSimpleStackTrace(Handle< JSObject > error_object, Handle< Object > caller, int limit)
ElementsKind GetInitialFastElementsKind()
static void SetThreadLocal(LocalStorageKey key, void *value)
Handle< String > StackTraceString()
Handle< String > ToString(Isolate *isolate)
void set_pending_exception(MaybeObject *exception)
Handle< Object > GetScriptNameOrSourceURL(Handle< Script > script)
static void PrintError(const char *format,...)
bool(* NamedSecurityCallback)(Local< Object > host, Local< Value > key, AccessType type, Local< Value > data)
const int kHandleBlockSize
#define TRACE_ISOLATE(tag)
static void ClearMentionedObjectCache(Isolate *isolate)
bool MayIndexedAccess(JSObject *receiver, uint32_t index, v8::AccessType type)
Isolate * isolate() const
static FixedArray * cast(Object *obj)
void InitializeLoggingAndCounters()
void UnregisterTryCatchHandler(v8::TryCatch *that)
Failure * TerminateExecution()
char * ArchiveThread(char *to)
Failure * ThrowIllegalOperation()
static ThreadId Invalid()
static Handle< String > GetStackTraceLine(Handle< Object > recv, Handle< JSFunction > fun, Handle< Object > pos, Handle< Object > is_global)
void RegisterTryCatchHandler(v8::TryCatch *that)
bool is_catchable_by_javascript(MaybeObject *exception)
char * RestoreThread(char *from)
void OutputToFile(FILE *out)
bool has_scheduled_exception()
static Thread::LocalStorageKey thread_local_key
Handle< Context > native_context()
static uintptr_t RegisterCTryCatch(uintptr_t try_catch_address)
static void ReportMessage(Isolate *isolate, MessageLocation *loc, Handle< Object > message)
bool ShouldReportException(bool *can_be_caught_externally, bool catchable_by_javascript)
Object * GetHiddenProperty(Name *key)
static int NewElementsCapacity(int old_capacity)
ThreadLocalTop * thread_local_top()
static const char *const kStackOverflowMessage
static void SetThreadLocalInt(LocalStorageKey key, int value)
static JSObject * cast(Object *obj)
#define ISOLATE_INIT_ARRAY_LIST(V)
JSFunction * function() const
Handle< JSArray > NewJSArray(ElementsKind elements_kind, int length, int capacity, ArrayStorageAllocationMode mode=INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, PretenureFlag pretenure=NOT_TENURED)
void CancelTerminateExecution()
#define TRY_CATCH_FROM_ADDRESS(try_catch_address)
#define ASSIGN_ELEMENT(CamelName, hacker_name)
static JSFunction * cast(Object *obj)