Reviewers: Kevin Millikin,

Message:
Follow-up on http://codereview.chromium.org/8359034/, including your
suggestions. Please take a look.

Description:
Further improvements upon r9747.


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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/arm/builtins-arm.cc
  M src/ia32/builtins-ia32.cc
  M src/x64/builtins-x64.cc


Index: src/arm/builtins-arm.cc
diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc
index 37bdc23edf5e4258e6ee0e5018ba838f73d7011c..95a8c3df0e061c74a1572d7854e4ab90c29a6777 100644
--- a/src/arm/builtins-arm.cc
+++ b/src/arm/builtins-arm.cc
@@ -96,8 +96,8 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
                                  Register scratch2,
                                  Register scratch3,
                                  Label* gc_required) {
-  int initial_capacity = JSArray::kPreallocatedArrayElements;
-  ASSERT(initial_capacity >= 0);
+  const int initial_capacity = JSArray::kPreallocatedArrayElements;
+  STATIC_ASSERT(initial_capacity >= 0);
   // Load the initial map from the array function.
   __ ldr(scratch1, FieldMemOperand(array_function,
JSFunction::kPrototypeOrInitialMapOffset));
@@ -180,11 +180,8 @@ static void AllocateJSArray(MacroAssembler* masm,
                          JSFunction::kPrototypeOrInitialMapOffset));

   if (FLAG_debug_code) {  // Assert that array size is not zero.
-    Label not_empty;
     __ tst(array_size, array_size);
-    __ b(ne, &not_empty);
-    __ Abort("array size is unexpectedly 0");
-    __ bind(&not_empty);
+    __ Assert(ne, "array size is unexpectedly 0");
   }

// Allocate the JSArray object together with space for a FixedArray with the
Index: src/ia32/builtins-ia32.cc
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc
index 58514bca1cfd5ea04ed63faf8d3a81fc1b7554a1..70e342d3d7832e9edfd037b4eeff081526db6182 100644
--- a/src/ia32/builtins-ia32.cc
+++ b/src/ia32/builtins-ia32.cc
@@ -926,8 +926,8 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
                                  Register scratch2,
                                  Register scratch3,
                                  Label* gc_required) {
-  int initial_capacity = JSArray::kPreallocatedArrayElements;
-  ASSERT(initial_capacity >= 0);
+  const int initial_capacity = JSArray::kPreallocatedArrayElements;
+  STATIC_ASSERT(initial_capacity >= 0);
   // Load the initial map from the array function.
   __ mov(scratch1, FieldOperand(array_function,
                                 JSFunction::kPrototypeOrInitialMapOffset));
Index: src/x64/builtins-x64.cc
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc
index db13d873bc568b9c0f916b7687d0a9b764a0a029..6eeb137bbd6232b36bcd5ee4aa11a01f0f1865f3 100644
--- a/src/x64/builtins-x64.cc
+++ b/src/x64/builtins-x64.cc
@@ -1004,8 +1004,8 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
                                  Register scratch2,
                                  Register scratch3,
                                  Label* gc_required) {
-  int initial_capacity = JSArray::kPreallocatedArrayElements;
-  ASSERT(initial_capacity >= 0);
+  const int initial_capacity = JSArray::kPreallocatedArrayElements;
+  STATIC_ASSERT(initial_capacity >= 0);

   // Load the initial map from the array function.
   __ movq(scratch1, FieldOperand(array_function,
@@ -1109,11 +1109,8 @@ static void AllocateJSArray(MacroAssembler* masm,
                        JSFunction::kPrototypeOrInitialMapOffset));

   if (FLAG_debug_code) {  // Assert that array size is not zero.
-    Label not_empty;
     __ testq(array_size, array_size);
-    __ j(not_zero, &not_empty);
-    __ int3();
-    __ bind(&not_empty);
+    __ Assert(not_zero, "array size is unexpectedly 0");
   }

// Allocate the JSArray object together with space for a FixedArray with the


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

Reply via email to