| OLD | NEW |
| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 static int GetCurrentThreadId(); | 201 static int GetCurrentThreadId(); |
| 202 | 202 |
| 203 int id_; | 203 int id_; |
| 204 | 204 |
| 205 static Atomic32 highest_thread_id_; | 205 static Atomic32 highest_thread_id_; |
| 206 | 206 |
| 207 friend class Isolate; | 207 friend class Isolate; |
| 208 }; | 208 }; |
| 209 | 209 |
| 210 | 210 |
| 211 #define FIELD_ACCESSOR(type, name) \ |
| 212 inline void set_##name(type v) { name##_ = v; } \ |
| 213 inline type name() const { return name##_; } |
| 214 |
| 215 |
| 211 class ThreadLocalTop BASE_EMBEDDED { | 216 class ThreadLocalTop BASE_EMBEDDED { |
| 212 public: | 217 public: |
| 213 // Does early low-level initialization that does not depend on the | 218 // Does early low-level initialization that does not depend on the |
| 214 // isolate being present. | 219 // isolate being present. |
| 215 ThreadLocalTop(); | 220 ThreadLocalTop(); |
| 216 | 221 |
| 217 // Initialize the thread data. | 222 // Initialize the thread data. |
| 218 void Initialize(); | 223 void Initialize(); |
| 219 | 224 |
| 220 // Get the top C++ try catch handler or NULL if none are registered. | 225 // Get the top C++ try catch handler or NULL if none are registered. |
| 221 // | 226 // |
| 222 // This method is not guarenteed to return an address that can be | 227 // This method is not guarenteed to return an address that can be |
| 223 // used for comparison with addresses into the JS stack. If such an | 228 // used for comparison with addresses into the JS stack. If such an |
| 224 // address is needed, use try_catch_handler_address. | 229 // address is needed, use try_catch_handler_address. |
| 225 v8::TryCatch* TryCatchHandler(); | 230 v8::TryCatch* TryCatchHandler(); |
| 226 | 231 |
| 227 // Get the address of the top C++ try catch handler or NULL if | 232 // Get the address of the top C++ try catch handler or NULL if |
| 228 // none are registered. | 233 // none are registered. |
| 229 // | 234 // |
| 230 // This method always returns an address that can be compared to | 235 // This method always returns an address that can be compared to |
| 231 // pointers into the JavaScript stack. When running on actual | 236 // pointers into the JavaScript stack. When running on actual |
| 232 // hardware, try_catch_handler_address and TryCatchHandler return | 237 // hardware, try_catch_handler_address and TryCatchHandler return |
| 233 // the same pointer. When running on a simulator with a separate JS | 238 // the same pointer. When running on a simulator with a separate JS |
| 234 // stack, try_catch_handler_address returns a JS stack address that | 239 // stack, try_catch_handler_address returns a JS stack address that |
| 235 // corresponds to the place on the JS stack where the C++ handler | 240 // corresponds to the place on the JS stack where the C++ handler |
| 236 // would have been if the stack were not separate. | 241 // would have been if the stack were not separate. |
| 237 inline Address try_catch_handler_address() { | 242 FIELD_ACCESSOR(Address, try_catch_handler_address) |
| 238 return try_catch_handler_address_; | |
| 239 } | |
| 240 | |
| 241 // Set the address of the top C++ try catch handler. | |
| 242 inline void set_try_catch_handler_address(Address address) { | |
| 243 try_catch_handler_address_ = address; | |
| 244 } | |
| 245 | 243 |
| 246 void Free() { | 244 void Free() { |
| 247 ASSERT(!has_pending_message_); | 245 ASSERT(!has_pending_message_); |
| 248 ASSERT(!external_caught_exception_); | 246 ASSERT(!external_caught_exception_); |
| 249 ASSERT(try_catch_handler_address_ == NULL); | 247 ASSERT(try_catch_handler_address_ == NULL); |
| 250 } | 248 } |
| 251 | 249 |
| 252 Isolate* isolate_; | 250 Isolate* isolate_; |
| 253 // The context where the current execution method is created and for variable | 251 // The context where the current execution method is created and for variable |
| 254 // lookups. | 252 // lookups. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 V(ExternalReferenceTable*, external_reference_table, NULL) \ | 358 V(ExternalReferenceTable*, external_reference_table, NULL) \ |
| 361 /* AstNode state. */ \ | 359 /* AstNode state. */ \ |
| 362 V(int, ast_node_id, 0) \ | 360 V(int, ast_node_id, 0) \ |
| 363 V(unsigned, ast_node_count, 0) \ | 361 V(unsigned, ast_node_count, 0) \ |
| 364 V(bool, microtask_pending, false) \ | 362 V(bool, microtask_pending, false) \ |
| 365 V(HStatistics*, hstatistics, NULL) \ | 363 V(HStatistics*, hstatistics, NULL) \ |
| 366 V(HTracer*, htracer, NULL) \ | 364 V(HTracer*, htracer, NULL) \ |
| 367 V(CodeTracer*, code_tracer, NULL) \ | 365 V(CodeTracer*, code_tracer, NULL) \ |
| 368 ISOLATE_DEBUGGER_INIT_LIST(V) | 366 ISOLATE_DEBUGGER_INIT_LIST(V) |
| 369 | 367 |
| 368 #define THREAD_LOCAL_TOP_ACCESSOR(type, name) \ |
| 369 inline void set_##name(type v) { thread_local_top_.name##_ = v; } \ |
| 370 inline type name() const { return thread_local_top_.name##_; } |
| 371 |
| 372 |
| 370 class Isolate { | 373 class Isolate { |
| 371 // These forward declarations are required to make the friend declarations in | 374 // These forward declarations are required to make the friend declarations in |
| 372 // PerIsolateThreadData work on some older versions of gcc. | 375 // PerIsolateThreadData work on some older versions of gcc. |
| 373 class ThreadDataTable; | 376 class ThreadDataTable; |
| 374 class EntryStackItem; | 377 class EntryStackItem; |
| 375 public: | 378 public: |
| 376 ~Isolate(); | 379 ~Isolate(); |
| 377 | 380 |
| 378 // A thread has a PerIsolateThreadData instance for each isolate that it has | 381 // A thread has a PerIsolateThreadData instance for each isolate that it has |
| 379 // entered. That instance is allocated when the isolate is initially entered | 382 // entered. That instance is allocated when the isolate is initially entered |
| 380 // and reused on subsequent entries. | 383 // and reused on subsequent entries. |
| 381 class PerIsolateThreadData { | 384 class PerIsolateThreadData { |
| 382 public: | 385 public: |
| 383 PerIsolateThreadData(Isolate* isolate, ThreadId thread_id) | 386 PerIsolateThreadData(Isolate* isolate, ThreadId thread_id) |
| 384 : isolate_(isolate), | 387 : isolate_(isolate), |
| 385 thread_id_(thread_id), | 388 thread_id_(thread_id), |
| 386 stack_limit_(0), | 389 stack_limit_(0), |
| 387 thread_state_(NULL), | 390 thread_state_(NULL), |
| 388 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \ | 391 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \ |
| 389 !defined(__aarch64__) && V8_TARGET_ARCH_A64 || \ | 392 !defined(__aarch64__) && V8_TARGET_ARCH_A64 || \ |
| 390 !defined(__mips__) && V8_TARGET_ARCH_MIPS | 393 !defined(__mips__) && V8_TARGET_ARCH_MIPS |
| 391 simulator_(NULL), | 394 simulator_(NULL), |
| 392 #endif | 395 #endif |
| 393 next_(NULL), | 396 next_(NULL), |
| 394 prev_(NULL) { } | 397 prev_(NULL) { } |
| 395 Isolate* isolate() const { return isolate_; } | 398 Isolate* isolate() const { return isolate_; } |
| 396 ThreadId thread_id() const { return thread_id_; } | 399 ThreadId thread_id() const { return thread_id_; } |
| 397 void set_stack_limit(uintptr_t value) { stack_limit_ = value; } | 400 |
| 398 uintptr_t stack_limit() const { return stack_limit_; } | 401 FIELD_ACCESSOR(uintptr_t, stack_limit) |
| 399 ThreadState* thread_state() const { return thread_state_; } | 402 FIELD_ACCESSOR(ThreadState*, thread_state) |
| 400 void set_thread_state(ThreadState* value) { thread_state_ = value; } | |
| 401 | 403 |
| 402 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \ | 404 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \ |
| 403 !defined(__aarch64__) && V8_TARGET_ARCH_A64 || \ | 405 !defined(__aarch64__) && V8_TARGET_ARCH_A64 || \ |
| 404 !defined(__mips__) && V8_TARGET_ARCH_MIPS | 406 !defined(__mips__) && V8_TARGET_ARCH_MIPS |
| 405 Simulator* simulator() const { return simulator_; } | 407 FIELD_ACCESSOR(Simulator*, simulator) |
| 406 void set_simulator(Simulator* simulator) { | |
| 407 simulator_ = simulator; | |
| 408 } | |
| 409 #endif | 408 #endif |
| 410 | 409 |
| 411 bool Matches(Isolate* isolate, ThreadId thread_id) const { | 410 bool Matches(Isolate* isolate, ThreadId thread_id) const { |
| 412 return isolate_ == isolate && thread_id_.Equals(thread_id); | 411 return isolate_ == isolate && thread_id_.Equals(thread_id); |
| 413 } | 412 } |
| 414 | 413 |
| 415 private: | 414 private: |
| 416 Isolate* isolate_; | 415 Isolate* isolate_; |
| 417 ThreadId thread_id_; | 416 ThreadId thread_id_; |
| 418 uintptr_t stack_limit_; | 417 uintptr_t stack_limit_; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 Address get_address_from_id(AddressId id); | 537 Address get_address_from_id(AddressId id); |
| 539 | 538 |
| 540 // Access to top context (where the current function object was created). | 539 // Access to top context (where the current function object was created). |
| 541 Context* context() { return thread_local_top_.context_; } | 540 Context* context() { return thread_local_top_.context_; } |
| 542 void set_context(Context* context) { | 541 void set_context(Context* context) { |
| 543 ASSERT(context == NULL || context->IsContext()); | 542 ASSERT(context == NULL || context->IsContext()); |
| 544 thread_local_top_.context_ = context; | 543 thread_local_top_.context_ = context; |
| 545 } | 544 } |
| 546 Context** context_address() { return &thread_local_top_.context_; } | 545 Context** context_address() { return &thread_local_top_.context_; } |
| 547 | 546 |
| 548 SaveContext* save_context() { return thread_local_top_.save_context_; } | 547 THREAD_LOCAL_TOP_ACCESSOR(SaveContext*, save_context) |
| 549 void set_save_context(SaveContext* save) { | |
| 550 thread_local_top_.save_context_ = save; | |
| 551 } | |
| 552 | 548 |
| 553 // Access to current thread id. | 549 // Access to current thread id. |
| 554 ThreadId thread_id() { return thread_local_top_.thread_id_; } | 550 THREAD_LOCAL_TOP_ACCESSOR(ThreadId, thread_id) |
| 555 void set_thread_id(ThreadId id) { thread_local_top_.thread_id_ = id; } | |
| 556 | 551 |
| 557 // Interface to pending exception. | 552 // Interface to pending exception. |
| 558 MaybeObject* pending_exception() { | 553 MaybeObject* pending_exception() { |
| 559 ASSERT(has_pending_exception()); | 554 ASSERT(has_pending_exception()); |
| 560 return thread_local_top_.pending_exception_; | 555 return thread_local_top_.pending_exception_; |
| 561 } | 556 } |
| 562 bool external_caught_exception() { | 557 |
| 563 return thread_local_top_.external_caught_exception_; | |
| 564 } | |
| 565 void set_external_caught_exception(bool value) { | |
| 566 thread_local_top_.external_caught_exception_ = value; | |
| 567 } | |
| 568 void set_pending_exception(MaybeObject* exception) { | 558 void set_pending_exception(MaybeObject* exception) { |
| 569 thread_local_top_.pending_exception_ = exception; | 559 thread_local_top_.pending_exception_ = exception; |
| 570 } | 560 } |
| 561 |
| 571 void clear_pending_exception() { | 562 void clear_pending_exception() { |
| 572 thread_local_top_.pending_exception_ = heap_.the_hole_value(); | 563 thread_local_top_.pending_exception_ = heap_.the_hole_value(); |
| 573 } | 564 } |
| 565 |
| 574 MaybeObject** pending_exception_address() { | 566 MaybeObject** pending_exception_address() { |
| 575 return &thread_local_top_.pending_exception_; | 567 return &thread_local_top_.pending_exception_; |
| 576 } | 568 } |
| 569 |
| 577 bool has_pending_exception() { | 570 bool has_pending_exception() { |
| 578 return !thread_local_top_.pending_exception_->IsTheHole(); | 571 return !thread_local_top_.pending_exception_->IsTheHole(); |
| 579 } | 572 } |
| 573 |
| 574 THREAD_LOCAL_TOP_ACCESSOR(bool, external_caught_exception) |
| 575 |
| 580 void clear_pending_message() { | 576 void clear_pending_message() { |
| 581 thread_local_top_.has_pending_message_ = false; | 577 thread_local_top_.has_pending_message_ = false; |
| 582 thread_local_top_.pending_message_obj_ = heap_.the_hole_value(); | 578 thread_local_top_.pending_message_obj_ = heap_.the_hole_value(); |
| 583 thread_local_top_.pending_message_script_ = heap_.the_hole_value(); | 579 thread_local_top_.pending_message_script_ = heap_.the_hole_value(); |
| 584 } | 580 } |
| 585 v8::TryCatch* try_catch_handler() { | 581 v8::TryCatch* try_catch_handler() { |
| 586 return thread_local_top_.TryCatchHandler(); | 582 return thread_local_top_.TryCatchHandler(); |
| 587 } | 583 } |
| 588 Address try_catch_handler_address() { | 584 Address try_catch_handler_address() { |
| 589 return thread_local_top_.try_catch_handler_address(); | 585 return thread_local_top_.try_catch_handler_address(); |
| 590 } | 586 } |
| 591 bool* external_caught_exception_address() { | 587 bool* external_caught_exception_address() { |
| 592 return &thread_local_top_.external_caught_exception_; | 588 return &thread_local_top_.external_caught_exception_; |
| 593 } | 589 } |
| 594 v8::TryCatch* catcher() { | 590 |
| 595 return thread_local_top_.catcher_; | 591 THREAD_LOCAL_TOP_ACCESSOR(v8::TryCatch*, catcher) |
| 596 } | |
| 597 void set_catcher(v8::TryCatch* catcher) { | |
| 598 thread_local_top_.catcher_ = catcher; | |
| 599 } | |
| 600 | 592 |
| 601 MaybeObject** scheduled_exception_address() { | 593 MaybeObject** scheduled_exception_address() { |
| 602 return &thread_local_top_.scheduled_exception_; | 594 return &thread_local_top_.scheduled_exception_; |
| 603 } | 595 } |
| 604 | 596 |
| 605 Address pending_message_obj_address() { | 597 Address pending_message_obj_address() { |
| 606 return reinterpret_cast<Address>(&thread_local_top_.pending_message_obj_); | 598 return reinterpret_cast<Address>(&thread_local_top_.pending_message_obj_); |
| 607 } | 599 } |
| 608 | 600 |
| 609 Address has_pending_message_address() { | 601 Address has_pending_message_address() { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 }; | 697 }; |
| 706 | 698 |
| 707 void SetCaptureStackTraceForUncaughtExceptions( | 699 void SetCaptureStackTraceForUncaughtExceptions( |
| 708 bool capture, | 700 bool capture, |
| 709 int frame_limit, | 701 int frame_limit, |
| 710 StackTrace::StackTraceOptions options); | 702 StackTrace::StackTraceOptions options); |
| 711 | 703 |
| 712 // Tells whether the current context has experienced an out of memory | 704 // Tells whether the current context has experienced an out of memory |
| 713 // exception. | 705 // exception. |
| 714 bool is_out_of_memory(); | 706 bool is_out_of_memory(); |
| 715 bool ignore_out_of_memory() { | 707 |
| 716 return thread_local_top_.ignore_out_of_memory_; | 708 THREAD_LOCAL_TOP_ACCESSOR(bool, ignore_out_of_memory) |
| 717 } | |
| 718 void set_ignore_out_of_memory(bool value) { | |
| 719 thread_local_top_.ignore_out_of_memory_ = value; | |
| 720 } | |
| 721 | 709 |
| 722 void PrintCurrentStackTrace(FILE* out); | 710 void PrintCurrentStackTrace(FILE* out); |
| 723 void PrintStack(StringStream* accumulator); | 711 void PrintStack(StringStream* accumulator); |
| 724 void PrintStack(FILE* out); | 712 void PrintStack(FILE* out); |
| 725 Handle<String> StackTraceString(); | 713 Handle<String> StackTraceString(); |
| 726 NO_INLINE(void PushStackTraceAndDie(unsigned int magic, | 714 NO_INLINE(void PushStackTraceAndDie(unsigned int magic, |
| 727 Object* object, | 715 Object* object, |
| 728 Map* map, | 716 Map* map, |
| 729 unsigned int magic2)); | 717 unsigned int magic2)); |
| 730 Handle<JSArray> CaptureCurrentStackTrace( | 718 Handle<JSArray> CaptureCurrentStackTrace( |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 ConsStringIteratorOp* objects_string_compare_iterator_b() { | 923 ConsStringIteratorOp* objects_string_compare_iterator_b() { |
| 936 return &objects_string_compare_iterator_b_; | 924 return &objects_string_compare_iterator_b_; |
| 937 } | 925 } |
| 938 | 926 |
| 939 StaticResource<ConsStringIteratorOp>* objects_string_iterator() { | 927 StaticResource<ConsStringIteratorOp>* objects_string_iterator() { |
| 940 return &objects_string_iterator_; | 928 return &objects_string_iterator_; |
| 941 } | 929 } |
| 942 | 930 |
| 943 RuntimeState* runtime_state() { return &runtime_state_; } | 931 RuntimeState* runtime_state() { return &runtime_state_; } |
| 944 | 932 |
| 945 void set_fp_stubs_generated(bool value) { | 933 FIELD_ACCESSOR(bool, fp_stubs_generated); |
| 946 fp_stubs_generated_ = value; | |
| 947 } | |
| 948 | |
| 949 bool fp_stubs_generated() { return fp_stubs_generated_; } | |
| 950 | 934 |
| 951 Builtins* builtins() { return &builtins_; } | 935 Builtins* builtins() { return &builtins_; } |
| 952 | 936 |
| 953 void NotifyExtensionInstalled() { | 937 void NotifyExtensionInstalled() { |
| 954 has_installed_extensions_ = true; | 938 has_installed_extensions_ = true; |
| 955 } | 939 } |
| 956 | 940 |
| 957 bool has_installed_extensions() { return has_installed_extensions_; } | 941 bool has_installed_extensions() { return has_installed_extensions_; } |
| 958 | 942 |
| 959 unibrow::Mapping<unibrow::Ecma262Canonicalize>* | 943 unibrow::Mapping<unibrow::Ecma262Canonicalize>* |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 JSObject::SpillInformation* js_spill_information() { | 977 JSObject::SpillInformation* js_spill_information() { |
| 994 return &js_spill_information_; | 978 return &js_spill_information_; |
| 995 } | 979 } |
| 996 | 980 |
| 997 int* code_kind_statistics() { return code_kind_statistics_; } | 981 int* code_kind_statistics() { return code_kind_statistics_; } |
| 998 #endif | 982 #endif |
| 999 | 983 |
| 1000 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ | 984 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ |
| 1001 V8_TARGET_ARCH_A64 && !defined(__aarch64__) || \ | 985 V8_TARGET_ARCH_A64 && !defined(__aarch64__) || \ |
| 1002 V8_TARGET_ARCH_MIPS && !defined(__mips__) | 986 V8_TARGET_ARCH_MIPS && !defined(__mips__) |
| 1003 bool simulator_initialized() { return simulator_initialized_; } | 987 FIELD_ACCESSOR(bool, simulator_initialized) |
| 1004 void set_simulator_initialized(bool initialized) { | 988 FIELD_ACCESSOR(HashMap*, simulator_i_cache) |
| 1005 simulator_initialized_ = initialized; | 989 FIELD_ACCESSOR(Redirection*, simulator_redirection) |
| 1006 } | |
| 1007 | |
| 1008 HashMap* simulator_i_cache() { return simulator_i_cache_; } | |
| 1009 void set_simulator_i_cache(HashMap* hash_map) { | |
| 1010 simulator_i_cache_ = hash_map; | |
| 1011 } | |
| 1012 | |
| 1013 Redirection* simulator_redirection() { | |
| 1014 return simulator_redirection_; | |
| 1015 } | |
| 1016 void set_simulator_redirection(Redirection* redirection) { | |
| 1017 simulator_redirection_ = redirection; | |
| 1018 } | |
| 1019 #endif | 990 #endif |
| 1020 | 991 |
| 1021 Factory* factory() { return reinterpret_cast<Factory*>(this); } | 992 Factory* factory() { return reinterpret_cast<Factory*>(this); } |
| 1022 | 993 |
| 1023 static const int kJSRegexpStaticOffsetsVectorSize = 128; | 994 static const int kJSRegexpStaticOffsetsVectorSize = 128; |
| 1024 | 995 |
| 1025 ExternalCallbackScope* external_callback_scope() { | 996 THREAD_LOCAL_TOP_ACCESSOR(ExternalCallbackScope*, external_callback_scope) |
| 1026 return thread_local_top_.external_callback_scope_; | |
| 1027 } | |
| 1028 void set_external_callback_scope(ExternalCallbackScope* scope) { | |
| 1029 thread_local_top_.external_callback_scope_ = scope; | |
| 1030 } | |
| 1031 | 997 |
| 1032 StateTag current_vm_state() { | 998 THREAD_LOCAL_TOP_ACCESSOR(StateTag, current_vm_state) |
| 1033 return thread_local_top_.current_vm_state_; | |
| 1034 } | |
| 1035 | |
| 1036 void set_current_vm_state(StateTag state) { | |
| 1037 thread_local_top_.current_vm_state_ = state; | |
| 1038 } | |
| 1039 | 999 |
| 1040 void SetData(uint32_t slot, void* data) { | 1000 void SetData(uint32_t slot, void* data) { |
| 1041 ASSERT(slot < Internals::kNumIsolateDataSlots); | 1001 ASSERT(slot < Internals::kNumIsolateDataSlots); |
| 1042 embedder_data_[slot] = data; | 1002 embedder_data_[slot] = data; |
| 1043 } | 1003 } |
| 1044 void* GetData(uint32_t slot) { | 1004 void* GetData(uint32_t slot) { |
| 1045 ASSERT(slot < Internals::kNumIsolateDataSlots); | 1005 ASSERT(slot < Internals::kNumIsolateDataSlots); |
| 1046 return embedder_data_[slot]; | 1006 return embedder_data_[slot]; |
| 1047 } | 1007 } |
| 1048 | 1008 |
| 1049 LookupResult* top_lookup_result() { | 1009 THREAD_LOCAL_TOP_ACCESSOR(LookupResult*, top_lookup_result) |
| 1050 return thread_local_top_.top_lookup_result_; | |
| 1051 } | |
| 1052 void SetTopLookupResult(LookupResult* top) { | |
| 1053 thread_local_top_.top_lookup_result_ = top; | |
| 1054 } | |
| 1055 | 1010 |
| 1056 bool IsDead() { return has_fatal_error_; } | 1011 bool IsDead() { return has_fatal_error_; } |
| 1057 void SignalFatalError() { has_fatal_error_ = true; } | 1012 void SignalFatalError() { has_fatal_error_ = true; } |
| 1058 | 1013 |
| 1059 bool use_crankshaft() const { return use_crankshaft_; } | 1014 bool use_crankshaft() const { return use_crankshaft_; } |
| 1060 | 1015 |
| 1061 bool initialized_from_snapshot() { return initialized_from_snapshot_; } | 1016 bool initialized_from_snapshot() { return initialized_from_snapshot_; } |
| 1062 | 1017 |
| 1063 double time_millis_since_init() { | 1018 double time_millis_since_init() { |
| 1064 return OS::TimeCurrentMillis() - time_millis_at_init_; | 1019 return OS::TimeCurrentMillis() - time_millis_at_init_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1094 CallInterfaceDescriptor* call_descriptor(CallDescriptorKey index); | 1049 CallInterfaceDescriptor* call_descriptor(CallDescriptorKey index); |
| 1095 | 1050 |
| 1096 void IterateDeferredHandles(ObjectVisitor* visitor); | 1051 void IterateDeferredHandles(ObjectVisitor* visitor); |
| 1097 void LinkDeferredHandles(DeferredHandles* deferred_handles); | 1052 void LinkDeferredHandles(DeferredHandles* deferred_handles); |
| 1098 void UnlinkDeferredHandles(DeferredHandles* deferred_handles); | 1053 void UnlinkDeferredHandles(DeferredHandles* deferred_handles); |
| 1099 | 1054 |
| 1100 #ifdef DEBUG | 1055 #ifdef DEBUG |
| 1101 bool IsDeferredHandle(Object** location); | 1056 bool IsDeferredHandle(Object** location); |
| 1102 #endif // DEBUG | 1057 #endif // DEBUG |
| 1103 | 1058 |
| 1104 int max_available_threads() const { | 1059 FIELD_ACCESSOR(int, max_available_threads); |
| 1105 return max_available_threads_; | |
| 1106 } | |
| 1107 | |
| 1108 void set_max_available_threads(int value) { | |
| 1109 max_available_threads_ = value; | |
| 1110 } | |
| 1111 | 1060 |
| 1112 bool concurrent_recompilation_enabled() { | 1061 bool concurrent_recompilation_enabled() { |
| 1113 // Thread is only available with flag enabled. | 1062 // Thread is only available with flag enabled. |
| 1114 ASSERT(optimizing_compiler_thread_ == NULL || | 1063 ASSERT(optimizing_compiler_thread_ == NULL || |
| 1115 FLAG_concurrent_recompilation); | 1064 FLAG_concurrent_recompilation); |
| 1116 return optimizing_compiler_thread_ != NULL; | 1065 return optimizing_compiler_thread_ != NULL; |
| 1117 } | 1066 } |
| 1118 | 1067 |
| 1119 bool concurrent_osr_enabled() const { | 1068 bool concurrent_osr_enabled() const { |
| 1120 // Thread is only available with flag enabled. | 1069 // Thread is only available with flag enabled. |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 friend class TestMemoryAllocatorScope; | 1351 friend class TestMemoryAllocatorScope; |
| 1403 friend class TestCodeRangeScope; | 1352 friend class TestCodeRangeScope; |
| 1404 friend class v8::Isolate; | 1353 friend class v8::Isolate; |
| 1405 friend class v8::Locker; | 1354 friend class v8::Locker; |
| 1406 friend class v8::Unlocker; | 1355 friend class v8::Unlocker; |
| 1407 | 1356 |
| 1408 DISALLOW_COPY_AND_ASSIGN(Isolate); | 1357 DISALLOW_COPY_AND_ASSIGN(Isolate); |
| 1409 }; | 1358 }; |
| 1410 | 1359 |
| 1411 | 1360 |
| 1361 #undef FIELD_ACCESSOR |
| 1362 #undef THREAD_LOCAL_TOP_ACCESSOR |
| 1363 |
| 1364 |
| 1412 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the | 1365 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the |
| 1413 // class as a work around for a bug in the generated code found with these | 1366 // class as a work around for a bug in the generated code found with these |
| 1414 // versions of GCC. See V8 issue 122 for details. | 1367 // versions of GCC. See V8 issue 122 for details. |
| 1415 class SaveContext BASE_EMBEDDED { | 1368 class SaveContext BASE_EMBEDDED { |
| 1416 public: | 1369 public: |
| 1417 inline explicit SaveContext(Isolate* isolate); | 1370 inline explicit SaveContext(Isolate* isolate); |
| 1418 | 1371 |
| 1419 ~SaveContext() { | 1372 ~SaveContext() { |
| 1420 isolate_->set_context(context_.is_null() ? NULL : *context_); | 1373 isolate_->set_context(context_.is_null() ? NULL : *context_); |
| 1421 isolate_->set_save_context(prev_); | 1374 isolate_->set_save_context(prev_); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 } | 1543 } |
| 1591 | 1544 |
| 1592 EmbeddedVector<char, 128> filename_; | 1545 EmbeddedVector<char, 128> filename_; |
| 1593 FILE* file_; | 1546 FILE* file_; |
| 1594 int scope_depth_; | 1547 int scope_depth_; |
| 1595 }; | 1548 }; |
| 1596 | 1549 |
| 1597 } } // namespace v8::internal | 1550 } } // namespace v8::internal |
| 1598 | 1551 |
| 1599 #endif // V8_ISOLATE_H_ | 1552 #endif // V8_ISOLATE_H_ |
| OLD | NEW |