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

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

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 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 | « src/vm/natives_windows.cc ('k') | src/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) 2014, the Dartino project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dartino 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 #ifndef SRC_VM_OBJECT_H_ 5 #ifndef SRC_VM_OBJECT_H_
6 #define SRC_VM_OBJECT_H_ 6 #define SRC_VM_OBJECT_H_
7 7
8 #define _USE_MATH_DEFINES // required for Windows 8 #define _USE_MATH_DEFINES // required for Windows
9 #include <math.h> 9 #include <math.h>
10 #include <string.h> 10 #include <string.h>
11 11
12 #include "src/shared/assert.h" 12 #include "src/shared/assert.h"
13 #include "src/shared/globals.h" 13 #include "src/shared/globals.h"
14 #include "src/shared/random.h" 14 #include "src/shared/random.h"
15 #include "src/shared/list.h" 15 #include "src/shared/list.h"
16 #include "src/shared/utils.h" 16 #include "src/shared/utils.h"
17 17
18 #include "src/vm/intrinsics.h" 18 #include "src/vm/intrinsics.h"
19 19
20 namespace fletch { 20 namespace dartino {
21 21
22 // This is an overview of the object class hierarchy: 22 // This is an overview of the object class hierarchy:
23 // 23 //
24 // Object 24 // Object
25 // Smi 25 // Smi
26 // Failure 26 // Failure
27 // HeapObject 27 // HeapObject
28 // FreeListChunk 28 // FreeListChunk
29 // OneWordFiller 29 // OneWordFiller
30 // PromotedTrack 30 // PromotedTrack
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 static const int kSize = kValueOffset + sizeof(int64); 445 static const int kSize = kValueOffset + sizeof(int64);
446 446
447 private: 447 private:
448 DISALLOW_IMPLICIT_CONSTRUCTORS(LargeInteger); 448 DISALLOW_IMPLICIT_CONSTRUCTORS(LargeInteger);
449 }; 449 };
450 450
451 // Heap allocated double. 451 // Heap allocated double.
452 class Double : public HeapObject { 452 class Double : public HeapObject {
453 public: 453 public:
454 // [value]: double value. 454 // [value]: double value.
455 inline fletch_double value(); 455 inline dartino_double value();
456 inline void set_value(fletch_double value); 456 inline void set_value(dartino_double value);
457 457
458 // Casting. 458 // Casting.
459 static inline Double* cast(Object* object); 459 static inline Double* cast(Object* object);
460 460
461 // Printing. 461 // Printing.
462 void DoublePrint(); 462 void DoublePrint();
463 void DoubleShortPrint(); 463 void DoubleShortPrint();
464 464
465 // Snapshotting. 465 // Snapshotting.
466 void DoubleWriteTo(SnapshotWriter* writer, Class* klass); 466 void DoubleWriteTo(SnapshotWriter* writer, Class* klass);
467 void DoubleReadFrom(SnapshotReader* reader); 467 void DoubleReadFrom(SnapshotReader* reader);
468 468
469 // Sizing. 469 // Sizing.
470 static int AllocationSize() { return Utils::RoundUp(kSize, kPointerSize); } 470 static int AllocationSize() { return Utils::RoundUp(kSize, kPointerSize); }
471 471
472 int DoubleSize() { return AllocationSize(); } 472 int DoubleSize() { return AllocationSize(); }
473 473
474 PortableSize CalculatePortableSize() { 474 PortableSize CalculatePortableSize() {
475 return PortableSize(HeapObject::kSize / kPointerSize, 0, 1); 475 return PortableSize(HeapObject::kSize / kPointerSize, 0, 1);
476 } 476 }
477 477
478 static const int kValueOffset = HeapObject::kSize; 478 static const int kValueOffset = HeapObject::kSize;
479 static const int kSize = kValueOffset + sizeof(fletch_double); 479 static const int kSize = kValueOffset + sizeof(dartino_double);
480 480
481 private: 481 private:
482 DISALLOW_IMPLICIT_CONSTRUCTORS(Double); 482 DISALLOW_IMPLICIT_CONSTRUCTORS(Double);
483 }; 483 };
484 484
485 // Heap allocated object that boxes a value. 485 // Heap allocated object that boxes a value.
486 class Boxed : public HeapObject { 486 class Boxed : public HeapObject {
487 public: 487 public:
488 inline Object* value(); 488 inline Object* value();
489 inline void set_value(Object* value); 489 inline void set_value(Object* value);
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 *reinterpret_cast<int64*>(address() + kValueOffset) = value; 2208 *reinterpret_cast<int64*>(address() + kValueOffset) = value;
2209 } 2209 }
2210 2210
2211 LargeInteger* LargeInteger::cast(Object* object) { 2211 LargeInteger* LargeInteger::cast(Object* object) {
2212 ASSERT(object->IsLargeInteger()); 2212 ASSERT(object->IsLargeInteger());
2213 return reinterpret_cast<LargeInteger*>(object); 2213 return reinterpret_cast<LargeInteger*>(object);
2214 } 2214 }
2215 2215
2216 // Inlined Double functions. 2216 // Inlined Double functions.
2217 2217
2218 fletch_double Double::value() { 2218 dartino_double Double::value() {
2219 return *reinterpret_cast<fletch_double*>(address() + kValueOffset); 2219 return *reinterpret_cast<dartino_double*>(address() + kValueOffset);
2220 } 2220 }
2221 2221
2222 void Double::set_value(fletch_double value) { 2222 void Double::set_value(dartino_double value) {
2223 *reinterpret_cast<fletch_double*>(address() + kValueOffset) = value; 2223 *reinterpret_cast<dartino_double*>(address() + kValueOffset) = value;
2224 } 2224 }
2225 2225
2226 Double* Double::cast(Object* object) { 2226 Double* Double::cast(Object* object) {
2227 ASSERT(object->IsDouble()); 2227 ASSERT(object->IsDouble());
2228 return reinterpret_cast<Double*>(object); 2228 return reinterpret_cast<Double*>(object);
2229 } 2229 }
2230 2230
2231 // Inlined Boxed functions. 2231 // Inlined Boxed functions.
2232 2232
2233 Object* Boxed::value() { return at(kValueOffset); } 2233 Object* Boxed::value() { return at(kValueOffset); }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2361 inline bool Coroutine::has_caller() { return !at(kCallerOffset)->IsNull(); } 2361 inline bool Coroutine::has_caller() { return !at(kCallerOffset)->IsNull(); }
2362 2362
2363 inline Coroutine* Coroutine::caller() { 2363 inline Coroutine* Coroutine::caller() {
2364 return Coroutine::cast(at(kCallerOffset)); 2364 return Coroutine::cast(at(kCallerOffset));
2365 } 2365 }
2366 2366
2367 inline void Coroutine::set_caller(Coroutine* value) { 2367 inline void Coroutine::set_caller(Coroutine* value) {
2368 at_put(kCallerOffset, value); 2368 at_put(kCallerOffset, value);
2369 } 2369 }
2370 2370
2371 } // namespace fletch 2371 } // namespace dartino
2372 2372
2373 #endif // SRC_VM_OBJECT_H_ 2373 #endif // SRC_VM_OBJECT_H_
OLDNEW
« no previous file with comments | « src/vm/natives_windows.cc ('k') | src/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698