Commit cd6afbc6 authored by whesse@chromium.org's avatar whesse@chromium.org

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
parent b46757a4
...@@ -2981,6 +2981,7 @@ void CodeGenerator::CallWithArguments(ZoneList<Expression*>* args, ...@@ -2981,6 +2981,7 @@ void CodeGenerator::CallWithArguments(ZoneList<Expression*>* args,
int arg_count = args->length(); int arg_count = args->length();
for (int i = 0; i < arg_count; i++) { for (int i = 0; i < arg_count; i++) {
Load(args->at(i)); Load(args->at(i));
frame_->SpillTop();
} }
// Record the position for debugging purposes. // Record the position for debugging purposes.
...@@ -5732,6 +5733,7 @@ void CodeGenerator::VisitCall(Call* node) { ...@@ -5732,6 +5733,7 @@ void CodeGenerator::VisitCall(Call* node) {
int arg_count = args->length(); int arg_count = args->length();
for (int i = 0; i < arg_count; i++) { for (int i = 0; i < arg_count; i++) {
Load(args->at(i)); Load(args->at(i));
frame_->SpillTop();
} }
// Prepare the stack for the call to ResolvePossiblyDirectEval. // Prepare the stack for the call to ResolvePossiblyDirectEval.
...@@ -5781,6 +5783,7 @@ void CodeGenerator::VisitCall(Call* node) { ...@@ -5781,6 +5783,7 @@ void CodeGenerator::VisitCall(Call* node) {
int arg_count = args->length(); int arg_count = args->length();
for (int i = 0; i < arg_count; i++) { for (int i = 0; i < arg_count; i++) {
Load(args->at(i)); Load(args->at(i));
frame_->SpillTop();
} }
// Push the name of the function onto the frame. // Push the name of the function onto the frame.
...@@ -5886,6 +5889,7 @@ void CodeGenerator::VisitCall(Call* node) { ...@@ -5886,6 +5889,7 @@ void CodeGenerator::VisitCall(Call* node) {
int arg_count = args->length(); int arg_count = args->length();
for (int i = 0; i < arg_count; i++) { for (int i = 0; i < arg_count; i++) {
Load(args->at(i)); Load(args->at(i));
frame_->SpillTop();
} }
// Push the name of the function onto the frame. // Push the name of the function onto the frame.
......
...@@ -144,6 +144,9 @@ class VirtualFrame: public ZoneObject { ...@@ -144,6 +144,9 @@ class VirtualFrame: public ZoneObject {
// (ie, they all have frame-external references). // (ie, they all have frame-external references).
Register SpillAnyRegister(); 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. // Sync the range of elements in [begin, end] with memory.
void SyncRange(int begin, int end); void SyncRange(int begin, int end);
......
...@@ -2801,6 +2801,7 @@ void CodeGenerator::VisitCall(Call* node) { ...@@ -2801,6 +2801,7 @@ void CodeGenerator::VisitCall(Call* node) {
int arg_count = args->length(); int arg_count = args->length();
for (int i = 0; i < arg_count; i++) { for (int i = 0; i < arg_count; i++) {
Load(args->at(i)); Load(args->at(i));
frame_->SpillTop();
} }
// Prepare the stack for the call to ResolvePossiblyDirectEval. // Prepare the stack for the call to ResolvePossiblyDirectEval.
...@@ -2850,6 +2851,7 @@ void CodeGenerator::VisitCall(Call* node) { ...@@ -2850,6 +2851,7 @@ void CodeGenerator::VisitCall(Call* node) {
int arg_count = args->length(); int arg_count = args->length();
for (int i = 0; i < arg_count; i++) { for (int i = 0; i < arg_count; i++) {
Load(args->at(i)); Load(args->at(i));
frame_->SpillTop();
} }
// Push the name of the function on the frame. // Push the name of the function on the frame.
...@@ -2955,6 +2957,7 @@ void CodeGenerator::VisitCall(Call* node) { ...@@ -2955,6 +2957,7 @@ void CodeGenerator::VisitCall(Call* node) {
int arg_count = args->length(); int arg_count = args->length();
for (int i = 0; i < arg_count; i++) { for (int i = 0; i < arg_count; i++) {
Load(args->at(i)); Load(args->at(i));
frame_->SpillTop();
} }
// Push the name of the function onto the frame. // Push the name of the function onto the frame.
...@@ -8902,6 +8905,7 @@ void CodeGenerator::CallWithArguments(ZoneList<Expression*>* args, ...@@ -8902,6 +8905,7 @@ void CodeGenerator::CallWithArguments(ZoneList<Expression*>* args,
int arg_count = args->length(); int arg_count = args->length();
for (int i = 0; i < arg_count; i++) { for (int i = 0; i < arg_count; i++) {
Load(args->at(i)); Load(args->at(i));
frame_->SpillTop();
} }
// Record the position for debugging purposes. // Record the position for debugging purposes.
......
...@@ -145,6 +145,9 @@ class VirtualFrame : public ZoneObject { ...@@ -145,6 +145,9 @@ class VirtualFrame : public ZoneObject {
// (ie, they all have frame-external references). // (ie, they all have frame-external references).
Register SpillAnyRegister(); 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. // Sync the range of elements in [begin, end] with memory.
void SyncRange(int begin, int end); void SyncRange(int begin, int end);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment