OLD | NEW |
---|---|
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC. |
6 #if defined(TARGET_ARCH_DBC) | 6 #if defined(TARGET_ARCH_DBC) |
7 | 7 |
8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 | 169 |
170 // For the outermost environment, set the incoming arguments. | 170 // For the outermost environment, set the incoming arguments. |
171 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { | 171 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { |
172 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++); | 172 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++); |
173 } | 173 } |
174 | 174 |
175 return builder->CreateDeoptInfo(deopt_table); | 175 return builder->CreateDeoptInfo(deopt_table); |
176 } | 176 } |
177 | 177 |
178 | 178 |
179 void FlowGraphCompiler::RecordAfterCall(Instruction* instr) { | 179 void FlowGraphCompiler::RecordAfterCallHelper(TokenPosition token_pos, |
180 RecordSafepoint(instr->locs()); | 180 intptr_t deopt_id, |
181 intptr_t argument_count, | |
182 LocationSummary* locs) { | |
183 RecordSafepoint(locs); | |
181 // Marks either the continuation point in unoptimized code or the | 184 // Marks either the continuation point in unoptimized code or the |
182 // deoptimization point in optimized code, after call. | 185 // deoptimization point in optimized code, after call. |
183 const intptr_t deopt_id_after = Thread::ToDeoptAfter(instr->deopt_id()); | 186 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
184 if (is_optimizing()) { | 187 if (is_optimizing()) { |
185 // Return/ReturnTOS instruction drops incoming arguments so | 188 // Return/ReturnTOS instruction drops incoming arguments so |
186 // we have to drop outgoing arguments from the innermost environment. | 189 // we have to drop outgoing arguments from the innermost environment. |
187 // On all other architectures caller drops outgoing arguments itself | 190 // On all other architectures caller drops outgoing arguments itself |
188 // hence the difference. | 191 // hence the difference. |
189 pending_deoptimization_env_->DropArguments(instr->ArgumentCount()); | 192 pending_deoptimization_env_->DropArguments(argument_count); |
190 AddDeoptIndexAtCall(deopt_id_after); | 193 AddDeoptIndexAtCall(deopt_id_after); |
191 // This descriptor is needed for exception handling in optimized code. | 194 // This descriptor is needed for exception handling in optimized code. |
192 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id_after, | 195 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id_after, token_pos); |
193 instr->token_pos()); | |
194 } else { | 196 } else { |
195 // Add deoptimization continuation point after the call and before the | 197 // Add deoptimization continuation point after the call and before the |
196 // arguments are removed. | 198 // arguments are removed. |
197 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, | 199 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); |
198 instr->token_pos()); | |
199 } | 200 } |
200 } | 201 } |
201 | 202 |
202 | 203 |
204 void FlowGraphCompiler::RecordAfterCall(Instruction* instr) { | |
205 RecordAfterCallHelper(instr->token_pos(), instr->deopt_id(), | |
206 instr->ArgumentCount(), instr->locs()); | |
207 } | |
208 | |
209 | |
203 void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, | 210 void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, |
204 intptr_t stub_ix) { | 211 intptr_t stub_ix) { |
205 UNREACHABLE(); | 212 UNREACHABLE(); |
206 } | 213 } |
207 | 214 |
208 | 215 |
209 #define __ assembler()-> | 216 #define __ assembler()-> |
210 | 217 |
211 | 218 |
212 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, | 219 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 if (is_optimizing()) { | 255 if (is_optimizing()) { |
249 // Register allocator does not think that our first input (also used as | 256 // Register allocator does not think that our first input (also used as |
250 // output) needs to be kept alive across the call because that is how code | 257 // output) needs to be kept alive across the call because that is how code |
251 // is written on other platforms (where registers are always spilled across | 258 // is written on other platforms (where registers are always spilled across |
252 // the call): inputs are consumed by operation and output is produced so | 259 // the call): inputs are consumed by operation and output is produced so |
253 // neither are alive at the safepoint. | 260 // neither are alive at the safepoint. |
254 // We have to mark the slot alive manually to ensure that GC | 261 // We have to mark the slot alive manually to ensure that GC |
255 // visits it. | 262 // visits it. |
256 locs->SetStackBit(locs->out(0).reg()); | 263 locs->SetStackBit(locs->out(0).reg()); |
257 } | 264 } |
258 RecordSafepoint(locs); | |
259 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); | 265 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); |
Florian Schneider
2016/11/11 23:48:59
Is this descriptor still needed?
zra
2016/11/12 05:29:03
I believe so yes. For the other architectures as w
| |
266 RecordAfterCallHelper(token_pos, deopt_id, 0, locs); | |
260 if (is_optimizing()) { | 267 if (is_optimizing()) { |
261 // Assert assignable keeps the instance on the stack as the result, | 268 // Assert assignable keeps the instance on the stack as the result, |
262 // all other arguments are popped. | 269 // all other arguments are popped. |
263 ASSERT(locs->out(0).reg() == locs->in(0).reg()); | 270 ASSERT(locs->out(0).reg() == locs->in(0).reg()); |
264 __ Drop1(); | 271 __ Drop1(); |
265 } | 272 } |
266 } | 273 } |
267 | 274 |
268 | 275 |
269 void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { | 276 void FlowGraphCompiler::EmitInstructionEpilogue(Instruction* instr) { |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 555 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
549 UNIMPLEMENTED(); | 556 UNIMPLEMENTED(); |
550 } | 557 } |
551 | 558 |
552 | 559 |
553 #undef __ | 560 #undef __ |
554 | 561 |
555 } // namespace dart | 562 } // namespace dart |
556 | 563 |
557 #endif // defined TARGET_ARCH_DBC | 564 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |