Reviewers: Karl Klose, Description: ARM: Implement lithium codegen for DoTypeof, DoTypeofIs and DoSmiUntag
Please review this at http://codereview.chromium.org/6174001/ SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M src/arm/lithium-arm.cc M src/arm/lithium-codegen-arm.cc Index: src/arm/lithium-arm.cc =================================================================== --- src/arm/lithium-arm.cc (revision 6216) +++ src/arm/lithium-arm.cc (working copy) @@ -2022,7 +2022,7 @@ LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { - LInstruction* result = new LTypeof(Use(instr->value())); + LInstruction* result = new LTypeof(UseRegisterAtStart(instr->value())); return MarkAsCall(DefineFixed(result, r0), instr); } Index: src/arm/lithium-codegen-arm.cc =================================================================== --- src/arm/lithium-codegen-arm.cc (revision 6216) +++ src/arm/lithium-codegen-arm.cc (working copy) @@ -2081,7 +2081,13 @@ void LCodeGen::DoSmiUntag(LSmiUntag* instr) { - Abort("DoSmiUntag unimplemented."); + LOperand* input = instr->input(); + ASSERT(input->IsRegister() && input->Equals(instr->result())); + if (instr->needs_check()) { + __ tst(ToRegister(input), Operand(kSmiTagMask)); + DeoptimizeIf(ne, instr->environment()); + } + __ SmiUntag(ToRegister(input)); } @@ -2455,12 +2461,27 @@ void LCodeGen::DoTypeof(LTypeof* instr) { - Abort("DoTypeof unimplemented."); + Register input = ToRegister(instr->input()); + __ push(input); + CallRuntime(Runtime::kTypeof, 1, instr); } void LCodeGen::DoTypeofIs(LTypeofIs* instr) { - Abort("DoTypeofIs unimplemented."); + Register input = ToRegister(instr->input()); + Register result = ToRegister(instr->result()); + Label true_label; + Label false_label; + Label done; + + Condition final_branch_condition = EmitTypeofIs(&true_label, + &false_label, + input, + instr->type_literal()); + + __ LoadRoot(result, Heap::kTrueValueRootIndex, final_branch_condition); + __ LoadRoot(result, Heap::kFalseValueRootIndex, + NegateCondition(final_branch_condition)); } -- v8-dev mailing list v8-dev@googlegroups.com http://groups.google.com/group/v8-dev