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

Side by Side Diff: src/top.h

Issue 3970005: Make Failure inherit from MaybeObject instead of Object. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 2 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 | « src/stub-cache.cc ('k') | src/top.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void Free() { 77 void Free() {
78 ASSERT(!has_pending_message_); 78 ASSERT(!has_pending_message_);
79 ASSERT(!external_caught_exception_); 79 ASSERT(!external_caught_exception_);
80 ASSERT(try_catch_handler_address_ == NULL); 80 ASSERT(try_catch_handler_address_ == NULL);
81 } 81 }
82 82
83 // The context where the current execution method is created and for variable 83 // The context where the current execution method is created and for variable
84 // lookups. 84 // lookups.
85 Context* context_; 85 Context* context_;
86 int thread_id_; 86 int thread_id_;
87 Object* pending_exception_; 87 MaybeObject* pending_exception_;
88 bool has_pending_message_; 88 bool has_pending_message_;
89 const char* pending_message_; 89 const char* pending_message_;
90 Object* pending_message_obj_; 90 Object* pending_message_obj_;
91 Script* pending_message_script_; 91 Script* pending_message_script_;
92 int pending_message_start_pos_; 92 int pending_message_start_pos_;
93 int pending_message_end_pos_; 93 int pending_message_end_pos_;
94 // Use a separate value for scheduled exceptions to preserve the 94 // Use a separate value for scheduled exceptions to preserve the
95 // invariants that hold about pending_exception. We may want to 95 // invariants that hold about pending_exception. We may want to
96 // unify them later. 96 // unify them later.
97 Object* scheduled_exception_; 97 MaybeObject* scheduled_exception_;
98 bool external_caught_exception_; 98 bool external_caught_exception_;
99 SaveContext* save_context_; 99 SaveContext* save_context_;
100 v8::TryCatch* catcher_; 100 v8::TryCatch* catcher_;
101 101
102 // Stack. 102 // Stack.
103 Address c_entry_fp_; // the frame pointer of the top c entry frame 103 Address c_entry_fp_; // the frame pointer of the top c entry frame
104 Address handler_; // try-blocks are chained through the stack 104 Address handler_; // try-blocks are chained through the stack
105 105
106 #ifdef ENABLE_LOGGING_AND_PROFILING 106 #ifdef ENABLE_LOGGING_AND_PROFILING
107 Address js_entry_sp_; // the stack pointer of the bottom js entry frame 107 Address js_entry_sp_; // the stack pointer of the bottom js entry frame
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 static SaveContext* save_context() {return thread_local_.save_context_; } 158 static SaveContext* save_context() {return thread_local_.save_context_; }
159 static void set_save_context(SaveContext* save) { 159 static void set_save_context(SaveContext* save) {
160 thread_local_.save_context_ = save; 160 thread_local_.save_context_ = save;
161 } 161 }
162 162
163 // Access to current thread id. 163 // Access to current thread id.
164 static int thread_id() { return thread_local_.thread_id_; } 164 static int thread_id() { return thread_local_.thread_id_; }
165 static void set_thread_id(int id) { thread_local_.thread_id_ = id; } 165 static void set_thread_id(int id) { thread_local_.thread_id_ = id; }
166 166
167 // Interface to pending exception. 167 // Interface to pending exception.
168 static Object* pending_exception() { 168 static MaybeObject* pending_exception() {
169 ASSERT(has_pending_exception()); 169 ASSERT(has_pending_exception());
170 return thread_local_.pending_exception_; 170 return thread_local_.pending_exception_;
171 } 171 }
172 static bool external_caught_exception() { 172 static bool external_caught_exception() {
173 return thread_local_.external_caught_exception_; 173 return thread_local_.external_caught_exception_;
174 } 174 }
175 static void set_pending_exception(Object* exception) { 175 static void set_pending_exception(MaybeObject* exception) {
176 thread_local_.pending_exception_ = exception; 176 thread_local_.pending_exception_ = exception;
177 } 177 }
178 static void clear_pending_exception() { 178 static void clear_pending_exception() {
179 thread_local_.pending_exception_ = Heap::the_hole_value(); 179 thread_local_.pending_exception_ = Heap::the_hole_value();
180 } 180 }
181 181
182 static Object** pending_exception_address() { 182 static MaybeObject** pending_exception_address() {
183 return &thread_local_.pending_exception_; 183 return &thread_local_.pending_exception_;
184 } 184 }
185 static bool has_pending_exception() { 185 static bool has_pending_exception() {
186 return !thread_local_.pending_exception_->IsTheHole(); 186 return !thread_local_.pending_exception_->IsTheHole();
187 } 187 }
188 static void clear_pending_message() { 188 static void clear_pending_message() {
189 thread_local_.has_pending_message_ = false; 189 thread_local_.has_pending_message_ = false;
190 thread_local_.pending_message_ = NULL; 190 thread_local_.pending_message_ = NULL;
191 thread_local_.pending_message_obj_ = Heap::the_hole_value(); 191 thread_local_.pending_message_obj_ = Heap::the_hole_value();
192 thread_local_.pending_message_script_ = NULL; 192 thread_local_.pending_message_script_ = NULL;
193 } 193 }
194 static v8::TryCatch* try_catch_handler() { 194 static v8::TryCatch* try_catch_handler() {
195 return thread_local_.TryCatchHandler(); 195 return thread_local_.TryCatchHandler();
196 } 196 }
197 static Address try_catch_handler_address() { 197 static Address try_catch_handler_address() {
198 return thread_local_.try_catch_handler_address(); 198 return thread_local_.try_catch_handler_address();
199 } 199 }
200 // This method is called by the api after operations that may throw 200 // This method is called by the api after operations that may throw
201 // exceptions. If an exception was thrown and not handled by an external 201 // exceptions. If an exception was thrown and not handled by an external
202 // handler the exception is scheduled to be rethrown when we return to running 202 // handler the exception is scheduled to be rethrown when we return to running
203 // JavaScript code. If an exception is scheduled true is returned. 203 // JavaScript code. If an exception is scheduled true is returned.
204 static bool OptionalRescheduleException(bool is_bottom_call); 204 static bool OptionalRescheduleException(bool is_bottom_call);
205 205
206 206
207 static bool* external_caught_exception_address() { 207 static bool* external_caught_exception_address() {
208 return &thread_local_.external_caught_exception_; 208 return &thread_local_.external_caught_exception_;
209 } 209 }
210 210
211 static Object** scheduled_exception_address() { 211 static MaybeObject** scheduled_exception_address() {
212 return &thread_local_.scheduled_exception_; 212 return &thread_local_.scheduled_exception_;
213 } 213 }
214 214
215 static Object* scheduled_exception() { 215 static MaybeObject* scheduled_exception() {
216 ASSERT(has_scheduled_exception()); 216 ASSERT(has_scheduled_exception());
217 return thread_local_.scheduled_exception_; 217 return thread_local_.scheduled_exception_;
218 } 218 }
219 static bool has_scheduled_exception() { 219 static bool has_scheduled_exception() {
220 return !thread_local_.scheduled_exception_->IsTheHole(); 220 return !thread_local_.scheduled_exception_->IsTheHole();
221 } 221 }
222 static void clear_scheduled_exception() { 222 static void clear_scheduled_exception() {
223 thread_local_.scheduled_exception_ = Heap::the_hole_value(); 223 thread_local_.scheduled_exception_ = Heap::the_hole_value();
224 } 224 }
225 225
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 static void SetFailedAccessCheckCallback( 295 static void SetFailedAccessCheckCallback(
296 v8::FailedAccessCheckCallback callback); 296 v8::FailedAccessCheckCallback callback);
297 static void ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type); 297 static void ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type);
298 298
299 // Exception throwing support. The caller should use the result 299 // Exception throwing support. The caller should use the result
300 // of Throw() as its return value. 300 // of Throw() as its return value.
301 static Failure* Throw(Object* exception, MessageLocation* location = NULL); 301 static Failure* Throw(Object* exception, MessageLocation* location = NULL);
302 // Re-throw an exception. This involves no error reporting since 302 // Re-throw an exception. This involves no error reporting since
303 // error reporting was handled when the exception was thrown 303 // error reporting was handled when the exception was thrown
304 // originally. 304 // originally.
305 static Failure* ReThrow(Object* exception, MessageLocation* location = NULL); 305 static Failure* ReThrow(MaybeObject* exception,
306 MessageLocation* location = NULL);
306 static void ScheduleThrow(Object* exception); 307 static void ScheduleThrow(Object* exception);
307 static void ReportPendingMessages(); 308 static void ReportPendingMessages();
308 static Failure* ThrowIllegalOperation(); 309 static Failure* ThrowIllegalOperation();
309 310
310 // Promote a scheduled exception to pending. Asserts has_scheduled_exception. 311 // Promote a scheduled exception to pending. Asserts has_scheduled_exception.
311 static Object* PromoteScheduledException(); 312 static Failure* PromoteScheduledException();
312 static void DoThrow(Object* exception, 313 static void DoThrow(MaybeObject* exception,
313 MessageLocation* location, 314 MessageLocation* location,
314 const char* message); 315 const char* message);
315 static bool ShouldReturnException(bool* is_caught_externally, 316 static bool ShouldReturnException(bool* is_caught_externally,
316 bool catchable_by_javascript); 317 bool catchable_by_javascript);
317 318
318 // Attempts to compute the current source location, storing the 319 // Attempts to compute the current source location, storing the
319 // result in the target out parameter. 320 // result in the target out parameter.
320 static void ComputeLocation(MessageLocation* target); 321 static void ComputeLocation(MessageLocation* target);
321 322
322 // Override command line flag. 323 // Override command line flag.
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 462
462 class ExecutionAccess BASE_EMBEDDED { 463 class ExecutionAccess BASE_EMBEDDED {
463 public: 464 public:
464 ExecutionAccess(); 465 ExecutionAccess();
465 ~ExecutionAccess(); 466 ~ExecutionAccess();
466 }; 467 };
467 468
468 } } // namespace v8::internal 469 } } // namespace v8::internal
469 470
470 #endif // V8_TOP_H_ 471 #endif // V8_TOP_H_
OLDNEW
« no previous file with comments | « src/stub-cache.cc ('k') | src/top.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698