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 7652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7663 class FlagsBits : public BitField<intptr_t, kFlagsPos, kFlagsSize> {}; | 7663 class FlagsBits : public BitField<intptr_t, kFlagsPos, kFlagsSize> {}; |
7664 | 7664 |
7665 bool is_initialized() const { return (type() != kUnitialized); } | 7665 bool is_initialized() const { return (type() != kUnitialized); } |
7666 bool is_simple() const { return (type() == kSimple); } | 7666 bool is_simple() const { return (type() == kSimple); } |
7667 bool is_complex() const { return (type() == kComplex); } | 7667 bool is_complex() const { return (type() == kComplex); } |
7668 | 7668 |
7669 bool is_global() const { return (flags() & kGlobal); } | 7669 bool is_global() const { return (flags() & kGlobal); } |
7670 bool is_ignore_case() const { return (flags() & kIgnoreCase); } | 7670 bool is_ignore_case() const { return (flags() & kIgnoreCase); } |
7671 bool is_multi_line() const { return (flags() & kMultiLine); } | 7671 bool is_multi_line() const { return (flags() & kMultiLine); } |
7672 | 7672 |
| 7673 intptr_t num_registers() const { return raw_ptr()->num_registers_; } |
| 7674 |
7673 RawString* pattern() const { return raw_ptr()->pattern_; } | 7675 RawString* pattern() const { return raw_ptr()->pattern_; } |
7674 RawSmi* num_bracket_expressions() const { | 7676 RawSmi* num_bracket_expressions() const { |
7675 return raw_ptr()->num_bracket_expressions_; | 7677 return raw_ptr()->num_bracket_expressions_; |
7676 } | 7678 } |
7677 | 7679 |
| 7680 RawTypedData* bytecode(bool is_one_byte) const { |
| 7681 return is_one_byte ? raw_ptr()->one_byte_bytecode_ |
| 7682 : raw_ptr()->two_byte_bytecode_; |
| 7683 } |
| 7684 |
7678 static intptr_t function_offset(intptr_t cid) { | 7685 static intptr_t function_offset(intptr_t cid) { |
7679 switch (cid) { | 7686 switch (cid) { |
7680 case kOneByteStringCid: | 7687 case kOneByteStringCid: |
7681 return OFFSET_OF(RawJSRegExp, one_byte_function_); | 7688 return OFFSET_OF(RawJSRegExp, one_byte_function_); |
7682 case kTwoByteStringCid: | 7689 case kTwoByteStringCid: |
7683 return OFFSET_OF(RawJSRegExp, two_byte_function_); | 7690 return OFFSET_OF(RawJSRegExp, two_byte_function_); |
7684 case kExternalOneByteStringCid: | 7691 case kExternalOneByteStringCid: |
7685 return OFFSET_OF(RawJSRegExp, external_one_byte_function_); | 7692 return OFFSET_OF(RawJSRegExp, external_one_byte_function_); |
7686 case kExternalTwoByteStringCid: | 7693 case kExternalTwoByteStringCid: |
7687 return OFFSET_OF(RawJSRegExp, external_two_byte_function_); | 7694 return OFFSET_OF(RawJSRegExp, external_two_byte_function_); |
7688 } | 7695 } |
7689 | 7696 |
7690 UNREACHABLE(); | 7697 UNREACHABLE(); |
7691 return -1; | 7698 return -1; |
7692 } | 7699 } |
7693 | 7700 |
7694 RawFunction** FunctionAddr(intptr_t cid) const { | 7701 RawFunction** FunctionAddr(intptr_t cid) const { |
7695 return reinterpret_cast<RawFunction**>( | 7702 return reinterpret_cast<RawFunction**>( |
7696 FieldAddrAtOffset(function_offset(cid))); | 7703 FieldAddrAtOffset(function_offset(cid))); |
7697 } | 7704 } |
7698 | 7705 |
7699 RawFunction* function(intptr_t cid) const { | 7706 RawFunction* function(intptr_t cid) const { |
7700 return *FunctionAddr(cid); | 7707 return *FunctionAddr(cid); |
7701 } | 7708 } |
7702 | 7709 |
7703 void set_pattern(const String& pattern) const; | 7710 void set_pattern(const String& pattern) const; |
7704 void set_function(intptr_t cid, const Function& value) const; | 7711 void set_function(intptr_t cid, const Function& value) const; |
| 7712 void set_bytecode(bool is_one_byte, const TypedData& bytecode) const; |
7705 | 7713 |
7706 void set_num_bracket_expressions(intptr_t value) const; | 7714 void set_num_bracket_expressions(intptr_t value) const; |
7707 void set_is_global() const { set_flags(flags() | kGlobal); } | 7715 void set_is_global() const { set_flags(flags() | kGlobal); } |
7708 void set_is_ignore_case() const { set_flags(flags() | kIgnoreCase); } | 7716 void set_is_ignore_case() const { set_flags(flags() | kIgnoreCase); } |
7709 void set_is_multi_line() const { set_flags(flags() | kMultiLine); } | 7717 void set_is_multi_line() const { set_flags(flags() | kMultiLine); } |
7710 void set_is_simple() const { set_type(kSimple); } | 7718 void set_is_simple() const { set_type(kSimple); } |
7711 void set_is_complex() const { set_type(kComplex); } | 7719 void set_is_complex() const { set_type(kComplex); } |
| 7720 void set_num_registers(intptr_t value) const { |
| 7721 StoreNonPointer(&raw_ptr()->num_registers_, value); |
| 7722 } |
7712 | 7723 |
7713 void* GetDataStartAddress() const; | 7724 void* GetDataStartAddress() const; |
7714 static RawJSRegExp* FromDataStartAddress(void* data); | 7725 static RawJSRegExp* FromDataStartAddress(void* data); |
7715 const char* Flags() const; | 7726 const char* Flags() const; |
7716 | 7727 |
7717 virtual bool CanonicalizeEquals(const Instance& other) const; | 7728 virtual bool CanonicalizeEquals(const Instance& other) const; |
7718 | 7729 |
7719 static intptr_t InstanceSize() { | 7730 static intptr_t InstanceSize() { |
7720 return RoundedAllocationSize(sizeof(RawJSRegExp)); | 7731 return RoundedAllocationSize(sizeof(RawJSRegExp)); |
7721 } | 7732 } |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7995 | 8006 |
7996 | 8007 |
7997 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8008 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7998 intptr_t index) { | 8009 intptr_t index) { |
7999 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8010 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
8000 } | 8011 } |
8001 | 8012 |
8002 } // namespace dart | 8013 } // namespace dart |
8003 | 8014 |
8004 #endif // VM_OBJECT_H_ | 8015 #endif // VM_OBJECT_H_ |
OLD | NEW |