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

Side by Side Diff: src/api.cc

Issue 14139033: Clean up VMState a little bit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fixed mistake Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "scanner-character-streams.h" 56 #include "scanner-character-streams.h"
57 #include "snapshot.h" 57 #include "snapshot.h"
58 #include "unicode-inl.h" 58 #include "unicode-inl.h"
59 #include "v8threads.h" 59 #include "v8threads.h"
60 #include "version.h" 60 #include "version.h"
61 #include "vm-state-inl.h" 61 #include "vm-state-inl.h"
62 62
63 63
64 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr)) 64 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr))
65 65
66 #define ENTER_V8(isolate) \ 66 #define ENTER_V8(isolate) \
67 ASSERT((isolate)->IsInitialized()); \ 67 ASSERT((isolate)->IsInitialized()); \
68 i::VMState __state__((isolate), i::OTHER) 68 i::VMState<i::OTHER> __state__((isolate))
69 #define LEAVE_V8(isolate) \
70 i::VMState __state__((isolate), i::EXTERNAL)
71 69
72 namespace v8 { 70 namespace v8 {
73 71
74 #define ON_BAILOUT(isolate, location, code) \ 72 #define ON_BAILOUT(isolate, location, code) \
75 if (IsDeadCheck(isolate, location) || \ 73 if (IsDeadCheck(isolate, location) || \
76 IsExecutionTerminatingCheck(isolate)) { \ 74 IsExecutionTerminatingCheck(isolate)) { \
77 code; \ 75 code; \
78 UNREACHABLE(); \ 76 UNREACHABLE(); \
79 } 77 }
80 78
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } while (false) 122 } while (false)
125 123
126 124
127 // --- E x c e p t i o n B e h a v i o r --- 125 // --- E x c e p t i o n B e h a v i o r ---
128 126
129 127
130 static void DefaultFatalErrorHandler(const char* location, 128 static void DefaultFatalErrorHandler(const char* location,
131 const char* message) { 129 const char* message) {
132 i::Isolate* isolate = i::Isolate::Current(); 130 i::Isolate* isolate = i::Isolate::Current();
133 if (isolate->IsInitialized()) { 131 if (isolate->IsInitialized()) {
134 i::VMState __state__(isolate, i::OTHER); 132 i::VMState<i::OTHER> state(isolate);
135 API_Fatal(location, message); 133 API_Fatal(location, message);
136 } else { 134 } else {
137 API_Fatal(location, message); 135 API_Fatal(location, message);
138 } 136 }
139 } 137 }
140 138
141 139
142 static FatalErrorCallback GetFatalErrorHandler() { 140 static FatalErrorCallback GetFatalErrorHandler() {
143 i::Isolate* isolate = i::Isolate::Current(); 141 i::Isolate* isolate = i::Isolate::Current();
144 if (isolate->exception_behavior() == NULL) { 142 if (isolate->exception_behavior() == NULL) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 heap_stats.end_marker = &end_marker; 207 heap_stats.end_marker = &end_marker;
210 i::Isolate* isolate = i::Isolate::Current(); 208 i::Isolate* isolate = i::Isolate::Current();
211 if (isolate->heap()->HasBeenSetUp()) { 209 if (isolate->heap()->HasBeenSetUp()) {
212 // BUG(1718): Don't use the take_snapshot since we don't support 210 // BUG(1718): Don't use the take_snapshot since we don't support
213 // HeapIterator here without doing a special GC. 211 // HeapIterator here without doing a special GC.
214 isolate->heap()->RecordStats(&heap_stats, false); 212 isolate->heap()->RecordStats(&heap_stats, false);
215 } 213 }
216 i::V8::SetFatalError(); 214 i::V8::SetFatalError();
217 FatalErrorCallback callback = GetFatalErrorHandler(); 215 FatalErrorCallback callback = GetFatalErrorHandler();
218 const char* message = "Allocation failed - process out of memory"; 216 const char* message = "Allocation failed - process out of memory";
219 { 217 callback(location, message);
220 if (isolate->IsInitialized()) {
221 LEAVE_V8(isolate);
222 callback(location, message);
223 } else {
224 callback(location, message);
225 }
226 }
227 // If the callback returns, we stop execution. 218 // If the callback returns, we stop execution.
228 UNREACHABLE(); 219 UNREACHABLE();
229 } 220 }
230 221
231 222
232 bool Utils::ReportApiFailure(const char* location, const char* message) { 223 bool Utils::ReportApiFailure(const char* location, const char* message) {
233 FatalErrorCallback callback = GetFatalErrorHandler(); 224 FatalErrorCallback callback = GetFatalErrorHandler();
234 callback(location, message); 225 callback(location, message);
235 i::V8::SetFatalError(); 226 i::V8::SetFatalError();
236 return false; 227 return false;
(...skipping 7197 matching lines...) Expand 10 before | Expand all | Expand 10 after
7434 7425
7435 v->VisitPointers(blocks_.first(), first_block_limit_); 7426 v->VisitPointers(blocks_.first(), first_block_limit_);
7436 7427
7437 for (int i = 1; i < blocks_.length(); i++) { 7428 for (int i = 1; i < blocks_.length(); i++) {
7438 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 7429 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7439 } 7430 }
7440 } 7431 }
7441 7432
7442 7433
7443 } } // namespace v8::internal 7434 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698