| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 typedef void* ExternalReferenceRedirectorPointer(); | 95 typedef void* ExternalReferenceRedirectorPointer(); |
| 96 | 96 |
| 97 | 97 |
| 98 #ifdef ENABLE_DEBUGGER_SUPPORT | 98 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 99 class Debug; | 99 class Debug; |
| 100 class Debugger; | 100 class Debugger; |
| 101 class DebuggerAgent; | 101 class DebuggerAgent; |
| 102 #endif | 102 #endif |
| 103 | 103 |
| 104 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \ | 104 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \ |
| 105 !defined(__aarch64__) && V8_TARGET_ARCH_A64 || \ | |
| 106 !defined(__mips__) && V8_TARGET_ARCH_MIPS | 105 !defined(__mips__) && V8_TARGET_ARCH_MIPS |
| 107 class Redirection; | 106 class Redirection; |
| 108 class Simulator; | 107 class Simulator; |
| 109 #endif | 108 #endif |
| 110 | 109 |
| 111 | 110 |
| 112 // Static indirection table for handles to constants. If a frame | 111 // Static indirection table for handles to constants. If a frame |
| 113 // element represents a constant, the data contains an index into | 112 // element represents a constant, the data contains an index into |
| 114 // this table of handles to the actual constants. | 113 // this table of handles to the actual constants. |
| 115 // Static indirection table for handles to constants. If a Result | 114 // Static indirection table for handles to constants. If a Result |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 static int GetCurrentThreadId(); | 200 static int GetCurrentThreadId(); |
| 202 | 201 |
| 203 int id_; | 202 int id_; |
| 204 | 203 |
| 205 static Atomic32 highest_thread_id_; | 204 static Atomic32 highest_thread_id_; |
| 206 | 205 |
| 207 friend class Isolate; | 206 friend class Isolate; |
| 208 }; | 207 }; |
| 209 | 208 |
| 210 | 209 |
| 211 #define FIELD_ACCESSOR(type, name) \ | |
| 212 inline void set_##name(type v) { name##_ = v; } \ | |
| 213 inline type name() const { return name##_; } | |
| 214 | |
| 215 | |
| 216 class ThreadLocalTop BASE_EMBEDDED { | 210 class ThreadLocalTop BASE_EMBEDDED { |
| 217 public: | 211 public: |
| 218 // Does early low-level initialization that does not depend on the | 212 // Does early low-level initialization that does not depend on the |
| 219 // isolate being present. | 213 // isolate being present. |
| 220 ThreadLocalTop(); | 214 ThreadLocalTop(); |
| 221 | 215 |
| 222 // Initialize the thread data. | 216 // Initialize the thread data. |
| 223 void Initialize(); | 217 void Initialize(); |
| 224 | 218 |
| 225 // Get the top C++ try catch handler or NULL if none are registered. | 219 // Get the top C++ try catch handler or NULL if none are registered. |
| 226 // | 220 // |
| 227 // This method is not guarenteed to return an address that can be | 221 // This method is not guarenteed to return an address that can be |
| 228 // used for comparison with addresses into the JS stack. If such an | 222 // used for comparison with addresses into the JS stack. If such an |
| 229 // address is needed, use try_catch_handler_address. | 223 // address is needed, use try_catch_handler_address. |
| 230 v8::TryCatch* TryCatchHandler(); | 224 v8::TryCatch* TryCatchHandler(); |
| 231 | 225 |
| 232 // Get the address of the top C++ try catch handler or NULL if | 226 // Get the address of the top C++ try catch handler or NULL if |
| 233 // none are registered. | 227 // none are registered. |
| 234 // | 228 // |
| 235 // This method always returns an address that can be compared to | 229 // This method always returns an address that can be compared to |
| 236 // pointers into the JavaScript stack. When running on actual | 230 // pointers into the JavaScript stack. When running on actual |
| 237 // hardware, try_catch_handler_address and TryCatchHandler return | 231 // hardware, try_catch_handler_address and TryCatchHandler return |
| 238 // the same pointer. When running on a simulator with a separate JS | 232 // the same pointer. When running on a simulator with a separate JS |
| 239 // stack, try_catch_handler_address returns a JS stack address that | 233 // stack, try_catch_handler_address returns a JS stack address that |
| 240 // corresponds to the place on the JS stack where the C++ handler | 234 // corresponds to the place on the JS stack where the C++ handler |
| 241 // would have been if the stack were not separate. | 235 // would have been if the stack were not separate. |
| 242 FIELD_ACCESSOR(Address, try_catch_handler_address) | 236 inline Address try_catch_handler_address() { |
| 237 return try_catch_handler_address_; |
| 238 } |
| 239 |
| 240 // Set the address of the top C++ try catch handler. |
| 241 inline void set_try_catch_handler_address(Address address) { |
| 242 try_catch_handler_address_ = address; |
| 243 } |
| 243 | 244 |
| 244 void Free() { | 245 void Free() { |
| 245 ASSERT(!has_pending_message_); | 246 ASSERT(!has_pending_message_); |
| 246 ASSERT(!external_caught_exception_); | 247 ASSERT(!external_caught_exception_); |
| 247 ASSERT(try_catch_handler_address_ == NULL); | 248 ASSERT(try_catch_handler_address_ == NULL); |
| 248 } | 249 } |
| 249 | 250 |
| 250 Isolate* isolate_; | 251 Isolate* isolate_; |
| 251 // The context where the current execution method is created and for variable | 252 // The context where the current execution method is created and for variable |
| 252 // lookups. | 253 // lookups. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 V(Relocatable*, relocatable_top, NULL) \ | 353 V(Relocatable*, relocatable_top, NULL) \ |
| 353 V(DebugObjectCache*, string_stream_debug_object_cache, NULL) \ | 354 V(DebugObjectCache*, string_stream_debug_object_cache, NULL) \ |
| 354 V(Object*, string_stream_current_security_token, NULL) \ | 355 V(Object*, string_stream_current_security_token, NULL) \ |
| 355 /* TODO(isolates): Release this on destruction? */ \ | 356 /* TODO(isolates): Release this on destruction? */ \ |
| 356 V(int*, irregexp_interpreter_backtrack_stack_cache, NULL) \ | 357 V(int*, irregexp_interpreter_backtrack_stack_cache, NULL) \ |
| 357 /* Serializer state. */ \ | 358 /* Serializer state. */ \ |
| 358 V(ExternalReferenceTable*, external_reference_table, NULL) \ | 359 V(ExternalReferenceTable*, external_reference_table, NULL) \ |
| 359 /* AstNode state. */ \ | 360 /* AstNode state. */ \ |
| 360 V(int, ast_node_id, 0) \ | 361 V(int, ast_node_id, 0) \ |
| 361 V(unsigned, ast_node_count, 0) \ | 362 V(unsigned, ast_node_count, 0) \ |
| 362 V(bool, microtask_pending, false) \ | 363 V(bool, microtask_pending, false) \ |
| 363 V(bool, autorun_microtasks, true) \ | |
| 364 V(HStatistics*, hstatistics, NULL) \ | 364 V(HStatistics*, hstatistics, NULL) \ |
| 365 V(HTracer*, htracer, NULL) \ | 365 V(HTracer*, htracer, NULL) \ |
| 366 V(CodeTracer*, code_tracer, NULL) \ | 366 V(CodeTracer*, code_tracer, NULL) \ |
| 367 ISOLATE_DEBUGGER_INIT_LIST(V) | 367 ISOLATE_DEBUGGER_INIT_LIST(V) |
| 368 | 368 |
| 369 #define THREAD_LOCAL_TOP_ACCESSOR(type, name) \ | |
| 370 inline void set_##name(type v) { thread_local_top_.name##_ = v; } \ | |
| 371 inline type name() const { return thread_local_top_.name##_; } | |
| 372 | |
| 373 | |
| 374 class Isolate { | 369 class Isolate { |
| 375 // These forward declarations are required to make the friend declarations in | 370 // These forward declarations are required to make the friend declarations in |
| 376 // PerIsolateThreadData work on some older versions of gcc. | 371 // PerIsolateThreadData work on some older versions of gcc. |
| 377 class ThreadDataTable; | 372 class ThreadDataTable; |
| 378 class EntryStackItem; | 373 class EntryStackItem; |
| 379 public: | 374 public: |
| 380 ~Isolate(); | 375 ~Isolate(); |
| 381 | 376 |
| 382 // A thread has a PerIsolateThreadData instance for each isolate that it has | 377 // A thread has a PerIsolateThreadData instance for each isolate that it has |
| 383 // entered. That instance is allocated when the isolate is initially entered | 378 // entered. That instance is allocated when the isolate is initially entered |
| 384 // and reused on subsequent entries. | 379 // and reused on subsequent entries. |
| 385 class PerIsolateThreadData { | 380 class PerIsolateThreadData { |
| 386 public: | 381 public: |
| 387 PerIsolateThreadData(Isolate* isolate, ThreadId thread_id) | 382 PerIsolateThreadData(Isolate* isolate, ThreadId thread_id) |
| 388 : isolate_(isolate), | 383 : isolate_(isolate), |
| 389 thread_id_(thread_id), | 384 thread_id_(thread_id), |
| 390 stack_limit_(0), | 385 stack_limit_(0), |
| 391 thread_state_(NULL), | 386 thread_state_(NULL), |
| 392 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \ | 387 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \ |
| 393 !defined(__aarch64__) && V8_TARGET_ARCH_A64 || \ | |
| 394 !defined(__mips__) && V8_TARGET_ARCH_MIPS | 388 !defined(__mips__) && V8_TARGET_ARCH_MIPS |
| 395 simulator_(NULL), | 389 simulator_(NULL), |
| 396 #endif | 390 #endif |
| 397 next_(NULL), | 391 next_(NULL), |
| 398 prev_(NULL) { } | 392 prev_(NULL) { } |
| 399 Isolate* isolate() const { return isolate_; } | 393 Isolate* isolate() const { return isolate_; } |
| 400 ThreadId thread_id() const { return thread_id_; } | 394 ThreadId thread_id() const { return thread_id_; } |
| 401 | 395 void set_stack_limit(uintptr_t value) { stack_limit_ = value; } |
| 402 FIELD_ACCESSOR(uintptr_t, stack_limit) | 396 uintptr_t stack_limit() const { return stack_limit_; } |
| 403 FIELD_ACCESSOR(ThreadState*, thread_state) | 397 ThreadState* thread_state() const { return thread_state_; } |
| 398 void set_thread_state(ThreadState* value) { thread_state_ = value; } |
| 404 | 399 |
| 405 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \ | 400 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \ |
| 406 !defined(__aarch64__) && V8_TARGET_ARCH_A64 || \ | |
| 407 !defined(__mips__) && V8_TARGET_ARCH_MIPS | 401 !defined(__mips__) && V8_TARGET_ARCH_MIPS |
| 408 FIELD_ACCESSOR(Simulator*, simulator) | 402 Simulator* simulator() const { return simulator_; } |
| 403 void set_simulator(Simulator* simulator) { |
| 404 simulator_ = simulator; |
| 405 } |
| 409 #endif | 406 #endif |
| 410 | 407 |
| 411 bool Matches(Isolate* isolate, ThreadId thread_id) const { | 408 bool Matches(Isolate* isolate, ThreadId thread_id) const { |
| 412 return isolate_ == isolate && thread_id_.Equals(thread_id); | 409 return isolate_ == isolate && thread_id_.Equals(thread_id); |
| 413 } | 410 } |
| 414 | 411 |
| 415 private: | 412 private: |
| 416 Isolate* isolate_; | 413 Isolate* isolate_; |
| 417 ThreadId thread_id_; | 414 ThreadId thread_id_; |
| 418 uintptr_t stack_limit_; | 415 uintptr_t stack_limit_; |
| 419 ThreadState* thread_state_; | 416 ThreadState* thread_state_; |
| 420 | 417 |
| 421 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \ | 418 #if !defined(__arm__) && V8_TARGET_ARCH_ARM || \ |
| 422 !defined(__aarch64__) && V8_TARGET_ARCH_A64 || \ | |
| 423 !defined(__mips__) && V8_TARGET_ARCH_MIPS | 419 !defined(__mips__) && V8_TARGET_ARCH_MIPS |
| 424 Simulator* simulator_; | 420 Simulator* simulator_; |
| 425 #endif | 421 #endif |
| 426 | 422 |
| 427 PerIsolateThreadData* next_; | 423 PerIsolateThreadData* next_; |
| 428 PerIsolateThreadData* prev_; | 424 PerIsolateThreadData* prev_; |
| 429 | 425 |
| 430 friend class Isolate; | 426 friend class Isolate; |
| 431 friend class ThreadDataTable; | 427 friend class ThreadDataTable; |
| 432 friend class EntryStackItem; | 428 friend class EntryStackItem; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 Address get_address_from_id(AddressId id); | 534 Address get_address_from_id(AddressId id); |
| 539 | 535 |
| 540 // Access to top context (where the current function object was created). | 536 // Access to top context (where the current function object was created). |
| 541 Context* context() { return thread_local_top_.context_; } | 537 Context* context() { return thread_local_top_.context_; } |
| 542 void set_context(Context* context) { | 538 void set_context(Context* context) { |
| 543 ASSERT(context == NULL || context->IsContext()); | 539 ASSERT(context == NULL || context->IsContext()); |
| 544 thread_local_top_.context_ = context; | 540 thread_local_top_.context_ = context; |
| 545 } | 541 } |
| 546 Context** context_address() { return &thread_local_top_.context_; } | 542 Context** context_address() { return &thread_local_top_.context_; } |
| 547 | 543 |
| 548 THREAD_LOCAL_TOP_ACCESSOR(SaveContext*, save_context) | 544 SaveContext* save_context() { return thread_local_top_.save_context_; } |
| 545 void set_save_context(SaveContext* save) { |
| 546 thread_local_top_.save_context_ = save; |
| 547 } |
| 549 | 548 |
| 550 // Access to current thread id. | 549 // Access to current thread id. |
| 551 THREAD_LOCAL_TOP_ACCESSOR(ThreadId, thread_id) | 550 ThreadId thread_id() { return thread_local_top_.thread_id_; } |
| 551 void set_thread_id(ThreadId id) { thread_local_top_.thread_id_ = id; } |
| 552 | 552 |
| 553 // Interface to pending exception. | 553 // Interface to pending exception. |
| 554 MaybeObject* pending_exception() { | 554 MaybeObject* pending_exception() { |
| 555 ASSERT(has_pending_exception()); | 555 ASSERT(has_pending_exception()); |
| 556 return thread_local_top_.pending_exception_; | 556 return thread_local_top_.pending_exception_; |
| 557 } | 557 } |
| 558 | 558 bool external_caught_exception() { |
| 559 return thread_local_top_.external_caught_exception_; |
| 560 } |
| 561 void set_external_caught_exception(bool value) { |
| 562 thread_local_top_.external_caught_exception_ = value; |
| 563 } |
| 559 void set_pending_exception(MaybeObject* exception) { | 564 void set_pending_exception(MaybeObject* exception) { |
| 560 thread_local_top_.pending_exception_ = exception; | 565 thread_local_top_.pending_exception_ = exception; |
| 561 } | 566 } |
| 562 | |
| 563 void clear_pending_exception() { | 567 void clear_pending_exception() { |
| 564 thread_local_top_.pending_exception_ = heap_.the_hole_value(); | 568 thread_local_top_.pending_exception_ = heap_.the_hole_value(); |
| 565 } | 569 } |
| 566 | |
| 567 MaybeObject** pending_exception_address() { | 570 MaybeObject** pending_exception_address() { |
| 568 return &thread_local_top_.pending_exception_; | 571 return &thread_local_top_.pending_exception_; |
| 569 } | 572 } |
| 570 | |
| 571 bool has_pending_exception() { | 573 bool has_pending_exception() { |
| 572 return !thread_local_top_.pending_exception_->IsTheHole(); | 574 return !thread_local_top_.pending_exception_->IsTheHole(); |
| 573 } | 575 } |
| 574 | |
| 575 THREAD_LOCAL_TOP_ACCESSOR(bool, external_caught_exception) | |
| 576 | |
| 577 void clear_pending_message() { | 576 void clear_pending_message() { |
| 578 thread_local_top_.has_pending_message_ = false; | 577 thread_local_top_.has_pending_message_ = false; |
| 579 thread_local_top_.pending_message_obj_ = heap_.the_hole_value(); | 578 thread_local_top_.pending_message_obj_ = heap_.the_hole_value(); |
| 580 thread_local_top_.pending_message_script_ = heap_.the_hole_value(); | 579 thread_local_top_.pending_message_script_ = heap_.the_hole_value(); |
| 581 } | 580 } |
| 582 v8::TryCatch* try_catch_handler() { | 581 v8::TryCatch* try_catch_handler() { |
| 583 return thread_local_top_.TryCatchHandler(); | 582 return thread_local_top_.TryCatchHandler(); |
| 584 } | 583 } |
| 585 Address try_catch_handler_address() { | 584 Address try_catch_handler_address() { |
| 586 return thread_local_top_.try_catch_handler_address(); | 585 return thread_local_top_.try_catch_handler_address(); |
| 587 } | 586 } |
| 588 bool* external_caught_exception_address() { | 587 bool* external_caught_exception_address() { |
| 589 return &thread_local_top_.external_caught_exception_; | 588 return &thread_local_top_.external_caught_exception_; |
| 590 } | 589 } |
| 591 | 590 v8::TryCatch* catcher() { |
| 592 THREAD_LOCAL_TOP_ACCESSOR(v8::TryCatch*, catcher) | 591 return thread_local_top_.catcher_; |
| 592 } |
| 593 void set_catcher(v8::TryCatch* catcher) { |
| 594 thread_local_top_.catcher_ = catcher; |
| 595 } |
| 593 | 596 |
| 594 MaybeObject** scheduled_exception_address() { | 597 MaybeObject** scheduled_exception_address() { |
| 595 return &thread_local_top_.scheduled_exception_; | 598 return &thread_local_top_.scheduled_exception_; |
| 596 } | 599 } |
| 597 | 600 |
| 598 Address pending_message_obj_address() { | 601 Address pending_message_obj_address() { |
| 599 return reinterpret_cast<Address>(&thread_local_top_.pending_message_obj_); | 602 return reinterpret_cast<Address>(&thread_local_top_.pending_message_obj_); |
| 600 } | 603 } |
| 601 | 604 |
| 602 Address has_pending_message_address() { | 605 Address has_pending_message_address() { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 }; | 701 }; |
| 699 | 702 |
| 700 void SetCaptureStackTraceForUncaughtExceptions( | 703 void SetCaptureStackTraceForUncaughtExceptions( |
| 701 bool capture, | 704 bool capture, |
| 702 int frame_limit, | 705 int frame_limit, |
| 703 StackTrace::StackTraceOptions options); | 706 StackTrace::StackTraceOptions options); |
| 704 | 707 |
| 705 // Tells whether the current context has experienced an out of memory | 708 // Tells whether the current context has experienced an out of memory |
| 706 // exception. | 709 // exception. |
| 707 bool is_out_of_memory(); | 710 bool is_out_of_memory(); |
| 708 | 711 bool ignore_out_of_memory() { |
| 709 THREAD_LOCAL_TOP_ACCESSOR(bool, ignore_out_of_memory) | 712 return thread_local_top_.ignore_out_of_memory_; |
| 713 } |
| 714 void set_ignore_out_of_memory(bool value) { |
| 715 thread_local_top_.ignore_out_of_memory_ = value; |
| 716 } |
| 710 | 717 |
| 711 void PrintCurrentStackTrace(FILE* out); | 718 void PrintCurrentStackTrace(FILE* out); |
| 712 void PrintStack(StringStream* accumulator); | 719 void PrintStack(StringStream* accumulator); |
| 713 void PrintStack(FILE* out); | 720 void PrintStack(FILE* out); |
| 714 Handle<String> StackTraceString(); | 721 Handle<String> StackTraceString(); |
| 715 NO_INLINE(void PushStackTraceAndDie(unsigned int magic, | 722 NO_INLINE(void PushStackTraceAndDie(unsigned int magic, |
| 716 Object* object, | 723 Object* object, |
| 717 Map* map, | 724 Map* map, |
| 718 unsigned int magic2)); | 725 unsigned int magic2)); |
| 719 Handle<JSArray> CaptureCurrentStackTrace( | 726 Handle<JSArray> CaptureCurrentStackTrace( |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 ConsStringIteratorOp* objects_string_compare_iterator_b() { | 931 ConsStringIteratorOp* objects_string_compare_iterator_b() { |
| 925 return &objects_string_compare_iterator_b_; | 932 return &objects_string_compare_iterator_b_; |
| 926 } | 933 } |
| 927 | 934 |
| 928 StaticResource<ConsStringIteratorOp>* objects_string_iterator() { | 935 StaticResource<ConsStringIteratorOp>* objects_string_iterator() { |
| 929 return &objects_string_iterator_; | 936 return &objects_string_iterator_; |
| 930 } | 937 } |
| 931 | 938 |
| 932 RuntimeState* runtime_state() { return &runtime_state_; } | 939 RuntimeState* runtime_state() { return &runtime_state_; } |
| 933 | 940 |
| 934 FIELD_ACCESSOR(bool, fp_stubs_generated); | 941 void set_fp_stubs_generated(bool value) { |
| 942 fp_stubs_generated_ = value; |
| 943 } |
| 944 |
| 945 bool fp_stubs_generated() { return fp_stubs_generated_; } |
| 935 | 946 |
| 936 Builtins* builtins() { return &builtins_; } | 947 Builtins* builtins() { return &builtins_; } |
| 937 | 948 |
| 938 void NotifyExtensionInstalled() { | 949 void NotifyExtensionInstalled() { |
| 939 has_installed_extensions_ = true; | 950 has_installed_extensions_ = true; |
| 940 } | 951 } |
| 941 | 952 |
| 942 bool has_installed_extensions() { return has_installed_extensions_; } | 953 bool has_installed_extensions() { return has_installed_extensions_; } |
| 943 | 954 |
| 944 unibrow::Mapping<unibrow::Ecma262Canonicalize>* | 955 unibrow::Mapping<unibrow::Ecma262Canonicalize>* |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 HistogramInfo* heap_histograms() { return heap_histograms_; } | 987 HistogramInfo* heap_histograms() { return heap_histograms_; } |
| 977 | 988 |
| 978 JSObject::SpillInformation* js_spill_information() { | 989 JSObject::SpillInformation* js_spill_information() { |
| 979 return &js_spill_information_; | 990 return &js_spill_information_; |
| 980 } | 991 } |
| 981 | 992 |
| 982 int* code_kind_statistics() { return code_kind_statistics_; } | 993 int* code_kind_statistics() { return code_kind_statistics_; } |
| 983 #endif | 994 #endif |
| 984 | 995 |
| 985 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ | 996 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ |
| 986 V8_TARGET_ARCH_A64 && !defined(__aarch64__) || \ | |
| 987 V8_TARGET_ARCH_MIPS && !defined(__mips__) | 997 V8_TARGET_ARCH_MIPS && !defined(__mips__) |
| 988 FIELD_ACCESSOR(bool, simulator_initialized) | 998 bool simulator_initialized() { return simulator_initialized_; } |
| 989 FIELD_ACCESSOR(HashMap*, simulator_i_cache) | 999 void set_simulator_initialized(bool initialized) { |
| 990 FIELD_ACCESSOR(Redirection*, simulator_redirection) | 1000 simulator_initialized_ = initialized; |
| 1001 } |
| 1002 |
| 1003 HashMap* simulator_i_cache() { return simulator_i_cache_; } |
| 1004 void set_simulator_i_cache(HashMap* hash_map) { |
| 1005 simulator_i_cache_ = hash_map; |
| 1006 } |
| 1007 |
| 1008 Redirection* simulator_redirection() { |
| 1009 return simulator_redirection_; |
| 1010 } |
| 1011 void set_simulator_redirection(Redirection* redirection) { |
| 1012 simulator_redirection_ = redirection; |
| 1013 } |
| 991 #endif | 1014 #endif |
| 992 | 1015 |
| 993 Factory* factory() { return reinterpret_cast<Factory*>(this); } | 1016 Factory* factory() { return reinterpret_cast<Factory*>(this); } |
| 994 | 1017 |
| 995 static const int kJSRegexpStaticOffsetsVectorSize = 128; | 1018 static const int kJSRegexpStaticOffsetsVectorSize = 128; |
| 996 | 1019 |
| 997 THREAD_LOCAL_TOP_ACCESSOR(ExternalCallbackScope*, external_callback_scope) | 1020 ExternalCallbackScope* external_callback_scope() { |
| 1021 return thread_local_top_.external_callback_scope_; |
| 1022 } |
| 1023 void set_external_callback_scope(ExternalCallbackScope* scope) { |
| 1024 thread_local_top_.external_callback_scope_ = scope; |
| 1025 } |
| 998 | 1026 |
| 999 THREAD_LOCAL_TOP_ACCESSOR(StateTag, current_vm_state) | 1027 StateTag current_vm_state() { |
| 1028 return thread_local_top_.current_vm_state_; |
| 1029 } |
| 1030 |
| 1031 void set_current_vm_state(StateTag state) { |
| 1032 thread_local_top_.current_vm_state_ = state; |
| 1033 } |
| 1000 | 1034 |
| 1001 void SetData(uint32_t slot, void* data) { | 1035 void SetData(uint32_t slot, void* data) { |
| 1002 ASSERT(slot < Internals::kNumIsolateDataSlots); | 1036 ASSERT(slot < Internals::kNumIsolateDataSlots); |
| 1003 embedder_data_[slot] = data; | 1037 embedder_data_[slot] = data; |
| 1004 } | 1038 } |
| 1005 void* GetData(uint32_t slot) { | 1039 void* GetData(uint32_t slot) { |
| 1006 ASSERT(slot < Internals::kNumIsolateDataSlots); | 1040 ASSERT(slot < Internals::kNumIsolateDataSlots); |
| 1007 return embedder_data_[slot]; | 1041 return embedder_data_[slot]; |
| 1008 } | 1042 } |
| 1009 | 1043 |
| 1010 THREAD_LOCAL_TOP_ACCESSOR(LookupResult*, top_lookup_result) | 1044 LookupResult* top_lookup_result() { |
| 1045 return thread_local_top_.top_lookup_result_; |
| 1046 } |
| 1047 void SetTopLookupResult(LookupResult* top) { |
| 1048 thread_local_top_.top_lookup_result_ = top; |
| 1049 } |
| 1011 | 1050 |
| 1012 bool IsDead() { return has_fatal_error_; } | 1051 bool IsDead() { return has_fatal_error_; } |
| 1013 void SignalFatalError() { has_fatal_error_ = true; } | 1052 void SignalFatalError() { has_fatal_error_ = true; } |
| 1014 | 1053 |
| 1015 bool use_crankshaft() const { return use_crankshaft_; } | 1054 bool use_crankshaft() const { return use_crankshaft_; } |
| 1016 | 1055 |
| 1017 bool initialized_from_snapshot() { return initialized_from_snapshot_; } | 1056 bool initialized_from_snapshot() { return initialized_from_snapshot_; } |
| 1018 | 1057 |
| 1019 double time_millis_since_init() { | 1058 double time_millis_since_init() { |
| 1020 return OS::TimeCurrentMillis() - time_millis_at_init_; | 1059 return OS::TimeCurrentMillis() - time_millis_at_init_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1050 CallInterfaceDescriptor* call_descriptor(CallDescriptorKey index); | 1089 CallInterfaceDescriptor* call_descriptor(CallDescriptorKey index); |
| 1051 | 1090 |
| 1052 void IterateDeferredHandles(ObjectVisitor* visitor); | 1091 void IterateDeferredHandles(ObjectVisitor* visitor); |
| 1053 void LinkDeferredHandles(DeferredHandles* deferred_handles); | 1092 void LinkDeferredHandles(DeferredHandles* deferred_handles); |
| 1054 void UnlinkDeferredHandles(DeferredHandles* deferred_handles); | 1093 void UnlinkDeferredHandles(DeferredHandles* deferred_handles); |
| 1055 | 1094 |
| 1056 #ifdef DEBUG | 1095 #ifdef DEBUG |
| 1057 bool IsDeferredHandle(Object** location); | 1096 bool IsDeferredHandle(Object** location); |
| 1058 #endif // DEBUG | 1097 #endif // DEBUG |
| 1059 | 1098 |
| 1060 FIELD_ACCESSOR(int, max_available_threads); | 1099 int max_available_threads() const { |
| 1100 return max_available_threads_; |
| 1101 } |
| 1102 |
| 1103 void set_max_available_threads(int value) { |
| 1104 max_available_threads_ = value; |
| 1105 } |
| 1061 | 1106 |
| 1062 bool concurrent_recompilation_enabled() { | 1107 bool concurrent_recompilation_enabled() { |
| 1063 // Thread is only available with flag enabled. | 1108 // Thread is only available with flag enabled. |
| 1064 ASSERT(optimizing_compiler_thread_ == NULL || | 1109 ASSERT(optimizing_compiler_thread_ == NULL || |
| 1065 FLAG_concurrent_recompilation); | 1110 FLAG_concurrent_recompilation); |
| 1066 return optimizing_compiler_thread_ != NULL; | 1111 return optimizing_compiler_thread_ != NULL; |
| 1067 } | 1112 } |
| 1068 | 1113 |
| 1069 bool concurrent_osr_enabled() const { | 1114 bool concurrent_osr_enabled() const { |
| 1070 // Thread is only available with flag enabled. | 1115 // Thread is only available with flag enabled. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1101 function_entry_hook_ = function_entry_hook; | 1146 function_entry_hook_ = function_entry_hook; |
| 1102 } | 1147 } |
| 1103 | 1148 |
| 1104 void* stress_deopt_count_address() { return &stress_deopt_count_; } | 1149 void* stress_deopt_count_address() { return &stress_deopt_count_; } |
| 1105 | 1150 |
| 1106 inline RandomNumberGenerator* random_number_generator(); | 1151 inline RandomNumberGenerator* random_number_generator(); |
| 1107 | 1152 |
| 1108 // Given an address occupied by a live code object, return that object. | 1153 // Given an address occupied by a live code object, return that object. |
| 1109 Object* FindCodeObject(Address a); | 1154 Object* FindCodeObject(Address a); |
| 1110 | 1155 |
| 1111 int NextOptimizationId() { | |
| 1112 int id = next_optimization_id_++; | |
| 1113 if (!Smi::IsValid(next_optimization_id_)) { | |
| 1114 next_optimization_id_ = 0; | |
| 1115 } | |
| 1116 return id; | |
| 1117 } | |
| 1118 | |
| 1119 private: | 1156 private: |
| 1120 Isolate(); | 1157 Isolate(); |
| 1121 | 1158 |
| 1122 friend struct GlobalState; | 1159 friend struct GlobalState; |
| 1123 friend struct InitializeGlobalState; | 1160 friend struct InitializeGlobalState; |
| 1124 | 1161 |
| 1125 enum State { | 1162 enum State { |
| 1126 UNINITIALIZED, // Some components may not have been allocated. | 1163 UNINITIALIZED, // Some components may not have been allocated. |
| 1127 INITIALIZED // All components are fully initialized. | 1164 INITIALIZED // All components are fully initialized. |
| 1128 }; | 1165 }; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 // True if we are using the Crankshaft optimizing compiler. | 1323 // True if we are using the Crankshaft optimizing compiler. |
| 1287 bool use_crankshaft_; | 1324 bool use_crankshaft_; |
| 1288 | 1325 |
| 1289 // True if this isolate was initialized from a snapshot. | 1326 // True if this isolate was initialized from a snapshot. |
| 1290 bool initialized_from_snapshot_; | 1327 bool initialized_from_snapshot_; |
| 1291 | 1328 |
| 1292 // Time stamp at initialization. | 1329 // Time stamp at initialization. |
| 1293 double time_millis_at_init_; | 1330 double time_millis_at_init_; |
| 1294 | 1331 |
| 1295 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ | 1332 #if V8_TARGET_ARCH_ARM && !defined(__arm__) || \ |
| 1296 V8_TARGET_ARCH_A64 && !defined(__aarch64__) || \ | |
| 1297 V8_TARGET_ARCH_MIPS && !defined(__mips__) | 1333 V8_TARGET_ARCH_MIPS && !defined(__mips__) |
| 1298 bool simulator_initialized_; | 1334 bool simulator_initialized_; |
| 1299 HashMap* simulator_i_cache_; | 1335 HashMap* simulator_i_cache_; |
| 1300 Redirection* simulator_redirection_; | 1336 Redirection* simulator_redirection_; |
| 1301 #endif | 1337 #endif |
| 1302 | 1338 |
| 1303 #ifdef DEBUG | 1339 #ifdef DEBUG |
| 1304 // A static array of histogram info for each type. | 1340 // A static array of histogram info for each type. |
| 1305 HistogramInfo heap_histograms_[LAST_TYPE + 1]; | 1341 HistogramInfo heap_histograms_[LAST_TYPE + 1]; |
| 1306 JSObject::SpillInformation js_spill_information_; | 1342 JSObject::SpillInformation js_spill_information_; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 SweeperThread** sweeper_thread_; | 1377 SweeperThread** sweeper_thread_; |
| 1342 int num_sweeper_threads_; | 1378 int num_sweeper_threads_; |
| 1343 | 1379 |
| 1344 // TODO(yangguo): This will become obsolete once ResourceConstraints | 1380 // TODO(yangguo): This will become obsolete once ResourceConstraints |
| 1345 // becomes an argument to Isolate constructor. | 1381 // becomes an argument to Isolate constructor. |
| 1346 int max_available_threads_; | 1382 int max_available_threads_; |
| 1347 | 1383 |
| 1348 // Counts deopt points if deopt_every_n_times is enabled. | 1384 // Counts deopt points if deopt_every_n_times is enabled. |
| 1349 unsigned int stress_deopt_count_; | 1385 unsigned int stress_deopt_count_; |
| 1350 | 1386 |
| 1351 int next_optimization_id_; | |
| 1352 | |
| 1353 friend class ExecutionAccess; | 1387 friend class ExecutionAccess; |
| 1354 friend class HandleScopeImplementer; | 1388 friend class HandleScopeImplementer; |
| 1355 friend class IsolateInitializer; | 1389 friend class IsolateInitializer; |
| 1356 friend class OptimizingCompilerThread; | 1390 friend class OptimizingCompilerThread; |
| 1357 friend class SweeperThread; | 1391 friend class SweeperThread; |
| 1358 friend class ThreadManager; | 1392 friend class ThreadManager; |
| 1359 friend class Simulator; | 1393 friend class Simulator; |
| 1360 friend class StackGuard; | 1394 friend class StackGuard; |
| 1361 friend class ThreadId; | 1395 friend class ThreadId; |
| 1362 friend class TestMemoryAllocatorScope; | 1396 friend class TestMemoryAllocatorScope; |
| 1363 friend class TestCodeRangeScope; | 1397 friend class TestCodeRangeScope; |
| 1364 friend class v8::Isolate; | 1398 friend class v8::Isolate; |
| 1365 friend class v8::Locker; | 1399 friend class v8::Locker; |
| 1366 friend class v8::Unlocker; | 1400 friend class v8::Unlocker; |
| 1367 | 1401 |
| 1368 DISALLOW_COPY_AND_ASSIGN(Isolate); | 1402 DISALLOW_COPY_AND_ASSIGN(Isolate); |
| 1369 }; | 1403 }; |
| 1370 | 1404 |
| 1371 | 1405 |
| 1372 #undef FIELD_ACCESSOR | |
| 1373 #undef THREAD_LOCAL_TOP_ACCESSOR | |
| 1374 | |
| 1375 | |
| 1376 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the | 1406 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the |
| 1377 // class as a work around for a bug in the generated code found with these | 1407 // class as a work around for a bug in the generated code found with these |
| 1378 // versions of GCC. See V8 issue 122 for details. | 1408 // versions of GCC. See V8 issue 122 for details. |
| 1379 class SaveContext BASE_EMBEDDED { | 1409 class SaveContext BASE_EMBEDDED { |
| 1380 public: | 1410 public: |
| 1381 inline explicit SaveContext(Isolate* isolate); | 1411 inline explicit SaveContext(Isolate* isolate); |
| 1382 | 1412 |
| 1383 ~SaveContext() { | 1413 ~SaveContext() { |
| 1384 isolate_->set_context(context_.is_null() ? NULL : *context_); | 1414 isolate_->set_context(context_.is_null() ? NULL : *context_); |
| 1385 isolate_->set_save_context(prev_); | 1415 isolate_->set_save_context(prev_); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 } | 1584 } |
| 1555 | 1585 |
| 1556 EmbeddedVector<char, 128> filename_; | 1586 EmbeddedVector<char, 128> filename_; |
| 1557 FILE* file_; | 1587 FILE* file_; |
| 1558 int scope_depth_; | 1588 int scope_depth_; |
| 1559 }; | 1589 }; |
| 1560 | 1590 |
| 1561 } } // namespace v8::internal | 1591 } } // namespace v8::internal |
| 1562 | 1592 |
| 1563 #endif // V8_ISOLATE_H_ | 1593 #endif // V8_ISOLATE_H_ |
| OLD | NEW |