Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 601 } | 601 } |
| 602 static intptr_t num_native_fields_offset() { | 602 static intptr_t num_native_fields_offset() { |
| 603 return OFFSET_OF(RawClass, num_native_fields_); | 603 return OFFSET_OF(RawClass, num_native_fields_); |
| 604 } | 604 } |
| 605 | 605 |
| 606 RawCode* allocation_stub() const { | 606 RawCode* allocation_stub() const { |
| 607 return raw_ptr()->allocation_stub_; | 607 return raw_ptr()->allocation_stub_; |
| 608 } | 608 } |
| 609 void set_allocation_stub(const Code& value) const; | 609 void set_allocation_stub(const Code& value) const; |
| 610 | 610 |
| 611 void set_constants(const Array& value) const; | |
| 612 RawArray* constants() const; | |
| 613 | |
| 611 void Finalize() const; | 614 void Finalize() const; |
| 612 | 615 |
| 613 // Allocate a class used for VM internal objects. | 616 // Allocate a class used for VM internal objects. |
| 614 template <class FakeObject> static RawClass* New(); | 617 template <class FakeObject> static RawClass* New(); |
| 615 | 618 |
| 616 // Allocate an instance class which has a VM implementation. | 619 // Allocate an instance class which has a VM implementation. |
| 617 template <class FakeInstance> static RawClass* New(const String& name, | 620 template <class FakeInstance> static RawClass* New(const String& name, |
| 618 const Script& script); | 621 const Script& script); |
| 619 | 622 |
| 620 // Allocate instance classes and interfaces. | 623 // Allocate instance classes and interfaces. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 639 // otherwise a new object is allocated and returned. | 642 // otherwise a new object is allocated and returned. |
| 640 static RawClass* GetClass(ObjectKind kind); | 643 static RawClass* GetClass(ObjectKind kind); |
| 641 | 644 |
| 642 private: | 645 private: |
| 643 void set_name(const String& value) const; | 646 void set_name(const String& value) const; |
| 644 void set_script(const Script& value) const; | 647 void set_script(const Script& value) const; |
| 645 void set_signature_function(const Function& value) const; | 648 void set_signature_function(const Function& value) const; |
| 646 void set_signature_type(const AbstractType& value) const; | 649 void set_signature_type(const AbstractType& value) const; |
| 647 void set_class_state(int8_t state) const; | 650 void set_class_state(int8_t state) const; |
| 648 | 651 |
| 649 void set_constants(const Array& value) const; | |
| 650 RawArray* constants() const; | |
| 651 | |
| 652 void set_canonical_types(const Array& value) const; | 652 void set_canonical_types(const Array& value) const; |
| 653 RawArray* canonical_types() const; | 653 RawArray* canonical_types() const; |
| 654 | 654 |
| 655 void CalculateFieldOffsets() const; | 655 void CalculateFieldOffsets() const; |
| 656 | 656 |
| 657 // Check the subtype or assignability relationship. | 657 // Check the subtype or assignability relationship. |
| 658 bool TestType(TypeTestKind test, | 658 bool TestType(TypeTestKind test, |
| 659 const AbstractTypeArguments& type_arguments, | 659 const AbstractTypeArguments& type_arguments, |
| 660 const Class& other, | 660 const Class& other, |
| 661 const AbstractTypeArguments& other_type_arguments) const; | 661 const AbstractTypeArguments& other_type_arguments) const; |
| (...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2348 } | 2348 } |
| 2349 | 2349 |
| 2350 virtual bool Equals(const Instance& other) const; | 2350 virtual bool Equals(const Instance& other) const; |
| 2351 | 2351 |
| 2352 virtual double AsDoubleValue() const; | 2352 virtual double AsDoubleValue() const; |
| 2353 virtual int64_t AsInt64Value() const; | 2353 virtual int64_t AsInt64Value() const; |
| 2354 | 2354 |
| 2355 virtual int CompareWith(const Integer& other) const; | 2355 virtual int CompareWith(const Integer& other) const; |
| 2356 | 2356 |
| 2357 static RawMint* New(int64_t value, Heap::Space space = Heap::kNew); | 2357 static RawMint* New(int64_t value, Heap::Space space = Heap::kNew); |
| 2358 static RawMint* NewCanonical(int64_t value); | |
| 2358 | 2359 |
| 2359 static intptr_t InstanceSize() { | 2360 static intptr_t InstanceSize() { |
| 2360 return RoundedAllocationSize(sizeof(RawMint)); | 2361 return RoundedAllocationSize(sizeof(RawMint)); |
| 2361 } | 2362 } |
| 2362 | 2363 |
| 2363 private: | 2364 private: |
| 2364 void set_value(int64_t value) const; | 2365 void set_value(int64_t value) const; |
| 2365 | 2366 |
| 2366 HEAP_OBJECT_IMPLEMENTATION(Mint, Integer); | 2367 HEAP_OBJECT_IMPLEMENTATION(Mint, Integer); |
| 2367 friend class Class; | 2368 friend class Class; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2426 friend class BigintOperations; | 2427 friend class BigintOperations; |
| 2427 }; | 2428 }; |
| 2428 | 2429 |
| 2429 | 2430 |
| 2430 class Double : public Number { | 2431 class Double : public Number { |
| 2431 public: | 2432 public: |
| 2432 double value() const { | 2433 double value() const { |
| 2433 return raw_ptr()->value_; | 2434 return raw_ptr()->value_; |
| 2434 } | 2435 } |
| 2435 | 2436 |
| 2437 bool Equals(double value) const; | |
|
srdjan
2011/12/15 22:02:26
Please give this one a different name, e.g. Equals
siva
2011/12/15 23:42:54
Done.
| |
| 2438 virtual bool Equals(const Instance& other) const; | |
| 2439 | |
| 2436 static RawDouble* New(double d, Heap::Space space = Heap::kNew); | 2440 static RawDouble* New(double d, Heap::Space space = Heap::kNew); |
| 2437 | 2441 |
| 2438 static RawDouble* New(const String& str, Heap::Space space = Heap::kNew); | 2442 static RawDouble* New(const String& str, Heap::Space space = Heap::kNew); |
| 2439 | 2443 |
| 2444 static RawDouble* NewCanonical(double d); | |
|
srdjan
2011/12/15 22:02:26
Please use different names, e.g., NewCanonicalFrom
siva
2011/12/15 23:42:54
This style seems to go against the style we have u
| |
| 2445 | |
| 2446 static RawDouble* NewCanonical(const String& str); | |
|
srdjan
2011/12/15 22:02:26
Need to comment that a Double::null() is returned
siva
2011/12/15 23:42:54
Done.
| |
| 2447 | |
| 2440 static intptr_t InstanceSize() { | 2448 static intptr_t InstanceSize() { |
| 2441 return RoundedAllocationSize(sizeof(RawDouble)); | 2449 return RoundedAllocationSize(sizeof(RawDouble)); |
| 2442 } | 2450 } |
| 2443 | 2451 |
| 2444 static intptr_t value_offset() { return OFFSET_OF(RawDouble, value_); } | 2452 static intptr_t value_offset() { return OFFSET_OF(RawDouble, value_); } |
| 2445 | 2453 |
| 2446 private: | 2454 private: |
| 2447 void set_value(double value) const; | 2455 void set_value(double value) const; |
| 2448 | 2456 |
| 2449 HEAP_OBJECT_IMPLEMENTATION(Double, Number); | 2457 HEAP_OBJECT_IMPLEMENTATION(Double, Number); |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3289 } | 3297 } |
| 3290 | 3298 |
| 3291 | 3299 |
| 3292 void Context::SetAt(intptr_t index, const Instance& value) const { | 3300 void Context::SetAt(intptr_t index, const Instance& value) const { |
| 3293 StorePointer(InstanceAddr(index), value.raw()); | 3301 StorePointer(InstanceAddr(index), value.raw()); |
| 3294 } | 3302 } |
| 3295 | 3303 |
| 3296 } // namespace dart | 3304 } // namespace dart |
| 3297 | 3305 |
| 3298 #endif // VM_OBJECT_H_ | 3306 #endif // VM_OBJECT_H_ |
| OLD | NEW |