OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
11 #include "src/base/sys-info.h" | 11 #include "src/base/sys-info.h" |
12 #include "src/base/utils/random-number-generator.h" | 12 #include "src/base/utils/random-number-generator.h" |
13 #include "src/bootstrapper.h" | 13 #include "src/bootstrapper.h" |
14 #include "src/codegen.h" | 14 #include "src/codegen.h" |
15 #include "src/compilation-cache.h" | 15 #include "src/compilation-cache.h" |
| 16 #include "src/compiler/pipeline.h" |
16 #include "src/cpu-profiler.h" | 17 #include "src/cpu-profiler.h" |
17 #include "src/debug.h" | 18 #include "src/debug.h" |
18 #include "src/deoptimizer.h" | 19 #include "src/deoptimizer.h" |
19 #include "src/heap/spaces.h" | 20 #include "src/heap/spaces.h" |
20 #include "src/heap/sweeper-thread.h" | 21 #include "src/heap/sweeper-thread.h" |
21 #include "src/heap-profiler.h" | 22 #include "src/heap-profiler.h" |
22 #include "src/hydrogen.h" | 23 #include "src/hydrogen.h" |
23 #include "src/ic/stub-cache.h" | 24 #include "src/ic/stub-cache.h" |
24 #include "src/isolate-inl.h" | 25 #include "src/isolate-inl.h" |
25 #include "src/lithium-allocator.h" | 26 #include "src/lithium-allocator.h" |
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 initialized_from_snapshot_(false), | 1510 initialized_from_snapshot_(false), |
1510 cpu_profiler_(NULL), | 1511 cpu_profiler_(NULL), |
1511 heap_profiler_(NULL), | 1512 heap_profiler_(NULL), |
1512 function_entry_hook_(NULL), | 1513 function_entry_hook_(NULL), |
1513 deferred_handles_head_(NULL), | 1514 deferred_handles_head_(NULL), |
1514 optimizing_compiler_thread_(NULL), | 1515 optimizing_compiler_thread_(NULL), |
1515 sweeper_thread_(NULL), | 1516 sweeper_thread_(NULL), |
1516 num_sweeper_threads_(0), | 1517 num_sweeper_threads_(0), |
1517 stress_deopt_count_(0), | 1518 stress_deopt_count_(0), |
1518 next_optimization_id_(0), | 1519 next_optimization_id_(0), |
1519 use_counter_callback_(NULL) { | 1520 use_counter_callback_(NULL), |
| 1521 basic_block_profiler_(NULL) { |
1520 { | 1522 { |
1521 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); | 1523 base::LockGuard<base::Mutex> lock_guard(thread_data_table_mutex_.Pointer()); |
1522 CHECK(thread_data_table_); | 1524 CHECK(thread_data_table_); |
1523 } | 1525 } |
1524 id_ = base::NoBarrier_AtomicIncrement(&isolate_counter_, 1); | 1526 id_ = base::NoBarrier_AtomicIncrement(&isolate_counter_, 1); |
1525 TRACE_ISOLATE(constructor); | 1527 TRACE_ISOLATE(constructor); |
1526 | 1528 |
1527 memset(isolate_addresses_, 0, | 1529 memset(isolate_addresses_, 0, |
1528 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); | 1530 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); |
1529 | 1531 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 | 1635 |
1634 delete deoptimizer_data_; | 1636 delete deoptimizer_data_; |
1635 deoptimizer_data_ = NULL; | 1637 deoptimizer_data_ = NULL; |
1636 builtins_.TearDown(); | 1638 builtins_.TearDown(); |
1637 bootstrapper_->TearDown(); | 1639 bootstrapper_->TearDown(); |
1638 | 1640 |
1639 if (runtime_profiler_ != NULL) { | 1641 if (runtime_profiler_ != NULL) { |
1640 delete runtime_profiler_; | 1642 delete runtime_profiler_; |
1641 runtime_profiler_ = NULL; | 1643 runtime_profiler_ = NULL; |
1642 } | 1644 } |
| 1645 |
| 1646 if (basic_block_profiler_ != NULL) { |
| 1647 delete basic_block_profiler_; |
| 1648 basic_block_profiler_ = NULL; |
| 1649 } |
| 1650 |
1643 heap_.TearDown(); | 1651 heap_.TearDown(); |
1644 logger_->TearDown(); | 1652 logger_->TearDown(); |
1645 | 1653 |
1646 delete heap_profiler_; | 1654 delete heap_profiler_; |
1647 heap_profiler_ = NULL; | 1655 heap_profiler_ = NULL; |
1648 delete cpu_profiler_; | 1656 delete cpu_profiler_; |
1649 cpu_profiler_ = NULL; | 1657 cpu_profiler_ = NULL; |
1650 | 1658 |
1651 // The default isolate is re-initializable due to legacy API. | 1659 // The default isolate is re-initializable due to legacy API. |
1652 state_ = UNINITIALIZED; | 1660 state_ = UNINITIALIZED; |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 } | 2364 } |
2357 | 2365 |
2358 | 2366 |
2359 void Isolate::CountUsage(v8::Isolate::UseCounterFeature feature) { | 2367 void Isolate::CountUsage(v8::Isolate::UseCounterFeature feature) { |
2360 if (use_counter_callback_) { | 2368 if (use_counter_callback_) { |
2361 use_counter_callback_(reinterpret_cast<v8::Isolate*>(this), feature); | 2369 use_counter_callback_(reinterpret_cast<v8::Isolate*>(this), feature); |
2362 } | 2370 } |
2363 } | 2371 } |
2364 | 2372 |
2365 | 2373 |
| 2374 compiler::BasicBlockProfiler* Isolate::GetBasicBlockProfiler() { |
| 2375 if (basic_block_profiler_ == NULL) { |
| 2376 basic_block_profiler_ = new compiler::BasicBlockProfiler(); |
| 2377 } |
| 2378 return basic_block_profiler_; |
| 2379 } |
| 2380 |
| 2381 |
2366 bool StackLimitCheck::JsHasOverflowed() const { | 2382 bool StackLimitCheck::JsHasOverflowed() const { |
2367 StackGuard* stack_guard = isolate_->stack_guard(); | 2383 StackGuard* stack_guard = isolate_->stack_guard(); |
2368 #ifdef USE_SIMULATOR | 2384 #ifdef USE_SIMULATOR |
2369 // The simulator uses a separate JS stack. | 2385 // The simulator uses a separate JS stack. |
2370 Address jssp_address = Simulator::current(isolate_)->get_sp(); | 2386 Address jssp_address = Simulator::current(isolate_)->get_sp(); |
2371 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); | 2387 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); |
2372 if (jssp < stack_guard->real_jslimit()) return true; | 2388 if (jssp < stack_guard->real_jslimit()) return true; |
2373 #endif // USE_SIMULATOR | 2389 #endif // USE_SIMULATOR |
2374 return GetCurrentStackPosition() < stack_guard->real_climit(); | 2390 return GetCurrentStackPosition() < stack_guard->real_climit(); |
2375 } | 2391 } |
2376 | 2392 |
2377 | 2393 |
2378 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { | 2394 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { |
2379 // First check whether the previous scope intercepts. | 2395 // First check whether the previous scope intercepts. |
2380 if (prev_ && prev_->Intercept(flag)) return true; | 2396 if (prev_ && prev_->Intercept(flag)) return true; |
2381 // Then check whether this scope intercepts. | 2397 // Then check whether this scope intercepts. |
2382 if ((flag & intercept_mask_)) { | 2398 if ((flag & intercept_mask_)) { |
2383 intercepted_flags_ |= flag; | 2399 intercepted_flags_ |= flag; |
2384 return true; | 2400 return true; |
2385 } | 2401 } |
2386 return false; | 2402 return false; |
2387 } | 2403 } |
2388 | 2404 |
2389 } } // namespace v8::internal | 2405 } } // namespace v8::internal |
OLD | NEW |