| 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_RAW_OBJECT_H_ | 5 #ifndef VM_RAW_OBJECT_H_ |
| 6 #define VM_RAW_OBJECT_H_ | 6 #define VM_RAW_OBJECT_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/token.h" | 10 #include "vm/token.h" |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 kSetterFunction, // represents setter functions e.g: set foo(..) { .. }. | 551 kSetterFunction, // represents setter functions e.g: set foo(..) { .. }. |
| 552 kConstructor, | 552 kConstructor, |
| 553 kImplicitGetter, // represents an implicit getter for fields. | 553 kImplicitGetter, // represents an implicit getter for fields. |
| 554 kImplicitSetter, // represents an implicit setter for fields. | 554 kImplicitSetter, // represents an implicit setter for fields. |
| 555 kConstImplicitGetter, // represents an implicit const getter for fields. | 555 kConstImplicitGetter, // represents an implicit const getter for fields. |
| 556 }; | 556 }; |
| 557 | 557 |
| 558 private: | 558 private: |
| 559 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); | 559 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); |
| 560 | 560 |
| 561 enum KindTagBits { | |
| 562 kStaticBit = 1, | |
| 563 kConstBit, | |
| 564 kOptimizableBit, | |
| 565 kHasFinallyBit, | |
| 566 kNativeBit, | |
| 567 kAbstractBit, | |
| 568 kExternalBit, | |
| 569 kKindTagBit, | |
| 570 kKindTagSize = 4, | |
| 571 }; | |
| 572 class StaticBit : public BitField<bool, kStaticBit, 1> {}; | |
| 573 class ConstBit : public BitField<bool, kConstBit, 1> {}; | |
| 574 class OptimizableBit : public BitField<bool, kOptimizableBit, 1> {}; | |
| 575 class HasFinallyBit : public BitField<bool, kHasFinallyBit, 1> {}; | |
| 576 class NativeBit : public BitField<bool, kNativeBit, 1> {}; | |
| 577 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; | |
| 578 class ExternalBit : public BitField<bool, kExternalBit, 1> {}; | |
| 579 class KindBits : public BitField<Kind, kKindTagBit, kKindTagSize> {}; | |
| 580 | |
| 581 bool IsStatic() const { | |
| 582 return StaticBit::decode(ptr()->kind_tag_); | |
| 583 } | |
| 584 void SetIsStatic(bool value) { | |
| 585 uword bits = ptr()->kind_tag_; | |
| 586 ptr()->kind_tag_ = StaticBit::update(value, bits); | |
| 587 } | |
| 588 bool IsConst() const { | |
| 589 return ConstBit::decode(ptr()->kind_tag_); | |
| 590 } | |
| 591 void SetIsConst(bool value) { | |
| 592 uword bits = ptr()->kind_tag_; | |
| 593 ptr()->kind_tag_ = ConstBit::update(value, bits); | |
| 594 } | |
| 595 bool IsOptimizable() const { | |
| 596 return OptimizableBit::decode(ptr()->kind_tag_); | |
| 597 } | |
| 598 void SetIsOptimizable(bool value) { | |
| 599 uword bits = ptr()->kind_tag_; | |
| 600 ptr()->kind_tag_ = OptimizableBit::update(value, bits); | |
| 601 } | |
| 602 bool HasFinally() const { | |
| 603 return HasFinallyBit::decode(ptr()->kind_tag_); | |
| 604 } | |
| 605 void SetHasFinally(bool value) { | |
| 606 uword bits = ptr()->kind_tag_; | |
| 607 ptr()->kind_tag_ = HasFinallyBit::update(value, bits); | |
| 608 } | |
| 609 bool IsNative() const { | |
| 610 return NativeBit::decode(ptr()->kind_tag_); | |
| 611 } | |
| 612 void SetIsNative(bool value) { | |
| 613 uword bits = ptr()->kind_tag_; | |
| 614 ptr()->kind_tag_ = NativeBit::update(value, bits); | |
| 615 } | |
| 616 bool IsAbstract() const { | |
| 617 return AbstractBit::decode(ptr()->kind_tag_); | |
| 618 } | |
| 619 void SetIsAbstract(bool value) { | |
| 620 uword bits = ptr()->kind_tag_; | |
| 621 ptr()->kind_tag_ = AbstractBit::update(value, bits); | |
| 622 } | |
| 623 bool IsExternal() const { | |
| 624 return ExternalBit::decode(ptr()->kind_tag_); | |
| 625 } | |
| 626 void SetIsExternal(bool value) { | |
| 627 uword bits = ptr()->kind_tag_; | |
| 628 ptr()->kind_tag_ = ExternalBit::update(value, bits); | |
| 629 } | |
| 630 Kind GetKind() const { | |
| 631 return KindBits::decode(ptr()->kind_tag_); | |
| 632 } | |
| 633 void SetKind(Kind value) { | |
| 634 uword bits = ptr()->kind_tag_; | |
| 635 ptr()->kind_tag_ = KindBits::update(value, bits); | |
| 636 } | |
| 637 | |
| 638 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 561 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
| 639 RawString* name_; | 562 RawString* name_; |
| 640 RawClass* owner_; | 563 RawClass* owner_; |
| 641 RawAbstractType* result_type_; | 564 RawAbstractType* result_type_; |
| 642 RawArray* parameter_types_; | 565 RawArray* parameter_types_; |
| 643 RawArray* parameter_names_; | 566 RawArray* parameter_names_; |
| 644 RawCode* code_; // Compiled code for the function. | 567 RawCode* code_; // Compiled code for the function. |
| 645 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. | 568 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. |
| 646 RawContextScope* context_scope_; | 569 RawContextScope* context_scope_; |
| 647 RawFunction* parent_function_; // Enclosing function of this local function. | 570 RawFunction* parent_function_; // Enclosing function of this local function. |
| (...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 kExternalUint64ArrayCid == kByteArrayCid + 18 && | 1533 kExternalUint64ArrayCid == kByteArrayCid + 18 && |
| 1611 kExternalFloat32ArrayCid == kByteArrayCid + 19 && | 1534 kExternalFloat32ArrayCid == kByteArrayCid + 19 && |
| 1612 kExternalFloat64ArrayCid == kByteArrayCid + 20 && | 1535 kExternalFloat64ArrayCid == kByteArrayCid + 20 && |
| 1613 kStacktraceCid == kByteArrayCid + 21); | 1536 kStacktraceCid == kByteArrayCid + 21); |
| 1614 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid); | 1537 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid); |
| 1615 } | 1538 } |
| 1616 | 1539 |
| 1617 } // namespace dart | 1540 } // namespace dart |
| 1618 | 1541 |
| 1619 #endif // VM_RAW_OBJECT_H_ | 1542 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |