OLD | NEW |
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 2965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2976 | 2976 |
2977 // For static fields only. Constructs a closure that gets/sets the | 2977 // For static fields only. Constructs a closure that gets/sets the |
2978 // field value. | 2978 // field value. |
2979 RawInstance* GetterClosure() const; | 2979 RawInstance* GetterClosure() const; |
2980 RawInstance* SetterClosure() const; | 2980 RawInstance* SetterClosure() const; |
2981 RawInstance* AccessorClosure(bool make_setter) const; | 2981 RawInstance* AccessorClosure(bool make_setter) const; |
2982 | 2982 |
2983 // Constructs getter and setter names for fields and vice versa. | 2983 // Constructs getter and setter names for fields and vice versa. |
2984 static RawString* GetterName(const String& field_name); | 2984 static RawString* GetterName(const String& field_name); |
2985 static RawString* GetterSymbol(const String& field_name); | 2985 static RawString* GetterSymbol(const String& field_name); |
| 2986 // Returns String::null() if getter symbol does not exist. |
| 2987 static RawString* LookupGetterSymbol(const String& field_name); |
2986 static RawString* SetterName(const String& field_name); | 2988 static RawString* SetterName(const String& field_name); |
2987 static RawString* SetterSymbol(const String& field_name); | 2989 static RawString* SetterSymbol(const String& field_name); |
| 2990 // Returns String::null() if setter symbol does not exist. |
| 2991 static RawString* LookupSetterSymbol(const String& field_name); |
2988 static RawString* NameFromGetter(const String& getter_name); | 2992 static RawString* NameFromGetter(const String& getter_name); |
2989 static RawString* NameFromSetter(const String& setter_name); | 2993 static RawString* NameFromSetter(const String& setter_name); |
2990 static bool IsGetterName(const String& function_name); | 2994 static bool IsGetterName(const String& function_name); |
2991 static bool IsSetterName(const String& function_name); | 2995 static bool IsSetterName(const String& function_name); |
2992 | 2996 |
2993 private: | 2997 private: |
2994 friend class StoreInstanceFieldInstr; // Generated code access to bit field. | 2998 friend class StoreInstanceFieldInstr; // Generated code access to bit field. |
2995 | 2999 |
2996 enum { | 3000 enum { |
2997 kConstBit = 0, | 3001 kConstBit = 0, |
(...skipping 2611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5609 // Returns 0, -1 or 1. | 5613 // Returns 0, -1 or 1. |
5610 virtual int CompareWith(const Integer& other) const; | 5614 virtual int CompareWith(const Integer& other) const; |
5611 | 5615 |
5612 // Return the most compact presentation of an integer. | 5616 // Return the most compact presentation of an integer. |
5613 RawInteger* AsValidInteger() const; | 5617 RawInteger* AsValidInteger() const; |
5614 | 5618 |
5615 // Returns null to indicate that a bigint operation is required. | 5619 // Returns null to indicate that a bigint operation is required. |
5616 RawInteger* ArithmeticOp(Token::Kind operation, | 5620 RawInteger* ArithmeticOp(Token::Kind operation, |
5617 const Integer& other, | 5621 const Integer& other, |
5618 Heap::Space space = Heap::kNew) const; | 5622 Heap::Space space = Heap::kNew) const; |
5619 RawInteger* BitOp(Token::Kind operation, const Integer& other) const; | 5623 RawInteger* BitOp(Token::Kind operation, |
| 5624 const Integer& other, |
| 5625 Heap::Space space = Heap::kNew) const; |
5620 | 5626 |
5621 // Returns true if the Integer does not fit in a Javascript integer. | 5627 // Returns true if the Integer does not fit in a Javascript integer. |
5622 bool CheckJavascriptIntegerOverflow() const; | 5628 bool CheckJavascriptIntegerOverflow() const; |
5623 | 5629 |
5624 private: | 5630 private: |
5625 OBJECT_IMPLEMENTATION(Integer, Number); | 5631 OBJECT_IMPLEMENTATION(Integer, Number); |
5626 friend class Class; | 5632 friend class Class; |
5627 }; | 5633 }; |
5628 | 5634 |
5629 | 5635 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5670 static intptr_t RawValue(intptr_t value) { | 5676 static intptr_t RawValue(intptr_t value) { |
5671 return reinterpret_cast<intptr_t>(New(value)); | 5677 return reinterpret_cast<intptr_t>(New(value)); |
5672 } | 5678 } |
5673 | 5679 |
5674 static bool IsValid(int64_t value) { | 5680 static bool IsValid(int64_t value) { |
5675 return (value >= kMinValue) && (value <= kMaxValue); | 5681 return (value >= kMinValue) && (value <= kMaxValue); |
5676 } | 5682 } |
5677 | 5683 |
5678 RawInteger* ShiftOp(Token::Kind kind, | 5684 RawInteger* ShiftOp(Token::Kind kind, |
5679 const Smi& other, | 5685 const Smi& other, |
| 5686 Heap::Space space = Heap::kNew, |
5680 const bool silent = false) const; | 5687 const bool silent = false) const; |
5681 | 5688 |
5682 void operator=(RawSmi* value) { | 5689 void operator=(RawSmi* value) { |
5683 raw_ = value; | 5690 raw_ = value; |
5684 CHECK_HANDLE(); | 5691 CHECK_HANDLE(); |
5685 } | 5692 } |
5686 void operator^=(RawObject* value) { | 5693 void operator^=(RawObject* value) { |
5687 raw_ = value; | 5694 raw_ = value; |
5688 CHECK_HANDLE(); | 5695 CHECK_HANDLE(); |
5689 } | 5696 } |
(...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8070 | 8077 |
8071 | 8078 |
8072 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8079 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
8073 intptr_t index) { | 8080 intptr_t index) { |
8074 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8081 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
8075 } | 8082 } |
8076 | 8083 |
8077 } // namespace dart | 8084 } // namespace dart |
8078 | 8085 |
8079 #endif // VM_OBJECT_H_ | 8086 #endif // VM_OBJECT_H_ |
OLD | NEW |