Revision: 6227
Author: [email protected]
Date: Fri Jan  7 05:44:05 2011
Log: ARM: Implement lithium codegen for DoTypeof, DoTypeofIs and DoSmiUntag
Review URL: http://codereview.chromium.org/6174001
http://code.google.com/p/v8/source/detail?r=6227

Modified:
 /branches/bleeding_edge/src/arm/lithium-arm.cc
 /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc

=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc      Fri Jan  7 03:49:22 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc      Fri Jan  7 05:44:05 2011
@@ -1877,7 +1877,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);
 }

=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Fri Jan 7 04:34:39 2011 +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Fri Jan 7 05:44:05 2011
@@ -2087,7 +2087,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));
 }


@@ -2461,12 +2467,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
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to