From cd6afbc617c22cc021e28bfad2ad5c0611deede8 Mon Sep 17 00:00:00 2001 From: "whesse@chromium.org" Date: Tue, 18 May 2010 11:19:34 +0000 Subject: [PATCH] Spill arguments for a function call from the virtual frame as they are produced. Review URL: http://codereview.chromium.org/2103007 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4671 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/ia32/codegen-ia32.cc | 4 ++++ src/ia32/virtual-frame-ia32.h | 3 +++ src/x64/codegen-x64.cc | 4 ++++ src/x64/virtual-frame-x64.h | 3 +++ 4 files changed, 14 insertions(+) diff --git a/src/ia32/codegen-ia32.cc b/src/ia32/codegen-ia32.cc index 4364cb4368..82d83da25f 100644 --- a/src/ia32/codegen-ia32.cc +++ b/src/ia32/codegen-ia32.cc @@ -2981,6 +2981,7 @@ void CodeGenerator::CallWithArguments(ZoneList* args, int arg_count = args->length(); for (int i = 0; i < arg_count; i++) { Load(args->at(i)); + frame_->SpillTop(); } // Record the position for debugging purposes. @@ -5732,6 +5733,7 @@ void CodeGenerator::VisitCall(Call* node) { int arg_count = args->length(); for (int i = 0; i < arg_count; i++) { Load(args->at(i)); + frame_->SpillTop(); } // Prepare the stack for the call to ResolvePossiblyDirectEval. @@ -5781,6 +5783,7 @@ void CodeGenerator::VisitCall(Call* node) { int arg_count = args->length(); for (int i = 0; i < arg_count; i++) { Load(args->at(i)); + frame_->SpillTop(); } // Push the name of the function onto the frame. @@ -5886,6 +5889,7 @@ void CodeGenerator::VisitCall(Call* node) { int arg_count = args->length(); for (int i = 0; i < arg_count; i++) { Load(args->at(i)); + frame_->SpillTop(); } // Push the name of the function onto the frame. diff --git a/src/ia32/virtual-frame-ia32.h b/src/ia32/virtual-frame-ia32.h index 51a802c74e..129e0fa605 100644 --- a/src/ia32/virtual-frame-ia32.h +++ b/src/ia32/virtual-frame-ia32.h @@ -144,6 +144,9 @@ class VirtualFrame: public ZoneObject { // (ie, they all have frame-external references). Register SpillAnyRegister(); + // Spill the top element of the frame. + void SpillTop() { SpillElementAt(element_count() - 1); } + // Sync the range of elements in [begin, end] with memory. void SyncRange(int begin, int end); diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc index 8c67d0f605..50e5aa110e 100644 --- a/src/x64/codegen-x64.cc +++ b/src/x64/codegen-x64.cc @@ -2801,6 +2801,7 @@ void CodeGenerator::VisitCall(Call* node) { int arg_count = args->length(); for (int i = 0; i < arg_count; i++) { Load(args->at(i)); + frame_->SpillTop(); } // Prepare the stack for the call to ResolvePossiblyDirectEval. @@ -2850,6 +2851,7 @@ void CodeGenerator::VisitCall(Call* node) { int arg_count = args->length(); for (int i = 0; i < arg_count; i++) { Load(args->at(i)); + frame_->SpillTop(); } // Push the name of the function on the frame. @@ -2955,6 +2957,7 @@ void CodeGenerator::VisitCall(Call* node) { int arg_count = args->length(); for (int i = 0; i < arg_count; i++) { Load(args->at(i)); + frame_->SpillTop(); } // Push the name of the function onto the frame. @@ -8902,6 +8905,7 @@ void CodeGenerator::CallWithArguments(ZoneList* args, int arg_count = args->length(); for (int i = 0; i < arg_count; i++) { Load(args->at(i)); + frame_->SpillTop(); } // Record the position for debugging purposes. diff --git a/src/x64/virtual-frame-x64.h b/src/x64/virtual-frame-x64.h index 529f47a82c..81d49b0200 100644 --- a/src/x64/virtual-frame-x64.h +++ b/src/x64/virtual-frame-x64.h @@ -145,6 +145,9 @@ class VirtualFrame : public ZoneObject { // (ie, they all have frame-external references). Register SpillAnyRegister(); + // Spill the top element of the frame to memory. + void SpillTop() { SpillElementAt(element_count() - 1); } + // Sync the range of elements in [begin, end] with memory. void SyncRange(int begin, int end);