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

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

Issue 12457034: Ensure that all goto instructions have deoptimization target. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Delete UNREACHABLE Created 7 years, 8 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 | « no previous file | 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"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 }; 88 };
89 89
90 90
91 91
92 // Represents one deopt instruction, e.g, setup return address, store object, 92 // Represents one deopt instruction, e.g, setup return address, store object,
93 // store register, etc. The target is defined by instruction's position in 93 // store register, etc. The target is defined by instruction's position in
94 // the deopt-info array. 94 // the deopt-info array.
95 class DeoptInstr : public ZoneAllocated { 95 class DeoptInstr : public ZoneAllocated {
96 public: 96 public:
97 enum Kind { 97 enum Kind {
98 kRetAfterAddress, 98 kRetAddress,
99 kRetBeforeAddress,
100 kConstant, 99 kConstant,
101 kRegister, 100 kRegister,
102 kFpuRegister, 101 kFpuRegister,
103 kInt64FpuRegister, 102 kInt64FpuRegister,
104 kFloat32x4FpuRegister, 103 kFloat32x4FpuRegister,
105 kUint32x4FpuRegister, 104 kUint32x4FpuRegister,
106 kStackSlot, 105 kStackSlot,
107 kDoubleStackSlot, 106 kDoubleStackSlot,
108 kInt64StackSlot, 107 kInt64StackSlot,
109 kFloat32x4StackSlot, 108 kFloat32x4StackSlot,
(...skipping 19 matching lines...) Expand all
129 bool Equals(const DeoptInstr& other) const { 128 bool Equals(const DeoptInstr& other) const {
130 return (kind() == other.kind()) && (from_index() == other.from_index()); 129 return (kind() == other.kind()) && (from_index() == other.from_index());
131 } 130 }
132 131
133 // Decode the payload of a suffix command. Return the suffix length and 132 // Decode the payload of a suffix command. Return the suffix length and
134 // set the output parameter info_number to the index of the shared suffix. 133 // set the output parameter info_number to the index of the shared suffix.
135 static intptr_t DecodeSuffix(intptr_t from_index, intptr_t* info_number); 134 static intptr_t DecodeSuffix(intptr_t from_index, intptr_t* info_number);
136 135
137 // Get the function and return address which is encoded in this 136 // Get the function and return address which is encoded in this
138 // kRetAfterAddress deopt instruction. 137 // kRetAfterAddress deopt instruction.
139 static uword GetRetAfterAddress(DeoptInstr* instr, 138 static uword GetRetAddress(DeoptInstr* instr,
140 const Array& object_table, 139 const Array& object_table,
141 Function* func); 140 Function* func);
142 141
143 protected: 142 protected:
144 virtual intptr_t from_index() const = 0; 143 virtual intptr_t from_index() const = 0;
145 144
146 friend class DeoptInfoBuilder; 145 friend class DeoptInfoBuilder;
147 146
148 private: 147 private:
149 DISALLOW_COPY_AND_ASSIGN(DeoptInstr); 148 DISALLOW_COPY_AND_ASSIGN(DeoptInstr);
150 }; 149 };
151 150
152 151
153 // Builds a deoptimization info table, one DeoptInfo at a time. Call AddXXX 152 // Builds a deoptimization info table, one DeoptInfo at a time. Call AddXXX
154 // methods in the order of their target, starting wih deoptimized code 153 // methods in the order of their target, starting wih deoptimized code
155 // continuation pc and ending with the first argument of the deoptimized 154 // continuation pc and ending with the first argument of the deoptimized
156 // code. Call CreateDeoptInfo to write the accumulated instructions into 155 // code. Call CreateDeoptInfo to write the accumulated instructions into
157 // the heap and reset the builder's internal state for the next DeoptInfo. 156 // the heap and reset the builder's internal state for the next DeoptInfo.
158 class DeoptInfoBuilder : public ValueObject { 157 class DeoptInfoBuilder : public ValueObject {
159 public: 158 public:
160 explicit DeoptInfoBuilder(const intptr_t num_args); 159 explicit DeoptInfoBuilder(const intptr_t num_args);
161 160
162 // 'object_table' holds all objects referred to by DeoptInstr in 161 // 'object_table' holds all objects referred to by DeoptInstr in
163 // all DeoptInfo instances for a single Code object. 162 // all DeoptInfo instances for a single Code object.
164 const GrowableObjectArray& object_table() { return object_table_; } 163 const GrowableObjectArray& object_table() { return object_table_; }
165 164
166 // Return address before instruction. 165 // Return address before instruction.
167 void AddReturnAddressBefore(const Function& function, 166 void AddReturnAddress(const Function& function,
168 intptr_t deopt_id, 167 intptr_t deopt_id,
169 intptr_t to_index); 168 intptr_t to_index);
170
171 // Return address after instruction.
172 void AddReturnAddressAfter(const Function& function,
173 intptr_t deopt_id,
174 intptr_t to_index);
175 169
176 // Copy from optimized frame to unoptimized. 170 // Copy from optimized frame to unoptimized.
177 void AddCopy(const Location& from_loc, intptr_t to_index); 171 void AddCopy(const Location& from_loc, intptr_t to_index);
178 void AddPcMarker(const Function& function, intptr_t to_index); 172 void AddPcMarker(const Function& function, intptr_t to_index);
179 void AddCallerFp(intptr_t to_index); 173 void AddCallerFp(intptr_t to_index);
180 void AddCallerPc(intptr_t to_index); 174 void AddCallerPc(intptr_t to_index);
181 175
182 RawDeoptInfo* CreateDeoptInfo(); 176 RawDeoptInfo* CreateDeoptInfo();
183 177
184 private: 178 private:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 DeoptInfo* info, 219 DeoptInfo* info,
226 Smi* reason); 220 Smi* reason);
227 221
228 private: 222 private:
229 static const intptr_t kEntrySize = 3; 223 static const intptr_t kEntrySize = 3;
230 }; 224 };
231 225
232 } // namespace dart 226 } // namespace dart
233 227
234 #endif // VM_DEOPT_INSTRUCTIONS_H_ 228 #endif // VM_DEOPT_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/deopt_instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698