Reviewers: Vitaly,

Message:
Welcome back from vacation, Vitaly :)

May you have a look?

If I understand idea behind your recent map change correctly, I'll port to x64
in the same CL.

The next move would be to have optimized builtins with omitted fast elements
check.

Description:
Omit fast element check as it is encoded in a map check now.

Thanks to new policy that there is map transition when fastness/slowness
of elements changes this check could be omitted now.

Please review this at http://codereview.chromium.org/3036016/show

Affected files:
  M src/ia32/stub-cache-ia32.cc


Index: src/ia32/stub-cache-ia32.cc
diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc
index e81fbc7b75f86723aae5bdf7ba997d39f1a9038d..a63111df7fa96d9e8bd6350e8883fb7c84a8bd15 100644
--- a/src/ia32/stub-cache-ia32.cc
+++ b/src/ia32/stub-cache-ia32.cc
@@ -1363,7 +1363,7 @@ Object* CallStubCompiler::CompileArrayPushCall(Object* object,
   ASSERT(check == RECEIVER_MAP_CHECK);

   // If object is not an array, bail out to regular call.
-  if (!object->IsJSArray()) {
+  if (!object->IsJSArray() || !JSObject::cast(object)->HasFastElements()) {
     return Heap::undefined_value();
   }

@@ -1391,10 +1391,12 @@ Object* CallStubCompiler::CompileArrayPushCall(Object* object,
     // Get the elements array of the object.
     __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset));

-    // Check that the elements are in fast mode (not dictionary).
-    __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
-           Immediate(Factory::fixed_array_map()));
-    __ j(not_equal, &miss);
+    if (FLAG_debug_code) {
+      // Check that the elements are in fast mode (not dictionary).
+      __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
+             Immediate(Factory::fixed_array_map()));
+ __ Assert(equal, "Array must be in fast case due to map check above");
+    }

     if (argc == 1) {  // Otherwise fall through to call builtin.
Label call_builtin, exit, with_write_barrier, attempt_to_grow_elements; @@ -1510,7 +1512,7 @@ Object* CallStubCompiler::CompileArrayPopCall(Object* object,
   ASSERT(check == RECEIVER_MAP_CHECK);

   // If object is not an array, bail out to regular call.
-  if (!object->IsJSArray()) {
+  if (!object->IsJSArray() || !JSObject::cast(object)->HasFastElements()) {
     return Heap::undefined_value();
   }

@@ -1532,10 +1534,12 @@ Object* CallStubCompiler::CompileArrayPopCall(Object* object,
   // Get the elements array of the object.
   __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset));

-  // Check that the elements are in fast mode (not dictionary).
-  __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
-         Immediate(Factory::fixed_array_map()));
-  __ j(not_equal, &miss);
+  if (FLAG_debug_code) {
+    // Check that the elements are in fast mode (not dictionary).
+    __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
+           Immediate(Factory::fixed_array_map()));
+    __ Assert(equal, "Array must be in fast case due to map check above");
+  }

   // Get the array's length into ecx and calculate new length.
   __ mov(ecx, FieldOperand(edx, JSArray::kLengthOffset));


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

Reply via email to