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 "allocation.h" | 9 #include "allocation.h" |
10 #include "assert-scope.h" | 10 #include "assert-scope.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 public: | 207 public: |
208 // Does early low-level initialization that does not depend on the | 208 // Does early low-level initialization that does not depend on the |
209 // isolate being present. | 209 // isolate being present. |
210 ThreadLocalTop(); | 210 ThreadLocalTop(); |
211 | 211 |
212 // Initialize the thread data. | 212 // Initialize the thread data. |
213 void Initialize(); | 213 void Initialize(); |
214 | 214 |
215 // Get the top C++ try catch handler or NULL if none are registered. | 215 // Get the top C++ try catch handler or NULL if none are registered. |
216 // | 216 // |
217 // This method is not guarenteed to return an address that can be | 217 // This method is not guaranteed to return an address that can be |
218 // used for comparison with addresses into the JS stack. If such an | 218 // used for comparison with addresses into the JS stack. If such an |
219 // address is needed, use try_catch_handler_address. | 219 // address is needed, use try_catch_handler_address. |
220 v8::TryCatch* TryCatchHandler(); | 220 FIELD_ACCESSOR(v8::TryCatch*, try_catch_handler) |
221 | 221 |
222 // Get the address of the top C++ try catch handler or NULL if | 222 // Get the address of the top C++ try catch handler or NULL if |
223 // none are registered. | 223 // none are registered. |
224 // | 224 // |
225 // This method always returns an address that can be compared to | 225 // This method always returns an address that can be compared to |
226 // pointers into the JavaScript stack. When running on actual | 226 // pointers into the JavaScript stack. When running on actual |
227 // hardware, try_catch_handler_address and TryCatchHandler return | 227 // hardware, try_catch_handler_address and TryCatchHandler return |
228 // the same pointer. When running on a simulator with a separate JS | 228 // the same pointer. When running on a simulator with a separate JS |
229 // stack, try_catch_handler_address returns a JS stack address that | 229 // stack, try_catch_handler_address returns a JS stack address that |
230 // corresponds to the place on the JS stack where the C++ handler | 230 // corresponds to the place on the JS stack where the C++ handler |
231 // would have been if the stack were not separate. | 231 // would have been if the stack were not separate. |
232 FIELD_ACCESSOR(Address, try_catch_handler_address) | 232 Address try_catch_handler_address() { |
| 233 return reinterpret_cast<Address>( |
| 234 v8::TryCatch::JSStackComparableAddress(try_catch_handler())); |
| 235 } |
233 | 236 |
234 void Free() { | 237 void Free() { |
235 ASSERT(!has_pending_message_); | 238 ASSERT(!has_pending_message_); |
236 ASSERT(!external_caught_exception_); | 239 ASSERT(!external_caught_exception_); |
237 ASSERT(try_catch_handler_address_ == NULL); | 240 ASSERT(try_catch_handler_ == NULL); |
238 } | 241 } |
239 | 242 |
240 Isolate* isolate_; | 243 Isolate* isolate_; |
241 // The context where the current execution method is created and for variable | 244 // The context where the current execution method is created and for variable |
242 // lookups. | 245 // lookups. |
243 Context* context_; | 246 Context* context_; |
244 ThreadId thread_id_; | 247 ThreadId thread_id_; |
245 Object* pending_exception_; | 248 Object* pending_exception_; |
246 bool has_pending_message_; | 249 bool has_pending_message_; |
247 bool rethrowing_message_; | 250 bool rethrowing_message_; |
(...skipping 27 matching lines...) Expand all Loading... |
275 | 278 |
276 // Call back function to report unsafe JS accesses. | 279 // Call back function to report unsafe JS accesses. |
277 v8::FailedAccessCheckCallback failed_access_check_callback_; | 280 v8::FailedAccessCheckCallback failed_access_check_callback_; |
278 | 281 |
279 // Head of the list of live LookupResults. | 282 // Head of the list of live LookupResults. |
280 LookupResult* top_lookup_result_; | 283 LookupResult* top_lookup_result_; |
281 | 284 |
282 private: | 285 private: |
283 void InitializeInternal(); | 286 void InitializeInternal(); |
284 | 287 |
285 Address try_catch_handler_address_; | 288 v8::TryCatch* try_catch_handler_; |
286 }; | 289 }; |
287 | 290 |
288 | 291 |
289 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ | 292 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ |
290 V8_TARGET_ARCH_ARM64 && !defined(__aarch64__) || \ | 293 V8_TARGET_ARCH_ARM64 && !defined(__aarch64__) || \ |
291 V8_TARGET_ARCH_MIPS && !defined(__mips__) | 294 V8_TARGET_ARCH_MIPS && !defined(__mips__) |
292 | 295 |
293 #define ISOLATE_INIT_SIMULATOR_LIST(V) \ | 296 #define ISOLATE_INIT_SIMULATOR_LIST(V) \ |
294 V(bool, simulator_initialized, false) \ | 297 V(bool, simulator_initialized, false) \ |
295 V(HashMap*, simulator_i_cache, NULL) \ | 298 V(HashMap*, simulator_i_cache, NULL) \ |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 } | 557 } |
555 | 558 |
556 THREAD_LOCAL_TOP_ACCESSOR(bool, external_caught_exception) | 559 THREAD_LOCAL_TOP_ACCESSOR(bool, external_caught_exception) |
557 | 560 |
558 void clear_pending_message() { | 561 void clear_pending_message() { |
559 thread_local_top_.has_pending_message_ = false; | 562 thread_local_top_.has_pending_message_ = false; |
560 thread_local_top_.pending_message_obj_ = heap_.the_hole_value(); | 563 thread_local_top_.pending_message_obj_ = heap_.the_hole_value(); |
561 thread_local_top_.pending_message_script_ = heap_.the_hole_value(); | 564 thread_local_top_.pending_message_script_ = heap_.the_hole_value(); |
562 } | 565 } |
563 v8::TryCatch* try_catch_handler() { | 566 v8::TryCatch* try_catch_handler() { |
564 return thread_local_top_.TryCatchHandler(); | 567 return thread_local_top_.try_catch_handler(); |
565 } | 568 } |
566 Address try_catch_handler_address() { | 569 Address try_catch_handler_address() { |
567 return thread_local_top_.try_catch_handler_address(); | 570 return thread_local_top_.try_catch_handler_address(); |
568 } | 571 } |
569 bool* external_caught_exception_address() { | 572 bool* external_caught_exception_address() { |
570 return &thread_local_top_.external_caught_exception_; | 573 return &thread_local_top_.external_caught_exception_; |
571 } | 574 } |
572 | 575 |
573 THREAD_LOCAL_TOP_ACCESSOR(v8::TryCatch*, catcher) | 576 THREAD_LOCAL_TOP_ACCESSOR(v8::TryCatch*, catcher) |
574 | 577 |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 } | 1484 } |
1482 | 1485 |
1483 EmbeddedVector<char, 128> filename_; | 1486 EmbeddedVector<char, 128> filename_; |
1484 FILE* file_; | 1487 FILE* file_; |
1485 int scope_depth_; | 1488 int scope_depth_; |
1486 }; | 1489 }; |
1487 | 1490 |
1488 } } // namespace v8::internal | 1491 } } // namespace v8::internal |
1489 | 1492 |
1490 #endif // V8_ISOLATE_H_ | 1493 #endif // V8_ISOLATE_H_ |
OLD | NEW |