| 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 "src/isolate.h" | 5 #include "src/isolate.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 3151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3162 StackGuard* stack_guard = isolate_->stack_guard(); | 3162 StackGuard* stack_guard = isolate_->stack_guard(); |
| 3163 #ifdef USE_SIMULATOR | 3163 #ifdef USE_SIMULATOR |
| 3164 // The simulator uses a separate JS stack. | 3164 // The simulator uses a separate JS stack. |
| 3165 Address jssp_address = Simulator::current(isolate_)->get_sp(); | 3165 Address jssp_address = Simulator::current(isolate_)->get_sp(); |
| 3166 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); | 3166 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); |
| 3167 if (jssp - gap < stack_guard->real_jslimit()) return true; | 3167 if (jssp - gap < stack_guard->real_jslimit()) return true; |
| 3168 #endif // USE_SIMULATOR | 3168 #endif // USE_SIMULATOR |
| 3169 return GetCurrentStackPosition() - gap < stack_guard->real_climit(); | 3169 return GetCurrentStackPosition() - gap < stack_guard->real_climit(); |
| 3170 } | 3170 } |
| 3171 | 3171 |
| 3172 | |
| 3173 SaveContext::SaveContext(Isolate* isolate) | |
| 3174 : isolate_(isolate), prev_(isolate->save_context()) { | |
| 3175 if (isolate->context() != NULL) { | |
| 3176 context_ = Handle<Context>(isolate->context()); | |
| 3177 } | |
| 3178 isolate->set_save_context(this); | |
| 3179 | |
| 3180 c_entry_fp_ = isolate->c_entry_fp(isolate->thread_local_top()); | |
| 3181 } | |
| 3182 | |
| 3183 | |
| 3184 SaveContext::~SaveContext() { | |
| 3185 isolate_->set_context(context_.is_null() ? NULL : *context_); | |
| 3186 isolate_->set_save_context(prev_); | |
| 3187 } | |
| 3188 | |
| 3189 | |
| 3190 #ifdef DEBUG | 3172 #ifdef DEBUG |
| 3191 AssertNoContextChange::AssertNoContextChange(Isolate* isolate) | 3173 AssertNoContextChange::AssertNoContextChange(Isolate* isolate) |
| 3192 : isolate_(isolate), context_(isolate->context(), isolate) {} | 3174 : isolate_(isolate), context_(isolate->context(), isolate) {} |
| 3193 #endif // DEBUG | 3175 #endif // DEBUG |
| 3194 | 3176 |
| 3195 | 3177 |
| 3196 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { | 3178 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { |
| 3197 // First check whether the previous scope intercepts. | 3179 // First check whether the previous scope intercepts. |
| 3198 if (prev_ && prev_->Intercept(flag)) return true; | 3180 if (prev_ && prev_->Intercept(flag)) return true; |
| 3199 // Then check whether this scope intercepts. | 3181 // Then check whether this scope intercepts. |
| 3200 if ((flag & intercept_mask_)) { | 3182 if ((flag & intercept_mask_)) { |
| 3201 intercepted_flags_ |= flag; | 3183 intercepted_flags_ |= flag; |
| 3202 return true; | 3184 return true; |
| 3203 } | 3185 } |
| 3204 return false; | 3186 return false; |
| 3205 } | 3187 } |
| 3206 | 3188 |
| 3207 } // namespace internal | 3189 } // namespace internal |
| 3208 } // namespace v8 | 3190 } // namespace v8 |
| OLD | NEW |