Revision: 4552
Author: [email protected]
Date: Fri Apr 30 01:40:31 2010
Log: Cut-and-paste port from ia32 to x64: Delay load of trivial left
operand of binary operation until after right operand loaded.
Review URL: http://codereview.chromium.org/1736023
http://code.google.com/p/v8/source/detail?r=4552
Modified:
/branches/bleeding_edge/src/x64/codegen-x64.cc
/branches/bleeding_edge/src/x64/virtual-frame-x64.cc
/branches/bleeding_edge/src/x64/virtual-frame-x64.h
=======================================
--- /branches/bleeding_edge/src/x64/codegen-x64.cc Thu Apr 29 08:14:39 2010
+++ /branches/bleeding_edge/src/x64/codegen-x64.cc Fri Apr 30 01:40:31 2010
@@ -3531,8 +3531,15 @@
overwrite_mode = OVERWRITE_RIGHT;
}
- Load(node->left());
- Load(node->right());
+ if (node->left()->IsTrivial()) {
+ Load(node->right());
+ Result right = frame_->Pop();
+ frame_->Push(node->left());
+ frame_->Push(&right);
+ } else {
+ Load(node->left());
+ Load(node->right());
+ }
GenericBinaryOperation(node->op(), node->type(), overwrite_mode);
}
}
=======================================
--- /branches/bleeding_edge/src/x64/virtual-frame-x64.cc Mon Apr 12
00:05:24 2010
+++ /branches/bleeding_edge/src/x64/virtual-frame-x64.cc Fri Apr 30
01:40:31 2010
@@ -224,6 +224,31 @@
stack_pointer_++;
__ PushRoot(index);
}
+
+
+void VirtualFrame::Push(Expression* expr) {
+ ASSERT(expr->IsTrivial());
+
+ Literal* lit = expr->AsLiteral();
+ if (lit != NULL) {
+ Push(lit->handle());
+ return;
+ }
+
+ VariableProxy* proxy = expr->AsVariableProxy();
+ if (proxy != NULL) {
+ Slot* slot = proxy->var()->slot();
+ if (slot->type() == Slot::LOCAL) {
+ PushLocalAt(slot->index());
+ return;
+ }
+ if (slot->type() == Slot::PARAMETER) {
+ PushParameterAt(slot->index());
+ return;
+ }
+ }
+ UNREACHABLE();
+}
void VirtualFrame::Drop(int count) {
=======================================
--- /branches/bleeding_edge/src/x64/virtual-frame-x64.h Mon Apr 12 00:05:24
2010
+++ /branches/bleeding_edge/src/x64/virtual-frame-x64.h Fri Apr 30 01:40:31
2010
@@ -414,6 +414,10 @@
}
result->Unuse();
}
+
+ // Pushing an expression expects that the expression is trivial
(according
+ // to Expression::IsTrivial).
+ void Push(Expression* expr);
// Nip removes zero or more elements from immediately below the top
// of the frame, leaving the previous top-of-frame value on top of
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev