Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: src/api.cc

Issue 6713128: Remove TLS read from ON_BAILOUT. (Closed)
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 258
259 static inline bool IsExecutionTerminatingCheck(i::Isolate* isolate) {
260 if (!isolate->IsInitialized()) return false;
261 if (isolate->has_scheduled_exception()) {
262 return isolate->scheduled_exception() ==
263 isolate->heap()->termination_exception();
264 }
265 return false;
266 }
267
268
259 static inline bool EmptyCheck(const char* location, v8::Handle<v8::Data> obj) { 269 static inline bool EmptyCheck(const char* location, v8::Handle<v8::Data> obj) {
260 return obj.IsEmpty() ? ReportEmptyHandle(location) : false; 270 return obj.IsEmpty() ? ReportEmptyHandle(location) : false;
261 } 271 }
262 272
263 273
264 static inline bool EmptyCheck(const char* location, const v8::Data* obj) { 274 static inline bool EmptyCheck(const char* location, const v8::Data* obj) {
265 return (obj == 0) ? ReportEmptyHandle(location) : false; 275 return (obj == 0) ? ReportEmptyHandle(location) : false;
266 } 276 }
267 277
268 // --- S t a t i c s --- 278 // --- S t a t i c s ---
(...skipping 4353 matching lines...) Expand 10 before | Expand all | Expand 10 after
4622 if (isolate != NULL) { 4632 if (isolate != NULL) {
4623 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->TerminateExecution(); 4633 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->TerminateExecution();
4624 } else { 4634 } else {
4625 i::Isolate::GetDefaultIsolateStackGuard()->TerminateExecution(); 4635 i::Isolate::GetDefaultIsolateStackGuard()->TerminateExecution();
4626 } 4636 }
4627 } 4637 }
4628 4638
4629 4639
4630 bool V8::IsExecutionTerminating() { 4640 bool V8::IsExecutionTerminating() {
4631 i::Isolate* isolate = i::Isolate::Current(); 4641 i::Isolate* isolate = i::Isolate::Current();
4632 if (!isolate->IsInitialized()) return false; 4642 return IsExecutionTerminatingCheck(isolate);
4633 if (isolate->has_scheduled_exception()) {
4634 return isolate->scheduled_exception() ==
4635 HEAP->termination_exception();
4636 }
4637 return false;
4638 } 4643 }
4639 4644
4640 4645
4641 Isolate* Isolate::GetCurrent() { 4646 Isolate* Isolate::GetCurrent() {
4642 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 4647 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
4643 return reinterpret_cast<Isolate*>(isolate); 4648 return reinterpret_cast<Isolate*>(isolate);
4644 } 4649 }
4645 4650
4646 4651
4647 Isolate* Isolate::New() { 4652 Isolate* Isolate::New() {
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
5722 5727
5723 5728
5724 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5729 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5725 HandleScopeImplementer* thread_local = 5730 HandleScopeImplementer* thread_local =
5726 reinterpret_cast<HandleScopeImplementer*>(storage); 5731 reinterpret_cast<HandleScopeImplementer*>(storage);
5727 thread_local->IterateThis(v); 5732 thread_local->IterateThis(v);
5728 return storage + ArchiveSpacePerThread(); 5733 return storage + ArchiveSpacePerThread();
5729 } 5734 }
5730 5735
5731 } } // namespace v8::internal 5736 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698