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 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 } | 1038 } |
1039 | 1039 |
1040 StateTag current_vm_state() { | 1040 StateTag current_vm_state() { |
1041 return thread_local_top_.current_vm_state_; | 1041 return thread_local_top_.current_vm_state_; |
1042 } | 1042 } |
1043 | 1043 |
1044 void set_current_vm_state(StateTag state) { | 1044 void set_current_vm_state(StateTag state) { |
1045 thread_local_top_.current_vm_state_ = state; | 1045 thread_local_top_.current_vm_state_ = state; |
1046 } | 1046 } |
1047 | 1047 |
1048 void SetData(void* data) { embedder_data_ = data; } | 1048 void SetData(uint32_t slot, void* data) { |
1049 void* GetData() { return embedder_data_; } | 1049 ASSERT(slot < Internals::kNumIsolateDataSlots); |
| 1050 embedder_data_[slot] = data; |
| 1051 } |
| 1052 void* GetData(uint32_t slot) { |
| 1053 ASSERT(slot < Internals::kNumIsolateDataSlots); |
| 1054 return embedder_data_[slot]; |
| 1055 } |
1050 | 1056 |
1051 LookupResult* top_lookup_result() { | 1057 LookupResult* top_lookup_result() { |
1052 return thread_local_top_.top_lookup_result_; | 1058 return thread_local_top_.top_lookup_result_; |
1053 } | 1059 } |
1054 void SetTopLookupResult(LookupResult* top) { | 1060 void SetTopLookupResult(LookupResult* top) { |
1055 thread_local_top_.top_lookup_result_ = top; | 1061 thread_local_top_.top_lookup_result_ = top; |
1056 } | 1062 } |
1057 | 1063 |
1058 bool IsDead() { return has_fatal_error_; } | 1064 bool IsDead() { return has_fatal_error_; } |
1059 void SignalFatalError() { has_fatal_error_ = true; } | 1065 void SignalFatalError() { has_fatal_error_ = true; } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 friend struct InitializeGlobalState; | 1158 friend struct InitializeGlobalState; |
1153 | 1159 |
1154 enum State { | 1160 enum State { |
1155 UNINITIALIZED, // Some components may not have been allocated. | 1161 UNINITIALIZED, // Some components may not have been allocated. |
1156 INITIALIZED // All components are fully initialized. | 1162 INITIALIZED // All components are fully initialized. |
1157 }; | 1163 }; |
1158 | 1164 |
1159 // These fields are accessed through the API, offsets must be kept in sync | 1165 // These fields are accessed through the API, offsets must be kept in sync |
1160 // with v8::internal::Internals (in include/v8.h) constants. This is also | 1166 // with v8::internal::Internals (in include/v8.h) constants. This is also |
1161 // verified in Isolate::Init() using runtime checks. | 1167 // verified in Isolate::Init() using runtime checks. |
| 1168 void* embedder_data_[Internals::kNumIsolateDataSlots]; |
| 1169 Heap heap_; |
1162 State state_; // Will be padded to kApiPointerSize. | 1170 State state_; // Will be padded to kApiPointerSize. |
1163 void* embedder_data_; | |
1164 Heap heap_; | |
1165 | 1171 |
1166 // The per-process lock should be acquired before the ThreadDataTable is | 1172 // The per-process lock should be acquired before the ThreadDataTable is |
1167 // modified. | 1173 // modified. |
1168 class ThreadDataTable { | 1174 class ThreadDataTable { |
1169 public: | 1175 public: |
1170 ThreadDataTable(); | 1176 ThreadDataTable(); |
1171 ~ThreadDataTable(); | 1177 ~ThreadDataTable(); |
1172 | 1178 |
1173 PerIsolateThreadData* Lookup(Isolate* isolate, ThreadId thread_id); | 1179 PerIsolateThreadData* Lookup(Isolate* isolate, ThreadId thread_id); |
1174 void Insert(PerIsolateThreadData* data); | 1180 void Insert(PerIsolateThreadData* data); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 } | 1580 } |
1575 | 1581 |
1576 EmbeddedVector<char, 128> filename_; | 1582 EmbeddedVector<char, 128> filename_; |
1577 FILE* file_; | 1583 FILE* file_; |
1578 int scope_depth_; | 1584 int scope_depth_; |
1579 }; | 1585 }; |
1580 | 1586 |
1581 } } // namespace v8::internal | 1587 } } // namespace v8::internal |
1582 | 1588 |
1583 #endif // V8_ISOLATE_H_ | 1589 #endif // V8_ISOLATE_H_ |
OLD | NEW |