Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/isolate.cc

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/isolate.h ('k') | src/json.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 21 matching lines...) Expand all
32 #include "ast.h" 32 #include "ast.h"
33 #include "bootstrapper.h" 33 #include "bootstrapper.h"
34 #include "codegen.h" 34 #include "codegen.h"
35 #include "compilation-cache.h" 35 #include "compilation-cache.h"
36 #include "cpu-profiler.h" 36 #include "cpu-profiler.h"
37 #include "debug.h" 37 #include "debug.h"
38 #include "deoptimizer.h" 38 #include "deoptimizer.h"
39 #include "heap-profiler.h" 39 #include "heap-profiler.h"
40 #include "hydrogen.h" 40 #include "hydrogen.h"
41 #include "isolate-inl.h" 41 #include "isolate-inl.h"
42 #include "lexer/experimental-scanner.h" 42 #include "lexer/lexer.h"
43 #include "lithium-allocator.h" 43 #include "lithium-allocator.h"
44 #include "log.h" 44 #include "log.h"
45 #include "messages.h" 45 #include "messages.h"
46 #include "platform.h" 46 #include "platform.h"
47 #include "regexp-stack.h" 47 #include "regexp-stack.h"
48 #include "runtime-profiler.h" 48 #include "runtime-profiler.h"
49 #include "sampler.h" 49 #include "sampler.h"
50 #include "scopeinfo.h" 50 #include "scopeinfo.h"
51 #include "serialize.h" 51 #include "serialize.h"
52 #include "simulator.h" 52 #include "simulator.h"
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 try_catch_handler() : NULL; 940 try_catch_handler() : NULL;
941 941
942 // Set the exception being re-thrown. 942 // Set the exception being re-thrown.
943 set_pending_exception(exception); 943 set_pending_exception(exception);
944 if (exception->IsFailure()) return exception->ToFailureUnchecked(); 944 if (exception->IsFailure()) return exception->ToFailureUnchecked();
945 return Failure::Exception(); 945 return Failure::Exception();
946 } 946 }
947 947
948 948
949 Failure* Isolate::ThrowIllegalOperation() { 949 Failure* Isolate::ThrowIllegalOperation() {
950 if (FLAG_stack_trace_on_illegal) PrintStack(stdout);
950 return Throw(heap_.illegal_access_string()); 951 return Throw(heap_.illegal_access_string());
951 } 952 }
952 953
953 954
954 void Isolate::ScheduleThrow(Object* exception) { 955 void Isolate::ScheduleThrow(Object* exception) {
955 // When scheduling a throw we first throw the exception to get the 956 // When scheduling a throw we first throw the exception to get the
956 // error reporting if it is uncaught before rescheduling it. 957 // error reporting if it is uncaught before rescheduling it.
957 Throw(exception); 958 Throw(exception);
958 PropagatePendingExceptionToExternalTryCatch(); 959 PropagatePendingExceptionToExternalTryCatch();
959 if (has_pending_exception()) { 960 if (has_pending_exception()) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 for (Object* prototype = *obj; !prototype->IsNull(); 1077 for (Object* prototype = *obj; !prototype->IsNull();
1077 prototype = prototype->GetPrototype(this)) { 1078 prototype = prototype->GetPrototype(this)) {
1078 if (!prototype->IsJSObject()) return false; 1079 if (!prototype->IsJSObject()) return false;
1079 if (JSObject::cast(prototype)->map()->constructor() == error_constructor) { 1080 if (JSObject::cast(prototype)->map()->constructor() == error_constructor) {
1080 return true; 1081 return true;
1081 } 1082 }
1082 } 1083 }
1083 return false; 1084 return false;
1084 } 1085 }
1085 1086
1086
1087 void Isolate::UpdateScannersAfterGC(v8::Isolate* isolate,
1088 GCType,
1089 GCCallbackFlags) {
1090 reinterpret_cast<i::Isolate*>(isolate)->UpdateScannersAfterGC();
1091 }
1092
1093
1094 void Isolate::UpdateScannersAfterGC() {
1095 for (std::set<ScannerBase*>::const_iterator it = scanners_.begin();
1096 it != scanners_.end(); ++it) {
1097 (*it)->UpdateBufferBasedOnHandle();
1098 }
1099 }
1100
1101
1102 static int fatal_exception_depth = 0; 1087 static int fatal_exception_depth = 0;
1103 1088
1104 void Isolate::DoThrow(Object* exception, MessageLocation* location) { 1089 void Isolate::DoThrow(Object* exception, MessageLocation* location) {
1105 ASSERT(!has_pending_exception()); 1090 ASSERT(!has_pending_exception());
1106 1091
1107 HandleScope scope(this); 1092 HandleScope scope(this);
1108 Handle<Object> exception_handle(exception, this); 1093 Handle<Object> exception_handle(exception, this);
1109 1094
1110 // Determine reporting and whether the exception is caught externally. 1095 // Determine reporting and whether the exception is caught externally.
1111 bool catchable_by_javascript = is_catchable_by_javascript(exception); 1096 bool catchable_by_javascript = is_catchable_by_javascript(exception);
(...skipping 20 matching lines...) Expand all
1132 MessageLocation potential_computed_location; 1117 MessageLocation potential_computed_location;
1133 if (location == NULL) { 1118 if (location == NULL) {
1134 // If no location was specified we use a computed one instead. 1119 // If no location was specified we use a computed one instead.
1135 ComputeLocation(&potential_computed_location); 1120 ComputeLocation(&potential_computed_location);
1136 location = &potential_computed_location; 1121 location = &potential_computed_location;
1137 } 1122 }
1138 // It's not safe to try to make message objects or collect stack traces 1123 // It's not safe to try to make message objects or collect stack traces
1139 // while the bootstrapper is active since the infrastructure may not have 1124 // while the bootstrapper is active since the infrastructure may not have
1140 // been properly initialized. 1125 // been properly initialized.
1141 if (!bootstrapping) { 1126 if (!bootstrapping) {
1142 Handle<String> stack_trace;
1143 if (FLAG_trace_exception) stack_trace = StackTraceString();
1144 Handle<JSArray> stack_trace_object; 1127 Handle<JSArray> stack_trace_object;
1145 if (capture_stack_trace_for_uncaught_exceptions_) { 1128 if (capture_stack_trace_for_uncaught_exceptions_) {
1146 if (IsErrorObject(exception_handle)) { 1129 if (IsErrorObject(exception_handle)) {
1147 // We fetch the stack trace that corresponds to this error object. 1130 // We fetch the stack trace that corresponds to this error object.
1148 String* key = heap()->hidden_stack_trace_string(); 1131 String* key = heap()->hidden_stack_trace_string();
1149 Object* stack_property = 1132 Object* stack_property =
1150 JSObject::cast(*exception_handle)->GetHiddenProperty(key); 1133 JSObject::cast(*exception_handle)->GetHiddenProperty(key);
1151 // Property lookup may have failed. In this case it's probably not 1134 // Property lookup may have failed. In this case it's probably not
1152 // a valid Error object. 1135 // a valid Error object.
1153 if (stack_property->IsJSArray()) { 1136 if (stack_property->IsJSArray()) {
(...skipping 19 matching lines...) Expand all
1173 if (failed) { 1156 if (failed) {
1174 exception_arg = factory()->InternalizeOneByteString( 1157 exception_arg = factory()->InternalizeOneByteString(
1175 STATIC_ASCII_VECTOR("exception")); 1158 STATIC_ASCII_VECTOR("exception"));
1176 } 1159 }
1177 } 1160 }
1178 Handle<Object> message_obj = MessageHandler::MakeMessageObject( 1161 Handle<Object> message_obj = MessageHandler::MakeMessageObject(
1179 this, 1162 this,
1180 "uncaught_exception", 1163 "uncaught_exception",
1181 location, 1164 location,
1182 HandleVector<Object>(&exception_arg, 1), 1165 HandleVector<Object>(&exception_arg, 1),
1183 stack_trace,
1184 stack_trace_object); 1166 stack_trace_object);
1185 thread_local_top()->pending_message_obj_ = *message_obj; 1167 thread_local_top()->pending_message_obj_ = *message_obj;
1186 if (location != NULL) { 1168 if (location != NULL) {
1187 thread_local_top()->pending_message_script_ = *location->script(); 1169 thread_local_top()->pending_message_script_ = *location->script();
1188 thread_local_top()->pending_message_start_pos_ = location->start_pos(); 1170 thread_local_top()->pending_message_start_pos_ = location->start_pos();
1189 thread_local_top()->pending_message_end_pos_ = location->end_pos(); 1171 thread_local_top()->pending_message_end_pos_ = location->end_pos();
1190 } 1172 }
1191 1173
1192 // If the abort-on-uncaught-exception flag is specified, abort on any 1174 // If the abort-on-uncaught-exception flag is specified, abort on any
1193 // exception not caught by JavaScript, even when an external handler is 1175 // exception not caught by JavaScript, even when an external handler is
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 1457
1476 1458
1477 Isolate::ThreadDataTable::~ThreadDataTable() { 1459 Isolate::ThreadDataTable::~ThreadDataTable() {
1478 // TODO(svenpanne) The assertion below would fire if an embedder does not 1460 // TODO(svenpanne) The assertion below would fire if an embedder does not
1479 // cleanly dispose all Isolates before disposing v8, so we are conservative 1461 // cleanly dispose all Isolates before disposing v8, so we are conservative
1480 // and leave it out for now. 1462 // and leave it out for now.
1481 // ASSERT_EQ(NULL, list_); 1463 // ASSERT_EQ(NULL, list_);
1482 } 1464 }
1483 1465
1484 1466
1467 Isolate::PerIsolateThreadData::~PerIsolateThreadData() {
1468 #if defined(USE_SIMULATOR)
1469 delete simulator_;
1470 #endif
1471 }
1472
1473
1485 Isolate::PerIsolateThreadData* 1474 Isolate::PerIsolateThreadData*
1486 Isolate::ThreadDataTable::Lookup(Isolate* isolate, 1475 Isolate::ThreadDataTable::Lookup(Isolate* isolate,
1487 ThreadId thread_id) { 1476 ThreadId thread_id) {
1488 for (PerIsolateThreadData* data = list_; data != NULL; data = data->next_) { 1477 for (PerIsolateThreadData* data = list_; data != NULL; data = data->next_) {
1489 if (data->Matches(isolate, thread_id)) return data; 1478 if (data->Matches(isolate, thread_id)) return data;
1490 } 1479 }
1491 return NULL; 1480 return NULL;
1492 } 1481 }
1493 1482
1494 1483
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 bootstrapper_(NULL), 1528 bootstrapper_(NULL),
1540 runtime_profiler_(NULL), 1529 runtime_profiler_(NULL),
1541 compilation_cache_(NULL), 1530 compilation_cache_(NULL),
1542 counters_(NULL), 1531 counters_(NULL),
1543 code_range_(NULL), 1532 code_range_(NULL),
1544 debugger_initialized_(false), 1533 debugger_initialized_(false),
1545 logger_(NULL), 1534 logger_(NULL),
1546 stats_table_(NULL), 1535 stats_table_(NULL),
1547 stub_cache_(NULL), 1536 stub_cache_(NULL),
1548 deoptimizer_data_(NULL), 1537 deoptimizer_data_(NULL),
1538 materialized_object_store_(NULL),
1549 capture_stack_trace_for_uncaught_exceptions_(false), 1539 capture_stack_trace_for_uncaught_exceptions_(false),
1550 stack_trace_for_uncaught_exceptions_frame_limit_(0), 1540 stack_trace_for_uncaught_exceptions_frame_limit_(0),
1551 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview), 1541 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview),
1552 memory_allocator_(NULL), 1542 memory_allocator_(NULL),
1553 keyed_lookup_cache_(NULL), 1543 keyed_lookup_cache_(NULL),
1554 context_slot_cache_(NULL), 1544 context_slot_cache_(NULL),
1555 descriptor_lookup_cache_(NULL), 1545 descriptor_lookup_cache_(NULL),
1556 handle_scope_implementer_(NULL), 1546 handle_scope_implementer_(NULL),
1557 unicode_cache_(NULL), 1547 unicode_cache_(NULL),
1558 runtime_zone_(this), 1548 runtime_zone_(this),
(...skipping 16 matching lines...) Expand all
1575 use_crankshaft_(true), 1565 use_crankshaft_(true),
1576 initialized_from_snapshot_(false), 1566 initialized_from_snapshot_(false),
1577 cpu_profiler_(NULL), 1567 cpu_profiler_(NULL),
1578 heap_profiler_(NULL), 1568 heap_profiler_(NULL),
1579 function_entry_hook_(NULL), 1569 function_entry_hook_(NULL),
1580 deferred_handles_head_(NULL), 1570 deferred_handles_head_(NULL),
1581 optimizing_compiler_thread_(NULL), 1571 optimizing_compiler_thread_(NULL),
1582 sweeper_thread_(NULL), 1572 sweeper_thread_(NULL),
1583 num_sweeper_threads_(0), 1573 num_sweeper_threads_(0),
1584 max_available_threads_(0), 1574 max_available_threads_(0),
1585 stress_deopt_count_(0) { 1575 stress_deopt_count_(0),
1576 lexer_gc_handler_(0),
1577 next_optimization_id_(0) {
1586 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1); 1578 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1);
1587 TRACE_ISOLATE(constructor); 1579 TRACE_ISOLATE(constructor);
1588 1580
1589 memset(isolate_addresses_, 0, 1581 memset(isolate_addresses_, 0,
1590 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); 1582 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1));
1591 1583
1592 heap_.isolate_ = this; 1584 heap_.isolate_ = this;
1593 stack_guard_.isolate_ = this; 1585 stack_guard_.isolate_ = this;
1594 1586
1595 // ThreadManager is initialized early to support locking an isolate 1587 // ThreadManager is initialized early to support locking an isolate
1596 // before it is entered. 1588 // before it is entered.
1597 thread_manager_ = new ThreadManager(); 1589 thread_manager_ = new ThreadManager();
1598 thread_manager_->isolate_ = this; 1590 thread_manager_->isolate_ = this;
1599 1591
1600 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ 1592 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \
1593 V8_TARGET_ARCH_A64 && !defined(__aarch64__) || \
1601 V8_TARGET_ARCH_MIPS && !defined(__mips__) 1594 V8_TARGET_ARCH_MIPS && !defined(__mips__)
1602 simulator_initialized_ = false; 1595 simulator_initialized_ = false;
1603 simulator_i_cache_ = NULL; 1596 simulator_i_cache_ = NULL;
1604 simulator_redirection_ = NULL; 1597 simulator_redirection_ = NULL;
1605 #endif 1598 #endif
1606 1599
1607 #ifdef DEBUG 1600 #ifdef DEBUG
1608 // heap_histograms_ initializes itself. 1601 // heap_histograms_ initializes itself.
1609 memset(&js_spill_information_, 0, sizeof(js_spill_information_)); 1602 memset(&js_spill_information_, 0, sizeof(js_spill_information_));
1610 memset(code_kind_statistics_, 0, 1603 memset(code_kind_statistics_, 0,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 } 1674 }
1682 1675
1683 for (int i = 0; i < num_sweeper_threads_; i++) { 1676 for (int i = 0; i < num_sweeper_threads_; i++) {
1684 sweeper_thread_[i]->Stop(); 1677 sweeper_thread_[i]->Stop();
1685 delete sweeper_thread_[i]; 1678 delete sweeper_thread_[i];
1686 sweeper_thread_[i] = NULL; 1679 sweeper_thread_[i] = NULL;
1687 } 1680 }
1688 delete[] sweeper_thread_; 1681 delete[] sweeper_thread_;
1689 sweeper_thread_ = NULL; 1682 sweeper_thread_ = NULL;
1690 1683
1684 if (FLAG_job_based_sweeping &&
1685 heap_.mark_compact_collector()->IsConcurrentSweepingInProgress()) {
1686 heap_.mark_compact_collector()->WaitUntilSweepingCompleted();
1687 }
1691 1688
1692 if (FLAG_hydrogen_stats) GetHStatistics()->Print(); 1689 if (FLAG_hydrogen_stats) GetHStatistics()->Print();
1693 1690
1694 if (FLAG_print_deopt_stress) { 1691 if (FLAG_print_deopt_stress) {
1695 PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_); 1692 PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_);
1696 } 1693 }
1697 1694
1698 // We must stop the logger before we tear down other components. 1695 // We must stop the logger before we tear down other components.
1699 Sampler* sampler = logger_->sampler(); 1696 Sampler* sampler = logger_->sampler();
1700 if (sampler && sampler->IsActive()) sampler->Stop(); 1697 if (sampler && sampler->IsActive()) sampler->Stop();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 delete context_slot_cache_; 1784 delete context_slot_cache_;
1788 context_slot_cache_ = NULL; 1785 context_slot_cache_ = NULL;
1789 delete keyed_lookup_cache_; 1786 delete keyed_lookup_cache_;
1790 keyed_lookup_cache_ = NULL; 1787 keyed_lookup_cache_ = NULL;
1791 1788
1792 delete stub_cache_; 1789 delete stub_cache_;
1793 stub_cache_ = NULL; 1790 stub_cache_ = NULL;
1794 delete stats_table_; 1791 delete stats_table_;
1795 stats_table_ = NULL; 1792 stats_table_ = NULL;
1796 1793
1794 delete materialized_object_store_;
1795 materialized_object_store_ = NULL;
1796
1797 delete logger_; 1797 delete logger_;
1798 logger_ = NULL; 1798 logger_ = NULL;
1799 1799
1800 delete counters_; 1800 delete counters_;
1801 counters_ = NULL; 1801 counters_ = NULL;
1802 1802
1803 delete handle_scope_implementer_; 1803 delete handle_scope_implementer_;
1804 handle_scope_implementer_ = NULL; 1804 handle_scope_implementer_ = NULL;
1805 1805
1806 delete compilation_cache_; 1806 delete compilation_cache_;
(...skipping 22 matching lines...) Expand all
1829 1829
1830 delete string_stream_debug_object_cache_; 1830 delete string_stream_debug_object_cache_;
1831 string_stream_debug_object_cache_ = NULL; 1831 string_stream_debug_object_cache_ = NULL;
1832 1832
1833 delete external_reference_table_; 1833 delete external_reference_table_;
1834 external_reference_table_ = NULL; 1834 external_reference_table_ = NULL;
1835 1835
1836 delete random_number_generator_; 1836 delete random_number_generator_;
1837 random_number_generator_ = NULL; 1837 random_number_generator_ = NULL;
1838 1838
1839 delete lexer_gc_handler_;
1840 lexer_gc_handler_ = NULL;
1841
1839 #ifdef ENABLE_DEBUGGER_SUPPORT 1842 #ifdef ENABLE_DEBUGGER_SUPPORT
1840 delete debugger_; 1843 delete debugger_;
1841 debugger_ = NULL; 1844 debugger_ = NULL;
1842 delete debug_; 1845 delete debug_;
1843 debug_ = NULL; 1846 debug_ = NULL;
1844 #endif 1847 #endif
1845 } 1848 }
1846 1849
1847 1850
1848 void Isolate::InitializeThreadLocal() { 1851 void Isolate::InitializeThreadLocal() {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 context_slot_cache_ = new ContextSlotCache(); 1960 context_slot_cache_ = new ContextSlotCache();
1958 descriptor_lookup_cache_ = new DescriptorLookupCache(); 1961 descriptor_lookup_cache_ = new DescriptorLookupCache();
1959 unicode_cache_ = new UnicodeCache(); 1962 unicode_cache_ = new UnicodeCache();
1960 inner_pointer_to_code_cache_ = new InnerPointerToCodeCache(this); 1963 inner_pointer_to_code_cache_ = new InnerPointerToCodeCache(this);
1961 write_iterator_ = new ConsStringIteratorOp(); 1964 write_iterator_ = new ConsStringIteratorOp();
1962 global_handles_ = new GlobalHandles(this); 1965 global_handles_ = new GlobalHandles(this);
1963 eternal_handles_ = new EternalHandles(); 1966 eternal_handles_ = new EternalHandles();
1964 bootstrapper_ = new Bootstrapper(this); 1967 bootstrapper_ = new Bootstrapper(this);
1965 handle_scope_implementer_ = new HandleScopeImplementer(this); 1968 handle_scope_implementer_ = new HandleScopeImplementer(this);
1966 stub_cache_ = new StubCache(this); 1969 stub_cache_ = new StubCache(this);
1970 materialized_object_store_ = new MaterializedObjectStore(this);
1967 regexp_stack_ = new RegExpStack(); 1971 regexp_stack_ = new RegExpStack();
1968 regexp_stack_->isolate_ = this; 1972 regexp_stack_->isolate_ = this;
1969 date_cache_ = new DateCache(); 1973 date_cache_ = new DateCache();
1970 code_stub_interface_descriptors_ = 1974 code_stub_interface_descriptors_ =
1971 new CodeStubInterfaceDescriptor[CodeStub::NUMBER_OF_IDS]; 1975 new CodeStubInterfaceDescriptor[CodeStub::NUMBER_OF_IDS];
1972 call_descriptors_ = 1976 call_descriptors_ =
1973 new CallInterfaceDescriptor[NUMBER_OF_CALL_DESCRIPTORS]; 1977 new CallInterfaceDescriptor[NUMBER_OF_CALL_DESCRIPTORS];
1974 cpu_profiler_ = new CpuProfiler(this); 1978 cpu_profiler_ = new CpuProfiler(this);
1975 heap_profiler_ = new HeapProfiler(heap()); 1979 heap_profiler_ = new HeapProfiler(heap());
1980 lexer_gc_handler_ = new LexerGCHandler(this);
1976 1981
1977 // Enable logging before setting up the heap 1982 // Enable logging before setting up the heap
1978 logger_->SetUp(this); 1983 logger_->SetUp(this);
1979 1984
1980 // Initialize other runtime facilities 1985 // Initialize other runtime facilities
1981 #if defined(USE_SIMULATOR) 1986 #if defined(USE_SIMULATOR)
1982 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS 1987 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_A64 || V8_TARGET_ARCH_MIPS
1983 Simulator::Initialize(this); 1988 Simulator::Initialize(this);
1984 #endif 1989 #endif
1985 #endif 1990 #endif
1986 1991
1987 { // NOLINT 1992 { // NOLINT
1988 // Ensure that the thread has a valid stack guard. The v8::Locker object 1993 // Ensure that the thread has a valid stack guard. The v8::Locker object
1989 // will ensure this too, but we don't have to use lockers if we are only 1994 // will ensure this too, but we don't have to use lockers if we are only
1990 // using one thread. 1995 // using one thread.
1991 ExecutionAccess lock(this); 1996 ExecutionAccess lock(this);
1992 stack_guard_.InitThread(lock); 1997 stack_guard_.InitThread(lock);
(...skipping 17 matching lines...) Expand all
2010 if (create_heap_objects) { 2015 if (create_heap_objects) {
2011 // Terminate the cache array with the sentinel so we can iterate. 2016 // Terminate the cache array with the sentinel so we can iterate.
2012 PushToPartialSnapshotCache(heap_.undefined_value()); 2017 PushToPartialSnapshotCache(heap_.undefined_value());
2013 } 2018 }
2014 2019
2015 InitializeThreadLocal(); 2020 InitializeThreadLocal();
2016 2021
2017 bootstrapper_->Initialize(create_heap_objects); 2022 bootstrapper_->Initialize(create_heap_objects);
2018 builtins_.SetUp(this, create_heap_objects); 2023 builtins_.SetUp(this, create_heap_objects);
2019 2024
2020 if (create_heap_objects) heap_.CreateStubsRequiringBuiltins();
2021
2022 // Set default value if not yet set. 2025 // Set default value if not yet set.
2023 // TODO(yangguo): move this to ResourceConstraints::ConfigureDefaults 2026 // TODO(yangguo): move this to ResourceConstraints::ConfigureDefaults
2024 // once ResourceConstraints becomes an argument to the Isolate constructor. 2027 // once ResourceConstraints becomes an argument to the Isolate constructor.
2025 if (max_available_threads_ < 1) { 2028 if (max_available_threads_ < 1) {
2026 // Choose the default between 1 and 4. 2029 // Choose the default between 1 and 4.
2027 max_available_threads_ = Max(Min(CPU::NumberOfProcessorsOnline(), 4), 1); 2030 max_available_threads_ = Max(Min(CPU::NumberOfProcessorsOnline(), 4), 1);
2028 } 2031 }
2029 2032
2030 num_sweeper_threads_ = SweeperThread::NumberOfThreads(max_available_threads_); 2033 if (!FLAG_job_based_sweeping) {
2034 num_sweeper_threads_ =
2035 SweeperThread::NumberOfThreads(max_available_threads_);
2036 }
2031 2037
2032 if (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs) { 2038 if (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs) {
2033 PrintF("Concurrent recompilation has been disabled for tracing.\n"); 2039 PrintF("Concurrent recompilation has been disabled for tracing.\n");
2034 } else if (OptimizingCompilerThread::Enabled(max_available_threads_)) { 2040 } else if (OptimizingCompilerThread::Enabled(max_available_threads_)) {
2035 optimizing_compiler_thread_ = new OptimizingCompilerThread(this); 2041 optimizing_compiler_thread_ = new OptimizingCompilerThread(this);
2036 optimizing_compiler_thread_->Start(); 2042 optimizing_compiler_thread_->Start();
2037 } 2043 }
2038 2044
2039 if (num_sweeper_threads_ > 0) { 2045 if (num_sweeper_threads_ > 0) {
2040 sweeper_thread_ = new SweeperThread*[num_sweeper_threads_]; 2046 sweeper_thread_ = new SweeperThread*[num_sweeper_threads_];
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 kDeoptTableSerializeEntryCount - 1); 2112 kDeoptTableSerializeEntryCount - 1);
2107 } 2113 }
2108 2114
2109 if (!Serializer::enabled()) { 2115 if (!Serializer::enabled()) {
2110 // Ensure that all stubs which need to be generated ahead of time, but 2116 // Ensure that all stubs which need to be generated ahead of time, but
2111 // cannot be serialized into the snapshot have been generated. 2117 // cannot be serialized into the snapshot have been generated.
2112 HandleScope scope(this); 2118 HandleScope scope(this);
2113 CodeStub::GenerateFPStubs(this); 2119 CodeStub::GenerateFPStubs(this);
2114 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(this); 2120 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(this);
2115 StubFailureTrampolineStub::GenerateAheadOfTime(this); 2121 StubFailureTrampolineStub::GenerateAheadOfTime(this);
2116 StubFailureTailCallTrampolineStub::GenerateAheadOfTime(this); 2122 // Ensure interface descriptors are initialized even when stubs have been
2117 // TODO(mstarzinger): The following is an ugly hack to make sure the 2123 // deserialized out of the snapshot without using the graph builder.
2118 // interface descriptor is initialized even when stubs have been 2124 FastCloneShallowArrayStub::InstallDescriptors(this);
2119 // deserialized out of the snapshot without the graph builder.
2120 FastCloneShallowArrayStub stub(FastCloneShallowArrayStub::CLONE_ELEMENTS,
2121 DONT_TRACK_ALLOCATION_SITE, 0);
2122 stub.InitializeInterfaceDescriptor(
2123 this, code_stub_interface_descriptor(CodeStub::FastCloneShallowArray));
2124 BinaryOpICStub::InstallDescriptors(this); 2125 BinaryOpICStub::InstallDescriptors(this);
2125 BinaryOpWithAllocationSiteStub::InstallDescriptors(this); 2126 BinaryOpWithAllocationSiteStub::InstallDescriptors(this);
2126 CompareNilICStub::InitializeForIsolate(this); 2127 CompareNilICStub::InstallDescriptors(this);
2127 ToBooleanStub::InitializeForIsolate(this); 2128 ToBooleanStub::InstallDescriptors(this);
2129 ToNumberStub::InstallDescriptors(this);
2128 ArrayConstructorStubBase::InstallDescriptors(this); 2130 ArrayConstructorStubBase::InstallDescriptors(this);
2129 InternalArrayConstructorStubBase::InstallDescriptors(this); 2131 InternalArrayConstructorStubBase::InstallDescriptors(this);
2130 FastNewClosureStub::InstallDescriptors(this); 2132 FastNewClosureStub::InstallDescriptors(this);
2133 FastNewContextStub::InstallDescriptors(this);
2131 NumberToStringStub::InstallDescriptors(this); 2134 NumberToStringStub::InstallDescriptors(this);
2132 NewStringAddStub::InstallDescriptors(this); 2135 StringAddStub::InstallDescriptors(this);
2136 RegExpConstructResultStub::InstallDescriptors(this);
2133 } 2137 }
2134 2138
2135 CallDescriptors::InitializeForIsolate(this); 2139 CallDescriptors::InitializeForIsolate(this);
2136 2140
2137 initialized_from_snapshot_ = (des != NULL); 2141 initialized_from_snapshot_ = (des != NULL);
2138 2142
2139 return true; 2143 return true;
2140 } 2144 }
2141 2145
2142 2146
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 Isolate::call_descriptor(CallDescriptorKey index) { 2319 Isolate::call_descriptor(CallDescriptorKey index) {
2316 ASSERT(0 <= index && index < NUMBER_OF_CALL_DESCRIPTORS); 2320 ASSERT(0 <= index && index < NUMBER_OF_CALL_DESCRIPTORS);
2317 return &call_descriptors_[index]; 2321 return &call_descriptors_[index];
2318 } 2322 }
2319 2323
2320 2324
2321 Object* Isolate::FindCodeObject(Address a) { 2325 Object* Isolate::FindCodeObject(Address a) {
2322 return inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer(a); 2326 return inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer(a);
2323 } 2327 }
2324 2328
2325
2326 void Isolate::AddScanner(ScannerBase* scanner) {
2327 if (scanners_.empty()) {
2328 heap()->AddGCEpilogueCallback(
2329 &Isolate::UpdateScannersAfterGC, kGCTypeAll, true);
2330 }
2331 scanners_.insert(scanner);
2332 }
2333
2334
2335 void Isolate::RemoveScanner(ScannerBase* scanner) {
2336 scanners_.erase(scanner);
2337 if (scanners_.empty()) {
2338 heap()->RemoveGCEpilogueCallback(&Isolate::UpdateScannersAfterGC);
2339 }
2340 }
2341
2342
2343 #ifdef DEBUG 2329 #ifdef DEBUG
2344 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2330 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2345 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2331 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2346 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2332 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
2347 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2333 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
2348 #undef ISOLATE_FIELD_OFFSET 2334 #undef ISOLATE_FIELD_OFFSET
2349 #endif 2335 #endif
2350 2336
2351 } } // namespace v8::internal 2337 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/json.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698