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