Author: [email protected]
Date: Wed Mar 25 04:05:36 2009
New Revision: 1607

Modified:
    branches/bleeding_edge/src/codegen-arm.cc
    branches/bleeding_edge/src/codegen-ia32.cc
    branches/bleeding_edge/src/virtual-frame-ia32.cc
    branches/bleeding_edge/src/virtual-frame.cc

Log:
The code generator doesn't need to put the argument count in eax for
call ICs.  Refactor CallRuntime on ARM to match the structure of IA32.
Update some comments.
Review URL: http://codereview.chromium.org/42598

Modified: branches/bleeding_edge/src/codegen-arm.cc
==============================================================================
--- branches/bleeding_edge/src/codegen-arm.cc   (original)
+++ branches/bleeding_edge/src/codegen-arm.cc   Wed Mar 25 04:05:36 2009
@@ -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,17 +3464,24 @@
      __ 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);

Modified: branches/bleeding_edge/src/codegen-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/codegen-ia32.cc  (original)
+++ branches/bleeding_edge/src/codegen-ia32.cc  Wed Mar 25 04:05:36 2009
@@ -4454,12 +4454,8 @@
    if (function == NULL) {
      // Call the JS runtime function.
      Handle<Code> stub = ComputeCallInitialize(arg_count);
-
-    Result num_args = allocator()->Allocate(eax);
-    ASSERT(num_args.is_valid());
-    __ Set(num_args.reg(), Immediate(args->length()));
-    Result answer = frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET,
-                                           &num_args, arg_count + 1);
+    Result answer =
+        frame_->CallCodeObject(stub, RelocInfo::CODE_TARGET, arg_count +  
1);
      frame_->RestoreContextRegister();
      frame_->SetElementAt(0, &answer);
    } else {

Modified: branches/bleeding_edge/src/virtual-frame-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/virtual-frame-ia32.cc    (original)
+++ branches/bleeding_edge/src/virtual-frame-ia32.cc    Wed Mar 25 04:05:36  
2009
@@ -784,10 +784,6 @@
                                      int dropped_args) {
    int spilled_args = 0;
    switch (code->kind()) {
-    case Code::CALL_IC:
-      ASSERT(arg->reg().is(eax));
-      spilled_args = dropped_args + 1;
-      break;
      case Code::LOAD_IC:
        ASSERT(arg->reg().is(ecx));
        ASSERT(dropped_args == 0);

Modified: branches/bleeding_edge/src/virtual-frame.cc
==============================================================================
--- branches/bleeding_edge/src/virtual-frame.cc (original)
+++ branches/bleeding_edge/src/virtual-frame.cc Wed Mar 25 04:05:36 2009
@@ -179,12 +179,10 @@
  }


-// Spill any register if possible, making its external reference count  
zero.
+// If there are any registers referenced only by the frame, spill one.
  Register VirtualFrame::SpillAnyRegister() {
-  // Find the leftmost (ordered by register code), least
-  // internally-referenced register whose internal reference count matches
-  // its external reference count (so that spilling it from the frame frees
-  // it for use).
+  // Find the leftmost (ordered by register code) register whose only
+  // reference is in the frame.
    for (int i = 0; i < kNumRegisters; i++) {
      if (is_used(i) && cgen_->allocator()->count(i) == 1) {
        Register result = { i };

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

Reply via email to