Chromium Code Reviews| 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 553 kConstImplicitGetter, // represents an implicit const getter for fields. | 553 kConstImplicitGetter, // represents an implicit const getter for fields. |
| 554 }; | 554 }; |
| 555 | 555 |
| 556 private: | 556 private: |
| 557 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); | 557 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); |
| 558 | 558 |
| 559 enum KindTagBits { | 559 enum KindTagBits { |
| 560 kStaticBit = 1, | 560 kStaticBit = 1, |
| 561 kConstBit = 2, | 561 kConstBit = 2, |
| 562 kOptimizableBit = 3, | 562 kOptimizableBit = 3, |
| 563 kNativeBit = 4, | 563 kHasFinallyBit = 4, |
| 564 kAbstractBit = 5, | 564 kNativeBit = 5, |
| 565 kExternalBit = 5, | 565 kAbstractBit = 6, |
| 566 kKindTagBit = 6, | 566 kExternalBit = 6, |
| 567 kKindTagBit = 7, | |
| 567 kKindTagSize = 4, | 568 kKindTagSize = 4, |
| 568 }; | 569 }; |
| 569 class StaticBit : public BitField<bool, kStaticBit, 1> {}; | 570 class StaticBit : public BitField<bool, kStaticBit, 1> {}; |
| 570 class ConstBit : public BitField<bool, kConstBit, 1> {}; | 571 class ConstBit : public BitField<bool, kConstBit, 1> {}; |
| 571 class OptimizableBit : public BitField<bool, kOptimizableBit, 1> {}; | 572 class OptimizableBit : public BitField<bool, kOptimizableBit, 1> {}; |
| 573 class HasFinallyBit : public BitField<bool, kHasFinallyBit, 1> {}; | |
| 572 class NativeBit : public BitField<bool, kNativeBit, 1> {}; | 574 class NativeBit : public BitField<bool, kNativeBit, 1> {}; |
| 573 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; | 575 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; |
| 574 class ExternalBit : public BitField<bool, kExternalBit, 1> {}; | 576 class ExternalBit : public BitField<bool, kExternalBit, 1> {}; |
| 575 class KindBits : public BitField<Kind, kKindTagBit, kKindTagSize> {}; | 577 class KindBits : public BitField<Kind, kKindTagBit, kKindTagSize> {}; |
| 576 | 578 |
| 577 bool IsStatic() const { | 579 bool IsStatic() const { |
| 578 return StaticBit::decode(ptr()->kind_tag_); | 580 return StaticBit::decode(ptr()->kind_tag_); |
| 579 } | 581 } |
| 580 void SetIsStatic(bool value) { | 582 void SetIsStatic(bool value) { |
| 581 uword bits = ptr()->kind_tag_; | 583 uword bits = ptr()->kind_tag_; |
| 582 ptr()->kind_tag_ = StaticBit::update(value, bits); | 584 ptr()->kind_tag_ = StaticBit::update(value, bits); |
| 583 } | 585 } |
| 584 bool IsConst() const { | 586 bool IsConst() const { |
| 585 return ConstBit::decode(ptr()->kind_tag_); | 587 return ConstBit::decode(ptr()->kind_tag_); |
| 586 } | 588 } |
| 587 void SetIsConst(bool value) { | 589 void SetIsConst(bool value) { |
| 588 uword bits = ptr()->kind_tag_; | 590 uword bits = ptr()->kind_tag_; |
| 589 ptr()->kind_tag_ = ConstBit::update(value, bits); | 591 ptr()->kind_tag_ = ConstBit::update(value, bits); |
| 590 } | 592 } |
| 591 bool IsOptimizable() const { | 593 bool IsOptimizable() const { |
| 592 return OptimizableBit::decode(ptr()->kind_tag_); | 594 return OptimizableBit::decode(ptr()->kind_tag_); |
| 593 } | 595 } |
| 594 void SetIsOptimizable(bool value) { | 596 void SetIsOptimizable(bool value) { |
| 595 uword bits = ptr()->kind_tag_; | 597 uword bits = ptr()->kind_tag_; |
| 596 ptr()->kind_tag_ = OptimizableBit::update(value, bits); | 598 ptr()->kind_tag_ = OptimizableBit::update(value, bits); |
| 597 } | 599 } |
| 600 bool HasFinally() const { | |
| 601 return HasFinallyBit::decode(ptr()->kind_tag_); | |
| 602 } | |
| 603 void SetHasFinally(bool value) { | |
| 604 uword bits = ptr()->kind_tag_; | |
| 605 ptr()->kind_tag_ = HasFinallyBit::update(value, bits); | |
| 606 } | |
| 598 bool IsNative() const { | 607 bool IsNative() const { |
| 599 return NativeBit::decode(ptr()->kind_tag_); | 608 return NativeBit::decode(ptr()->kind_tag_); |
| 600 } | 609 } |
| 601 void SetIsNative(bool value) { | 610 void SetIsNative(bool value) { |
| 602 uword bits = ptr()->kind_tag_; | 611 uword bits = ptr()->kind_tag_; |
| 603 ptr()->kind_tag_ = NativeBit::update(value, bits); | 612 ptr()->kind_tag_ = NativeBit::update(value, bits); |
| 604 } | 613 } |
| 605 bool IsAbstract() const { | 614 bool IsAbstract() const { |
| 606 return AbstractBit::decode(ptr()->kind_tag_); | 615 return AbstractBit::decode(ptr()->kind_tag_); |
| 607 } | 616 } |
| 608 void SetIsAbstract(bool value) { | 617 void SetIsAbstract(bool value) { |
| 609 uword bits = ptr()->kind_tag_; | 618 uword bits = ptr()->kind_tag_; |
| 610 ptr()->kind_tag_ = AbstractBit::update(value, bits); | 619 ptr()->kind_tag_ = AbstractBit::update(value, bits); |
| 611 } | 620 } |
| 612 bool IsExternal() const { | 621 bool IsExternal() const { |
| 613 return ExternalBit::decode(ptr()->kind_tag_); | 622 return ExternalBit::decode(ptr()->kind_tag_); |
| 614 } | 623 } |
| 615 void SetIsExternal(bool value) { | 624 void SetIsExternal(bool value) { |
| 616 uword bits = ptr()->kind_tag_; | 625 uword bits = ptr()->kind_tag_; |
| 617 ptr()->kind_tag_ = ExternalBit::update(value, bits); | 626 ptr()->kind_tag_ = ExternalBit::update(value, bits); |
| 618 } | 627 } |
| 619 Kind GetKind() const { | 628 Kind GetKind() const { |
| 620 return KindBits::decode(ptr()->kind_tag_); | 629 return KindBits::decode(ptr()->kind_tag_); |
| 621 } | 630 } |
| 622 void SetKind(Kind value) { | 631 void SetKind(Kind value) { |
|
siva
2012/08/07 19:48:12
Not related to your change but we need an assertio
| |
| 623 uword bits = ptr()->kind_tag_; | 632 uword bits = ptr()->kind_tag_; |
| 624 ptr()->kind_tag_ = KindBits::update(value, bits); | 633 ptr()->kind_tag_ = KindBits::update(value, bits); |
| 625 } | 634 } |
| 626 | 635 |
| 627 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 636 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
| 628 RawString* name_; | 637 RawString* name_; |
| 629 RawClass* owner_; | 638 RawClass* owner_; |
| 630 RawAbstractType* result_type_; | 639 RawAbstractType* result_type_; |
| 631 RawArray* parameter_types_; | 640 RawArray* parameter_types_; |
| 632 RawArray* parameter_names_; | 641 RawArray* parameter_names_; |
| (...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1598 kExternalUint64Array == kByteArray + 18 && | 1607 kExternalUint64Array == kByteArray + 18 && |
| 1599 kExternalFloat32Array == kByteArray + 19 && | 1608 kExternalFloat32Array == kByteArray + 19 && |
| 1600 kExternalFloat64Array == kByteArray + 20 && | 1609 kExternalFloat64Array == kByteArray + 20 && |
| 1601 kClosure == kByteArray + 21); | 1610 kClosure == kByteArray + 21); |
| 1602 return (index >= kByteArray && index <= kClosure); | 1611 return (index >= kByteArray && index <= kClosure); |
| 1603 } | 1612 } |
| 1604 | 1613 |
| 1605 } // namespace dart | 1614 } // namespace dart |
| 1606 | 1615 |
| 1607 #endif // VM_RAW_OBJECT_H_ | 1616 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |