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

Side by Side Diff: runtime/vm/raw_object.h

Issue 311963002: In class Function replace current code field with current instruction field, that way we save one l… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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
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"
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 static bool SkipCode(RawFunction* raw_fun); 605 static bool SkipCode(RawFunction* raw_fun);
606 606
607 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 607 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
608 RawString* name_; 608 RawString* name_;
609 RawObject* owner_; // Class or patch class or mixin class 609 RawObject* owner_; // Class or patch class or mixin class
610 // where this function is defined. 610 // where this function is defined.
611 RawAbstractType* result_type_; 611 RawAbstractType* result_type_;
612 RawArray* parameter_types_; 612 RawArray* parameter_types_;
613 RawArray* parameter_names_; 613 RawArray* parameter_names_;
614 RawObject* data_; // Additional data specific to the function kind. 614 RawObject* data_; // Additional data specific to the function kind.
615 RawCode* code_; // Compiled code for the function. 615 RawInstructions* instructions_; // Instructions of currently active code.
616 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. 616 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization.
617 RawObject** to() { 617 RawObject** to() {
618 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_); 618 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_);
619 } 619 }
620 RawObject** to_no_code() { 620 RawObject** to_no_code() {
621 return reinterpret_cast<RawObject**>(&ptr()->data_); 621 return reinterpret_cast<RawObject**>(&ptr()->data_);
622 } 622 }
623 623
624 intptr_t token_pos_; 624 intptr_t token_pos_;
625 intptr_t end_token_pos_; 625 intptr_t end_token_pos_;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 intptr_t pointer_offsets_length_; 837 intptr_t pointer_offsets_length_;
838 // Alive: If true, the embedded object pointers will be visited during GC. 838 // Alive: If true, the embedded object pointers will be visited during GC.
839 // This field cannot be shorter because of alignment issues on x64 839 // This field cannot be shorter because of alignment issues on x64
840 // architectures. 840 // architectures.
841 intptr_t state_bits_; // state, is_optimized, is_alive. 841 intptr_t state_bits_; // state, is_optimized, is_alive.
842 842
843 // Variable length data follows here. 843 // Variable length data follows here.
844 int32_t data_[0]; 844 int32_t data_[0];
845 845
846 friend class StackFrame; 846 friend class StackFrame;
847 friend class MarkingVisitor;
848 friend class Function;
847 }; 849 };
848 850
849 851
850 class RawInstructions : public RawObject { 852 class RawInstructions : public RawObject {
851 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); 853 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions);
852 854
853 RawObject** from() { 855 RawObject** from() {
854 return reinterpret_cast<RawObject**>(&ptr()->code_); 856 return reinterpret_cast<RawObject**>(&ptr()->code_);
855 } 857 }
856 RawCode* code_; 858 RawCode* code_;
857 RawArray* object_pool_; 859 RawArray* object_pool_;
858 RawObject** to() { 860 RawObject** to() {
859 return reinterpret_cast<RawObject**>(&ptr()->object_pool_); 861 return reinterpret_cast<RawObject**>(&ptr()->object_pool_);
860 } 862 }
861 intptr_t size_; 863 intptr_t size_;
862 864
863 // Variable length data follows here. 865 // Variable length data follows here.
864 uint8_t data_[0]; 866 uint8_t data_[0];
865 867
866 // Private helper function used while visiting stack frames. The 868 // Private helper function used while visiting stack frames. The
867 // code which iterates over dart frames is also called during GC and 869 // code which iterates over dart frames is also called during GC and
868 // is not allowed to create handles. 870 // is not allowed to create handles.
869 static bool ContainsPC(RawObject* raw_obj, uword pc); 871 static bool ContainsPC(RawObject* raw_obj, uword pc);
870 872
871 friend class RawCode; 873 friend class RawCode;
872 friend class Code; 874 friend class Code;
873 friend class StackFrame; 875 friend class StackFrame;
876 friend class MarkingVisitor;
877 friend class Function;
874 }; 878 };
875 879
876 880
877 class RawPcDescriptors : public RawObject { 881 class RawPcDescriptors : public RawObject {
878 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors); 882 RAW_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors);
879 883
880 intptr_t length_; // Number of descriptors. 884 intptr_t length_; // Number of descriptors.
881 885
882 // Variable length data follows here. 886 // Variable length data follows here.
883 intptr_t data_[0]; 887 intptr_t data_[0];
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); 1849 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14);
1846 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 1850 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
1847 kTypedDataInt8ArrayViewCid + 15); 1851 kTypedDataInt8ArrayViewCid + 15);
1848 COMPILE_ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14); 1852 COMPILE_ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14);
1849 return (kNullCid - kTypedDataInt8ArrayCid); 1853 return (kNullCid - kTypedDataInt8ArrayCid);
1850 } 1854 }
1851 1855
1852 } // namespace dart 1856 } // namespace dart
1853 1857
1854 #endif // VM_RAW_OBJECT_H_ 1858 #endif // VM_RAW_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698