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: runtime/vm/object.h

Issue 9956133: Remove many calls to Isolate::Current() in the dart embedding api by (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/native_entry.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 22 matching lines...) Expand all
33 public: /* NOLINT */ \ 33 public: /* NOLINT */ \
34 Raw##object* raw() const { return reinterpret_cast<Raw##object*>(raw_); } \ 34 Raw##object* raw() const { return reinterpret_cast<Raw##object*>(raw_); } \
35 void operator=(Raw##object* value) { \ 35 void operator=(Raw##object* value) { \
36 initializeHandle(this, value); \ 36 initializeHandle(this, value); \
37 } \ 37 } \
38 bool Is##object() const { return true; } \ 38 bool Is##object() const { return true; } \
39 void operator^=(RawObject* value) { \ 39 void operator^=(RawObject* value) { \
40 initializeHandle(this, value); \ 40 initializeHandle(this, value); \
41 ASSERT(IsNull() || Is##object()); \ 41 ASSERT(IsNull() || Is##object()); \
42 } \ 42 } \
43 static object& Handle(Isolate* islt, Raw##object* raw_ptr) { \ 43 static object& Handle(Isolate* isolate, Raw##object* raw_ptr) { \
44 object* obj = reinterpret_cast<object*>(VMHandles::AllocateHandle(islt)); \ 44 object* obj = \
45 reinterpret_cast<object*>(VMHandles::AllocateHandle(isolate)); \
45 initializeHandle(obj, raw_ptr); \ 46 initializeHandle(obj, raw_ptr); \
46 return *obj; \ 47 return *obj; \
47 } \ 48 } \
48 static object& Handle() { \ 49 static object& Handle() { \
49 return Handle(Isolate::Current(), object::null()); \ 50 return Handle(Isolate::Current(), object::null()); \
50 } \ 51 } \
52 static object& Handle(Isolate* isolate) { \
53 return Handle(isolate, object::null()); \
54 } \
51 static object& Handle(Raw##object* raw_ptr) { \ 55 static object& Handle(Raw##object* raw_ptr) { \
52 return Handle(Isolate::Current(), raw_ptr); \ 56 return Handle(Isolate::Current(), raw_ptr); \
53 } \ 57 } \
54 static object& CheckedHandle(Isolate* islt, RawObject* raw_ptr) { \ 58 static object& CheckedHandle(Isolate* isolate, RawObject* raw_ptr) { \
55 object* obj = reinterpret_cast<object*>(VMHandles::AllocateHandle(islt)); \ 59 object* obj = \
60 reinterpret_cast<object*>(VMHandles::AllocateHandle(isolate)); \
56 initializeHandle(obj, raw_ptr); \ 61 initializeHandle(obj, raw_ptr); \
57 if (!obj->Is##object()) { \ 62 if (!obj->Is##object()) { \
58 FATAL("Handle check failed."); \ 63 FATAL("Handle check failed."); \
59 } \ 64 } \
60 return *obj; \ 65 return *obj; \
61 } \ 66 } \
62 static object& CheckedHandle(RawObject* raw_ptr) { \ 67 static object& CheckedHandle(RawObject* raw_ptr) { \
63 return CheckedHandle(Isolate::Current(), raw_ptr); \ 68 return CheckedHandle(Isolate::Current(), raw_ptr); \
64 } \ 69 } \
65 static object& ZoneHandle(Isolate* isolate, Raw##object* raw_ptr) { \ 70 static object& ZoneHandle(Isolate* isolate, Raw##object* raw_ptr) { \
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 static Object& Handle(Isolate* isolate, RawObject* raw_ptr) { 231 static Object& Handle(Isolate* isolate, RawObject* raw_ptr) {
227 Object* obj = reinterpret_cast<Object*>(VMHandles::AllocateHandle(isolate)); 232 Object* obj = reinterpret_cast<Object*>(VMHandles::AllocateHandle(isolate));
228 obj->SetRaw(raw_ptr); 233 obj->SetRaw(raw_ptr);
229 return *obj; 234 return *obj;
230 } 235 }
231 236
232 static Object& Handle() { 237 static Object& Handle() {
233 return Handle(Isolate::Current(), null_); 238 return Handle(Isolate::Current(), null_);
234 } 239 }
235 240
241 static Object& Handle(Isolate* isolate) {
242 return Handle(isolate, null_);
243 }
244
236 static Object& Handle(RawObject* raw_ptr) { 245 static Object& Handle(RawObject* raw_ptr) {
237 return Handle(Isolate::Current(), raw_ptr); 246 return Handle(Isolate::Current(), raw_ptr);
238 } 247 }
239 248
240 static Object& ZoneHandle(Isolate* isolate, RawObject* raw_ptr) { 249 static Object& ZoneHandle(Isolate* isolate, RawObject* raw_ptr) {
241 Object* obj = reinterpret_cast<Object*>( 250 Object* obj = reinterpret_cast<Object*>(
242 VMHandles::AllocateZoneHandle(isolate)); 251 VMHandles::AllocateZoneHandle(isolate));
243 obj->SetRaw(raw_ptr); 252 obj->SetRaw(raw_ptr);
244 return *obj; 253 return *obj;
245 } 254 }
(...skipping 3705 matching lines...) Expand 10 before | Expand all | Expand 10 after
3951 } 3960 }
3952 3961
3953 3962
3954 intptr_t Stackmap::SizeInBits() const { 3963 intptr_t Stackmap::SizeInBits() const {
3955 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); 3964 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte);
3956 } 3965 }
3957 3966
3958 } // namespace dart 3967 } // namespace dart
3959 3968
3960 #endif // VM_OBJECT_H_ 3969 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/native_entry.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698