Reviewers: Søren Gjesse,

Description:
MIPS: port Add complete ElementsKind information directly to Map for objects
with elements.

Ported commits: r8162 (c56f802)

BUG=
TEST=


Please review this at http://codereview.chromium.org/7024042/

Affected files:
  M src/mips/full-codegen-mips.cc
  M src/mips/ic-mips.cc
  M src/mips/macro-assembler-mips.h
  M src/mips/macro-assembler-mips.cc


Index: src/mips/full-codegen-mips.cc
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
index b085859d00bd2a6194d210ad7d749ff69cdd10ad..f8803e47a31af03d7698c54d8bbfa346ce9b979c 100644
--- a/src/mips/full-codegen-mips.cc
+++ b/src/mips/full-codegen-mips.cc
@@ -3444,9 +3444,7 @@ void FullCodeGenerator::EmitFastAsciiArrayJoin(ZoneList<Expression*>* args) {
   __ Branch(&bailout, ne, scratch2, Operand(JS_ARRAY_TYPE));

   // Check that the array has fast elements.
-  __ lbu(scratch2, FieldMemOperand(scratch1, Map::kBitField2Offset));
-  __ And(scratch3, scratch2, Operand(1 << Map::kHasFastElements));
-  __ Branch(&bailout, eq, scratch3, Operand(zero_reg));
+  __ CheckFastElements(scratch1, scratch2, &bailout);

   // If the array has length zero, return the empty string.
   __ lw(array_length, FieldMemOperand(array, JSArray::kLengthOffset));
Index: src/mips/ic-mips.cc
diff --git a/src/mips/ic-mips.cc b/src/mips/ic-mips.cc
index 85b1ca22d2db5951ae94a7c62f49f5c78ab9b991..3c5e8db9cba72cc9954e8238c4af90c963950aef 100644
--- a/src/mips/ic-mips.cc
+++ b/src/mips/ic-mips.cc
@@ -950,11 +950,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
   GenerateKeyedLoadReceiverCheck(
       masm, receiver, a2, a3, Map::kHasIndexedInterceptor, &slow);

-  // Check the "has fast elements" bit in the receiver's map which is
-  // now in a2.
-  __ lbu(a3, FieldMemOperand(a2, Map::kBitField2Offset));
-  __ And(at, a3, Operand(1 << Map::kHasFastElements));
-  __ Branch(&check_number_dictionary, eq, at, Operand(zero_reg));
+  // Check the receiver's map to see if it has fast elements.
+  __ CheckFastElements(a2, a3, &check_number_dictionary);

   GenerateFastArrayLoad(
       masm, receiver, key, t0, a3, a2, v0, NULL, &slow);
Index: src/mips/macro-assembler-mips.cc
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc index bd585946f11d546bed602bd8d338b4ca1f0f1c5c..fe6f1aefda4eb353c404aec997aae73cbcd31499 100644
--- a/src/mips/macro-assembler-mips.cc
+++ b/src/mips/macro-assembler-mips.cc
@@ -2642,6 +2642,16 @@ void MacroAssembler::CopyBytes(Register src,
 }


+void MacroAssembler::CheckFastElements(Register map,
+                                       Register scratch,
+                                       Label* fail) {
+  STATIC_ASSERT(JSObject::FAST_ELEMENTS == 0);
+  lbu(scratch, FieldMemOperand(map, Map::kBitField2Offset));
+  And(scratch, scratch, Operand(Map::kMaximumBitField2FastElementValue));
+  Branch(fail, hi, scratch, Operand(zero_reg));
+}
+
+
 void MacroAssembler::CheckMap(Register obj,
                               Register scratch,
                               Handle<Map> map,
Index: src/mips/macro-assembler-mips.h
diff --git a/src/mips/macro-assembler-mips.h b/src/mips/macro-assembler-mips.h index 2fbe2d7c7cc7e30344bf05c3552ea72502e0e1cd..0eb5981b6d42788bfdf622764d38ce9eb454889a 100644
--- a/src/mips/macro-assembler-mips.h
+++ b/src/mips/macro-assembler-mips.h
@@ -723,6 +723,12 @@ DECLARE_NOTARGET_PROTOTYPE(Ret)
                      Register map,
                      Register type_reg);

+ // Check if a map for a JSObject indicates that the object has fast elements.
+  // Jump to the specified label if it does not.
+  void CheckFastElements(Register map,
+                         Register scratch,
+                         Label* fail);
+
   // Check if the map of an object is equal to a specified map (either
   // given directly or as an index into the root list) and branch to
   // label if not. Skip the smi check if not required (object is known


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

Reply via email to