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 7633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7644 class FlagsBits : public BitField<intptr_t, kFlagsPos, kFlagsSize> {}; | 7644 class FlagsBits : public BitField<intptr_t, kFlagsPos, kFlagsSize> {}; |
7645 | 7645 |
7646 bool is_initialized() const { return (type() != kUnitialized); } | 7646 bool is_initialized() const { return (type() != kUnitialized); } |
7647 bool is_simple() const { return (type() == kSimple); } | 7647 bool is_simple() const { return (type() == kSimple); } |
7648 bool is_complex() const { return (type() == kComplex); } | 7648 bool is_complex() const { return (type() == kComplex); } |
7649 | 7649 |
7650 bool is_global() const { return (flags() & kGlobal); } | 7650 bool is_global() const { return (flags() & kGlobal); } |
7651 bool is_ignore_case() const { return (flags() & kIgnoreCase); } | 7651 bool is_ignore_case() const { return (flags() & kIgnoreCase); } |
7652 bool is_multi_line() const { return (flags() & kMultiLine); } | 7652 bool is_multi_line() const { return (flags() & kMultiLine); } |
7653 | 7653 |
| 7654 intptr_t num_registers() const { return raw_ptr()->num_registers_; } |
| 7655 |
7654 RawString* pattern() const { return raw_ptr()->pattern_; } | 7656 RawString* pattern() const { return raw_ptr()->pattern_; } |
7655 RawSmi* num_bracket_expressions() const { | 7657 RawSmi* num_bracket_expressions() const { |
7656 return raw_ptr()->num_bracket_expressions_; | 7658 return raw_ptr()->num_bracket_expressions_; |
7657 } | 7659 } |
7658 | 7660 |
| 7661 RawTypedData* bytecode(bool is_one_byte) const { |
| 7662 return is_one_byte ? raw_ptr()->one_byte_bytecode_ |
| 7663 : raw_ptr()->two_byte_bytecode_; |
| 7664 } |
| 7665 |
7659 static intptr_t function_offset(intptr_t cid) { | 7666 static intptr_t function_offset(intptr_t cid) { |
7660 switch (cid) { | 7667 switch (cid) { |
7661 case kOneByteStringCid: | 7668 case kOneByteStringCid: |
7662 return OFFSET_OF(RawJSRegExp, one_byte_function_); | 7669 return OFFSET_OF(RawJSRegExp, one_byte_function_); |
7663 case kTwoByteStringCid: | 7670 case kTwoByteStringCid: |
7664 return OFFSET_OF(RawJSRegExp, two_byte_function_); | 7671 return OFFSET_OF(RawJSRegExp, two_byte_function_); |
7665 case kExternalOneByteStringCid: | 7672 case kExternalOneByteStringCid: |
7666 return OFFSET_OF(RawJSRegExp, external_one_byte_function_); | 7673 return OFFSET_OF(RawJSRegExp, external_one_byte_function_); |
7667 case kExternalTwoByteStringCid: | 7674 case kExternalTwoByteStringCid: |
7668 return OFFSET_OF(RawJSRegExp, external_two_byte_function_); | 7675 return OFFSET_OF(RawJSRegExp, external_two_byte_function_); |
7669 } | 7676 } |
7670 | 7677 |
7671 UNREACHABLE(); | 7678 UNREACHABLE(); |
7672 return -1; | 7679 return -1; |
7673 } | 7680 } |
7674 | 7681 |
7675 RawFunction** FunctionAddr(intptr_t cid) const { | 7682 RawFunction** FunctionAddr(intptr_t cid) const { |
7676 return reinterpret_cast<RawFunction**>( | 7683 return reinterpret_cast<RawFunction**>( |
7677 FieldAddrAtOffset(function_offset(cid))); | 7684 FieldAddrAtOffset(function_offset(cid))); |
7678 } | 7685 } |
7679 | 7686 |
7680 RawFunction* function(intptr_t cid) const { | 7687 RawFunction* function(intptr_t cid) const { |
7681 return *FunctionAddr(cid); | 7688 return *FunctionAddr(cid); |
7682 } | 7689 } |
7683 | 7690 |
7684 void set_pattern(const String& pattern) const; | 7691 void set_pattern(const String& pattern) const; |
7685 void set_function(intptr_t cid, const Function& value) const; | 7692 void set_function(intptr_t cid, const Function& value) const; |
| 7693 void set_bytecode(bool is_one_byte, const TypedData& bytecode) const; |
7686 | 7694 |
7687 void set_num_bracket_expressions(intptr_t value) const; | 7695 void set_num_bracket_expressions(intptr_t value) const; |
7688 void set_is_global() const { set_flags(flags() | kGlobal); } | 7696 void set_is_global() const { set_flags(flags() | kGlobal); } |
7689 void set_is_ignore_case() const { set_flags(flags() | kIgnoreCase); } | 7697 void set_is_ignore_case() const { set_flags(flags() | kIgnoreCase); } |
7690 void set_is_multi_line() const { set_flags(flags() | kMultiLine); } | 7698 void set_is_multi_line() const { set_flags(flags() | kMultiLine); } |
7691 void set_is_simple() const { set_type(kSimple); } | 7699 void set_is_simple() const { set_type(kSimple); } |
7692 void set_is_complex() const { set_type(kComplex); } | 7700 void set_is_complex() const { set_type(kComplex); } |
| 7701 void set_num_registers(intptr_t value) const { |
| 7702 StoreNonPointer(&raw_ptr()->num_registers_, value); |
| 7703 } |
7693 | 7704 |
7694 void* GetDataStartAddress() const; | 7705 void* GetDataStartAddress() const; |
7695 static RawJSRegExp* FromDataStartAddress(void* data); | 7706 static RawJSRegExp* FromDataStartAddress(void* data); |
7696 const char* Flags() const; | 7707 const char* Flags() const; |
7697 | 7708 |
7698 virtual bool CanonicalizeEquals(const Instance& other) const; | 7709 virtual bool CanonicalizeEquals(const Instance& other) const; |
7699 | 7710 |
7700 static intptr_t InstanceSize() { | 7711 static intptr_t InstanceSize() { |
7701 return RoundedAllocationSize(sizeof(RawJSRegExp)); | 7712 return RoundedAllocationSize(sizeof(RawJSRegExp)); |
7702 } | 7713 } |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7976 | 7987 |
7977 | 7988 |
7978 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7989 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7979 intptr_t index) { | 7990 intptr_t index) { |
7980 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7991 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7981 } | 7992 } |
7982 | 7993 |
7983 } // namespace dart | 7994 } // namespace dart |
7984 | 7995 |
7985 #endif // VM_OBJECT_H_ | 7996 #endif // VM_OBJECT_H_ |
OLD | NEW |