Index: src/hydrogen.h |
diff --git a/src/hydrogen.h b/src/hydrogen.h |
index 5611d8da182505fe64167816466e847bf4b5094c..91f3c9e2d632d8b20eee26627aadb35c1749b6a8 100644 |
--- a/src/hydrogen.h |
+++ b/src/hydrogen.h |
@@ -557,29 +557,10 @@ class AstContext { |
bool IsValue() const { return kind_ == Expression::kValue; } |
bool IsTest() const { return kind_ == Expression::kTest; } |
- // 'Fill' this context with a hydrogen value. The value is assumed to |
- // have already been inserted in the instruction stream (or not need to |
- // be, e.g., HPhi). Call this function in tail position in the Visit |
- // functions for expressions. |
- virtual void ReturnValue(HValue* value) = 0; |
- |
- // Add a hydrogen instruction to the instruction stream (recording an |
- // environment simulation if necessary) and then fill this context with |
- // the instruction as value. |
- virtual void ReturnInstruction(HInstruction* instr, int ast_id) = 0; |
- |
protected: |
AstContext(HGraphBuilder* owner, Expression::Context kind); |
virtual ~AstContext(); |
- HGraphBuilder* owner() const { return owner_; } |
- |
- // We want to be able to assert, in a context-specific way, that the stack |
- // height makes sense when the context is filled. |
-#ifdef DEBUG |
- int original_count_; |
-#endif |
- |
private: |
HGraphBuilder* owner_; |
Expression::Context kind_; |
@@ -592,10 +573,6 @@ class EffectContext: public AstContext { |
explicit EffectContext(HGraphBuilder* owner) |
: AstContext(owner, Expression::kEffect) { |
} |
- virtual ~EffectContext(); |
- |
- virtual void ReturnValue(HValue* value); |
- virtual void ReturnInstruction(HInstruction* instr, int ast_id); |
}; |
@@ -604,10 +581,6 @@ class ValueContext: public AstContext { |
explicit ValueContext(HGraphBuilder* owner) |
: AstContext(owner, Expression::kValue) { |
} |
- virtual ~ValueContext(); |
- |
- virtual void ReturnValue(HValue* value); |
- virtual void ReturnInstruction(HInstruction* instr, int ast_id); |
}; |
@@ -625,9 +598,6 @@ class TestContext: public AstContext { |
invert_false_(invert_false) { |
} |
- virtual void ReturnValue(HValue* value); |
- virtual void ReturnInstruction(HInstruction* instr, int ast_id); |
- |
static TestContext* cast(AstContext* context) { |
ASSERT(context->IsTest()); |
return reinterpret_cast<TestContext*>(context); |
@@ -640,10 +610,6 @@ class TestContext: public AstContext { |
bool invert_false() { return invert_false_; } |
private: |
- // Build the shared core part of the translation unpacking a value into |
- // control flow. |
- void BuildBranch(HValue* value); |
- |
HBasicBlock* if_true_; |
HBasicBlock* if_false_; |
bool invert_true_; |
@@ -665,25 +631,9 @@ class HGraphBuilder: public AstVisitor { |
HGraph* CreateGraph(CompilationInfo* info); |
- // Simple accessors. |
- HGraph* graph() const { return graph_; } |
- HSubgraph* subgraph() const { return current_subgraph_; } |
- |
- HEnvironment* environment() const { return subgraph()->environment(); } |
- HBasicBlock* CurrentBlock() const { return subgraph()->exit_block(); } |
- |
- // Adding instructions. |
- HInstruction* AddInstruction(HInstruction* instr); |
- void AddSimulate(int id); |
- |
- // Bailout environment manipulation. |
- void Push(HValue* value) { environment()->Push(value); } |
- HValue* Pop() { return environment()->Pop(); } |
- |
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)(int argument_count); |
// Forward declarations for inner scope classes. |
class SubgraphScope; |
@@ -700,14 +650,19 @@ class HGraphBuilder: public AstVisitor { |
// Simple accessors. |
TypeFeedbackOracle* oracle() const { return oracle_; } |
+ HGraph* graph() const { return graph_; } |
+ HSubgraph* subgraph() const { return current_subgraph_; } |
AstContext* ast_context() const { return ast_context_; } |
void set_ast_context(AstContext* context) { ast_context_ = context; } |
AstContext* call_context() const { return call_context_; } |
HBasicBlock* function_return() const { return function_return_; } |
+ HEnvironment* environment() const { return subgraph()->environment(); } |
+ |
+ HBasicBlock* CurrentBlock() const { return subgraph()->exit_block(); } |
// Generators for inline runtime functions. |
-#define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize) \ |
- void Generate##Name(int argument_count, int ast_id); |
+#define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize) \ |
+ void Generate##Name(int argument_count); |
INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) |
INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) |
@@ -728,6 +683,8 @@ class HGraphBuilder: public AstVisitor { |
HSubgraph* true_graph, |
HSubgraph* false_graph); |
+ void Push(HValue* value) { environment()->Push(value); } |
+ HValue* Pop() { return environment()->Pop(); } |
HValue* Top() const { return environment()->Top(); } |
void Drop(int n) { environment()->Drop(n); } |
void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } |
@@ -751,15 +708,18 @@ class HGraphBuilder: public AstVisitor { |
HValue* VisitArgument(Expression* expr); |
void VisitArgumentList(ZoneList<Expression*>* arguments); |
+ HInstruction* AddInstruction(HInstruction* instr); |
+ void AddSimulate(int id); |
void AddPhi(HPhi* phi); |
void PushAndAdd(HInstruction* instr); |
+ void PushAndAdd(HInstruction* instr, int position); |
void PushArgumentsForStubCall(int argument_count); |
- // Remove the arguments from the bailout environment and emit instructions |
- // to push them as outgoing parameters. |
- void ProcessCall(HCall* call); |
+ // Initialize the arguments to the call based on then environment, add it |
+ // to the graph, and drop the arguments from the environment. |
+ void ProcessCall(HCall* call, int source_position); |
void AssumeRepresentation(HValue* value, Representation r); |
static Representation ToRepresentation(TypeInfo info); |
@@ -783,7 +743,7 @@ class HGraphBuilder: public AstVisitor { |
FunctionLiteral* function); |
// Helpers for flow graph construction. |
- void LookupGlobalPropertyCell(Variable* var, |
+ void LookupGlobalPropertyCell(VariableProxy* expr, |
LookupResult* lookup, |
bool is_store); |
@@ -793,11 +753,10 @@ class HGraphBuilder: public AstVisitor { |
bool TryMathFunctionInline(Call* expr); |
void TraceInline(Handle<JSFunction> target, bool result); |
- void HandleGlobalVariableAssignment(Variable* var, |
+ void HandleGlobalVariableAssignment(VariableProxy* proxy, |
HValue* value, |
- int position, |
- int ast_id); |
- |
+ int position); |
+ void HandleGlobalVariableLoad(VariableProxy* expr); |
void HandlePropertyAssignment(Assignment* expr); |
void HandleCompoundAssignment(Assignment* expr); |
void HandlePolymorphicLoadNamedField(Property* expr, |