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/base/bits.h" | 5 #include "src/base/bits.h" |
6 #include "src/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { | 442 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { |
443 VisitRR(this, kMipsFloat64RoundTruncate, node); | 443 VisitRR(this, kMipsFloat64RoundTruncate, node); |
444 } | 444 } |
445 | 445 |
446 | 446 |
447 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { | 447 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
448 UNREACHABLE(); | 448 UNREACHABLE(); |
449 } | 449 } |
450 | 450 |
451 | 451 |
452 void InstructionSelector::VisitCall(Node* node) { | 452 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
453 MipsOperandGenerator g(this); | 453 MipsOperandGenerator g(this); |
454 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); | 454 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); |
455 | 455 |
456 FrameStateDescriptor* frame_state_descriptor = NULL; | 456 FrameStateDescriptor* frame_state_descriptor = NULL; |
457 if (descriptor->NeedsFrameState()) { | 457 if (descriptor->NeedsFrameState()) { |
458 frame_state_descriptor = | 458 frame_state_descriptor = |
459 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); | 459 GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); |
460 } | 460 } |
461 | 461 |
462 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); | 462 CallBuffer buffer(zone(), descriptor, frame_state_descriptor); |
463 | 463 |
464 // Compute InstructionOperands for inputs and outputs. | 464 // Compute InstructionOperands for inputs and outputs. |
465 InitializeCallBuffer(node, &buffer, true, false); | 465 InitializeCallBuffer(node, &buffer, true, false); |
466 // Possibly align stack here for functions. | 466 // Possibly align stack here for functions. |
467 int push_count = buffer.pushed_nodes.size(); | 467 int push_count = buffer.pushed_nodes.size(); |
468 if (push_count > 0) { | 468 if (push_count > 0) { |
469 Emit(kMipsStackClaim | MiscField::encode(push_count), g.NoOutput()); | 469 Emit(kMipsStackClaim | MiscField::encode(push_count), g.NoOutput()); |
470 } | 470 } |
471 int slot = buffer.pushed_nodes.size() - 1; | 471 int slot = buffer.pushed_nodes.size() - 1; |
472 for (auto i = buffer.pushed_nodes.rbegin(); i != buffer.pushed_nodes.rend(); | 472 for (auto i = buffer.pushed_nodes.rbegin(); i != buffer.pushed_nodes.rend(); |
473 ++i) { | 473 ++i) { |
474 Emit(kMipsStoreToStackSlot | MiscField::encode(slot), g.NoOutput(), | 474 Emit(kMipsStoreToStackSlot | MiscField::encode(slot), g.NoOutput(), |
475 g.UseRegister(*i)); | 475 g.UseRegister(*i)); |
476 slot--; | 476 slot--; |
477 } | 477 } |
478 | 478 |
| 479 // Pass label of exception handler block. |
| 480 CallDescriptor::Flags flags = descriptor->flags(); |
| 481 if (handler != nullptr) { |
| 482 flags |= CallDescriptor::kHasExceptionHandler; |
| 483 buffer.instruction_args.push_back(g.Label(handler)); |
| 484 } |
| 485 |
479 // Select the appropriate opcode based on the call type. | 486 // Select the appropriate opcode based on the call type. |
480 InstructionCode opcode; | 487 InstructionCode opcode; |
481 switch (descriptor->kind()) { | 488 switch (descriptor->kind()) { |
482 case CallDescriptor::kCallCodeObject: { | 489 case CallDescriptor::kCallCodeObject: { |
483 opcode = kArchCallCodeObject; | 490 opcode = kArchCallCodeObject; |
484 break; | 491 break; |
485 } | 492 } |
486 case CallDescriptor::kCallJSFunction: | 493 case CallDescriptor::kCallJSFunction: |
487 opcode = kArchCallJSFunction; | 494 opcode = kArchCallJSFunction; |
488 break; | 495 break; |
489 default: | 496 default: |
490 UNREACHABLE(); | 497 UNREACHABLE(); |
491 return; | 498 return; |
492 } | 499 } |
493 opcode |= MiscField::encode(descriptor->flags()); | 500 opcode |= MiscField::encode(flags); |
494 | 501 |
495 // Emit the call instruction. | 502 // Emit the call instruction. |
496 InstructionOperand* first_output = | 503 InstructionOperand* first_output = |
497 buffer.outputs.size() > 0 ? &buffer.outputs.front() : NULL; | 504 buffer.outputs.size() > 0 ? &buffer.outputs.front() : NULL; |
498 Instruction* call_instr = | 505 Instruction* call_instr = |
499 Emit(opcode, buffer.outputs.size(), first_output, | 506 Emit(opcode, buffer.outputs.size(), first_output, |
500 buffer.instruction_args.size(), &buffer.instruction_args.front()); | 507 buffer.instruction_args.size(), &buffer.instruction_args.front()); |
501 call_instr->MarkAsCall(); | 508 call_instr->MarkAsCall(); |
502 } | 509 } |
503 | 510 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 return MachineOperatorBuilder::kFloat64Floor | | 892 return MachineOperatorBuilder::kFloat64Floor | |
886 MachineOperatorBuilder::kFloat64Ceil | | 893 MachineOperatorBuilder::kFloat64Ceil | |
887 MachineOperatorBuilder::kFloat64RoundTruncate; | 894 MachineOperatorBuilder::kFloat64RoundTruncate; |
888 } | 895 } |
889 return MachineOperatorBuilder::kNoFlags; | 896 return MachineOperatorBuilder::kNoFlags; |
890 } | 897 } |
891 | 898 |
892 } // namespace compiler | 899 } // namespace compiler |
893 } // namespace internal | 900 } // namespace internal |
894 } // namespace v8 | 901 } // namespace v8 |
OLD | NEW |