Shorten live ranges for arguments to runtime calls.

Before, the live ranges of the arguments extended to the call itself, and
they were pushed immediately before the call.  Now, they are spilled eagerly
as soon as their value is available and they are spilled to the right place.

The inlined runtime calls in the optimized backend are changed to work as in
all the other backends: they get their arguments untranslated and can choose
their own custom evaluation order.

Review URL: http://codereview.chromium.org/6526047

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6876 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4e6635ad
......@@ -1049,7 +1049,9 @@ class HLeaveInlined: public HInstruction {
class HPushArgument: public HUnaryOperation {
public:
explicit HPushArgument(HValue* value) : HUnaryOperation(value) { }
explicit HPushArgument(HValue* value) : HUnaryOperation(value) {
set_representation(Representation::Tagged());
}
virtual Representation RequiredInputRepresentation(int index) const {
return Representation::Tagged();
......
This diff is collapsed.
......@@ -647,8 +647,7 @@ class HGraphBuilder: public AstVisitor {
private:
// Type of a member function that generates inline code for a native function.
typedef void (HGraphBuilder::*InlineFunctionGenerator)(int argument_count,
int ast_id);
typedef void (HGraphBuilder::*InlineFunctionGenerator)(CallRuntime* call);
// Forward declarations for inner scope classes.
class SubgraphScope;
......@@ -672,7 +671,7 @@ class HGraphBuilder: public AstVisitor {
// Generators for inline runtime functions.
#define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize) \
void Generate##Name(int argument_count, int ast_id);
void Generate##Name(CallRuntime* call);
INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION)
INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION)
......@@ -699,10 +698,14 @@ class HGraphBuilder: public AstVisitor {
HBasicBlock* true_block,
HBasicBlock* false_block);
// Visit an argument subexpression.
// Visit an argument subexpression and emit a push to the outgoing
// arguments.
void VisitArgument(Expression* expr);
void VisitArgumentList(ZoneList<Expression*>* arguments);
// Visit a list of expressions from left to right, each in a value context.
void VisitExpressions(ZoneList<Expression*>* exprs);
void AddPhi(HPhi* phi);
void PushAndAdd(HInstruction* instr);
......
......@@ -536,10 +536,12 @@ class ShallowIterator BASE_EMBEDDED {
inline LEnvironment* env() { return env_; }
private:
inline bool ShouldSkip(LOperand* op) {
return op == NULL || op->IsConstantOperand() || op->IsArgument();
}
inline int AdvanceToNext(int start) {
while (start < limit_ &&
(env_->values()->at(start) == NULL ||
env_->values()->at(start)->IsConstantOperand())) {
while (start < limit_ && ShouldSkip(env_->values()->at(start))) {
start++;
}
return start;
......
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