OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 14 matching lines...) Expand all Loading... |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_ISOLATE_H_ | 28 #ifndef V8_ISOLATE_H_ |
29 #define V8_ISOLATE_H_ | 29 #define V8_ISOLATE_H_ |
30 | 30 |
31 #define V8_USE_TLS_FOR_GLOBAL_ISOLATE | 31 #define V8_USE_TLS_FOR_GLOBAL_ISOLATE |
32 | 32 |
33 #include "allocation.h" | 33 #include "allocation.h" |
34 #include "apiutils.h" | 34 #include "apiutils.h" |
| 35 #include "builtins.h" |
35 #include "contexts.h" | 36 #include "contexts.h" |
36 #include "execution.h" | 37 #include "execution.h" |
37 #include "frames-inl.h" | 38 #include "frames-inl.h" |
38 #include "frames.h" | 39 #include "frames.h" |
39 #include "global-handles.h" | 40 #include "global-handles.h" |
40 #include "handles.h" | 41 #include "handles.h" |
41 #include "heap.h" | 42 #include "heap.h" |
| 43 #include "runtime.h" |
42 #include "zone.h" | 44 #include "zone.h" |
43 #include "../include/v8-debug.h" | 45 #include "../include/v8-debug.h" |
44 | 46 |
45 namespace v8 { | 47 namespace v8 { |
46 namespace internal { | 48 namespace internal { |
47 | 49 |
| 50 class AstSentinels; |
48 class Bootstrapper; | 51 class Bootstrapper; |
49 class CompilationCache; | 52 class CompilationCache; |
50 class ContextSlotCache; | 53 class ContextSlotCache; |
51 class ContextSwitcher; | 54 class ContextSwitcher; |
52 class CodeRange; | 55 class CodeRange; |
53 class CpuFeatures; | 56 class CpuFeatures; |
54 class Deserializer; | 57 class Deserializer; |
| 58 class EmptyStatement; |
| 59 class FunctionInfoListener; |
55 class HandleScopeImplementer; | 60 class HandleScopeImplementer; |
56 class NoAllocationStringAllocator; | 61 class NoAllocationStringAllocator; |
57 class PreallocatedMemoryThread; | 62 class PreallocatedMemoryThread; |
58 class SaveContext; | 63 class SaveContext; |
59 class StubCache; | 64 class StubCache; |
60 class StringInputBuffer; | 65 class StringInputBuffer; |
61 class StringTracker; | 66 class StringTracker; |
62 class ScannerCharacterClasses; | 67 class ScannerCharacterClasses; |
63 class ThreadVisitor; // Defined in v8threads.h | 68 class ThreadVisitor; // Defined in v8threads.h |
64 class ThreadManager; | 69 class ThreadManager; |
| 70 class VMState; |
| 71 |
| 72 typedef void* ExternalReferenceRedirector(void* original, bool fp_return); |
65 | 73 |
66 | 74 |
67 #ifdef ENABLE_DEBUGGER_SUPPORT | 75 #ifdef ENABLE_DEBUGGER_SUPPORT |
68 class Debugger; | 76 class Debugger; |
69 #endif | 77 #endif |
70 | 78 |
71 #define RETURN_IF_SCHEDULED_EXCEPTION() \ | 79 #define RETURN_IF_SCHEDULED_EXCEPTION() \ |
72 if (Isolate::Current()->has_scheduled_exception()) \ | 80 if (Isolate::Current()->has_scheduled_exception()) \ |
73 return Isolate::Current()->PromoteScheduledException() | 81 return Isolate::Current()->PromoteScheduledException() |
74 | 82 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 /* Assembler state. */ \ | 196 /* Assembler state. */ \ |
189 /* A previously allocated buffer of kMinimalBufferSize bytes, or NULL. */ \ | 197 /* A previously allocated buffer of kMinimalBufferSize bytes, or NULL. */ \ |
190 V(byte*, assembler_spare_buffer, NULL) \ | 198 V(byte*, assembler_spare_buffer, NULL) \ |
191 /*This static counter ensures that NativeAllocationCheckers can be nested.*/ \ | 199 /*This static counter ensures that NativeAllocationCheckers can be nested.*/ \ |
192 V(int, allocation_disallowed, 0) \ | 200 V(int, allocation_disallowed, 0) \ |
193 V(FatalErrorCallback, exception_behavior, NULL) \ | 201 V(FatalErrorCallback, exception_behavior, NULL) \ |
194 V(v8::Debug::MessageHandler, message_handler, NULL) \ | 202 V(v8::Debug::MessageHandler, message_handler, NULL) \ |
195 /* To distinguish the function templates, so that we can find them in the */ \ | 203 /* To distinguish the function templates, so that we can find them in the */ \ |
196 /* function cache of the global context. */ \ | 204 /* function cache of the global context. */ \ |
197 V(int, next_serial_number, 0) \ | 205 V(int, next_serial_number, 0) \ |
| 206 V(ExternalReferenceRedirector*, external_reference_redirector, NULL) \ |
| 207 V(bool, always_allow_natives_syntax, false) \ |
| 208 /* A stack of VM states. */ \ |
| 209 V(VMState*, vm_state, NULL) \ |
| 210 /* Part of the state of liveedit. */ \ |
| 211 V(FunctionInfoListener*, active_function_info_listener, NULL) \ |
198 /* State for Relocatable. */ \ | 212 /* State for Relocatable. */ \ |
199 V(Relocatable*, relocatable_top, NULL) \ | 213 V(Relocatable*, relocatable_top, NULL) \ |
200 /* State for CodeEntry in profile-generator. */ \ | 214 /* State for CodeEntry in profile-generator. */ \ |
201 V(unsigned, code_entry_next_call_uid, NULL) \ | 215 V(unsigned, code_entry_next_call_uid, NULL) \ |
202 ISOLATE_PLATFORM_INIT_LIST(V) | 216 ISOLATE_PLATFORM_INIT_LIST(V) |
203 | 217 |
204 class Isolate { | 218 class Isolate { |
205 public: | 219 public: |
206 ~Isolate(); | 220 ~Isolate(); |
207 | 221 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 // a builtin object, or a js global object. | 361 // a builtin object, or a js global object. |
348 Handle<GlobalObject> global() { | 362 Handle<GlobalObject> global() { |
349 return Handle<GlobalObject>(context()->global()); | 363 return Handle<GlobalObject>(context()->global()); |
350 } | 364 } |
351 | 365 |
352 // Returns the global proxy object of the current context. | 366 // Returns the global proxy object of the current context. |
353 Object* global_proxy() { | 367 Object* global_proxy() { |
354 return context()->global_proxy(); | 368 return context()->global_proxy(); |
355 } | 369 } |
356 | 370 |
357 Handle<JSBuiltinsObject> builtins() { | 371 Handle<JSBuiltinsObject> js_builtins_object() { |
358 return Handle<JSBuiltinsObject>(thread_local_top_.context_->builtins()); | 372 return Handle<JSBuiltinsObject>(thread_local_top_.context_->builtins()); |
359 } | 373 } |
360 | 374 |
361 static int ArchiveSpacePerThread() { return sizeof(ThreadLocalTop); } | 375 static int ArchiveSpacePerThread() { return sizeof(ThreadLocalTop); } |
362 void FreeThreadResources() { thread_local_top_.Free(); } | 376 void FreeThreadResources() { thread_local_top_.Free(); } |
363 | 377 |
364 // This method is called by the api after operations that may throw | 378 // This method is called by the api after operations that may throw |
365 // exceptions. If an exception was thrown and not handled by an external | 379 // exceptions. If an exception was thrown and not handled by an external |
366 // handler the exception is scheduled to be rethrown when we return to running | 380 // handler the exception is scheduled to be rethrown when we return to running |
367 // JavaScript code. If an exception is scheduled true is returned. | 381 // JavaScript code. If an exception is scheduled true is returned. |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 } | 561 } |
548 | 562 |
549 StringInputBuffer* objects_string_compare_buffer_b() { | 563 StringInputBuffer* objects_string_compare_buffer_b() { |
550 return &objects_string_compare_buffer_b_; | 564 return &objects_string_compare_buffer_b_; |
551 } | 565 } |
552 | 566 |
553 StaticResource<StringInputBuffer>* objects_string_input_buffer() { | 567 StaticResource<StringInputBuffer>* objects_string_input_buffer() { |
554 return &objects_string_input_buffer_; | 568 return &objects_string_input_buffer_; |
555 } | 569 } |
556 | 570 |
| 571 AstSentinels* ast_sentinels() { return ast_sentinels_; } |
| 572 |
| 573 InlineRuntimeFunctionsTable* inline_runtime_functions_table() { |
| 574 return &inline_runtime_functions_table_; |
| 575 } |
| 576 |
| 577 RuntimeState* runtime_state() { return &runtime_state_; } |
| 578 |
| 579 StringInputBuffer* liveedit_compare_substrings_buf1() { |
| 580 return &liveedit_compare_substrings_buf1_; |
| 581 } |
| 582 |
| 583 StringInputBuffer* liveedit_compare_substrings_buf2() { |
| 584 return &liveedit_compare_substrings_buf2_; |
| 585 } |
| 586 |
| 587 StaticResource<SafeStringInputBuffer>* compiler_safe_string_input_buffer() { |
| 588 return &compiler_safe_string_input_buffer_; |
| 589 } |
| 590 |
| 591 Builtins* builtins() { return &builtins_; } |
| 592 |
557 void* PreallocatedStorageNew(size_t size); | 593 void* PreallocatedStorageNew(size_t size); |
558 void PreallocatedStorageDelete(void* p); | 594 void PreallocatedStorageDelete(void* p); |
559 void PreallocatedStorageInit(size_t size); | 595 void PreallocatedStorageInit(size_t size); |
560 | 596 |
561 #ifdef ENABLE_DEBUGGER_SUPPORT | 597 #ifdef ENABLE_DEBUGGER_SUPPORT |
562 Debugger* debugger() { return debugger_; } | 598 Debugger* debugger() { return debugger_; } |
563 #endif | 599 #endif |
564 | 600 |
565 #ifdef DEBUG | 601 #ifdef DEBUG |
566 HistogramInfo* heap_histograms() { return heap_histograms_; } | 602 HistogramInfo* heap_histograms() { return heap_histograms_; } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 HandleScopeImplementer* handle_scope_implementer_; | 684 HandleScopeImplementer* handle_scope_implementer_; |
649 ScannerCharacterClasses* scanner_character_classes_; | 685 ScannerCharacterClasses* scanner_character_classes_; |
650 Zone zone_; | 686 Zone zone_; |
651 PreallocatedStorage in_use_list_; | 687 PreallocatedStorage in_use_list_; |
652 PreallocatedStorage free_list_; | 688 PreallocatedStorage free_list_; |
653 bool preallocated_storage_preallocated_; | 689 bool preallocated_storage_preallocated_; |
654 StringInputBuffer* write_input_buffer_; | 690 StringInputBuffer* write_input_buffer_; |
655 GlobalHandles* global_handles_; | 691 GlobalHandles* global_handles_; |
656 ContextSwitcher* context_switcher_; | 692 ContextSwitcher* context_switcher_; |
657 ThreadManager* thread_manager_; | 693 ThreadManager* thread_manager_; |
| 694 AstSentinels* ast_sentinels_; |
| 695 InlineRuntimeFunctionsTable inline_runtime_functions_table_; |
| 696 RuntimeState runtime_state_; |
| 697 StringInputBuffer liveedit_compare_substrings_buf1_; |
| 698 StringInputBuffer liveedit_compare_substrings_buf2_; |
| 699 StaticResource<SafeStringInputBuffer> compiler_safe_string_input_buffer_; |
| 700 Builtins builtins_; |
658 StringTracker* string_tracker_; | 701 StringTracker* string_tracker_; |
659 unibrow::Mapping<unibrow::Ecma262UnCanonicalize> jsregexp_uncanonicalize_; | 702 unibrow::Mapping<unibrow::Ecma262UnCanonicalize> jsregexp_uncanonicalize_; |
660 unibrow::Mapping<unibrow::CanonicalizationRange> jsregexp_canonrange_; | 703 unibrow::Mapping<unibrow::CanonicalizationRange> jsregexp_canonrange_; |
661 StringInputBuffer objects_string_compare_buffer_a_; | 704 StringInputBuffer objects_string_compare_buffer_a_; |
662 StringInputBuffer objects_string_compare_buffer_b_; | 705 StringInputBuffer objects_string_compare_buffer_b_; |
663 StaticResource<StringInputBuffer> objects_string_input_buffer_; | 706 StaticResource<StringInputBuffer> objects_string_input_buffer_; |
664 | 707 |
665 #ifdef DEBUG | 708 #ifdef DEBUG |
666 // A static array of histogram info for each type. | 709 // A static array of histogram info for each type. |
667 HistogramInfo heap_histograms_[LAST_TYPE + 1]; | 710 HistogramInfo heap_histograms_[LAST_TYPE + 1]; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 // Temporary macro to be used to flag classes that are completely converted | 868 // Temporary macro to be used to flag classes that are completely converted |
826 // to be isolate-friendly. Their mix of static/nonstatic methods/fields is | 869 // to be isolate-friendly. Their mix of static/nonstatic methods/fields is |
827 // correct. | 870 // correct. |
828 #define ISOLATED_CLASS class | 871 #define ISOLATED_CLASS class |
829 | 872 |
830 } } // namespace v8::internal | 873 } } // namespace v8::internal |
831 | 874 |
832 #include "allocation-inl.h" | 875 #include "allocation-inl.h" |
833 | 876 |
834 #endif // V8_ISOLATE_H_ | 877 #endif // V8_ISOLATE_H_ |
OLD | NEW |