| Index: src/compiler/x64/code-generator-x64.cc
|
| diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc
|
| index f5117f292a8cc300c98ec0273e40edb6f473fd7f..bad87b2fff73c65d44e0fc1bb7f90f08d5e1cca9 100644
|
| --- a/src/compiler/x64/code-generator-x64.cc
|
| +++ b/src/compiler/x64/code-generator-x64.cc
|
| @@ -532,6 +532,9 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
|
| case kArchJmp:
|
| AssembleArchJump(i.InputRpo(0));
|
| break;
|
| + case kArchSwitch:
|
| + AssembleArchSwitch(instr);
|
| + break;
|
| case kArchNop:
|
| // don't emit code for nops.
|
| break;
|
| @@ -1067,6 +1070,19 @@ void CodeGenerator::AssembleArchJump(BasicBlock::RpoNumber target) {
|
| }
|
|
|
|
|
| +void CodeGenerator::AssembleArchSwitch(Instruction* instr) {
|
| + X64OperandConverter i(this, instr);
|
| + size_t const label_count = instr->InputCount() - 1;
|
| + Label** labels = zone()->NewArray<Label*>(static_cast<int>(label_count));
|
| + for (size_t index = 0; index < label_count; ++index) {
|
| + labels[index] = GetLabel(i.InputRpo(static_cast<int>(index + 1)));
|
| + }
|
| + Label* const table = AddJumpTable(labels, label_count);
|
| + __ leaq(kScratchRegister, Operand(table));
|
| + __ jmp(Operand(kScratchRegister, i.InputRegister(0), times_8, 0));
|
| +}
|
| +
|
| +
|
| // Assembles boolean materializations after this instruction.
|
| void CodeGenerator::AssembleArchBoolean(Instruction* instr,
|
| FlagsCondition condition) {
|
| @@ -1380,6 +1396,13 @@ void CodeGenerator::AssembleSwap(InstructionOperand* source,
|
| }
|
|
|
|
|
| +void CodeGenerator::AssembleJumpTable(Label** targets, size_t target_count) {
|
| + for (size_t index = 0; index < target_count; ++index) {
|
| + __ dq(targets[index]);
|
| + }
|
| +}
|
| +
|
| +
|
| void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); }
|
|
|
|
|
|
|