Optimized String.prototype.match.

Improved the stack information in profiles.

Fixed bug in ARM port making it possible to compile the runtime system for thumb mode again.

Implemented a number of optimizations in the code generator.

Fixed a number of memory leaks in tests.

Fixed crash bug in connection with script source code and external strings.



git-svn-id: http://v8.googlecode.com/svn/trunk@1642 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/codegen-arm.cc b/src/codegen-arm.cc
index 52009d9..0823f77 100644
--- a/src/codegen-arm.cc
+++ b/src/codegen-arm.cc
@@ -868,11 +868,11 @@
   }
 
   GenericBinaryOpStub igostub(op_);
-  Result arg0 = generator()->allocator()->Allocate(r0);
+  Result arg0 = generator()->allocator()->Allocate(r1);
   ASSERT(arg0.is_valid());
-  Result arg1 = generator()->allocator()->Allocate(r1);
+  Result arg1 = generator()->allocator()->Allocate(r0);
   ASSERT(arg1.is_valid());
-  generator()->frame()->CallStub(&igostub, &arg0, &arg1, 0);
+  generator()->frame()->CallStub(&igostub, &arg0, &arg1);
   exit_.Jump();
 }
 
@@ -3456,18 +3456,7 @@
   Comment cmnt(masm_, "[ CallRuntime");
   Runtime::Function* function = node->function();
 
-  if (function != NULL) {
-    // Push the arguments ("left-to-right").
-    int arg_count = args->length();
-    for (int i = 0; i < arg_count; i++) {
-      LoadAndSpill(args->at(i));
-    }
-
-    // Call the C runtime function.
-    frame_->CallRuntime(function, arg_count);
-    frame_->EmitPush(r0);
-
-  } else {
+  if (function == NULL) {
     // Prepare stack for calling JS runtime function.
     __ mov(r0, Operand(node->name()));
     frame_->EmitPush(r0);
@@ -3475,18 +3464,25 @@
     __ ldr(r1, GlobalObject());
     __ ldr(r0, FieldMemOperand(r1, GlobalObject::kBuiltinsOffset));
     frame_->EmitPush(r0);
+  }
 
-    int arg_count = args->length();
-    for (int i = 0; i < arg_count; i++) {
-      LoadAndSpill(args->at(i));
-    }
+  // Push the arguments ("left-to-right").
+  int arg_count = args->length();
+  for (int i = 0; i < arg_count; i++) {
+    LoadAndSpill(args->at(i));
+  }
 
+  if (function == NULL) {
     // Call the JS runtime function.
-    Handle<Code> stub = ComputeCallInitialize(args->length());
+    Handle<Code> stub = ComputeCallInitialize(arg_count);
     frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count + 1);
     __ ldr(cp, frame_->Context());
     frame_->Drop();
     frame_->EmitPush(r0);
+  } else {
+    // Call the C runtime function.
+    frame_->CallRuntime(function, arg_count);
+    frame_->EmitPush(r0);
   }
   ASSERT(frame_->height() == original_height + 1);
 }
@@ -4862,7 +4858,7 @@
   // Notify the simulator of the transition to C code.
   __ swi(assembler::arm::call_rt_r5);
 #else /* !defined(__arm__) */
-  __ mov(pc, Operand(r5));
+  __ Jump(r5);
 #endif /* !defined(__arm__) */
 
   if (always_allocate) {