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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 V(int, serialize_partial_snapshot_cache_length, 0) \ | 322 V(int, serialize_partial_snapshot_cache_length, 0) \ |
323 V(int, serialize_partial_snapshot_cache_capacity, 0) \ | 323 V(int, serialize_partial_snapshot_cache_capacity, 0) \ |
324 V(Object**, serialize_partial_snapshot_cache, NULL) \ | 324 V(Object**, serialize_partial_snapshot_cache, NULL) \ |
325 /* Assembler state. */ \ | 325 /* Assembler state. */ \ |
326 /* A previously allocated buffer of kMinimalBufferSize bytes, or NULL. */ \ | 326 /* A previously allocated buffer of kMinimalBufferSize bytes, or NULL. */ \ |
327 V(byte*, assembler_spare_buffer, NULL) \ | 327 V(byte*, assembler_spare_buffer, NULL) \ |
328 V(FatalErrorCallback, exception_behavior, NULL) \ | 328 V(FatalErrorCallback, exception_behavior, NULL) \ |
329 V(AllowCodeGenerationFromStringsCallback, allow_code_gen_callback, NULL) \ | 329 V(AllowCodeGenerationFromStringsCallback, allow_code_gen_callback, NULL) \ |
330 V(v8::Debug::MessageHandler, message_handler, NULL) \ | 330 V(v8::Debug::MessageHandler, message_handler, NULL) \ |
331 /* To distinguish the function templates, so that we can find them in the */ \ | 331 /* To distinguish the function templates, so that we can find them in the */ \ |
332 /* function cache of the global context. */ \ | 332 /* function cache of the native context. */ \ |
333 V(int, next_serial_number, 0) \ | 333 V(int, next_serial_number, 0) \ |
334 V(ExternalReferenceRedirectorPointer*, external_reference_redirector, NULL) \ | 334 V(ExternalReferenceRedirectorPointer*, external_reference_redirector, NULL) \ |
335 V(bool, always_allow_natives_syntax, false) \ | 335 V(bool, always_allow_natives_syntax, false) \ |
336 /* Part of the state of liveedit. */ \ | 336 /* Part of the state of liveedit. */ \ |
337 V(FunctionInfoListener*, active_function_info_listener, NULL) \ | 337 V(FunctionInfoListener*, active_function_info_listener, NULL) \ |
338 /* State for Relocatable. */ \ | 338 /* State for Relocatable. */ \ |
339 V(Relocatable*, relocatable_top, NULL) \ | 339 V(Relocatable*, relocatable_top, NULL) \ |
340 /* State for CodeEntry in profile-generator. */ \ | 340 /* State for CodeEntry in profile-generator. */ \ |
341 V(CodeGenerator*, current_code_generator, NULL) \ | 341 V(CodeGenerator*, current_code_generator, NULL) \ |
342 V(bool, jump_target_compiling_deferred_code, false) \ | 342 V(bool, jump_target_compiling_deferred_code, false) \ |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 } | 524 } |
525 Context** context_address() { return &thread_local_top_.context_; } | 525 Context** context_address() { return &thread_local_top_.context_; } |
526 | 526 |
527 SaveContext* save_context() {return thread_local_top_.save_context_; } | 527 SaveContext* save_context() {return thread_local_top_.save_context_; } |
528 void set_save_context(SaveContext* save) { | 528 void set_save_context(SaveContext* save) { |
529 thread_local_top_.save_context_ = save; | 529 thread_local_top_.save_context_ = save; |
530 } | 530 } |
531 | 531 |
532 // Access to the map of "new Object()". | 532 // Access to the map of "new Object()". |
533 Map* empty_object_map() { | 533 Map* empty_object_map() { |
534 return context()->global_context()->object_function()->map(); | 534 return context()->native_context()->object_function()->map(); |
535 } | 535 } |
536 | 536 |
537 // Access to current thread id. | 537 // Access to current thread id. |
538 ThreadId thread_id() { return thread_local_top_.thread_id_; } | 538 ThreadId thread_id() { return thread_local_top_.thread_id_; } |
539 void set_thread_id(ThreadId id) { thread_local_top_.thread_id_ = id; } | 539 void set_thread_id(ThreadId id) { thread_local_top_.thread_id_ = id; } |
540 | 540 |
541 // Interface to pending exception. | 541 // Interface to pending exception. |
542 MaybeObject* pending_exception() { | 542 MaybeObject* pending_exception() { |
543 ASSERT(has_pending_exception()); | 543 ASSERT(has_pending_exception()); |
544 return thread_local_top_.pending_exception_; | 544 return thread_local_top_.pending_exception_; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 Failure* TerminateExecution(); | 757 Failure* TerminateExecution(); |
758 | 758 |
759 // Administration | 759 // Administration |
760 void Iterate(ObjectVisitor* v); | 760 void Iterate(ObjectVisitor* v); |
761 void Iterate(ObjectVisitor* v, ThreadLocalTop* t); | 761 void Iterate(ObjectVisitor* v, ThreadLocalTop* t); |
762 char* Iterate(ObjectVisitor* v, char* t); | 762 char* Iterate(ObjectVisitor* v, char* t); |
763 void IterateThread(ThreadVisitor* v); | 763 void IterateThread(ThreadVisitor* v); |
764 void IterateThread(ThreadVisitor* v, char* t); | 764 void IterateThread(ThreadVisitor* v, char* t); |
765 | 765 |
766 | 766 |
767 // Returns the current global context. | 767 // Returns the current native context. |
768 Handle<Context> global_context(); | 768 Handle<Context> native_context(); |
769 | 769 |
770 // Returns the global context of the calling JavaScript code. That | 770 // Returns the native context of the calling JavaScript code. That |
771 // is, the global context of the top-most JavaScript frame. | 771 // is, the native context of the top-most JavaScript frame. |
772 Handle<Context> GetCallingGlobalContext(); | 772 Handle<Context> GetCallingNativeContext(); |
773 | 773 |
774 void RegisterTryCatchHandler(v8::TryCatch* that); | 774 void RegisterTryCatchHandler(v8::TryCatch* that); |
775 void UnregisterTryCatchHandler(v8::TryCatch* that); | 775 void UnregisterTryCatchHandler(v8::TryCatch* that); |
776 | 776 |
777 char* ArchiveThread(char* to); | 777 char* ArchiveThread(char* to); |
778 char* RestoreThread(char* from); | 778 char* RestoreThread(char* from); |
779 | 779 |
780 static const char* const kStackOverflowMessage; | 780 static const char* const kStackOverflowMessage; |
781 | 781 |
782 static const int kUC16AlphabetSize = 256; // See StringSearchBase. | 782 static const int kUC16AlphabetSize = 256; // See StringSearchBase. |
(...skipping 13 matching lines...) Expand all Loading... |
796 #undef GLOBAL_ACCESSOR | 796 #undef GLOBAL_ACCESSOR |
797 | 797 |
798 #define GLOBAL_ARRAY_ACCESSOR(type, name, length) \ | 798 #define GLOBAL_ARRAY_ACCESSOR(type, name, length) \ |
799 inline type* name() { \ | 799 inline type* name() { \ |
800 ASSERT(OFFSET_OF(Isolate, name##_) == name##_debug_offset_); \ | 800 ASSERT(OFFSET_OF(Isolate, name##_) == name##_debug_offset_); \ |
801 return &(name##_)[0]; \ | 801 return &(name##_)[0]; \ |
802 } | 802 } |
803 ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_ACCESSOR) | 803 ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_ACCESSOR) |
804 #undef GLOBAL_ARRAY_ACCESSOR | 804 #undef GLOBAL_ARRAY_ACCESSOR |
805 | 805 |
806 #define GLOBAL_CONTEXT_FIELD_ACCESSOR(index, type, name) \ | 806 #define NATIVE_CONTEXT_FIELD_ACCESSOR(index, type, name) \ |
807 Handle<type> name() { \ | 807 Handle<type> name() { \ |
808 return Handle<type>(context()->global_context()->name()); \ | 808 return Handle<type>(context()->native_context()->name()); \ |
809 } | 809 } |
810 GLOBAL_CONTEXT_FIELDS(GLOBAL_CONTEXT_FIELD_ACCESSOR) | 810 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSOR) |
811 #undef GLOBAL_CONTEXT_FIELD_ACCESSOR | 811 #undef NATIVE_CONTEXT_FIELD_ACCESSOR |
812 | 812 |
813 Bootstrapper* bootstrapper() { return bootstrapper_; } | 813 Bootstrapper* bootstrapper() { return bootstrapper_; } |
814 Counters* counters() { | 814 Counters* counters() { |
815 // Call InitializeLoggingAndCounters() if logging is needed before | 815 // Call InitializeLoggingAndCounters() if logging is needed before |
816 // the isolate is fully initialized. | 816 // the isolate is fully initialized. |
817 ASSERT(counters_ != NULL); | 817 ASSERT(counters_ != NULL); |
818 return counters_; | 818 return counters_; |
819 } | 819 } |
820 CodeRange* code_range() { return code_range_; } | 820 CodeRange* code_range() { return code_range_; } |
821 RuntimeProfiler* runtime_profiler() { return runtime_profiler_; } | 821 RuntimeProfiler* runtime_profiler() { return runtime_profiler_; } |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 | 1427 |
1428 | 1428 |
1429 // Temporary macros for accessing current isolate and its subobjects. | 1429 // Temporary macros for accessing current isolate and its subobjects. |
1430 // They provide better readability, especially when used a lot in the code. | 1430 // They provide better readability, especially when used a lot in the code. |
1431 #define HEAP (v8::internal::Isolate::Current()->heap()) | 1431 #define HEAP (v8::internal::Isolate::Current()->heap()) |
1432 #define FACTORY (v8::internal::Isolate::Current()->factory()) | 1432 #define FACTORY (v8::internal::Isolate::Current()->factory()) |
1433 #define ISOLATE (v8::internal::Isolate::Current()) | 1433 #define ISOLATE (v8::internal::Isolate::Current()) |
1434 #define LOGGER (v8::internal::Isolate::Current()->logger()) | 1434 #define LOGGER (v8::internal::Isolate::Current()->logger()) |
1435 | 1435 |
1436 | 1436 |
1437 // Tells whether the global context is marked with out of memory. | 1437 // Tells whether the native context is marked with out of memory. |
1438 inline bool Context::has_out_of_memory() { | 1438 inline bool Context::has_out_of_memory() { |
1439 return global_context()->out_of_memory()->IsTrue(); | 1439 return native_context()->out_of_memory()->IsTrue(); |
1440 } | 1440 } |
1441 | 1441 |
1442 | 1442 |
1443 // Mark the global context with out of memory. | 1443 // Mark the native context with out of memory. |
1444 inline void Context::mark_out_of_memory() { | 1444 inline void Context::mark_out_of_memory() { |
1445 global_context()->set_out_of_memory(HEAP->true_value()); | 1445 native_context()->set_out_of_memory(HEAP->true_value()); |
1446 } | 1446 } |
1447 | 1447 |
1448 | 1448 |
1449 } } // namespace v8::internal | 1449 } } // namespace v8::internal |
1450 | 1450 |
1451 #endif // V8_ISOLATE_H_ | 1451 #endif // V8_ISOLATE_H_ |
OLD | NEW |