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 3237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3248 StackGuard* stack_guard = isolate_->stack_guard(); | 3248 StackGuard* stack_guard = isolate_->stack_guard(); |
3249 #ifdef USE_SIMULATOR | 3249 #ifdef USE_SIMULATOR |
3250 // The simulator uses a separate JS stack. | 3250 // The simulator uses a separate JS stack. |
3251 Address jssp_address = Simulator::current(isolate_)->get_sp(); | 3251 Address jssp_address = Simulator::current(isolate_)->get_sp(); |
3252 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); | 3252 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); |
3253 if (jssp - gap < stack_guard->real_jslimit()) return true; | 3253 if (jssp - gap < stack_guard->real_jslimit()) return true; |
3254 #endif // USE_SIMULATOR | 3254 #endif // USE_SIMULATOR |
3255 return GetCurrentStackPosition() - gap < stack_guard->real_climit(); | 3255 return GetCurrentStackPosition() - gap < stack_guard->real_climit(); |
3256 } | 3256 } |
3257 | 3257 |
| 3258 SaveContext::SaveContext(Isolate* isolate) |
| 3259 : isolate_(isolate), prev_(isolate->save_context()) { |
| 3260 if (isolate->context() != NULL) { |
| 3261 context_ = Handle<Context>(isolate->context()); |
| 3262 } |
| 3263 isolate->set_save_context(this); |
| 3264 |
| 3265 c_entry_fp_ = isolate->c_entry_fp(isolate->thread_local_top()); |
| 3266 } |
| 3267 |
| 3268 SaveContext::~SaveContext() { |
| 3269 isolate_->set_context(context_.is_null() ? NULL : *context_); |
| 3270 isolate_->set_save_context(prev_); |
| 3271 } |
| 3272 |
3258 #ifdef DEBUG | 3273 #ifdef DEBUG |
3259 AssertNoContextChange::AssertNoContextChange(Isolate* isolate) | 3274 AssertNoContextChange::AssertNoContextChange(Isolate* isolate) |
3260 : isolate_(isolate), context_(isolate->context(), isolate) {} | 3275 : isolate_(isolate), context_(isolate->context(), isolate) {} |
3261 #endif // DEBUG | 3276 #endif // DEBUG |
3262 | 3277 |
3263 | 3278 |
3264 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { | 3279 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { |
3265 // First check whether the previous scope intercepts. | 3280 // First check whether the previous scope intercepts. |
3266 if (prev_ && prev_->Intercept(flag)) return true; | 3281 if (prev_ && prev_->Intercept(flag)) return true; |
3267 // Then check whether this scope intercepts. | 3282 // Then check whether this scope intercepts. |
3268 if ((flag & intercept_mask_)) { | 3283 if ((flag & intercept_mask_)) { |
3269 intercepted_flags_ |= flag; | 3284 intercepted_flags_ |= flag; |
3270 return true; | 3285 return true; |
3271 } | 3286 } |
3272 return false; | 3287 return false; |
3273 } | 3288 } |
3274 | 3289 |
3275 } // namespace internal | 3290 } // namespace internal |
3276 } // namespace v8 | 3291 } // namespace v8 |
OLD | NEW |