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

Side by Side Diff: runtime/vm/thread.h

Issue 1263513002: VM: Load allocation-top and -end via Thread. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fixed cc tests Created 5 years, 4 months 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_THREAD_H_ 5 #ifndef VM_THREAD_H_
6 #define VM_THREAD_H_ 6 #define VM_THREAD_H_
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/os_thread.h" 9 #include "vm/os_thread.h"
10 #include "vm/store_buffer.h" 10 #include "vm/store_buffer.h"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 class CHA; 14 class CHA;
15 class HandleScope; 15 class HandleScope;
16 class Heap;
16 class Isolate; 17 class Isolate;
17 class Object; 18 class Object;
18 class RawBool; 19 class RawBool;
19 class RawObject; 20 class RawObject;
20 class StackResource; 21 class StackResource;
21 class Zone; 22 class Zone;
22 23
24
23 // List of VM-global objects/addresses cached in each Thread object. 25 // List of VM-global objects/addresses cached in each Thread object.
24 #define CACHED_VM_OBJECTS_LIST(V) \ 26 #define CACHED_VM_OBJECTS_LIST(V) \
25 V(RawObject*, object_null_, Object::null(), NULL) \ 27 V(RawObject*, object_null_, Object::null(), NULL) \
26 V(RawBool*, bool_true_, Object::bool_true().raw(), NULL) \ 28 V(RawBool*, bool_true_, Object::bool_true().raw(), NULL) \
27 V(RawBool*, bool_false_, Object::bool_false().raw(), NULL) \ 29 V(RawBool*, bool_false_, Object::bool_false().raw(), NULL) \
28 30
29 #define CACHED_ADDRESSES_LIST(V) \ 31 #define CACHED_ADDRESSES_LIST(V) \
30 V(uword, update_store_buffer_entry_point_, \ 32 V(uword, update_store_buffer_entry_point_, \
31 StubCode::UpdateStoreBufferEntryPoint(), 0) 33 StubCode::UpdateStoreBufferEntryPoint(), 0)
32 34
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 112 }
111 113
112 StackResource* top_resource() const { return state_.top_resource; } 114 StackResource* top_resource() const { return state_.top_resource; }
113 void set_top_resource(StackResource* value) { 115 void set_top_resource(StackResource* value) {
114 state_.top_resource = value; 116 state_.top_resource = value;
115 } 117 }
116 static intptr_t top_resource_offset() { 118 static intptr_t top_resource_offset() {
117 return OFFSET_OF(Thread, state_) + OFFSET_OF(State, top_resource); 119 return OFFSET_OF(Thread, state_) + OFFSET_OF(State, top_resource);
118 } 120 }
119 121
122 static intptr_t heap_offset() {
123 return OFFSET_OF(Thread, heap_);
124 }
125
120 int32_t no_handle_scope_depth() const { 126 int32_t no_handle_scope_depth() const {
121 #if defined(DEBUG) 127 #if defined(DEBUG)
122 return state_.no_handle_scope_depth; 128 return state_.no_handle_scope_depth;
123 #else 129 #else
124 return 0; 130 return 0;
125 #endif 131 #endif
126 } 132 }
127 133
128 void IncrementNoHandleScopeDepth() { 134 void IncrementNoHandleScopeDepth() {
129 #if defined(DEBUG) 135 #if defined(DEBUG)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 CACHED_CONSTANTS_LIST(DEFINE_OFFSET_METHOD) 201 CACHED_CONSTANTS_LIST(DEFINE_OFFSET_METHOD)
196 #undef DEFINE_OFFSET_METHOD 202 #undef DEFINE_OFFSET_METHOD
197 203
198 static bool CanLoadFromThread(const Object& object); 204 static bool CanLoadFromThread(const Object& object);
199 static intptr_t OffsetFromThread(const Object& object); 205 static intptr_t OffsetFromThread(const Object& object);
200 206
201 private: 207 private:
202 static ThreadLocalKey thread_key_; 208 static ThreadLocalKey thread_key_;
203 209
204 Isolate* isolate_; 210 Isolate* isolate_;
211 Heap* heap_;
205 State state_; 212 State state_;
206 StoreBufferBlock* store_buffer_block_; 213 StoreBufferBlock* store_buffer_block_;
207 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ 214 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \
208 type_name member_name; 215 type_name member_name;
209 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS) 216 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS)
210 #undef DECLARE_MEMBERS 217 #undef DECLARE_MEMBERS
211 218
212 explicit Thread(bool init_vm_constants = true); 219 explicit Thread(bool init_vm_constants = true);
213 220
214 void InitVMConstants(); 221 void InitVMConstants();
(...skipping 17 matching lines...) Expand all
232 239
233 friend class ApiZone; 240 friend class ApiZone;
234 friend class Isolate; 241 friend class Isolate;
235 friend class StackZone; 242 friend class StackZone;
236 DISALLOW_COPY_AND_ASSIGN(Thread); 243 DISALLOW_COPY_AND_ASSIGN(Thread);
237 }; 244 };
238 245
239 } // namespace dart 246 } // namespace dart
240 247
241 #endif // VM_THREAD_H_ 248 #endif // VM_THREAD_H_
OLDNEW
« runtime/vm/isolate.h ('K') | « runtime/vm/stub_code_x64.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698