Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: src/isolate.h

Issue 77913003: Make it possible to add more than one piece of embedder data to isolates (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 } 1043 }
1044 1044
1045 StateTag current_vm_state() { 1045 StateTag current_vm_state() {
1046 return thread_local_top_.current_vm_state_; 1046 return thread_local_top_.current_vm_state_;
1047 } 1047 }
1048 1048
1049 void set_current_vm_state(StateTag state) { 1049 void set_current_vm_state(StateTag state) {
1050 thread_local_top_.current_vm_state_ = state; 1050 thread_local_top_.current_vm_state_ = state;
1051 } 1051 }
1052 1052
1053 void SetData(void* data) { embedder_data_ = data; } 1053 void SetData(uint32_t slot, void* data) { embedder_data_[slot] = data; }
Sven Panne 2013/11/20 10:03:02 An ASSERT that slot is in range might be nice here
1054 void* GetData() { return embedder_data_; } 1054 void* GetData(uint32_t slot) { return embedder_data_[slot]; }
1055 1055
1056 LookupResult* top_lookup_result() { 1056 LookupResult* top_lookup_result() {
1057 return thread_local_top_.top_lookup_result_; 1057 return thread_local_top_.top_lookup_result_;
1058 } 1058 }
1059 void SetTopLookupResult(LookupResult* top) { 1059 void SetTopLookupResult(LookupResult* top) {
1060 thread_local_top_.top_lookup_result_ = top; 1060 thread_local_top_.top_lookup_result_ = top;
1061 } 1061 }
1062 1062
1063 bool IsDead() { return has_fatal_error_; } 1063 bool IsDead() { return has_fatal_error_; }
1064 void SignalFatalError() { has_fatal_error_ = true; } 1064 void SignalFatalError() { has_fatal_error_ = true; }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 1158
1159 enum State { 1159 enum State {
1160 UNINITIALIZED, // Some components may not have been allocated. 1160 UNINITIALIZED, // Some components may not have been allocated.
1161 INITIALIZED // All components are fully initialized. 1161 INITIALIZED // All components are fully initialized.
1162 }; 1162 };
1163 1163
1164 // These fields are accessed through the API, offsets must be kept in sync 1164 // These fields are accessed through the API, offsets must be kept in sync
1165 // with v8::internal::Internals (in include/v8.h) constants. This is also 1165 // with v8::internal::Internals (in include/v8.h) constants. This is also
1166 // verified in Isolate::Init() using runtime checks. 1166 // verified in Isolate::Init() using runtime checks.
1167 State state_; // Will be padded to kApiPointerSize. 1167 State state_; // Will be padded to kApiPointerSize.
1168 void* embedder_data_; 1168 void* embedder_data_[Internals::kNumIsolateDataSlots];
1169 Heap heap_; 1169 Heap heap_;
1170 1170
1171 // The per-process lock should be acquired before the ThreadDataTable is 1171 // The per-process lock should be acquired before the ThreadDataTable is
1172 // modified. 1172 // modified.
1173 class ThreadDataTable { 1173 class ThreadDataTable {
1174 public: 1174 public:
1175 ThreadDataTable(); 1175 ThreadDataTable();
1176 ~ThreadDataTable(); 1176 ~ThreadDataTable();
1177 1177
1178 PerIsolateThreadData* Lookup(Isolate* isolate, ThreadId thread_id); 1178 PerIsolateThreadData* Lookup(Isolate* isolate, ThreadId thread_id);
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 } 1587 }
1588 1588
1589 EmbeddedVector<char, 128> filename_; 1589 EmbeddedVector<char, 128> filename_;
1590 FILE* file_; 1590 FILE* file_;
1591 int scope_depth_; 1591 int scope_depth_;
1592 }; 1592 };
1593 1593
1594 } } // namespace v8::internal 1594 } } // namespace v8::internal
1595 1595
1596 #endif // V8_ISOLATE_H_ 1596 #endif // V8_ISOLATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698