Revision: 6209
Author: [email protected]
Date: Thu Jan  6 07:25:03 2011
Log: ARM: Support DoCheckInstanceType in lithium codegenerator.

BUG=
TEST=

Review URL: http://codereview.chromium.org/6040008
http://code.google.com/p/v8/source/detail?r=6209

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

=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc      Thu Jan  6 04:21:06 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc      Thu Jan  6 07:25:03 2011
@@ -1762,8 +1762,7 @@

LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
   LOperand* value = UseRegisterAtStart(instr->value());
-  LOperand* temp = TempRegister();
-  LInstruction* result = new LCheckInstanceType(value, temp);
+  LInstruction* result = new LCheckInstanceType(value);
   return AssignEnvironment(result);
 }

=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h       Wed Jan  5 04:01:53 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.h       Thu Jan  6 07:25:03 2011
@@ -1653,8 +1653,7 @@

 class LCheckInstanceType: public LUnaryOperation {
  public:
-  LCheckInstanceType(LOperand* use, LOperand* temp)
-      : LUnaryOperation(use), temp_(temp) { }
+  LCheckInstanceType(LOperand* use) : LUnaryOperation(use) { }

   DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
   DECLARE_HYDROGEN_ACCESSOR(CheckInstanceType)
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Thu Jan 6 04:53:59 2011 +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Thu Jan 6 07:25:03 2011
@@ -2156,7 +2156,26 @@


 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
-  Abort("DoCheckInstanceType unimplemented.");
+  Register input = ToRegister(instr->input());
+  Register scratch = scratch0();
+  InstanceType first = instr->hydrogen()->first();
+  InstanceType last = instr->hydrogen()->last();
+
+  __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset));
+  __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
+  __ cmp(scratch, Operand(first));
+
+  // If there is only one type in the interval check for equality.
+  if (first == last) {
+    DeoptimizeIf(ne, instr->environment());
+  } else {
+    DeoptimizeIf(lo, instr->environment());
+    // Omit check for the last type.
+    if (last != LAST_TYPE) {
+      __ cmp(scratch, Operand(last));
+      DeoptimizeIf(hi, instr->environment());
+    }
+  }
 }


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to