| 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 21 matching lines...) Expand all Loading... |
| 32 #include "heap.h" | 32 #include "heap.h" |
| 33 #include "execution.h" | 33 #include "execution.h" |
| 34 #include "zone.h" | 34 #include "zone.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 class Bootstrapper; | 39 class Bootstrapper; |
| 40 class Deserializer; | 40 class Deserializer; |
| 41 class HandleScopeImplementer; | 41 class HandleScopeImplementer; |
| 42 class SaveContext; |
| 42 class StubCache; | 43 class StubCache; |
| 43 | 44 |
| 45 class ThreadLocalTop BASE_EMBEDDED { |
| 46 public: |
| 47 // Initialize the thread data. |
| 48 void Initialize(); |
| 49 |
| 50 // Get the top C++ try catch handler or NULL if none are registered. |
| 51 // |
| 52 // This method is not guarenteed to return an address that can be |
| 53 // used for comparison with addresses into the JS stack. If such an |
| 54 // address is needed, use try_catch_handler_address. |
| 55 v8::TryCatch* TryCatchHandler(); |
| 56 |
| 57 // Get the address of the top C++ try catch handler or NULL if |
| 58 // none are registered. |
| 59 // |
| 60 // This method always returns an address that can be compared to |
| 61 // pointers into the JavaScript stack. When running on actual |
| 62 // hardware, try_catch_handler_address and TryCatchHandler return |
| 63 // the same pointer. When running on a simulator with a separate JS |
| 64 // stack, try_catch_handler_address returns a JS stack address that |
| 65 // corresponds to the place on the JS stack where the C++ handler |
| 66 // would have been if the stack were not separate. |
| 67 inline Address try_catch_handler_address() { |
| 68 return try_catch_handler_address_; |
| 69 } |
| 70 |
| 71 // Set the address of the top C++ try catch handler. |
| 72 inline void set_try_catch_handler_address(Address address) { |
| 73 try_catch_handler_address_ = address; |
| 74 } |
| 75 |
| 76 void Free() { |
| 77 ASSERT(!has_pending_message_); |
| 78 ASSERT(!external_caught_exception_); |
| 79 ASSERT(try_catch_handler_address_ == NULL); |
| 80 } |
| 81 |
| 82 // The context where the current execution method is created and for variable |
| 83 // lookups. |
| 84 Context* context_; |
| 85 int thread_id_; |
| 86 Object* pending_exception_; |
| 87 bool has_pending_message_; |
| 88 const char* pending_message_; |
| 89 Object* pending_message_obj_; |
| 90 Script* pending_message_script_; |
| 91 int pending_message_start_pos_; |
| 92 int pending_message_end_pos_; |
| 93 // Use a separate value for scheduled exceptions to preserve the |
| 94 // invariants that hold about pending_exception. We may want to |
| 95 // unify them later. |
| 96 Object* scheduled_exception_; |
| 97 bool external_caught_exception_; |
| 98 SaveContext* save_context_; |
| 99 v8::TryCatch* catcher_; |
| 100 |
| 101 // Stack. |
| 102 Address c_entry_fp_; // the frame pointer of the top c entry frame |
| 103 Address handler_; // try-blocks are chained through the stack |
| 104 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 105 Address js_entry_sp_; // the stack pointer of the bottom js entry frame |
| 106 #endif |
| 107 bool stack_is_cooked_; |
| 108 inline bool stack_is_cooked() { return stack_is_cooked_; } |
| 109 inline void set_stack_is_cooked(bool value) { stack_is_cooked_ = value; } |
| 110 |
| 111 // Generated code scratch locations. |
| 112 int32_t formal_count_; |
| 113 |
| 114 // Call back function to report unsafe JS accesses. |
| 115 v8::FailedAccessCheckCallback failed_access_check_callback_; |
| 116 |
| 117 private: |
| 118 Address try_catch_handler_address_; |
| 119 }; |
| 120 |
| 44 #define ISOLATE_INIT_ARRAY_LIST(V) \ | 121 #define ISOLATE_INIT_ARRAY_LIST(V) \ |
| 45 /* SerializerDeserializer state. */ \ | 122 /* SerializerDeserializer state. */ \ |
| 46 V(Object*, serialize_partial_snapshot_cache, kPartialSnapshotCacheCapacity) | 123 V(Object*, serialize_partial_snapshot_cache, kPartialSnapshotCacheCapacity) |
| 47 | 124 |
| 48 #define ISOLATE_INIT_LIST(V) \ | 125 #define ISOLATE_INIT_LIST(V) \ |
| 49 /* AssertNoZoneAllocation state. */ \ | 126 /* AssertNoZoneAllocation state. */ \ |
| 50 V(bool, zone_allow_allocation, true) \ | 127 V(bool, zone_allow_allocation, true) \ |
| 51 /* SerializerDeserializer state. */ \ | 128 /* SerializerDeserializer state. */ \ |
| 52 V(int, serialize_partial_snapshot_cache_length, 0) | 129 V(int, serialize_partial_snapshot_cache_length, 0) |
| 53 | 130 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 78 | 155 |
| 79 // Debug. | 156 // Debug. |
| 80 // Mutex for serializing access to break control structures. | 157 // Mutex for serializing access to break control structures. |
| 81 Mutex* break_access() { return break_access_; } | 158 Mutex* break_access() { return break_access_; } |
| 82 | 159 |
| 83 // Accessors. | 160 // Accessors. |
| 84 Bootstrapper* bootstrapper() { return bootstrapper_; } | 161 Bootstrapper* bootstrapper() { return bootstrapper_; } |
| 85 StackGuard* stack_guard() { return &stack_guard_; } | 162 StackGuard* stack_guard() { return &stack_guard_; } |
| 86 Heap* heap() { return &heap_; } | 163 Heap* heap() { return &heap_; } |
| 87 StubCache* stub_cache() { return stub_cache_; } | 164 StubCache* stub_cache() { return stub_cache_; } |
| 165 ThreadLocalTop* thread_local_top() { return &thread_local_top_; } |
| 88 | 166 |
| 89 TranscendentalCache* transcendental_cache() const { | 167 TranscendentalCache* transcendental_cache() const { |
| 90 return transcendental_cache_; | 168 return transcendental_cache_; |
| 91 } | 169 } |
| 92 | 170 |
| 93 v8::ImplementationUtilities::HandleScopeData* handle_scope_data() { | 171 v8::ImplementationUtilities::HandleScopeData* handle_scope_data() { |
| 94 return &handle_scope_data_; | 172 return &handle_scope_data_; |
| 95 } | 173 } |
| 96 HandleScopeImplementer* handle_scope_implementer() { | 174 HandleScopeImplementer* handle_scope_implementer() { |
| 97 ASSERT(handle_scope_implementer_); | 175 ASSERT(handle_scope_implementer_); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 124 INITIALIZED // All components are fully initialized. | 202 INITIALIZED // All components are fully initialized. |
| 125 }; | 203 }; |
| 126 | 204 |
| 127 State state_; | 205 State state_; |
| 128 | 206 |
| 129 Bootstrapper* bootstrapper_; | 207 Bootstrapper* bootstrapper_; |
| 130 Mutex* break_access_; | 208 Mutex* break_access_; |
| 131 Heap heap_; | 209 Heap heap_; |
| 132 StackGuard stack_guard_; | 210 StackGuard stack_guard_; |
| 133 StubCache* stub_cache_; | 211 StubCache* stub_cache_; |
| 212 ThreadLocalTop thread_local_top_; |
| 134 TranscendentalCache* transcendental_cache_; | 213 TranscendentalCache* transcendental_cache_; |
| 135 v8::ImplementationUtilities::HandleScopeData handle_scope_data_; | 214 v8::ImplementationUtilities::HandleScopeData handle_scope_data_; |
| 136 HandleScopeImplementer* handle_scope_implementer_; | 215 HandleScopeImplementer* handle_scope_implementer_; |
| 137 Zone zone_; | 216 Zone zone_; |
| 138 | 217 |
| 139 #define GLOBAL_BACKING_STORE(type, name, initialvalue) \ | 218 #define GLOBAL_BACKING_STORE(type, name, initialvalue) \ |
| 140 type name##_; | 219 type name##_; |
| 141 ISOLATE_INIT_LIST(GLOBAL_BACKING_STORE) | 220 ISOLATE_INIT_LIST(GLOBAL_BACKING_STORE) |
| 142 #undef GLOBAL_BACKING_STORE | 221 #undef GLOBAL_BACKING_STORE |
| 143 | 222 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 283 |
| 205 | 284 |
| 206 // Temporary macro to be used to flag classes that are completely converted | 285 // Temporary macro to be used to flag classes that are completely converted |
| 207 // to be isolate-friendly. Their mix of static/nonstatic methods/fields is | 286 // to be isolate-friendly. Their mix of static/nonstatic methods/fields is |
| 208 // correct. | 287 // correct. |
| 209 #define ISOLATED_CLASS class | 288 #define ISOLATED_CLASS class |
| 210 | 289 |
| 211 } } // namespace v8::internal | 290 } } // namespace v8::internal |
| 212 | 291 |
| 213 #endif // V8_ISOLATE_H_ | 292 #endif // V8_ISOLATE_H_ |
| OLD | NEW |