Fixed string length bug on ARM (issue 171).

Made most methods in the API const.

Optimized object literals by improving data locality.

Fixed bug that caused incomplete functions to be cached in case of stack overflow exceptions.

Fixed bugs that caused catch variables and variables introduced by eval to behave incorrectly when using accessors (issues 186, 190 and 191).


git-svn-id: http://v8.googlecode.com/svn/trunk@1095 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/stub-cache-arm.cc b/src/stub-cache-arm.cc
index 3584a4e..732d292 100644
--- a/src/stub-cache-arm.cc
+++ b/src/stub-cache-arm.cc
@@ -312,20 +312,24 @@
 }
 
 
+// Generate code to load the length from a string object and return the length.
+// If the receiver object is not a string or a wrapped string object the
+// execution continues at the miss label. The register containing the
+// receiver is potentially clobbered.
 void StubCompiler::GenerateLoadStringLength2(MacroAssembler* masm,
                                              Register receiver,
                                              Register scratch1,
                                              Register scratch2,
                                              Label* miss) {
-  Label load_length, check_wrapper;
+  Label check_string, check_wrapper;
 
+  __ bind(&check_string);
   // Check if the object is a string leaving the instance type in the
   // scratch1 register.
   GenerateStringCheck(masm, receiver, scratch1, scratch2,
                       miss, &check_wrapper);
 
   // Load length directly from the string.
-  __ bind(&load_length);
   __ and_(scratch1, scratch1, Operand(kStringSizeMask));
   __ add(scratch1, scratch1, Operand(String::kHashShift));
   __ ldr(r0, FieldMemOperand(receiver, String::kLengthOffset));
@@ -338,11 +342,9 @@
   __ cmp(scratch1, Operand(JS_VALUE_TYPE));
   __ b(ne, miss);
 
-  // Check if the wrapped value is a string and load the length
-  // directly if it is.
-  __ ldr(r0, FieldMemOperand(receiver, JSValue::kValueOffset));
-  GenerateStringCheck(masm, receiver, scratch1, scratch1, miss, miss);
-  __ b(&load_length);
+  // Unwrap the value in place and check if the wrapped value is a string.
+  __ ldr(receiver, FieldMemOperand(receiver, JSValue::kValueOffset));
+  __ b(&check_string);
 }
 
 
@@ -382,7 +384,7 @@
   // Perform map transition for the receiver if necessary.
   if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) {
     // The properties must be extended before we can store the value.
-    // We jump to a runtime call that extends the propeties array.
+    // We jump to a runtime call that extends the properties array.
     __ mov(r2, Operand(Handle<Map>(transition)));
     // Please note, if we implement keyed store for arm we need
     // to call the Builtins::KeyedStoreIC_ExtendStorage.