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 #ifndef V8_ISOLATE_H_ | 5 #ifndef V8_ISOLATE_H_ |
6 #define V8_ISOLATE_H_ | 6 #define V8_ISOLATE_H_ |
7 | 7 |
8 #include "include/v8-debug.h" | 8 #include "include/v8-debug.h" |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 Isolate* isolate_; | 1413 Isolate* isolate_; |
1414 }; | 1414 }; |
1415 | 1415 |
1416 | 1416 |
1417 // Support for temporarily postponing interrupts. When the outermost | 1417 // Support for temporarily postponing interrupts. When the outermost |
1418 // postpone scope is left the interrupts will be re-enabled and any | 1418 // postpone scope is left the interrupts will be re-enabled and any |
1419 // interrupts that occurred while in the scope will be taken into | 1419 // interrupts that occurred while in the scope will be taken into |
1420 // account. | 1420 // account. |
1421 class PostponeInterruptsScope BASE_EMBEDDED { | 1421 class PostponeInterruptsScope BASE_EMBEDDED { |
1422 public: | 1422 public: |
1423 PostponeInterruptsScope(Isolate* isolate, | 1423 explicit PostponeInterruptsScope(Isolate* isolate) |
1424 int intercept_mask = StackGuard::ALL_INTERRUPTS) | 1424 : stack_guard_(isolate->stack_guard()), isolate_(isolate) { |
1425 : stack_guard_(isolate->stack_guard()), | 1425 ExecutionAccess access(isolate_); |
1426 intercept_mask_(intercept_mask), | 1426 stack_guard_->thread_local_.postpone_interrupts_nesting_++; |
1427 intercepted_flags_(0) { | 1427 stack_guard_->DisableInterrupts(); |
1428 stack_guard_->PushPostponeInterruptsScope(this); | |
1429 } | 1428 } |
1430 | 1429 |
1431 ~PostponeInterruptsScope() { | 1430 ~PostponeInterruptsScope() { |
1432 stack_guard_->PopPostponeInterruptsScope(); | 1431 ExecutionAccess access(isolate_); |
| 1432 if (--stack_guard_->thread_local_.postpone_interrupts_nesting_ == 0) { |
| 1433 stack_guard_->EnableInterrupts(); |
| 1434 } |
1433 } | 1435 } |
1434 | |
1435 // Find the bottom-most scope that intercepts this interrupt. | |
1436 // Return whether the interrupt has been intercepted. | |
1437 bool Intercept(StackGuard::InterruptFlag flag); | |
1438 | |
1439 private: | 1436 private: |
1440 StackGuard* stack_guard_; | 1437 StackGuard* stack_guard_; |
1441 int intercept_mask_; | 1438 Isolate* isolate_; |
1442 int intercepted_flags_; | |
1443 PostponeInterruptsScope* prev_; | |
1444 | |
1445 friend class StackGuard; | |
1446 }; | 1439 }; |
1447 | 1440 |
1448 | 1441 |
1449 class CodeTracer V8_FINAL : public Malloced { | 1442 class CodeTracer V8_FINAL : public Malloced { |
1450 public: | 1443 public: |
1451 explicit CodeTracer(int isolate_id) | 1444 explicit CodeTracer(int isolate_id) |
1452 : file_(NULL), | 1445 : file_(NULL), |
1453 scope_depth_(0) { | 1446 scope_depth_(0) { |
1454 if (!ShouldRedirect()) { | 1447 if (!ShouldRedirect()) { |
1455 file_ = stdout; | 1448 file_ = stdout; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 } | 1503 } |
1511 | 1504 |
1512 EmbeddedVector<char, 128> filename_; | 1505 EmbeddedVector<char, 128> filename_; |
1513 FILE* file_; | 1506 FILE* file_; |
1514 int scope_depth_; | 1507 int scope_depth_; |
1515 }; | 1508 }; |
1516 | 1509 |
1517 } } // namespace v8::internal | 1510 } } // namespace v8::internal |
1518 | 1511 |
1519 #endif // V8_ISOLATE_H_ | 1512 #endif // V8_ISOLATE_H_ |
OLD | NEW |