| 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 <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/v8.h" | 10 #include "src/v8.h" |
| 11 | 11 |
| 12 #include "src/ast.h" | 12 #include "src/ast.h" |
| 13 #include "src/base/platform/platform.h" | 13 #include "src/base/platform/platform.h" |
| 14 #include "src/base/sys-info.h" | 14 #include "src/base/sys-info.h" |
| 15 #include "src/base/utils/random-number-generator.h" | 15 #include "src/base/utils/random-number-generator.h" |
| 16 #include "src/basic-block-profiler.h" | 16 #include "src/basic-block-profiler.h" |
| 17 #include "src/bootstrapper.h" | 17 #include "src/bootstrapper.h" |
| 18 #include "src/codegen.h" | 18 #include "src/codegen.h" |
| 19 #include "src/compilation-cache.h" | 19 #include "src/compilation-cache.h" |
| 20 #include "src/compilation-statistics.h" | 20 #include "src/compilation-statistics.h" |
| 21 #include "src/cpu-profiler.h" | 21 #include "src/cpu-profiler.h" |
| 22 #include "src/debug.h" | 22 #include "src/debug.h" |
| 23 #include "src/deoptimizer.h" | 23 #include "src/deoptimizer.h" |
| 24 #include "src/heap/spaces.h" | 24 #include "src/heap/spaces.h" |
| 25 #include "src/heap-profiler.h" | 25 #include "src/heap-profiler.h" |
| 26 #include "src/hydrogen.h" | 26 #include "src/hydrogen.h" |
| 27 #include "src/ic/stub-cache.h" | 27 #include "src/ic/stub-cache.h" |
| 28 #include "src/isolate-inl.h" | |
| 29 #include "src/lithium-allocator.h" | 28 #include "src/lithium-allocator.h" |
| 30 #include "src/log.h" | 29 #include "src/log.h" |
| 31 #include "src/messages.h" | 30 #include "src/messages.h" |
| 32 #include "src/prototype.h" | 31 #include "src/prototype.h" |
| 33 #include "src/regexp-stack.h" | 32 #include "src/regexp-stack.h" |
| 34 #include "src/runtime-profiler.h" | 33 #include "src/runtime-profiler.h" |
| 35 #include "src/sampler.h" | 34 #include "src/sampler.h" |
| 36 #include "src/scopeinfo.h" | 35 #include "src/scopeinfo.h" |
| 37 #include "src/simulator.h" | 36 #include "src/simulator.h" |
| 38 #include "src/snapshot/serialize.h" | 37 #include "src/snapshot/serialize.h" |
| (...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2400 return iter.IsAtEnd(); | 2399 return iter.IsAtEnd(); |
| 2401 } | 2400 } |
| 2402 | 2401 |
| 2403 | 2402 |
| 2404 CallInterfaceDescriptorData* Isolate::call_descriptor_data(int index) { | 2403 CallInterfaceDescriptorData* Isolate::call_descriptor_data(int index) { |
| 2405 DCHECK(0 <= index && index < CallDescriptors::NUMBER_OF_DESCRIPTORS); | 2404 DCHECK(0 <= index && index < CallDescriptors::NUMBER_OF_DESCRIPTORS); |
| 2406 return &call_descriptor_data_[index]; | 2405 return &call_descriptor_data_[index]; |
| 2407 } | 2406 } |
| 2408 | 2407 |
| 2409 | 2408 |
| 2409 base::RandomNumberGenerator* Isolate::random_number_generator() { |
| 2410 if (random_number_generator_ == NULL) { |
| 2411 if (FLAG_random_seed != 0) { |
| 2412 random_number_generator_ = |
| 2413 new base::RandomNumberGenerator(FLAG_random_seed); |
| 2414 } else { |
| 2415 random_number_generator_ = new base::RandomNumberGenerator(); |
| 2416 } |
| 2417 } |
| 2418 return random_number_generator_; |
| 2419 } |
| 2420 |
| 2421 |
| 2410 Object* Isolate::FindCodeObject(Address a) { | 2422 Object* Isolate::FindCodeObject(Address a) { |
| 2411 return inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer(a); | 2423 return inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer(a); |
| 2412 } | 2424 } |
| 2413 | 2425 |
| 2414 | 2426 |
| 2415 #ifdef DEBUG | 2427 #ifdef DEBUG |
| 2416 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2428 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 2417 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2429 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 2418 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2430 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 2419 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2431 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2654 #ifdef USE_SIMULATOR | 2666 #ifdef USE_SIMULATOR |
| 2655 // The simulator uses a separate JS stack. | 2667 // The simulator uses a separate JS stack. |
| 2656 Address jssp_address = Simulator::current(isolate_)->get_sp(); | 2668 Address jssp_address = Simulator::current(isolate_)->get_sp(); |
| 2657 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); | 2669 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); |
| 2658 if (jssp < stack_guard->real_jslimit()) return true; | 2670 if (jssp < stack_guard->real_jslimit()) return true; |
| 2659 #endif // USE_SIMULATOR | 2671 #endif // USE_SIMULATOR |
| 2660 return GetCurrentStackPosition() < stack_guard->real_climit(); | 2672 return GetCurrentStackPosition() < stack_guard->real_climit(); |
| 2661 } | 2673 } |
| 2662 | 2674 |
| 2663 | 2675 |
| 2676 SaveContext::SaveContext(Isolate* isolate) |
| 2677 : isolate_(isolate), prev_(isolate->save_context()) { |
| 2678 if (isolate->context() != NULL) { |
| 2679 context_ = Handle<Context>(isolate->context()); |
| 2680 } |
| 2681 isolate->set_save_context(this); |
| 2682 |
| 2683 c_entry_fp_ = isolate->c_entry_fp(isolate->thread_local_top()); |
| 2684 } |
| 2685 |
| 2686 |
| 2664 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { | 2687 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { |
| 2665 // First check whether the previous scope intercepts. | 2688 // First check whether the previous scope intercepts. |
| 2666 if (prev_ && prev_->Intercept(flag)) return true; | 2689 if (prev_ && prev_->Intercept(flag)) return true; |
| 2667 // Then check whether this scope intercepts. | 2690 // Then check whether this scope intercepts. |
| 2668 if ((flag & intercept_mask_)) { | 2691 if ((flag & intercept_mask_)) { |
| 2669 intercepted_flags_ |= flag; | 2692 intercepted_flags_ |= flag; |
| 2670 return true; | 2693 return true; |
| 2671 } | 2694 } |
| 2672 return false; | 2695 return false; |
| 2673 } | 2696 } |
| 2674 | 2697 |
| 2675 } } // namespace v8::internal | 2698 } } // namespace v8::internal |
| OLD | NEW |