| 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/basic-block-profiler.h" |
| 13 #include "src/bootstrapper.h" | 14 #include "src/bootstrapper.h" |
| 14 #include "src/codegen.h" | 15 #include "src/codegen.h" |
| 15 #include "src/compilation-cache.h" | 16 #include "src/compilation-cache.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" |
| (...skipping 1486 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 delete basic_block_profiler_; |
| 1647 basic_block_profiler_ = NULL; |
| 1648 |
| 1643 heap_.TearDown(); | 1649 heap_.TearDown(); |
| 1644 logger_->TearDown(); | 1650 logger_->TearDown(); |
| 1645 | 1651 |
| 1646 delete heap_profiler_; | 1652 delete heap_profiler_; |
| 1647 heap_profiler_ = NULL; | 1653 heap_profiler_ = NULL; |
| 1648 delete cpu_profiler_; | 1654 delete cpu_profiler_; |
| 1649 cpu_profiler_ = NULL; | 1655 cpu_profiler_ = NULL; |
| 1650 | 1656 |
| 1651 // The default isolate is re-initializable due to legacy API. | 1657 // The default isolate is re-initializable due to legacy API. |
| 1652 state_ = UNINITIALIZED; | 1658 state_ = UNINITIALIZED; |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 } | 2362 } |
| 2357 | 2363 |
| 2358 | 2364 |
| 2359 void Isolate::CountUsage(v8::Isolate::UseCounterFeature feature) { | 2365 void Isolate::CountUsage(v8::Isolate::UseCounterFeature feature) { |
| 2360 if (use_counter_callback_) { | 2366 if (use_counter_callback_) { |
| 2361 use_counter_callback_(reinterpret_cast<v8::Isolate*>(this), feature); | 2367 use_counter_callback_(reinterpret_cast<v8::Isolate*>(this), feature); |
| 2362 } | 2368 } |
| 2363 } | 2369 } |
| 2364 | 2370 |
| 2365 | 2371 |
| 2372 BasicBlockProfiler* Isolate::GetOrCreateBasicBlockProfiler() { |
| 2373 if (basic_block_profiler_ == NULL) { |
| 2374 basic_block_profiler_ = new BasicBlockProfiler(); |
| 2375 } |
| 2376 return basic_block_profiler_; |
| 2377 } |
| 2378 |
| 2379 |
| 2366 bool StackLimitCheck::JsHasOverflowed() const { | 2380 bool StackLimitCheck::JsHasOverflowed() const { |
| 2367 StackGuard* stack_guard = isolate_->stack_guard(); | 2381 StackGuard* stack_guard = isolate_->stack_guard(); |
| 2368 #ifdef USE_SIMULATOR | 2382 #ifdef USE_SIMULATOR |
| 2369 // The simulator uses a separate JS stack. | 2383 // The simulator uses a separate JS stack. |
| 2370 Address jssp_address = Simulator::current(isolate_)->get_sp(); | 2384 Address jssp_address = Simulator::current(isolate_)->get_sp(); |
| 2371 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); | 2385 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); |
| 2372 if (jssp < stack_guard->real_jslimit()) return true; | 2386 if (jssp < stack_guard->real_jslimit()) return true; |
| 2373 #endif // USE_SIMULATOR | 2387 #endif // USE_SIMULATOR |
| 2374 return GetCurrentStackPosition() < stack_guard->real_climit(); | 2388 return GetCurrentStackPosition() < stack_guard->real_climit(); |
| 2375 } | 2389 } |
| 2376 | 2390 |
| 2377 | 2391 |
| 2378 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { | 2392 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { |
| 2379 // First check whether the previous scope intercepts. | 2393 // First check whether the previous scope intercepts. |
| 2380 if (prev_ && prev_->Intercept(flag)) return true; | 2394 if (prev_ && prev_->Intercept(flag)) return true; |
| 2381 // Then check whether this scope intercepts. | 2395 // Then check whether this scope intercepts. |
| 2382 if ((flag & intercept_mask_)) { | 2396 if ((flag & intercept_mask_)) { |
| 2383 intercepted_flags_ |= flag; | 2397 intercepted_flags_ |= flag; |
| 2384 return true; | 2398 return true; |
| 2385 } | 2399 } |
| 2386 return false; | 2400 return false; |
| 2387 } | 2401 } |
| 2388 | 2402 |
| 2389 } } // namespace v8::internal | 2403 } } // namespace v8::internal |
| OLD | NEW |