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

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

Issue 1151573022: Fix for issue 192 in domokit/mojo (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add comment Created 5 years, 6 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
« no previous file with comments | « no previous file | runtime/vm/object.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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 OBJECT_IMPLEMENTATION(object, super); \ 199 OBJECT_IMPLEMENTATION(object, super); \
200 const Raw##object* raw_ptr() const { \ 200 const Raw##object* raw_ptr() const { \
201 ASSERT(raw() != null()); \ 201 ASSERT(raw() != null()); \
202 return raw()->ptr(); \ 202 return raw()->ptr(); \
203 } \ 203 } \
204 SNAPSHOT_READER_SUPPORT(object) \ 204 SNAPSHOT_READER_SUPPORT(object) \
205 friend class Isolate; \ 205 friend class Isolate; \
206 friend class StackFrame; \ 206 friend class StackFrame; \
207 207
208 // This macro is used to denote types that do not have a sub-type. 208 // This macro is used to denote types that do not have a sub-type.
209 #define FINAL_HEAP_OBJECT_IMPLEMENTATION(object, super) \ 209 #define FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, rettype, super) \
210 public: /* NOLINT */ \ 210 public: /* NOLINT */ \
211 void operator=(Raw##object* value) { \ 211 void operator=(Raw##object* value) { \
212 raw_ = value; \ 212 raw_ = value; \
213 CHECK_HANDLE(); \ 213 CHECK_HANDLE(); \
214 } \ 214 } \
215 void operator^=(RawObject* value) { \ 215 void operator^=(RawObject* value) { \
216 raw_ = value; \ 216 raw_ = value; \
217 CHECK_HANDLE(); \ 217 CHECK_HANDLE(); \
218 } \ 218 } \
219 private: /* NOLINT */ \ 219 private: /* NOLINT */ \
220 object() : super() {} \ 220 object() : super() {} \
221 BASE_OBJECT_IMPLEMENTATION(object, super) \ 221 BASE_OBJECT_IMPLEMENTATION(object, super) \
222 const Raw##object* raw_ptr() const { \ 222 const Raw##object* raw_ptr() const { \
223 ASSERT(raw() != null()); \ 223 ASSERT(raw() != null()); \
224 return raw()->ptr(); \ 224 return raw()->ptr(); \
225 } \ 225 } \
226 static intptr_t NextFieldOffset() { \ 226 static intptr_t NextFieldOffset() { \
227 return -kWordSize; \ 227 return -kWordSize; \
228 } \ 228 } \
229 SNAPSHOT_READER_SUPPORT(object) \ 229 SNAPSHOT_READER_SUPPORT(rettype) \
230 friend class Isolate; \ 230 friend class Isolate; \
231 friend class StackFrame; \ 231 friend class StackFrame; \
232 232
233 #define FINAL_HEAP_OBJECT_IMPLEMENTATION(object, super) \
234 FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, object, super) \
235
236 #define MINT_OBJECT_IMPLEMENTATION(object, rettype, super) \
237 FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, rettype, super) \
238
233 class Object { 239 class Object {
234 public: 240 public:
235 virtual ~Object() { } 241 virtual ~Object() { }
236 242
237 RawObject* raw() const { return raw_; } 243 RawObject* raw() const { return raw_; }
238 void operator=(RawObject* value) { 244 void operator=(RawObject* value) {
239 initializeHandle(this, value); 245 initializeHandle(this, value);
240 } 246 }
241 247
242 uword CompareAndSwapTags(uword old_tags, uword new_tags) const { 248 uword CompareAndSwapTags(uword old_tags, uword new_tags) const {
(...skipping 5302 matching lines...) Expand 10 before | Expand all | Expand 10 after
5545 // Only Integer::NewXXX is allowed to call Mint::NewXXX directly. 5551 // Only Integer::NewXXX is allowed to call Mint::NewXXX directly.
5546 friend class Integer; 5552 friend class Integer;
5547 5553
5548 static RawMint* New(int64_t value, Heap::Space space = Heap::kNew); 5554 static RawMint* New(int64_t value, Heap::Space space = Heap::kNew);
5549 5555
5550 static RawMint* NewCanonical(int64_t value); 5556 static RawMint* NewCanonical(int64_t value);
5551 5557
5552 private: 5558 private:
5553 void set_value(int64_t value) const; 5559 void set_value(int64_t value) const;
5554 5560
5555 FINAL_HEAP_OBJECT_IMPLEMENTATION(Mint, Integer); 5561 MINT_OBJECT_IMPLEMENTATION(Mint, Integer, Integer);
5556 friend class Class; 5562 friend class Class;
5557 }; 5563 };
5558 5564
5559 5565
5560 class Bigint : public Integer { 5566 class Bigint : public Integer {
5561 public: 5567 public:
5562 virtual bool IsZero() const { return Used() == 0;} 5568 virtual bool IsZero() const { return Used() == 0;}
5563 virtual bool IsNegative() const { return Neg(); } 5569 virtual bool IsNegative() const { return Neg(); }
5564 virtual bool Equals(const Instance& other) const; 5570 virtual bool Equals(const Instance& other) const;
5565 5571
(...skipping 2282 matching lines...) Expand 10 before | Expand all | Expand 10 after
7848 7854
7849 7855
7850 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7856 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7851 intptr_t index) { 7857 intptr_t index) {
7852 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7858 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7853 } 7859 }
7854 7860
7855 } // namespace dart 7861 } // namespace dart
7856 7862
7857 #endif // VM_OBJECT_H_ 7863 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698