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

Side by Side Diff: vm/object.h

Issue 8963001: Add Double::NewCanonical and Mint::NewCanonical so that it is possible to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years 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 | « no previous file | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/dart.h" 9 #include "vm/dart.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 RawFunction* LookupConstructor(const String& name) const; 563 RawFunction* LookupConstructor(const String& name) const;
564 RawFunction* LookupFactory(const String& name) const; 564 RawFunction* LookupFactory(const String& name) const;
565 RawFunction* LookupFunction(const String& name) const; 565 RawFunction* LookupFunction(const String& name) const;
566 566
567 RawField* LookupInstanceField(const String& name) const; 567 RawField* LookupInstanceField(const String& name) const;
568 RawField* LookupStaticField(const String& name) const; 568 RawField* LookupStaticField(const String& name) const;
569 RawField* LookupField(const String& name) const; 569 RawField* LookupField(const String& name) const;
570 570
571 RawLibraryPrefix* LookupLibraryPrefix(const String& name) const; 571 RawLibraryPrefix* LookupLibraryPrefix(const String& name) const;
572 572
573 void InsertCanonicalConstant(intptr_t index, const Instance& constant) const;
574
573 static intptr_t InstanceSize() { 575 static intptr_t InstanceSize() {
574 return RoundedAllocationSize(sizeof(RawClass)); 576 return RoundedAllocationSize(sizeof(RawClass));
575 } 577 }
576 578
577 bool is_interface() const { 579 bool is_interface() const {
578 return raw_ptr()->is_interface_; 580 return raw_ptr()->is_interface_;
579 } 581 }
580 void set_is_interface() const; 582 void set_is_interface() const;
581 583
582 bool is_finalized() const { 584 bool is_finalized() const {
(...skipping 18 matching lines...) Expand all
601 } 603 }
602 static intptr_t num_native_fields_offset() { 604 static intptr_t num_native_fields_offset() {
603 return OFFSET_OF(RawClass, num_native_fields_); 605 return OFFSET_OF(RawClass, num_native_fields_);
604 } 606 }
605 607
606 RawCode* allocation_stub() const { 608 RawCode* allocation_stub() const {
607 return raw_ptr()->allocation_stub_; 609 return raw_ptr()->allocation_stub_;
608 } 610 }
609 void set_allocation_stub(const Code& value) const; 611 void set_allocation_stub(const Code& value) const;
610 612
613 RawArray* constants() const;
614
611 void Finalize() const; 615 void Finalize() const;
612 616
613 // Allocate a class used for VM internal objects. 617 // Allocate a class used for VM internal objects.
614 template <class FakeObject> static RawClass* New(); 618 template <class FakeObject> static RawClass* New();
615 619
616 // Allocate an instance class which has a VM implementation. 620 // Allocate an instance class which has a VM implementation.
617 template <class FakeInstance> static RawClass* New(const String& name, 621 template <class FakeInstance> static RawClass* New(const String& name,
618 const Script& script); 622 const Script& script);
619 623
620 // Allocate instance classes and interfaces. 624 // Allocate instance classes and interfaces.
(...skipping 19 matching lines...) Expand all
640 static RawClass* GetClass(ObjectKind kind); 644 static RawClass* GetClass(ObjectKind kind);
641 645
642 private: 646 private:
643 void set_name(const String& value) const; 647 void set_name(const String& value) const;
644 void set_script(const Script& value) const; 648 void set_script(const Script& value) const;
645 void set_signature_function(const Function& value) const; 649 void set_signature_function(const Function& value) const;
646 void set_signature_type(const AbstractType& value) const; 650 void set_signature_type(const AbstractType& value) const;
647 void set_class_state(int8_t state) const; 651 void set_class_state(int8_t state) const;
648 652
649 void set_constants(const Array& value) const; 653 void set_constants(const Array& value) const;
650 RawArray* constants() const;
651 654
652 void set_canonical_types(const Array& value) const; 655 void set_canonical_types(const Array& value) const;
653 RawArray* canonical_types() const; 656 RawArray* canonical_types() const;
654 657
655 void CalculateFieldOffsets() const; 658 void CalculateFieldOffsets() const;
656 659
657 // Check the subtype or assignability relationship. 660 // Check the subtype or assignability relationship.
658 bool TestType(TypeTestKind test, 661 bool TestType(TypeTestKind test,
659 const AbstractTypeArguments& type_arguments, 662 const AbstractTypeArguments& type_arguments,
660 const Class& other, 663 const Class& other,
(...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 } 2351 }
2349 2352
2350 virtual bool Equals(const Instance& other) const; 2353 virtual bool Equals(const Instance& other) const;
2351 2354
2352 virtual double AsDoubleValue() const; 2355 virtual double AsDoubleValue() const;
2353 virtual int64_t AsInt64Value() const; 2356 virtual int64_t AsInt64Value() const;
2354 2357
2355 virtual int CompareWith(const Integer& other) const; 2358 virtual int CompareWith(const Integer& other) const;
2356 2359
2357 static RawMint* New(int64_t value, Heap::Space space = Heap::kNew); 2360 static RawMint* New(int64_t value, Heap::Space space = Heap::kNew);
2361 static RawMint* NewCanonical(int64_t value);
2358 2362
2359 static intptr_t InstanceSize() { 2363 static intptr_t InstanceSize() {
2360 return RoundedAllocationSize(sizeof(RawMint)); 2364 return RoundedAllocationSize(sizeof(RawMint));
2361 } 2365 }
2362 2366
2363 private: 2367 private:
2364 void set_value(int64_t value) const; 2368 void set_value(int64_t value) const;
2365 2369
2366 HEAP_OBJECT_IMPLEMENTATION(Mint, Integer); 2370 HEAP_OBJECT_IMPLEMENTATION(Mint, Integer);
2367 friend class Class; 2371 friend class Class;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2426 friend class BigintOperations; 2430 friend class BigintOperations;
2427 }; 2431 };
2428 2432
2429 2433
2430 class Double : public Number { 2434 class Double : public Number {
2431 public: 2435 public:
2432 double value() const { 2436 double value() const {
2433 return raw_ptr()->value_; 2437 return raw_ptr()->value_;
2434 } 2438 }
2435 2439
2440 bool EqualsToDouble(double value) const;
2441 virtual bool Equals(const Instance& other) const;
2442
2436 static RawDouble* New(double d, Heap::Space space = Heap::kNew); 2443 static RawDouble* New(double d, Heap::Space space = Heap::kNew);
2437 2444
2438 static RawDouble* New(const String& str, Heap::Space space = Heap::kNew); 2445 static RawDouble* New(const String& str, Heap::Space space = Heap::kNew);
2439 2446
2447 // Returns a canonical double object allocated in the old gen space.
2448 static RawDouble* NewCanonical(double d);
2449
2450 // Returns a canonical double object (allocated in the old gen space) or
2451 // Double::null() if str points to a string that does not convert to a
2452 // double value.
2453 static RawDouble* NewCanonical(const String& str);
2454
2440 static intptr_t InstanceSize() { 2455 static intptr_t InstanceSize() {
2441 return RoundedAllocationSize(sizeof(RawDouble)); 2456 return RoundedAllocationSize(sizeof(RawDouble));
2442 } 2457 }
2443 2458
2444 static intptr_t value_offset() { return OFFSET_OF(RawDouble, value_); } 2459 static intptr_t value_offset() { return OFFSET_OF(RawDouble, value_); }
2445 2460
2446 private: 2461 private:
2447 void set_value(double value) const; 2462 void set_value(double value) const;
2448 2463
2449 HEAP_OBJECT_IMPLEMENTATION(Double, Number); 2464 HEAP_OBJECT_IMPLEMENTATION(Double, Number);
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
3289 } 3304 }
3290 3305
3291 3306
3292 void Context::SetAt(intptr_t index, const Instance& value) const { 3307 void Context::SetAt(intptr_t index, const Instance& value) const {
3293 StorePointer(InstanceAddr(index), value.raw()); 3308 StorePointer(InstanceAddr(index), value.raw());
3294 } 3309 }
3295 3310
3296 } // namespace dart 3311 } // namespace dart
3297 3312
3298 #endif // VM_OBJECT_H_ 3313 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698