OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 i::VMState __state__((isolate), i::EXTERNAL) | 62 i::VMState __state__((isolate), i::EXTERNAL) |
63 #else | 63 #else |
64 #define ENTER_V8(isolate) ((void) 0) | 64 #define ENTER_V8(isolate) ((void) 0) |
65 #define LEAVE_V8(isolate) ((void) 0) | 65 #define LEAVE_V8(isolate) ((void) 0) |
66 #endif | 66 #endif |
67 | 67 |
68 namespace v8 { | 68 namespace v8 { |
69 | 69 |
70 #define ON_BAILOUT(isolate, location, code) \ | 70 #define ON_BAILOUT(isolate, location, code) \ |
71 if (IsDeadCheck(isolate, location) || \ | 71 if (IsDeadCheck(isolate, location) || \ |
72 v8::V8::IsExecutionTerminating()) { \ | 72 IsExecutionTerminatingCheck(isolate)) { \ |
73 code; \ | 73 code; \ |
74 UNREACHABLE(); \ | 74 UNREACHABLE(); \ |
75 } | 75 } |
76 | 76 |
77 | 77 |
78 #define EXCEPTION_PREAMBLE(isolate) \ | 78 #define EXCEPTION_PREAMBLE(isolate) \ |
79 (isolate)->handle_scope_implementer()->IncrementCallDepth(); \ | 79 (isolate)->handle_scope_implementer()->IncrementCallDepth(); \ |
80 ASSERT(!(isolate)->external_caught_exception()); \ | 80 ASSERT(!(isolate)->external_caught_exception()); \ |
81 bool has_pending_exception = false | 81 bool has_pending_exception = false |
82 | 82 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 * can arrange to return if the VM is dead. This is needed to ensure that no VM | 248 * can arrange to return if the VM is dead. This is needed to ensure that no VM |
249 * heap allocations are attempted on a dead VM. EnsureInitialized has the | 249 * heap allocations are attempted on a dead VM. EnsureInitialized has the |
250 * advantage over ON_BAILOUT that it actually initializes the VM if this has not | 250 * advantage over ON_BAILOUT that it actually initializes the VM if this has not |
251 * yet been done. | 251 * yet been done. |
252 */ | 252 */ |
253 static inline bool IsDeadCheck(i::Isolate* isolate, const char* location) { | 253 static inline bool IsDeadCheck(i::Isolate* isolate, const char* location) { |
254 return !isolate->IsInitialized() | 254 return !isolate->IsInitialized() |
255 && i::V8::IsDead() ? ReportV8Dead(location) : false; | 255 && i::V8::IsDead() ? ReportV8Dead(location) : false; |
256 } | 256 } |
257 | 257 |
| 258 static inline bool IsExecutionTerminatingCheck(i::Isolate* isolate) { |
| 259 if (!isolate->IsInitialized()) return false; |
| 260 if (isolate->has_scheduled_exception()) { |
| 261 return isolate->scheduled_exception() == |
| 262 isolate->heap()->termination_exception(); |
| 263 } |
| 264 return false; |
| 265 } |
258 | 266 |
259 static inline bool EmptyCheck(const char* location, v8::Handle<v8::Data> obj) { | 267 static inline bool EmptyCheck(const char* location, v8::Handle<v8::Data> obj) { |
260 return obj.IsEmpty() ? ReportEmptyHandle(location) : false; | 268 return obj.IsEmpty() ? ReportEmptyHandle(location) : false; |
261 } | 269 } |
262 | 270 |
263 | 271 |
264 static inline bool EmptyCheck(const char* location, const v8::Data* obj) { | 272 static inline bool EmptyCheck(const char* location, const v8::Data* obj) { |
265 return (obj == 0) ? ReportEmptyHandle(location) : false; | 273 return (obj == 0) ? ReportEmptyHandle(location) : false; |
266 } | 274 } |
267 | 275 |
(...skipping 4354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4622 if (isolate != NULL) { | 4630 if (isolate != NULL) { |
4623 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->TerminateExecution(); | 4631 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->TerminateExecution(); |
4624 } else { | 4632 } else { |
4625 i::Isolate::GetDefaultIsolateStackGuard()->TerminateExecution(); | 4633 i::Isolate::GetDefaultIsolateStackGuard()->TerminateExecution(); |
4626 } | 4634 } |
4627 } | 4635 } |
4628 | 4636 |
4629 | 4637 |
4630 bool V8::IsExecutionTerminating() { | 4638 bool V8::IsExecutionTerminating() { |
4631 i::Isolate* isolate = i::Isolate::Current(); | 4639 i::Isolate* isolate = i::Isolate::Current(); |
4632 if (!isolate->IsInitialized()) return false; | 4640 return IsExecutionTerminatingCheck(isolate); |
4633 if (isolate->has_scheduled_exception()) { | |
4634 return isolate->scheduled_exception() == | |
4635 HEAP->termination_exception(); | |
4636 } | |
4637 return false; | |
4638 } | 4641 } |
4639 | 4642 |
4640 | 4643 |
4641 Isolate* Isolate::GetCurrent() { | 4644 Isolate* Isolate::GetCurrent() { |
4642 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | 4645 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
4643 return reinterpret_cast<Isolate*>(isolate); | 4646 return reinterpret_cast<Isolate*>(isolate); |
4644 } | 4647 } |
4645 | 4648 |
4646 | 4649 |
4647 Isolate* Isolate::New() { | 4650 Isolate* Isolate::New() { |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5722 | 5725 |
5723 | 5726 |
5724 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5727 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
5725 HandleScopeImplementer* thread_local = | 5728 HandleScopeImplementer* thread_local = |
5726 reinterpret_cast<HandleScopeImplementer*>(storage); | 5729 reinterpret_cast<HandleScopeImplementer*>(storage); |
5727 thread_local->IterateThis(v); | 5730 thread_local->IterateThis(v); |
5728 return storage + ArchiveSpacePerThread(); | 5731 return storage + ArchiveSpacePerThread(); |
5729 } | 5732 } |
5730 | 5733 |
5731 } } // namespace v8::internal | 5734 } } // namespace v8::internal |
OLD | NEW |