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

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

Issue 15110003: Make deoptimization architecture dependent (it depends on the frame layout). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | « runtime/vm/code_generator.cc ('k') | runtime/vm/deopt_instructions.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_DEOPT_INSTRUCTIONS_H_ 5 #ifndef VM_DEOPT_INSTRUCTIONS_H_
6 #define VM_DEOPT_INSTRUCTIONS_H_ 6 #define VM_DEOPT_INSTRUCTIONS_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/code_generator.h" 10 #include "vm/code_generator.h"
11 #include "vm/growable_array.h" 11 #include "vm/growable_array.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 class Location; 16 class Location;
17 class Value; 17 class Value;
18 class MaterializeObjectInstr; 18 class MaterializeObjectInstr;
19 19
20 // Holds all data relevant for execution of deoptimization instructions. 20 // Holds all data relevant for execution of deoptimization instructions.
21 class DeoptimizationContext : public ValueObject { 21 class DeoptimizationContext : public ValueObject {
22 public: 22 public:
23 // 'to_frame_start' points to the return address just below the frame's 23 // 'to_frame_start' points to the fixed size portion of the frame under sp.
24 // stack pointer (kPcAddressOffsetFromSp). 'num_args' is 0 if there are no 24 // 'num_args' is 0 if there are no arguments or if there are optional
25 // arguments or if there are optional arguments. 25 // arguments.
26 DeoptimizationContext(intptr_t* to_frame_start, 26 DeoptimizationContext(intptr_t* to_frame_start,
27 intptr_t to_frame_size, 27 intptr_t to_frame_size,
28 const Array& object_table, 28 const Array& object_table,
29 intptr_t num_args, 29 intptr_t num_args,
30 DeoptReasonId deopt_reason); 30 DeoptReasonId deopt_reason);
31 31
32 intptr_t* GetFromFrameAddressAt(intptr_t index) const { 32 intptr_t* GetFromFrameAddressAt(intptr_t index) const {
33 ASSERT((0 <= index) && (index < from_frame_size_)); 33 ASSERT((0 <= index) && (index < from_frame_size_));
34 return &from_frame_[index]; 34 return &from_frame_[index];
35 } 35 }
36 36
37 intptr_t* GetToFrameAddressAt(intptr_t index) const { 37 intptr_t* GetToFrameAddressAt(intptr_t index) const {
38 ASSERT((0 <= index) && (index < to_frame_size_)); 38 ASSERT((0 <= index) && (index < to_frame_size_));
39 return &to_frame_[index]; 39 return &to_frame_[index];
40 } 40 }
41 41
42 intptr_t GetFromFp() const; 42 intptr_t GetFromFp() const;
43 intptr_t GetFromPp() const;
43 intptr_t GetFromPc() const; 44 intptr_t GetFromPc() const;
44 45
45 intptr_t GetCallerFp() const; 46 intptr_t GetCallerFp() const;
46 void SetCallerFp(intptr_t callers_fp); 47 void SetCallerFp(intptr_t callers_fp);
47 48
48 RawObject* ObjectAt(intptr_t index) const { 49 RawObject* ObjectAt(intptr_t index) const {
49 return object_table_.At(index); 50 return object_table_.At(index);
50 } 51 }
51 52
52 intptr_t RegisterValue(Register reg) const { 53 intptr_t RegisterValue(Register reg) const {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 kFpuRegister, 103 kFpuRegister,
103 kInt64FpuRegister, 104 kInt64FpuRegister,
104 kFloat32x4FpuRegister, 105 kFloat32x4FpuRegister,
105 kUint32x4FpuRegister, 106 kUint32x4FpuRegister,
106 kStackSlot, 107 kStackSlot,
107 kDoubleStackSlot, 108 kDoubleStackSlot,
108 kInt64StackSlot, 109 kInt64StackSlot,
109 kFloat32x4StackSlot, 110 kFloat32x4StackSlot,
110 kUint32x4StackSlot, 111 kUint32x4StackSlot,
111 kPcMarker, 112 kPcMarker,
113 kPp,
112 kCallerFp, 114 kCallerFp,
115 kCallerPp,
113 kCallerPc, 116 kCallerPc,
114 kSuffix, 117 kSuffix,
115 kMaterializedObjectRef, 118 kMaterializedObjectRef,
116 kMaterializeObject 119 kMaterializeObject
117 }; 120 };
118 121
119 static DeoptInstr* Create(intptr_t kind_as_int, intptr_t from_index); 122 static DeoptInstr* Create(intptr_t kind_as_int, intptr_t from_index);
120 123
121 DeoptInstr() {} 124 DeoptInstr() {}
122 virtual ~DeoptInstr() {} 125 virtual ~DeoptInstr() {}
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 const GrowableObjectArray& object_table() { return object_table_; } 176 const GrowableObjectArray& object_table() { return object_table_; }
174 177
175 // Return address before instruction. 178 // Return address before instruction.
176 void AddReturnAddress(const Function& function, 179 void AddReturnAddress(const Function& function,
177 intptr_t deopt_id, 180 intptr_t deopt_id,
178 intptr_t to_index); 181 intptr_t to_index);
179 182
180 // Copy from optimized frame to unoptimized. 183 // Copy from optimized frame to unoptimized.
181 void AddCopy(Value* value, const Location& from_loc, intptr_t to_index); 184 void AddCopy(Value* value, const Location& from_loc, intptr_t to_index);
182 void AddPcMarker(const Function& function, intptr_t to_index); 185 void AddPcMarker(const Function& function, intptr_t to_index);
186 void AddPp(const Function& function, intptr_t to_index);
183 void AddCallerFp(intptr_t to_index); 187 void AddCallerFp(intptr_t to_index);
188 void AddCallerPp(intptr_t to_index);
184 void AddCallerPc(intptr_t to_index); 189 void AddCallerPc(intptr_t to_index);
185 190
186 // Add object to be materialized. Emit kMaterializeObject instruction. 191 // Add object to be materialized. Emit kMaterializeObject instruction.
187 void AddMaterialization(MaterializeObjectInstr* mat); 192 void AddMaterialization(MaterializeObjectInstr* mat);
188 193
189 // For every materialized object emit instructions describing data required 194 // For every materialized object emit instructions describing data required
190 // for materialization: class of the instance to allocate and field-value 195 // for materialization: class of the instance to allocate and field-value
191 // pairs for initialization. 196 // pairs for initialization.
192 // Emitted instructions are expected to follow return-address slot emitted 197 // Emitted instructions are expected to follow fixed size section of frame
193 // first. This way they become a part of the bottom-most deoptimized frame 198 // emitted first. This way they become a part of the bottom-most deoptimized
194 // and are discoverable by GC. 199 // frame and are discoverable by GC.
195 // At deoptimization they will be removed by the stub at the very end: 200 // At deoptimization they will be removed by the stub at the very end:
196 // after they were used to materialize objects. 201 // after they were used to materialize objects.
197 // Returns the index of the next stack slot. Used for verification. 202 // Returns the index of the next stack slot. Used for verification.
198 intptr_t EmitMaterializationArguments(); 203 intptr_t EmitMaterializationArguments(intptr_t to_index);
199 204
200 RawDeoptInfo* CreateDeoptInfo(); 205 RawDeoptInfo* CreateDeoptInfo();
201 206
202 // Mark the actual start of the frame description after all materialization 207 // Mark the actual start of the frame description after all materialization
203 // instructions were emitted. Used for verification purposes. 208 // instructions were emitted. Used for verification purposes.
204 void MarkFrameStart() { 209 void MarkFrameStart() {
205 ASSERT(frame_start_ == -1); 210 ASSERT(frame_start_ == -1);
206 frame_start_ = instructions_.length(); 211 frame_start_ = instructions_.length();
207 } 212 }
208 213
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 DeoptInfo* info, 266 DeoptInfo* info,
262 Smi* reason); 267 Smi* reason);
263 268
264 private: 269 private:
265 static const intptr_t kEntrySize = 3; 270 static const intptr_t kEntrySize = 3;
266 }; 271 };
267 272
268 } // namespace dart 273 } // namespace dart
269 274
270 #endif // VM_DEOPT_INSTRUCTIONS_H_ 275 #endif // VM_DEOPT_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/deopt_instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698