OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/pipeline.h" | 9 #include "src/compiler/pipeline.h" |
10 | 10 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 i, Smi::FromInt(deoptimization_states_[i]->translation_id_)); | 233 i, Smi::FromInt(deoptimization_states_[i]->translation_id_)); |
234 data->SetArgumentsStackHeight(i, Smi::FromInt(0)); | 234 data->SetArgumentsStackHeight(i, Smi::FromInt(0)); |
235 data->SetPc(i, Smi::FromInt(-1)); | 235 data->SetPc(i, Smi::FromInt(-1)); |
236 } | 236 } |
237 | 237 |
238 code_object->set_deoptimization_data(*data); | 238 code_object->set_deoptimization_data(*data); |
239 } | 239 } |
240 | 240 |
241 | 241 |
242 void CodeGenerator::AddSafepointAndDeopt(Instruction* instr) { | 242 void CodeGenerator::AddSafepointAndDeopt(Instruction* instr) { |
243 CallDescriptor::DeoptimizationSupport deopt = | 243 CallDescriptor::Flags flags(MiscField::decode(instr->opcode())); |
244 static_cast<CallDescriptor::DeoptimizationSupport>( | |
245 MiscField::decode(instr->opcode())); | |
246 | 244 |
247 bool needs_frame_state = (deopt & CallDescriptor::kNeedsFrameState) != 0; | 245 bool needs_frame_state = (flags & CallDescriptor::kNeedsFrameState); |
248 | 246 |
249 Safepoint::Id safepoint_id = RecordSafepoint( | 247 Safepoint::Id safepoint_id = RecordSafepoint( |
250 instr->pointer_map(), Safepoint::kSimple, 0, | 248 instr->pointer_map(), Safepoint::kSimple, 0, |
251 needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt); | 249 needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt); |
252 | 250 |
253 if ((deopt & CallDescriptor::kLazyDeoptimization) != 0) { | 251 if (flags & CallDescriptor::kLazyDeoptimization) { |
254 RecordLazyDeoptimizationEntry(instr, safepoint_id); | 252 RecordLazyDeoptimizationEntry(instr, safepoint_id); |
255 } | 253 } |
256 | 254 |
257 if (needs_frame_state) { | 255 if (needs_frame_state) { |
258 // If the frame state is present, it starts at argument 1 | 256 // If the frame state is present, it starts at argument 1 |
259 // (just after the code address). | 257 // (just after the code address). |
260 InstructionOperandConverter converter(this, instr); | 258 InstructionOperandConverter converter(this, instr); |
261 // Deoptimization info starts at argument 1 | 259 // Deoptimization info starts at argument 1 |
262 int frame_state_offset = 1; | 260 int frame_state_offset = 1; |
263 int deoptimization_id = BuildTranslation(instr, frame_state_offset); | 261 int deoptimization_id = BuildTranslation(instr, frame_state_offset); |
264 #if DEBUG | 262 #if DEBUG |
265 // Make sure all the values live in stack slots or they are immediates. | 263 // Make sure all the values live in stack slots or they are immediates. |
266 // (The values should not live in register because registers are clobbered | 264 // (The values should not live in register because registers are clobbered |
267 // by calls.) | 265 // by calls.) |
268 FrameStateDescriptor* descriptor = | 266 FrameStateDescriptor* descriptor = |
269 code()->GetDeoptimizationEntry(deoptimization_id); | 267 code()->GetDeoptimizationEntry(deoptimization_id); |
270 for (int i = 0; i < descriptor->size(); i++) { | 268 for (int i = 0; i < descriptor->size(); i++) { |
271 InstructionOperand* op = instr->InputAt(frame_state_offset + 1 + i); | 269 InstructionOperand* op = instr->InputAt(frame_state_offset + 1 + i); |
272 CHECK(op->IsStackSlot() || op->IsImmediate()); | 270 CHECK(op->IsStackSlot() || op->IsImmediate()); |
273 } | 271 } |
274 #endif | 272 #endif |
275 safepoints()->RecordLazyDeoptimizationIndex(deoptimization_id); | 273 safepoints()->RecordLazyDeoptimizationIndex(deoptimization_id); |
276 } | 274 } |
| 275 |
| 276 if (flags & CallDescriptor::kNeedsNopAfterCall) { |
| 277 AddNopForSmiCodeInlining(); |
| 278 } |
277 } | 279 } |
278 | 280 |
279 | 281 |
280 void CodeGenerator::RecordLazyDeoptimizationEntry(Instruction* instr, | 282 void CodeGenerator::RecordLazyDeoptimizationEntry(Instruction* instr, |
281 Safepoint::Id safepoint_id) { | 283 Safepoint::Id safepoint_id) { |
282 InstructionOperandConverter i(this, instr); | 284 InstructionOperandConverter i(this, instr); |
283 | 285 |
284 Label after_call; | 286 Label after_call; |
285 masm()->bind(&after_call); | 287 masm()->bind(&after_call); |
286 | 288 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 414 } |
413 | 415 |
414 | 416 |
415 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); } | 417 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); } |
416 | 418 |
417 #endif // !V8_TURBOFAN_BACKEND | 419 #endif // !V8_TURBOFAN_BACKEND |
418 | 420 |
419 } // namespace compiler | 421 } // namespace compiler |
420 } // namespace internal | 422 } // namespace internal |
421 } // namespace v8 | 423 } // namespace v8 |
OLD | NEW |