Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: vm/raw_object.h

Issue 10917222: Move all the closure related fields in RawFunction into a new class (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/object.cc ('k') | vm/raw_object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "vm/snapshot.h" 11 #include "vm/snapshot.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 // Macrobatics to define the Object hierarchy of VM implementation classes. 15 // Macrobatics to define the Object hierarchy of VM implementation classes.
16 #define CLASS_LIST_NO_OBJECT(V) \ 16 #define CLASS_LIST_NO_OBJECT(V) \
17 V(Class) \ 17 V(Class) \
18 V(UnresolvedClass) \ 18 V(UnresolvedClass) \
19 V(AbstractType) \ 19 V(AbstractType) \
20 V(Type) \ 20 V(Type) \
21 V(TypeParameter) \ 21 V(TypeParameter) \
22 V(AbstractTypeArguments) \ 22 V(AbstractTypeArguments) \
23 V(TypeArguments) \ 23 V(TypeArguments) \
24 V(InstantiatedTypeArguments) \ 24 V(InstantiatedTypeArguments) \
25 V(PatchClass) \ 25 V(PatchClass) \
26 V(Function) \ 26 V(Function) \
27 V(ClosureData) \
27 V(Field) \ 28 V(Field) \
28 V(LiteralToken) \ 29 V(LiteralToken) \
29 V(TokenStream) \ 30 V(TokenStream) \
30 V(Script) \ 31 V(Script) \
31 V(Library) \ 32 V(Library) \
32 V(LibraryPrefix) \ 33 V(LibraryPrefix) \
33 V(Code) \ 34 V(Code) \
34 V(Instructions) \ 35 V(Instructions) \
35 V(PcDescriptors) \ 36 V(PcDescriptors) \
36 V(Stackmap) \ 37 V(Stackmap) \
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); 595 RAW_HEAP_OBJECT_IMPLEMENTATION(Function);
595 596
596 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 597 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
597 RawString* name_; 598 RawString* name_;
598 RawObject* owner_; // Class or patch class where this function was defined. 599 RawObject* owner_; // Class or patch class where this function was defined.
599 RawAbstractType* result_type_; 600 RawAbstractType* result_type_;
600 RawArray* parameter_types_; 601 RawArray* parameter_types_;
601 RawArray* parameter_names_; 602 RawArray* parameter_names_;
602 RawCode* code_; // Compiled code for the function. 603 RawCode* code_; // Compiled code for the function.
603 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. 604 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization.
604 RawContextScope* context_scope_; 605 RawObject* data_; // Additional data specific to the function kind.
605 RawFunction* parent_function_; // Enclosing function of this local function.
606 RawClass* signature_class_; // Only for closure or signature function.
607 RawCode* closure_allocation_stub_; // Stub code for allocation of closures.
608 RawFunction* implicit_closure_function_; // Implicit closure function.
609 RawObject** to() { 606 RawObject** to() {
610 return reinterpret_cast<RawObject**>(&ptr()->implicit_closure_function_); 607 return reinterpret_cast<RawObject**>(&ptr()->data_);
611 } 608 }
612 609
613 intptr_t token_pos_; 610 intptr_t token_pos_;
614 intptr_t end_token_pos_; 611 intptr_t end_token_pos_;
615 intptr_t num_fixed_parameters_; 612 intptr_t num_fixed_parameters_;
616 intptr_t num_optional_positional_parameters_; 613 intptr_t num_optional_positional_parameters_;
617 intptr_t num_optional_named_parameters_; 614 intptr_t num_optional_named_parameters_;
618 intptr_t usage_counter_; // Incremented while function is running. 615 intptr_t usage_counter_; // Incremented while function is running.
619 uint16_t deoptimization_counter_; 616 uint16_t deoptimization_counter_;
620 uint16_t kind_tag_; 617 uint16_t kind_tag_;
621 }; 618 };
622 619
623 620
621 class RawClosureData : public RawObject {
622 private:
623 RAW_HEAP_OBJECT_IMPLEMENTATION(ClosureData);
624
625 RawObject** from() {
626 return reinterpret_cast<RawObject**>(&ptr()->context_scope_);
627 }
628 RawContextScope* context_scope_;
629 RawFunction* parent_function_; // Enclosing function of this local function.
630 RawClass* signature_class_;
631 RawCode* closure_allocation_stub_; // Stub code for allocation of closures.
632 RawObject** to() {
633 return reinterpret_cast<RawObject**>(&ptr()->closure_allocation_stub_);
634 }
635 };
636
637
624 class RawField : public RawObject { 638 class RawField : public RawObject {
625 RAW_HEAP_OBJECT_IMPLEMENTATION(Field); 639 RAW_HEAP_OBJECT_IMPLEMENTATION(Field);
626 640
627 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 641 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
628 RawString* name_; 642 RawString* name_;
629 RawClass* owner_; 643 RawClass* owner_;
630 RawAbstractType* type_; 644 RawAbstractType* type_;
631 RawInstance* value_; // Offset for instance and value for static fields. 645 RawInstance* value_; // Offset for instance and value for static fields.
632 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } 646 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); }
633 647
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 kExternalUint64ArrayCid == kByteArrayCid + 18 && 1605 kExternalUint64ArrayCid == kByteArrayCid + 18 &&
1592 kExternalFloat32ArrayCid == kByteArrayCid + 19 && 1606 kExternalFloat32ArrayCid == kByteArrayCid + 19 &&
1593 kExternalFloat64ArrayCid == kByteArrayCid + 20 && 1607 kExternalFloat64ArrayCid == kByteArrayCid + 20 &&
1594 kStacktraceCid == kByteArrayCid + 21); 1608 kStacktraceCid == kByteArrayCid + 21);
1595 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid); 1609 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid);
1596 } 1610 }
1597 1611
1598 } // namespace dart 1612 } // namespace dart
1599 1613
1600 #endif // VM_RAW_OBJECT_H_ 1614 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « vm/object.cc ('k') | vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698