OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/instruction-selector-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 #include "src/compiler/node-properties-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 g.CanBeImmediate(*input) ? g.UseImmediate(*input) : g.Use(*input)); | 524 g.CanBeImmediate(*input) ? g.UseImmediate(*input) : g.Use(*input)); |
525 } | 525 } |
526 | 526 |
527 // Select the appropriate opcode based on the call type. | 527 // Select the appropriate opcode based on the call type. |
528 InstructionCode opcode; | 528 InstructionCode opcode; |
529 switch (descriptor->kind()) { | 529 switch (descriptor->kind()) { |
530 case CallDescriptor::kCallCodeObject: { | 530 case CallDescriptor::kCallCodeObject: { |
531 opcode = kArchCallCodeObject; | 531 opcode = kArchCallCodeObject; |
532 break; | 532 break; |
533 } | 533 } |
534 case CallDescriptor::kCallAddress: | |
535 opcode = kArchCallAddress; | |
536 break; | |
537 case CallDescriptor::kCallJSFunction: | 534 case CallDescriptor::kCallJSFunction: |
538 opcode = kArchCallJSFunction; | 535 opcode = kArchCallJSFunction; |
539 break; | 536 break; |
540 default: | 537 default: |
541 UNREACHABLE(); | 538 UNREACHABLE(); |
542 return; | 539 return; |
543 } | 540 } |
544 opcode |= MiscField::encode(descriptor->flags()); | 541 opcode |= MiscField::encode(descriptor->flags()); |
545 | 542 |
546 // Emit the call instruction. | 543 // Emit the call instruction. |
547 Instruction* call_instr = | 544 Instruction* call_instr = |
548 Emit(opcode, buffer.outputs.size(), &buffer.outputs.front(), | 545 Emit(opcode, buffer.outputs.size(), &buffer.outputs.front(), |
549 buffer.instruction_args.size(), &buffer.instruction_args.front()); | 546 buffer.instruction_args.size(), &buffer.instruction_args.front()); |
550 | 547 |
551 call_instr->MarkAsCall(); | 548 call_instr->MarkAsCall(); |
552 if (deoptimization != NULL) { | 549 if (deoptimization != NULL) { |
553 DCHECK(continuation != NULL); | 550 DCHECK(continuation != NULL); |
554 call_instr->MarkAsControl(); | 551 call_instr->MarkAsControl(); |
555 } | 552 } |
556 | |
557 // Caller clean up of stack for C-style calls. | |
558 if (descriptor->kind() == CallDescriptor::kCallAddress && | |
559 buffer.pushed_nodes.size() > 0) { | |
560 DCHECK(deoptimization == NULL && continuation == NULL); | |
561 Emit(kArchDrop | MiscField::encode(buffer.pushed_nodes.size()), NULL); | |
562 } | |
563 } | 553 } |
564 | 554 |
565 } // namespace compiler | 555 } // namespace compiler |
566 } // namespace internal | 556 } // namespace internal |
567 } // namespace v8 | 557 } // namespace v8 |
OLD | NEW |