Revision: 11474
Author:   [email protected]
Date:     Wed May  2 00:51:03 2012
Log:      MIPS: Fix LFastLiteral to check boilerplate elements kind.

Port r11470 (621f96c0)

Original commit message:
Fix LFastLiteral to check boilerplate elements kind.

Adds a missing check that the elements kind of the boilerplate object
still has the expected elements kind, unoptimized code can transition
the boilerplate. Corner cases might cause the optimized code to be
reentered again.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10271018
Patch from Akos Palfi <[email protected]>.
http://code.google.com/p/v8/source/detail?r=11474

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

=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Fri Apr 27 05:57:01 2012 +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Wed May 2 00:51:03 2012
@@ -4603,6 +4603,23 @@

 void LCodeGen::DoFastLiteral(LFastLiteral* instr) {
   int size = instr->hydrogen()->total_size();
+  ElementsKind boilerplate_elements_kind =
+      instr->hydrogen()->boilerplate()->GetElementsKind();
+
+ // Deopt if the literal boilerplate ElementsKind is of a type different than + // the expected one. The check isn't necessary if the boilerplate has already
+  // been converted to FAST_ELEMENTS.
+  if (boilerplate_elements_kind != FAST_ELEMENTS) {
+    __ LoadHeapObject(a1, instr->hydrogen()->boilerplate());
+    // Load map into a2.
+    __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset));
+    // Load the map's "bit field 2".
+    __ lbu(a2, FieldMemOperand(a2, Map::kBitField2Offset));
+    // Retrieve elements_kind from bit field 2.
+    __ Ext(a2, a2, Map::kElementsKindShift, Map::kElementsKindBitCount);
+    DeoptimizeIf(ne, instr->environment(), a2,
+        Operand(boilerplate_elements_kind));
+  }

   // Allocate all objects that are part of the literal in one big
   // allocation. This avoids multiple limit checks.

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

Reply via email to