Chromium Code Reviews| Index: src/x64/lithium-codegen-x64.cc |
| =================================================================== |
| --- src/x64/lithium-codegen-x64.cc (revision 6629) |
| +++ src/x64/lithium-codegen-x64.cc (working copy) |
| @@ -260,8 +260,8 @@ |
| } else { |
| // Incoming parameter. Skip the return address. |
| return Operand(rbp, -(index - 1) * kPointerSize); |
| - } |
| } |
|
William Hesse
2011/02/04 14:37:12
Indentation fixed.
|
| +} |
| void LCodeGen::WriteTranslation(LEnvironment* environment, |
| @@ -433,10 +433,10 @@ |
| if (cc == no_condition) { |
| __ Jump(entry, RelocInfo::RUNTIME_ENTRY); |
| } else { |
| - NearLabel done; |
| - __ j(NegateCondition(cc), &done); |
| + NearLabel done; |
| + __ j(NegateCondition(cc), &done); |
| __ Jump(entry, RelocInfo::RUNTIME_ENTRY); |
| - __ bind(&done); |
| + __ bind(&done); |
| } |
| } |
| @@ -605,11 +605,115 @@ |
| void LCodeGen::DoBitI(LBitI* instr) { |
| - Abort("Unimplemented: %s", "DoBitI");} |
| + LOperand* left = instr->InputAt(0); |
| + LOperand* right = instr->InputAt(1); |
| + ASSERT(left->Equals(instr->result())); |
| + ASSERT(left->IsRegister()); |
| + if (right->IsConstantOperand()) { |
| + int right_operand = ToInteger32(LConstantOperand::cast(right)); |
| + switch (instr->op()) { |
| + case Token::BIT_AND: |
| + __ andl(ToRegister(left), Immediate(right_operand)); |
| + break; |
| + case Token::BIT_OR: |
| + __ orl(ToRegister(left), Immediate(right_operand)); |
| + break; |
| + case Token::BIT_XOR: |
| + __ xorl(ToRegister(left), Immediate(right_operand)); |
| + break; |
| + default: |
| + UNREACHABLE(); |
| + break; |
| + } |
| + } else if (right->IsStackSlot()) { |
| + switch (instr->op()) { |
| + case Token::BIT_AND: |
| + __ andl(ToRegister(left), ToOperand(right)); |
| + break; |
| + case Token::BIT_OR: |
| + __ orl(ToRegister(left), ToOperand(right)); |
| + break; |
| + case Token::BIT_XOR: |
| + __ xorl(ToRegister(left), ToOperand(right)); |
| + break; |
| + default: |
| + UNREACHABLE(); |
| + break; |
| + } |
| + } else { |
| + ASSERT(right->IsRegister()); |
| + switch (instr->op()) { |
| + case Token::BIT_AND: |
| + __ andl(ToRegister(left), ToRegister(right)); |
| + break; |
| + case Token::BIT_OR: |
| + __ orl(ToRegister(left), ToRegister(right)); |
| + break; |
| + case Token::BIT_XOR: |
| + __ xorl(ToRegister(left), ToRegister(right)); |
| + break; |
| + default: |
| + UNREACHABLE(); |
| + break; |
| + } |
| + } |
| +} |
| + |
| void LCodeGen::DoShiftI(LShiftI* instr) { |
| - Abort("Unimplemented: %s", "DoShiftI"); |
| + LOperand* left = instr->InputAt(0); |
| + LOperand* right = instr->InputAt(1); |
| + ASSERT(left->Equals(instr->result())); |
| + ASSERT(left->IsRegister()); |
| + if (right->IsRegister()) { |
| + ASSERT(ToRegister(right).is(rcx)); |
| + |
| + switch (instr->op()) { |
| + case Token::SAR: |
| + __ sarl_cl(ToRegister(left)); |
| + break; |
| + case Token::SHR: |
| + __ shrl_cl(ToRegister(left)); |
| + if (instr->can_deopt()) { |
| + __ testl(ToRegister(left), Immediate(0x80000000)); |
| + DeoptimizeIf(not_zero, instr->environment()); |
| + } |
| + break; |
| + case Token::SHL: |
| + __ shll_cl(ToRegister(left)); |
| + break; |
| + default: |
| + UNREACHABLE(); |
| + break; |
| + } |
| + } else { |
| + int value = ToInteger32(LConstantOperand::cast(right)); |
| + uint8_t shift_count = static_cast<uint8_t>(value & 0x1F); |
| + switch (instr->op()) { |
| + case Token::SAR: |
| + if (shift_count != 0) { |
| + __ sarl(ToRegister(left), Immediate(shift_count)); |
| + } |
| + break; |
| + case Token::SHR: |
| + if (shift_count == 0 && instr->can_deopt()) { |
| + __ testl(ToRegister(left), Immediate(0x80000000)); |
| + DeoptimizeIf(not_zero, instr->environment()); |
| + } else { |
| + __ shrl(ToRegister(left), Immediate(shift_count)); |
| + } |
| + break; |
| + case Token::SHL: |
| + if (shift_count != 0) { |
| + __ shll(ToRegister(left), Immediate(shift_count)); |
| + } |
| + break; |
| + default: |
| + UNREACHABLE(); |
| + break; |
| + } |
| + } |
| } |
| @@ -663,7 +767,7 @@ |
| void LCodeGen::DoConstantT(LConstantT* instr) { |
| - ASSERT(instr->result()->IsRegister()); |
| + ASSERT(instr->result()->IsRegister()); |
| __ Move(ToRegister(instr->result()), instr->value()); |
| } |
| @@ -686,7 +790,9 @@ |
| void LCodeGen::DoBitNotI(LBitNotI* instr) { |
| - Abort("Unimplemented: %s", "DoBitNotI"); |
| + LOperand* input = instr->InputAt(0); |
| + ASSERT(input->Equals(instr->result())); |
| + __ not_(ToRegister(input)); |
| } |
| @@ -754,10 +860,10 @@ |
| } else { |
| __ j(cc, chunk_->GetAssemblyLabel(left_block)); |
| if (cc != always) { |
| - __ jmp(chunk_->GetAssemblyLabel(right_block)); |
| - } |
| + __ jmp(chunk_->GetAssemblyLabel(right_block)); |
| } |
| } |
| +} |
| void LCodeGen::DoBranch(LBranch* instr) { |
| @@ -899,7 +1005,7 @@ |
| int32_t value = ToInteger32(LConstantOperand::cast(right)); |
| if (left->IsRegister()) { |
| __ cmpl(ToRegister(left), Immediate(value)); |
| - } else { |
| + } else { |
| __ cmpl(ToOperand(left), Immediate(value)); |
| } |
| } else if (right->IsRegister()) { |
| @@ -1201,13 +1307,13 @@ |
| void LCodeGen::DoHasCachedArrayIndexAndBranch( |
| LHasCachedArrayIndexAndBranch* instr) { |
| - Register input = ToRegister(instr->InputAt(0)); |
| + Register input = ToRegister(instr->InputAt(0)); |
| int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| __ testl(FieldOperand(input, String::kHashFieldOffset), |
| - Immediate(String::kContainsCachedArrayIndexMask)); |
| + Immediate(String::kContainsCachedArrayIndexMask)); |
| EmitBranch(true_block, false_block, not_equal); |
| } |
| @@ -1216,7 +1322,7 @@ |
| // Trashes the temp register and possibly input (if it and temp are aliased). |
| void LCodeGen::EmitClassOfTest(Label* is_true, |
| Label* is_false, |
| - Handle<String> class_name, |
| + Handle<String>class_name, |
| Register input, |
| Register temp) { |
| __ JumpIfSmi(input, is_false); |
| @@ -1253,7 +1359,7 @@ |
| // instance class name from there. |
| __ movq(temp, FieldOperand(temp, JSFunction::kSharedFunctionInfoOffset)); |
| __ movq(temp, FieldOperand(temp, |
| - SharedFunctionInfo::kInstanceClassNameOffset)); |
| + SharedFunctionInfo::kInstanceClassNameOffset)); |
| // The class name we are testing against is a symbol because it's a literal. |
| // The name in the constructor is a symbol because of the way the context is |
| // booted. This routine isn't expected to work for random API-created |
| @@ -1524,17 +1630,17 @@ |
| __ push(Immediate(static_cast<int32_t>(literal->Number()))); |
| } else if (r.IsDouble()) { |
| Abort("unsupported double immediate"); |
| - } else { |
| + } else { |
| ASSERT(r.IsTagged()); |
| __ Push(literal); |
| - } |
| +} |
| } else if (argument->IsRegister()) { |
| __ push(ToRegister(argument)); |
| } else { |
| ASSERT(!argument->IsDoubleRegister()); |
| __ push(ToOperand(argument)); |
| - } |
| } |
| +} |
| void LCodeGen::DoGlobalObject(LGlobalObject* instr) { |