Revision: 6785
Author: [email protected]
Date: Tue Feb 15 02:22:24 2011
Log: ARM: Implement DoHasCachedArrayIndex and DoHasCachedArrayIndexAndBranch.

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

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

=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Feb 14 15:41:47 2011 +++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Tue Feb 15 02:22:24 2011
@@ -1897,13 +1897,32 @@


 void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) {
-  Abort("DoHasCachedArrayIndex unimplemented.");
+  Register input = ToRegister(instr->InputAt(0));
+  Register result = ToRegister(instr->result());
+  Register scratch = scratch0();
+
+  ASSERT(instr->hydrogen()->value()->representation().IsTagged());
+  __ ldr(scratch,
+         FieldMemOperand(input, String::kContainsCachedArrayIndexMask));
+  __ tst(scratch, Operand(String::kContainsCachedArrayIndexMask));
+  __ LoadRoot(result, Heap::kTrueValueRootIndex, ne);
+  __ LoadRoot(result, Heap::kFalseValueRootIndex, eq);
 }


 void LCodeGen::DoHasCachedArrayIndexAndBranch(
     LHasCachedArrayIndexAndBranch* instr) {
-  Abort("DoHasCachedArrayIndexAndBranch unimplemented.");
+  Register input = ToRegister(instr->InputAt(0));
+  Register scratch = scratch0();
+
+  int true_block = chunk_->LookupDestination(instr->true_block_id());
+  int false_block = chunk_->LookupDestination(instr->false_block_id());
+
+  ASSERT(instr->hydrogen()->value()->representation().IsTagged());
+  __ ldr(scratch,
+         FieldMemOperand(input, String::kContainsCachedArrayIndexMask));
+  __ tst(scratch, Operand(String::kContainsCachedArrayIndexMask));
+  EmitBranch(true_block, false_block, ne);
 }


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

Reply via email to