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" |
(...skipping 2754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2765 } | 2765 } |
2766 if (new_length == 0) { | 2766 if (new_length == 0) { |
2767 heap()->set_detached_contexts(heap()->empty_fixed_array()); | 2767 heap()->set_detached_contexts(heap()->empty_fixed_array()); |
2768 } else if (new_length < length) { | 2768 } else if (new_length < length) { |
2769 heap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>( | 2769 heap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>( |
2770 *detached_contexts, length - new_length); | 2770 *detached_contexts, length - new_length); |
2771 } | 2771 } |
2772 } | 2772 } |
2773 | 2773 |
2774 | 2774 |
2775 bool StackLimitCheck::JsHasOverflowed() const { | 2775 bool StackLimitCheck::JsHasOverflowed(uintptr_t gap) const { |
2776 StackGuard* stack_guard = isolate_->stack_guard(); | 2776 StackGuard* stack_guard = isolate_->stack_guard(); |
2777 #ifdef USE_SIMULATOR | 2777 #ifdef USE_SIMULATOR |
2778 // The simulator uses a separate JS stack. | 2778 // The simulator uses a separate JS stack. |
2779 Address jssp_address = Simulator::current(isolate_)->get_sp(); | 2779 Address jssp_address = Simulator::current(isolate_)->get_sp(); |
2780 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); | 2780 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); |
2781 if (jssp < stack_guard->real_jslimit()) return true; | 2781 if (jssp - gap < stack_guard->real_jslimit()) return true; |
2782 #endif // USE_SIMULATOR | 2782 #endif // USE_SIMULATOR |
2783 return GetCurrentStackPosition() < stack_guard->real_climit(); | 2783 return GetCurrentStackPosition() - gap < stack_guard->real_climit(); |
2784 } | 2784 } |
2785 | 2785 |
2786 | 2786 |
2787 SaveContext::SaveContext(Isolate* isolate) | 2787 SaveContext::SaveContext(Isolate* isolate) |
2788 : isolate_(isolate), prev_(isolate->save_context()) { | 2788 : isolate_(isolate), prev_(isolate->save_context()) { |
2789 if (isolate->context() != NULL) { | 2789 if (isolate->context() != NULL) { |
2790 context_ = Handle<Context>(isolate->context()); | 2790 context_ = Handle<Context>(isolate->context()); |
2791 } | 2791 } |
2792 isolate->set_save_context(this); | 2792 isolate->set_save_context(this); |
2793 | 2793 |
2794 c_entry_fp_ = isolate->c_entry_fp(isolate->thread_local_top()); | 2794 c_entry_fp_ = isolate->c_entry_fp(isolate->thread_local_top()); |
2795 } | 2795 } |
2796 | 2796 |
2797 | 2797 |
2798 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { | 2798 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { |
2799 // First check whether the previous scope intercepts. | 2799 // First check whether the previous scope intercepts. |
2800 if (prev_ && prev_->Intercept(flag)) return true; | 2800 if (prev_ && prev_->Intercept(flag)) return true; |
2801 // Then check whether this scope intercepts. | 2801 // Then check whether this scope intercepts. |
2802 if ((flag & intercept_mask_)) { | 2802 if ((flag & intercept_mask_)) { |
2803 intercepted_flags_ |= flag; | 2803 intercepted_flags_ |= flag; |
2804 return true; | 2804 return true; |
2805 } | 2805 } |
2806 return false; | 2806 return false; |
2807 } | 2807 } |
2808 | 2808 |
2809 } // namespace internal | 2809 } // namespace internal |
2810 } // namespace v8 | 2810 } // namespace v8 |
OLD | NEW |