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

Side by Side Diff: src/compiler/ia32/code-generator-ia32.cc

Issue 1455833004: [turbofan]: Implement tail calls with more callee than caller parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Improve comment Created 5 years, 1 month 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
« no previous file with comments | « src/compiler/code-generator.cc ('k') | src/compiler/instruction-codes.h » ('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 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/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/osr.h" 10 #include "src/compiler/osr.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 if (instr->InputAt(2)->IsRegister()) { \ 320 if (instr->InputAt(2)->IsRegister()) { \
321 __ asm_instr(i.MemoryOperand(3), i.InputRegister(2)); \ 321 __ asm_instr(i.MemoryOperand(3), i.InputRegister(2)); \
322 } else { \ 322 } else { \
323 __ asm_instr(i.MemoryOperand(3), i.InputImmediate(2)); \ 323 __ asm_instr(i.MemoryOperand(3), i.InputImmediate(2)); \
324 } \ 324 } \
325 __ bind(&done); \ 325 __ bind(&done); \
326 } while (false) 326 } while (false)
327 327
328 328
329 void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { 329 void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) {
330 int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta);
331 if (sp_slot_delta > 0) {
332 __ add(esp, Immediate(sp_slot_delta * kPointerSize));
333 }
330 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 334 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
331 int stack_slots = frame()->GetSpillSlotCount(); 335 int spill_slots = frame()->GetSpillSlotCount();
332 if (descriptor->IsJSFunctionCall() || stack_slots > 0) { 336 bool has_frame = descriptor->IsJSFunctionCall() || spill_slots > 0;
333 __ mov(esp, ebp); 337 if (has_frame) {
334 __ pop(ebp); 338 __ pop(ebp);
335 } 339 }
336 if (stack_param_delta < 0) {
337 int offset = -(stack_param_delta + 1) * kPointerSize;
338 __ pop(Operand(esp, offset));
339 if (offset != 0) {
340 __ add(esp, Immediate(offset));
341 }
342 }
343 } 340 }
344 341
342
343 void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) {
344 int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta);
345 if (sp_slot_delta < 0) {
346 __ sub(esp, Immediate(-sp_slot_delta * kPointerSize));
347 }
348 }
349
345 350
346 // Assembles an instruction after register allocation, producing machine code. 351 // Assembles an instruction after register allocation, producing machine code.
347 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { 352 void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
348 IA32OperandConverter i(this, instr); 353 IA32OperandConverter i(this, instr);
349 354
350 switch (ArchOpcodeField::decode(instr->opcode())) { 355 switch (ArchOpcodeField::decode(instr->opcode())) {
351 case kArchCallCodeObject: { 356 case kArchCallCodeObject: {
352 EnsureSpaceForLazyDeopt(); 357 EnsureSpaceForLazyDeopt();
353 if (HasImmediateInput(instr, 0)) { 358 if (HasImmediateInput(instr, 0)) {
354 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); 359 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 case kArchLazyBailout: { 406 case kArchLazyBailout: {
402 EnsureSpaceForLazyDeopt(); 407 EnsureSpaceForLazyDeopt();
403 RecordCallPosition(instr); 408 RecordCallPosition(instr);
404 break; 409 break;
405 } 410 }
406 case kArchPrepareCallCFunction: { 411 case kArchPrepareCallCFunction: {
407 int const num_parameters = MiscField::decode(instr->opcode()); 412 int const num_parameters = MiscField::decode(instr->opcode());
408 __ PrepareCallCFunction(num_parameters, i.TempRegister(0)); 413 __ PrepareCallCFunction(num_parameters, i.TempRegister(0));
409 break; 414 break;
410 } 415 }
416 case kArchPrepareTailCall:
417 AssemblePrepareTailCall(i.InputInt32(instr->InputCount() - 1));
418 break;
411 case kArchCallCFunction: { 419 case kArchCallCFunction: {
412 int const num_parameters = MiscField::decode(instr->opcode()); 420 int const num_parameters = MiscField::decode(instr->opcode());
413 if (HasImmediateInput(instr, 0)) { 421 if (HasImmediateInput(instr, 0)) {
414 ExternalReference ref = i.InputExternalReference(0); 422 ExternalReference ref = i.InputExternalReference(0);
415 __ CallCFunction(ref, num_parameters); 423 __ CallCFunction(ref, num_parameters);
416 } else { 424 } else {
417 Register func = i.InputRegister(0); 425 Register func = i.InputRegister(0);
418 __ CallCFunction(func, num_parameters); 426 __ CallCFunction(func, num_parameters);
419 } 427 }
420 break; 428 break;
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 1623 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
1616 __ Nop(padding_size); 1624 __ Nop(padding_size);
1617 } 1625 }
1618 } 1626 }
1619 1627
1620 #undef __ 1628 #undef __
1621 1629
1622 } // namespace compiler 1630 } // namespace compiler
1623 } // namespace internal 1631 } // namespace internal
1624 } // namespace v8 1632 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/code-generator.cc ('k') | src/compiler/instruction-codes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698