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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 enum Kind { | 532 enum Kind { |
533 kRegularFunction, | 533 kRegularFunction, |
534 kClosureFunction, | 534 kClosureFunction, |
535 kSignatureFunction, // represents a signature only without actual code. | 535 kSignatureFunction, // represents a signature only without actual code. |
536 kGetterFunction, // represents getter functions e.g: get foo() { .. }. | 536 kGetterFunction, // represents getter functions e.g: get foo() { .. }. |
537 kSetterFunction, // represents setter functions e.g: set foo(..) { .. }. | 537 kSetterFunction, // represents setter functions e.g: set foo(..) { .. }. |
538 kConstructor, | 538 kConstructor, |
539 kImplicitGetter, // represents an implicit getter for fields. | 539 kImplicitGetter, // represents an implicit getter for fields. |
540 kImplicitSetter, // represents an implicit setter for fields. | 540 kImplicitSetter, // represents an implicit setter for fields. |
541 kConstImplicitGetter, // represents an implicit const getter for fields. | 541 kConstImplicitGetter, // represents an implicit const getter for fields. |
| 542 kMethodExtractor, // converts method into implicit closure on the receiver. |
542 }; | 543 }; |
543 | 544 |
544 private: | 545 private: |
545 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); | 546 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); |
546 | 547 |
547 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 548 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
548 RawString* name_; | 549 RawString* name_; |
549 RawObject* owner_; // Class or patch class where this function was defined. | 550 RawObject* owner_; // Class or patch class where this function was defined. |
550 RawAbstractType* result_type_; | 551 RawAbstractType* result_type_; |
551 RawArray* parameter_types_; | 552 RawArray* parameter_types_; |
(...skipping 24 matching lines...) Expand all Loading... |
576 RawObject** from() { | 577 RawObject** from() { |
577 return reinterpret_cast<RawObject**>(&ptr()->context_scope_); | 578 return reinterpret_cast<RawObject**>(&ptr()->context_scope_); |
578 } | 579 } |
579 RawContextScope* context_scope_; | 580 RawContextScope* context_scope_; |
580 RawFunction* parent_function_; // Enclosing function of this local function. | 581 RawFunction* parent_function_; // Enclosing function of this local function. |
581 RawClass* signature_class_; | 582 RawClass* signature_class_; |
582 union { | 583 union { |
583 RawInstance* closure_; // Closure object for static implicit closures. | 584 RawInstance* closure_; // Closure object for static implicit closures. |
584 RawCode* closure_allocation_stub_; // Stub code for allocation of closures. | 585 RawCode* closure_allocation_stub_; // Stub code for allocation of closures. |
585 }; | 586 }; |
| 587 RawFunction* method_extractor_; // Stub code for method extraction. |
586 RawObject** to() { | 588 RawObject** to() { |
587 return reinterpret_cast<RawObject**>(&ptr()->closure_allocation_stub_); | 589 return reinterpret_cast<RawObject**>(&ptr()->method_extractor_); |
588 } | 590 } |
589 }; | 591 }; |
590 | 592 |
591 | 593 |
592 class RawRedirectionData : public RawObject { | 594 class RawRedirectionData : public RawObject { |
593 private: | 595 private: |
594 RAW_HEAP_OBJECT_IMPLEMENTATION(RedirectionData); | 596 RAW_HEAP_OBJECT_IMPLEMENTATION(RedirectionData); |
595 | 597 |
596 RawObject** from() { | 598 RawObject** from() { |
597 return reinterpret_cast<RawObject**>(&ptr()->type_); | 599 return reinterpret_cast<RawObject**>(&ptr()->type_); |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 8 && | 1687 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 8 && |
1686 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 9 && | 1688 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 9 && |
1687 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 10 && | 1689 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 10 && |
1688 kStacktraceCid == kExternalInt8ArrayCid + 11); | 1690 kStacktraceCid == kExternalInt8ArrayCid + 11); |
1689 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); | 1691 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); |
1690 } | 1692 } |
1691 | 1693 |
1692 } // namespace dart | 1694 } // namespace dart |
1693 | 1695 |
1694 #endif // VM_RAW_OBJECT_H_ | 1696 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |