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

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

Issue 1192103004: VM: New calling convention for generated code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: ARM64 port Created 5 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
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/atomic.h" 9 #include "vm/atomic.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 friend class ExternalTypedData; 568 friend class ExternalTypedData;
569 friend class ForwardList; 569 friend class ForwardList;
570 friend class GrowableObjectArray; // StorePointer 570 friend class GrowableObjectArray; // StorePointer
571 friend class Heap; 571 friend class Heap;
572 friend class HeapMapAsJSONVisitor; 572 friend class HeapMapAsJSONVisitor;
573 friend class ClassStatsVisitor; 573 friend class ClassStatsVisitor;
574 friend class MarkingVisitor; 574 friend class MarkingVisitor;
575 friend class Mint; 575 friend class Mint;
576 friend class Object; 576 friend class Object;
577 friend class OneByteString; // StoreSmi 577 friend class OneByteString; // StoreSmi
578 friend class RawCode;
578 friend class RawExternalTypedData; 579 friend class RawExternalTypedData;
579 friend class RawInstructions; 580 friend class RawInstructions;
580 friend class RawInstance; 581 friend class RawInstance;
581 friend class RawTypedData; 582 friend class RawTypedData;
582 friend class Scavenger; 583 friend class Scavenger;
583 friend class ScavengerVisitor; 584 friend class ScavengerVisitor;
584 friend class SizeExcludingClassVisitor; // GetClassId 585 friend class SizeExcludingClassVisitor; // GetClassId
585 friend class RetainingPathVisitor; // GetClassId 586 friend class RetainingPathVisitor; // GetClassId
586 friend class SkippedCodeFunctions; // StorePointer 587 friend class SkippedCodeFunctions; // StorePointer
587 friend class InstructionsReader; // tags_ check 588 friend class InstructionsReader; // tags_ check
588 friend class SnapshotReader; 589 friend class SnapshotReader;
589 friend class SnapshotWriter; 590 friend class SnapshotWriter;
590 friend class String; 591 friend class String;
591 friend class TypedData; 592 friend class TypedData;
592 friend class TypedDataView; 593 friend class TypedDataView;
593 friend class WeakProperty; // StorePointer 594 friend class WeakProperty; // StorePointer
594 friend class Instance; // StorePointer 595 friend class Instance; // StorePointer
596 friend class StackFrame; // GetCodeObject assertion.
595 597
596 DISALLOW_ALLOCATION(); 598 DISALLOW_ALLOCATION();
597 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); 599 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject);
598 }; 600 };
599 601
600 602
601 class RawClass : public RawObject { 603 class RawClass : public RawObject {
602 public: 604 public:
603 enum ClassFinalizedState { 605 enum ClassFinalizedState {
604 kAllocated = 0, // Initial state. 606 kAllocated = 0, // Initial state.
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 RawArray* parameter_names_; 763 RawArray* parameter_names_;
762 RawObject* data_; // Additional data specific to the function kind. 764 RawObject* data_; // Additional data specific to the function kind.
763 RawObject** to_snapshot() { 765 RawObject** to_snapshot() {
764 return reinterpret_cast<RawObject**>(&ptr()->data_); 766 return reinterpret_cast<RawObject**>(&ptr()->data_);
765 } 767 }
766 // Fields below are not part of the snapshot. 768 // Fields below are not part of the snapshot.
767 RawArray* ic_data_array_; // ICData of unoptimized code. 769 RawArray* ic_data_array_; // ICData of unoptimized code.
768 RawObject** to_no_code() { 770 RawObject** to_no_code() {
769 return reinterpret_cast<RawObject**>(&ptr()->ic_data_array_); 771 return reinterpret_cast<RawObject**>(&ptr()->ic_data_array_);
770 } 772 }
771 RawInstructions* instructions_; // Instructions of currently active code. 773 RawCode* code_; // Currently active code.
772 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. 774 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization.
773 RawObject** to() { 775 RawObject** to() {
774 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_); 776 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_);
775 } 777 }
776 uword entry_point_; 778 uword entry_point_;
777 779
778 int32_t token_pos_; 780 int32_t token_pos_;
779 int32_t end_token_pos_; 781 int32_t end_token_pos_;
780 int32_t usage_counter_; // Incremented while function is running. 782 int32_t usage_counter_; // Incremented while function is running.
781 int16_t num_fixed_parameters_; 783 int16_t num_fixed_parameters_;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 class RawCode : public RawObject { 993 class RawCode : public RawObject {
992 enum InlinedMetadataIndex { 994 enum InlinedMetadataIndex {
993 kInlinedIntervalsIndex = 0, 995 kInlinedIntervalsIndex = 0,
994 kInlinedIdToFunctionIndex = 1, 996 kInlinedIdToFunctionIndex = 1,
995 kInlinedCallerIdMapIndex = 2, 997 kInlinedCallerIdMapIndex = 2,
996 kInlinedMetadataSize = 3, 998 kInlinedMetadataSize = 3,
997 }; 999 };
998 1000
999 RAW_HEAP_OBJECT_IMPLEMENTATION(Code); 1001 RAW_HEAP_OBJECT_IMPLEMENTATION(Code);
1000 1002
1003 uword entry_point_;
1004
1001 RawObject** from() { 1005 RawObject** from() {
1002 return reinterpret_cast<RawObject**>(&ptr()->instructions_); 1006 return reinterpret_cast<RawObject**>(&ptr()->active_instructions_);
1003 } 1007 }
1008 RawInstructions* active_instructions_;
1004 RawInstructions* instructions_; 1009 RawInstructions* instructions_;
1010 RawObjectPool* object_pool_;
1005 // If owner_ is Function::null() the owner is a regular stub. 1011 // If owner_ is Function::null() the owner is a regular stub.
1006 // If owner_ is a Class the owner is the allocation stub for that class. 1012 // If owner_ is a Class the owner is the allocation stub for that class.
1007 // Else, owner_ is a regular Dart Function. 1013 // Else, owner_ is a regular Dart Function.
1008 RawObject* owner_; // Function, Null, or a Class. 1014 RawObject* owner_; // Function, Null, or a Class.
1009 RawExceptionHandlers* exception_handlers_; 1015 RawExceptionHandlers* exception_handlers_;
1010 RawPcDescriptors* pc_descriptors_; 1016 RawPcDescriptors* pc_descriptors_;
1011 RawArray* deopt_info_array_; 1017 RawArray* deopt_info_array_;
1012 RawArray* static_calls_target_table_; // (code-offset, function, code). 1018 RawArray* static_calls_target_table_; // (code-offset, function, code).
1013 RawArray* stackmaps_; 1019 RawArray* stackmaps_;
1014 RawLocalVarDescriptors* var_descriptors_; 1020 RawLocalVarDescriptors* var_descriptors_;
1015 RawArray* inlined_metadata_; 1021 RawArray* inlined_metadata_;
1016 RawArray* comments_; 1022 RawArray* comments_;
1017 // If return_address_metadata_ is a Smi, it is the offset to the prologue. 1023 // If return_address_metadata_ is a Smi, it is the offset to the prologue.
1018 // Else, return_address_metadata_ is null. 1024 // Else, return_address_metadata_ is null.
1019 RawObject* return_address_metadata_; 1025 RawObject* return_address_metadata_;
1020 RawObject** to() { 1026 RawObject** to() {
1021 return reinterpret_cast<RawObject**>(&ptr()->return_address_metadata_); 1027 return reinterpret_cast<RawObject**>(&ptr()->return_address_metadata_);
1022 } 1028 }
1023 uword entry_point_;
1024 1029
1025 // Compilation timestamp. 1030 // Compilation timestamp.
1026 int64_t compile_timestamp_; 1031 int64_t compile_timestamp_;
1027 1032
1028 // state_bits_ is a bitfield with three fields: 1033 // state_bits_ is a bitfield with three fields:
1029 // The optimized bit, the alive bit, and a count of the number of pointer 1034 // The optimized bit, the alive bit, and a count of the number of pointer
1030 // offsets. 1035 // offsets.
1031 // Alive: If true, the embedded object pointers will be visited during GC. 1036 // Alive: If true, the embedded object pointers will be visited during GC.
1032 int32_t state_bits_; 1037 int32_t state_bits_;
1033 1038
1034 // PC offsets for code patching. 1039 // PC offsets for code patching.
1035 int32_t entry_patch_pc_offset_;
1036 int32_t patch_code_pc_offset_;
1037 int32_t lazy_deopt_pc_offset_; 1040 int32_t lazy_deopt_pc_offset_;
1038 1041
1039 // Variable length data follows here. 1042 // Variable length data follows here.
1040 int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); } 1043 int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); }
1041 const int32_t* data() const { OPEN_ARRAY_START(int32_t, int32_t); } 1044 const int32_t* data() const { OPEN_ARRAY_START(int32_t, int32_t); }
1042 1045
1046 static bool ContainsPC(RawObject* raw_obj, uword pc);
1047
1043 friend class Function; 1048 friend class Function;
1044 friend class MarkingVisitor; 1049 friend class MarkingVisitor;
1045 friend class SkippedCodeFunctions; 1050 friend class SkippedCodeFunctions;
1046 friend class StackFrame; 1051 friend class StackFrame;
1047 }; 1052 };
1048 1053
1049 1054
1050 class RawObjectPool : public RawObject { 1055 class RawObjectPool : public RawObject {
1051 RAW_HEAP_OBJECT_IMPLEMENTATION(ObjectPool); 1056 RAW_HEAP_OBJECT_IMPLEMENTATION(ObjectPool);
1052 1057
(...skipping 12 matching lines...) Expand all
1065 Entry* first_entry() { return &ptr()->data()[0]; } 1070 Entry* first_entry() { return &ptr()->data()[0]; }
1066 1071
1067 friend class Object; 1072 friend class Object;
1068 friend class SnapshotReader; 1073 friend class SnapshotReader;
1069 }; 1074 };
1070 1075
1071 1076
1072 class RawInstructions : public RawObject { 1077 class RawInstructions : public RawObject {
1073 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); 1078 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions);
1074 1079
1075 RawObject** from() {
1076 return reinterpret_cast<RawObject**>(&ptr()->code_);
1077 }
1078 RawCode* code_;
1079 RawObjectPool* object_pool_;
1080 RawObject** to() {
1081 return reinterpret_cast<RawObject**>(&ptr()->object_pool_);
1082 }
1083 int32_t size_; 1080 int32_t size_;
1084 1081
1085 // Variable length data follows here. 1082 // Variable length data follows here.
1086 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } 1083 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
1087 1084
1088 // Private helper function used while visiting stack frames. The 1085 // Private helper function used while visiting stack frames. The
1089 // code which iterates over dart frames is also called during GC and 1086 // code which iterates over dart frames is also called during GC and
1090 // is not allowed to create handles. 1087 // is not allowed to create handles.
1091 static bool ContainsPC(RawObject* raw_obj, uword pc); 1088 static bool ContainsPC(RawInstructions* raw_instr, uword pc);
1092 1089
1093 friend class RawCode; 1090 friend class RawCode;
1094 friend class RawFunction; 1091 friend class RawFunction;
1095 friend class Code; 1092 friend class Code;
1096 friend class StackFrame; 1093 friend class StackFrame;
1097 friend class MarkingVisitor; 1094 friend class MarkingVisitor;
1098 friend class SkippedCodeFunctions; 1095 friend class SkippedCodeFunctions;
1099 friend class Function; 1096 friend class Function;
1100 friend class InstructionsReader; 1097 friend class InstructionsReader;
1101 }; 1098 };
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2224 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2221 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2225 kTypedDataInt8ArrayViewCid + 15); 2222 kTypedDataInt8ArrayViewCid + 15);
2226 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2223 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2227 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2224 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2228 return (kNullCid - kTypedDataInt8ArrayCid); 2225 return (kNullCid - kTypedDataInt8ArrayCid);
2229 } 2226 }
2230 2227
2231 } // namespace dart 2228 } // namespace dart
2232 2229
2233 #endif // VM_RAW_OBJECT_H_ 2230 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.cc » ('j') | runtime/vm/stack_frame.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698