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

Side by Side Diff: src/isolate.cc

Issue 181453002: Reset trunk to 3.24.35.4 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 try_catch_handler() : NULL; 939 try_catch_handler() : NULL;
940 940
941 // Set the exception being re-thrown. 941 // Set the exception being re-thrown.
942 set_pending_exception(exception); 942 set_pending_exception(exception);
943 if (exception->IsFailure()) return exception->ToFailureUnchecked(); 943 if (exception->IsFailure()) return exception->ToFailureUnchecked();
944 return Failure::Exception(); 944 return Failure::Exception();
945 } 945 }
946 946
947 947
948 Failure* Isolate::ThrowIllegalOperation() { 948 Failure* Isolate::ThrowIllegalOperation() {
949 if (FLAG_stack_trace_on_illegal) PrintStack(stdout);
950 return Throw(heap_.illegal_access_string()); 949 return Throw(heap_.illegal_access_string());
951 } 950 }
952 951
953 952
954 void Isolate::ScheduleThrow(Object* exception) { 953 void Isolate::ScheduleThrow(Object* exception) {
955 // When scheduling a throw we first throw the exception to get the 954 // When scheduling a throw we first throw the exception to get the
956 // error reporting if it is uncaught before rescheduling it. 955 // error reporting if it is uncaught before rescheduling it.
957 Throw(exception); 956 Throw(exception);
958 PropagatePendingExceptionToExternalTryCatch(); 957 PropagatePendingExceptionToExternalTryCatch();
959 if (has_pending_exception()) { 958 if (has_pending_exception()) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 MessageLocation potential_computed_location; 1115 MessageLocation potential_computed_location;
1117 if (location == NULL) { 1116 if (location == NULL) {
1118 // If no location was specified we use a computed one instead. 1117 // If no location was specified we use a computed one instead.
1119 ComputeLocation(&potential_computed_location); 1118 ComputeLocation(&potential_computed_location);
1120 location = &potential_computed_location; 1119 location = &potential_computed_location;
1121 } 1120 }
1122 // It's not safe to try to make message objects or collect stack traces 1121 // It's not safe to try to make message objects or collect stack traces
1123 // while the bootstrapper is active since the infrastructure may not have 1122 // while the bootstrapper is active since the infrastructure may not have
1124 // been properly initialized. 1123 // been properly initialized.
1125 if (!bootstrapping) { 1124 if (!bootstrapping) {
1125 Handle<String> stack_trace;
1126 if (FLAG_trace_exception) stack_trace = StackTraceString();
1126 Handle<JSArray> stack_trace_object; 1127 Handle<JSArray> stack_trace_object;
1127 if (capture_stack_trace_for_uncaught_exceptions_) { 1128 if (capture_stack_trace_for_uncaught_exceptions_) {
1128 if (IsErrorObject(exception_handle)) { 1129 if (IsErrorObject(exception_handle)) {
1129 // We fetch the stack trace that corresponds to this error object. 1130 // We fetch the stack trace that corresponds to this error object.
1130 String* key = heap()->hidden_stack_trace_string(); 1131 String* key = heap()->hidden_stack_trace_string();
1131 Object* stack_property = 1132 Object* stack_property =
1132 JSObject::cast(*exception_handle)->GetHiddenProperty(key); 1133 JSObject::cast(*exception_handle)->GetHiddenProperty(key);
1133 // 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
1134 // a valid Error object. 1135 // a valid Error object.
1135 if (stack_property->IsJSArray()) { 1136 if (stack_property->IsJSArray()) {
(...skipping 19 matching lines...) Expand all
1155 if (failed) { 1156 if (failed) {
1156 exception_arg = factory()->InternalizeOneByteString( 1157 exception_arg = factory()->InternalizeOneByteString(
1157 STATIC_ASCII_VECTOR("exception")); 1158 STATIC_ASCII_VECTOR("exception"));
1158 } 1159 }
1159 } 1160 }
1160 Handle<Object> message_obj = MessageHandler::MakeMessageObject( 1161 Handle<Object> message_obj = MessageHandler::MakeMessageObject(
1161 this, 1162 this,
1162 "uncaught_exception", 1163 "uncaught_exception",
1163 location, 1164 location,
1164 HandleVector<Object>(&exception_arg, 1), 1165 HandleVector<Object>(&exception_arg, 1),
1166 stack_trace,
1165 stack_trace_object); 1167 stack_trace_object);
1166 thread_local_top()->pending_message_obj_ = *message_obj; 1168 thread_local_top()->pending_message_obj_ = *message_obj;
1167 if (location != NULL) { 1169 if (location != NULL) {
1168 thread_local_top()->pending_message_script_ = *location->script(); 1170 thread_local_top()->pending_message_script_ = *location->script();
1169 thread_local_top()->pending_message_start_pos_ = location->start_pos(); 1171 thread_local_top()->pending_message_start_pos_ = location->start_pos();
1170 thread_local_top()->pending_message_end_pos_ = location->end_pos(); 1172 thread_local_top()->pending_message_end_pos_ = location->end_pos();
1171 } 1173 }
1172 1174
1173 // If the abort-on-uncaught-exception flag is specified, abort on any 1175 // If the abort-on-uncaught-exception flag is specified, abort on any
1174 // exception not caught by JavaScript, even when an external handler is 1176 // exception not caught by JavaScript, even when an external handler is
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 use_crankshaft_(true), 1559 use_crankshaft_(true),
1558 initialized_from_snapshot_(false), 1560 initialized_from_snapshot_(false),
1559 cpu_profiler_(NULL), 1561 cpu_profiler_(NULL),
1560 heap_profiler_(NULL), 1562 heap_profiler_(NULL),
1561 function_entry_hook_(NULL), 1563 function_entry_hook_(NULL),
1562 deferred_handles_head_(NULL), 1564 deferred_handles_head_(NULL),
1563 optimizing_compiler_thread_(NULL), 1565 optimizing_compiler_thread_(NULL),
1564 sweeper_thread_(NULL), 1566 sweeper_thread_(NULL),
1565 num_sweeper_threads_(0), 1567 num_sweeper_threads_(0),
1566 max_available_threads_(0), 1568 max_available_threads_(0),
1567 stress_deopt_count_(0), 1569 stress_deopt_count_(0) {
1568 next_optimization_id_(0) {
1569 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1); 1570 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1);
1570 TRACE_ISOLATE(constructor); 1571 TRACE_ISOLATE(constructor);
1571 1572
1572 memset(isolate_addresses_, 0, 1573 memset(isolate_addresses_, 0,
1573 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); 1574 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1));
1574 1575
1575 heap_.isolate_ = this; 1576 heap_.isolate_ = this;
1576 stack_guard_.isolate_ = this; 1577 stack_guard_.isolate_ = this;
1577 1578
1578 // ThreadManager is initialized early to support locking an isolate 1579 // ThreadManager is initialized early to support locking an isolate
1579 // before it is entered. 1580 // before it is entered.
1580 thread_manager_ = new ThreadManager(); 1581 thread_manager_ = new ThreadManager();
1581 thread_manager_->isolate_ = this; 1582 thread_manager_->isolate_ = this;
1582 1583
1583 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ 1584 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \
1584 V8_TARGET_ARCH_A64 && !defined(__aarch64__) || \
1585 V8_TARGET_ARCH_MIPS && !defined(__mips__) 1585 V8_TARGET_ARCH_MIPS && !defined(__mips__)
1586 simulator_initialized_ = false; 1586 simulator_initialized_ = false;
1587 simulator_i_cache_ = NULL; 1587 simulator_i_cache_ = NULL;
1588 simulator_redirection_ = NULL; 1588 simulator_redirection_ = NULL;
1589 #endif 1589 #endif
1590 1590
1591 #ifdef DEBUG 1591 #ifdef DEBUG
1592 // heap_histograms_ initializes itself. 1592 // heap_histograms_ initializes itself.
1593 memset(&js_spill_information_, 0, sizeof(js_spill_information_)); 1593 memset(&js_spill_information_, 0, sizeof(js_spill_information_));
1594 memset(code_kind_statistics_, 0, 1594 memset(code_kind_statistics_, 0,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 } 1665 }
1666 1666
1667 for (int i = 0; i < num_sweeper_threads_; i++) { 1667 for (int i = 0; i < num_sweeper_threads_; i++) {
1668 sweeper_thread_[i]->Stop(); 1668 sweeper_thread_[i]->Stop();
1669 delete sweeper_thread_[i]; 1669 delete sweeper_thread_[i];
1670 sweeper_thread_[i] = NULL; 1670 sweeper_thread_[i] = NULL;
1671 } 1671 }
1672 delete[] sweeper_thread_; 1672 delete[] sweeper_thread_;
1673 sweeper_thread_ = NULL; 1673 sweeper_thread_ = NULL;
1674 1674
1675 if (FLAG_job_based_sweeping &&
1676 heap_.mark_compact_collector()->IsConcurrentSweepingInProgress()) {
1677 heap_.mark_compact_collector()->WaitUntilSweepingCompleted();
1678 }
1679 1675
1680 if (FLAG_hydrogen_stats) GetHStatistics()->Print(); 1676 if (FLAG_hydrogen_stats) GetHStatistics()->Print();
1681 1677
1682 if (FLAG_print_deopt_stress) { 1678 if (FLAG_print_deopt_stress) {
1683 PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_); 1679 PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_);
1684 } 1680 }
1685 1681
1686 // We must stop the logger before we tear down other components. 1682 // We must stop the logger before we tear down other components.
1687 Sampler* sampler = logger_->sampler(); 1683 Sampler* sampler = logger_->sampler();
1688 if (sampler && sampler->IsActive()) sampler->Stop(); 1684 if (sampler && sampler->IsActive()) sampler->Stop();
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 call_descriptors_ = 1960 call_descriptors_ =
1965 new CallInterfaceDescriptor[NUMBER_OF_CALL_DESCRIPTORS]; 1961 new CallInterfaceDescriptor[NUMBER_OF_CALL_DESCRIPTORS];
1966 cpu_profiler_ = new CpuProfiler(this); 1962 cpu_profiler_ = new CpuProfiler(this);
1967 heap_profiler_ = new HeapProfiler(heap()); 1963 heap_profiler_ = new HeapProfiler(heap());
1968 1964
1969 // Enable logging before setting up the heap 1965 // Enable logging before setting up the heap
1970 logger_->SetUp(this); 1966 logger_->SetUp(this);
1971 1967
1972 // Initialize other runtime facilities 1968 // Initialize other runtime facilities
1973 #if defined(USE_SIMULATOR) 1969 #if defined(USE_SIMULATOR)
1974 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_A64 || V8_TARGET_ARCH_MIPS 1970 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS
1975 Simulator::Initialize(this); 1971 Simulator::Initialize(this);
1976 #endif 1972 #endif
1977 #endif 1973 #endif
1978 1974
1979 { // NOLINT 1975 { // NOLINT
1980 // Ensure that the thread has a valid stack guard. The v8::Locker object 1976 // Ensure that the thread has a valid stack guard. The v8::Locker object
1981 // will ensure this too, but we don't have to use lockers if we are only 1977 // will ensure this too, but we don't have to use lockers if we are only
1982 // using one thread. 1978 // using one thread.
1983 ExecutionAccess lock(this); 1979 ExecutionAccess lock(this);
1984 stack_guard_.InitThread(lock); 1980 stack_guard_.InitThread(lock);
(...skipping 25 matching lines...) Expand all
2010 builtins_.SetUp(this, create_heap_objects); 2006 builtins_.SetUp(this, create_heap_objects);
2011 2007
2012 // Set default value if not yet set. 2008 // Set default value if not yet set.
2013 // TODO(yangguo): move this to ResourceConstraints::ConfigureDefaults 2009 // TODO(yangguo): move this to ResourceConstraints::ConfigureDefaults
2014 // once ResourceConstraints becomes an argument to the Isolate constructor. 2010 // once ResourceConstraints becomes an argument to the Isolate constructor.
2015 if (max_available_threads_ < 1) { 2011 if (max_available_threads_ < 1) {
2016 // Choose the default between 1 and 4. 2012 // Choose the default between 1 and 4.
2017 max_available_threads_ = Max(Min(CPU::NumberOfProcessorsOnline(), 4), 1); 2013 max_available_threads_ = Max(Min(CPU::NumberOfProcessorsOnline(), 4), 1);
2018 } 2014 }
2019 2015
2020 if (!FLAG_job_based_sweeping) { 2016 num_sweeper_threads_ = SweeperThread::NumberOfThreads(max_available_threads_);
2021 num_sweeper_threads_ =
2022 SweeperThread::NumberOfThreads(max_available_threads_);
2023 }
2024 2017
2025 if (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs) { 2018 if (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs) {
2026 PrintF("Concurrent recompilation has been disabled for tracing.\n"); 2019 PrintF("Concurrent recompilation has been disabled for tracing.\n");
2027 } else if (OptimizingCompilerThread::Enabled(max_available_threads_)) { 2020 } else if (OptimizingCompilerThread::Enabled(max_available_threads_)) {
2028 optimizing_compiler_thread_ = new OptimizingCompilerThread(this); 2021 optimizing_compiler_thread_ = new OptimizingCompilerThread(this);
2029 optimizing_compiler_thread_->Start(); 2022 optimizing_compiler_thread_->Start();
2030 } 2023 }
2031 2024
2032 if (num_sweeper_threads_ > 0) { 2025 if (num_sweeper_threads_ > 0) {
2033 sweeper_thread_ = new SweeperThread*[num_sweeper_threads_]; 2026 sweeper_thread_ = new SweeperThread*[num_sweeper_threads_];
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 kDeoptTableSerializeEntryCount - 1); 2092 kDeoptTableSerializeEntryCount - 1);
2100 } 2093 }
2101 2094
2102 if (!Serializer::enabled()) { 2095 if (!Serializer::enabled()) {
2103 // Ensure that all stubs which need to be generated ahead of time, but 2096 // Ensure that all stubs which need to be generated ahead of time, but
2104 // cannot be serialized into the snapshot have been generated. 2097 // cannot be serialized into the snapshot have been generated.
2105 HandleScope scope(this); 2098 HandleScope scope(this);
2106 CodeStub::GenerateFPStubs(this); 2099 CodeStub::GenerateFPStubs(this);
2107 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(this); 2100 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(this);
2108 StubFailureTrampolineStub::GenerateAheadOfTime(this); 2101 StubFailureTrampolineStub::GenerateAheadOfTime(this);
2109 // Ensure interface descriptors are initialized even when stubs have been 2102 // TODO(mstarzinger): The following is an ugly hack to make sure the
2110 // deserialized out of the snapshot without using the graph builder. 2103 // interface descriptor is initialized even when stubs have been
2111 FastCloneShallowArrayStub::InstallDescriptors(this); 2104 // deserialized out of the snapshot without the graph builder.
2105 FastCloneShallowArrayStub stub(FastCloneShallowArrayStub::CLONE_ELEMENTS,
2106 DONT_TRACK_ALLOCATION_SITE, 0);
2107 stub.InitializeInterfaceDescriptor(
2108 this, code_stub_interface_descriptor(CodeStub::FastCloneShallowArray));
2112 BinaryOpICStub::InstallDescriptors(this); 2109 BinaryOpICStub::InstallDescriptors(this);
2113 BinaryOpWithAllocationSiteStub::InstallDescriptors(this); 2110 BinaryOpWithAllocationSiteStub::InstallDescriptors(this);
2114 CompareNilICStub::InstallDescriptors(this); 2111 CompareNilICStub::InitializeForIsolate(this);
2115 ToBooleanStub::InstallDescriptors(this); 2112 ToBooleanStub::InitializeForIsolate(this);
2116 ToNumberStub::InstallDescriptors(this);
2117 ArrayConstructorStubBase::InstallDescriptors(this); 2113 ArrayConstructorStubBase::InstallDescriptors(this);
2118 InternalArrayConstructorStubBase::InstallDescriptors(this); 2114 InternalArrayConstructorStubBase::InstallDescriptors(this);
2119 FastNewClosureStub::InstallDescriptors(this); 2115 FastNewClosureStub::InstallDescriptors(this);
2120 FastNewContextStub::InstallDescriptors(this); 2116 FastNewContextStub::InstallDescriptors(this);
2121 NumberToStringStub::InstallDescriptors(this); 2117 NumberToStringStub::InstallDescriptors(this);
2122 StringAddStub::InstallDescriptors(this); 2118 StringAddStub::InstallDescriptors(this);
2123 RegExpConstructResultStub::InstallDescriptors(this); 2119 RegExpConstructResultStub::InstallDescriptors(this);
2124 } 2120 }
2125 2121
2126 CallDescriptors::InitializeForIsolate(this); 2122 CallDescriptors::InitializeForIsolate(this);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2316 2312
2317 #ifdef DEBUG 2313 #ifdef DEBUG
2318 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2314 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2319 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2315 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2320 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2316 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
2321 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2317 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
2322 #undef ISOLATE_FIELD_OFFSET 2318 #undef ISOLATE_FIELD_OFFSET
2323 #endif 2319 #endif
2324 2320
2325 } } // namespace v8::internal 2321 } } // 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