Chromium Code Reviews| Index: src/hydrogen.h |
| diff --git a/src/hydrogen.h b/src/hydrogen.h |
| index 7e09505d7261c6710d24c2e5fd268316c37c5992..d9597ce2004a356eba37ea8b3235613892c1d9ee 100644 |
| --- a/src/hydrogen.h |
| +++ b/src/hydrogen.h |
| @@ -337,19 +337,19 @@ class HGraph: public ZoneObject { |
| Zone* HBasicBlock::zone() { return graph_->zone(); } |
| +// XXX |
|
Vyacheslav Egorov (Chromium)
2012/02/13 15:01:39
XXX?
Michael Starzinger
2012/02/27 14:16:32
Done. Ooops.
|
| +enum FrameType { JS_FUNCTION, JS_CONSTRUCT, ARGUMENTS_ADAPTOR }; |
| + |
| + |
| class HEnvironment: public ZoneObject { |
| public: |
| HEnvironment(HEnvironment* outer, |
| Scope* scope, |
| Handle<JSFunction> closure); |
| - bool is_arguments_adaptor() const { |
| - return arguments_adaptor_; |
| - } |
| - |
| HEnvironment* DiscardInlined(bool drop_extra) { |
| - HEnvironment* outer = outer_->is_arguments_adaptor() ? |
| - outer_->outer_ : outer_; |
| + HEnvironment* outer = outer_; |
| + while (outer->frame_type() != JS_FUNCTION) outer = outer->outer_; |
| if (drop_extra) outer->Drop(1); |
| return outer; |
| } |
| @@ -360,6 +360,7 @@ class HEnvironment: public ZoneObject { |
| const ZoneList<int>* assigned_variables() const { |
| return &assigned_variables_; |
| } |
| + FrameType frame_type() const { return frame_type_; } |
| int parameter_count() const { return parameter_count_; } |
| int specials_count() const { return specials_count_; } |
| int local_count() const { return local_count_; } |
| @@ -441,7 +442,8 @@ class HEnvironment: public ZoneObject { |
| int arguments, |
| FunctionLiteral* function, |
| HConstant* undefined, |
| - CallKind call_kind) const; |
| + CallKind call_kind, |
| + bool is_construct) const; |
| void AddIncomingEdge(HBasicBlock* block, HEnvironment* other); |
| @@ -465,6 +467,8 @@ class HEnvironment: public ZoneObject { |
| // Create an argument adaptor environment. |
| HEnvironment(HEnvironment* outer, Handle<JSFunction> closure, int arguments); |
| + // Create an constructor stub environment. |
| + HEnvironment(HEnvironment* outer, Handle<JSFunction> closure); |
| // True if index is included in the expression stack part of the environment. |
| bool HasExpressionAt(int index) const; |
| @@ -487,6 +491,7 @@ class HEnvironment: public ZoneObject { |
| // Value array [parameters] [specials] [locals] [temporaries]. |
| ZoneList<HValue*> values_; |
| ZoneList<int> assigned_variables_; |
| + FrameType frame_type_; |
| int parameter_count_; |
| int specials_count_; |
| int local_count_; |
| @@ -494,7 +499,6 @@ class HEnvironment: public ZoneObject { |
| int pop_count_; |
| int push_count_; |
| int ast_id_; |
| - bool arguments_adaptor_; |
| }; |
| @@ -627,13 +631,15 @@ class FunctionState { |
| FunctionState(HGraphBuilder* owner, |
| CompilationInfo* info, |
| TypeFeedbackOracle* oracle, |
| - bool drop_extra); |
| + bool drop_extra, |
| + bool is_construct); |
| ~FunctionState(); |
| CompilationInfo* compilation_info() { return compilation_info_; } |
| TypeFeedbackOracle* oracle() { return oracle_; } |
| AstContext* call_context() { return call_context_; } |
| bool drop_extra() { return drop_extra_; } |
| + bool is_construct() { return is_construct_; } |
| HBasicBlock* function_return() { return function_return_; } |
| TestContext* test_context() { return test_context_; } |
| void ClearInlinedTestContext() { |
| @@ -657,6 +663,10 @@ class FunctionState { |
| // return from inlined functions. |
| bool drop_extra_; |
| + // Indicate if we are inlining a constructor call and need to perform |
| + // special handling of the return value. |
| + bool is_construct_; |
| + |
| // When inlining in an effect of value context, this is the return block. |
| // It is NULL otherwise. When inlining in a test context, there are a |
| // pair of return blocks in the context. When not inlining, there is no |
| @@ -789,7 +799,6 @@ class HGraphBuilder: public AstVisitor { |
| CompilationInfo* info() const { |
| return function_state()->compilation_info(); |
| } |
| - |
| AstContext* call_context() const { |
| return function_state()->call_context(); |
| } |
| @@ -917,7 +926,17 @@ class HGraphBuilder: public AstVisitor { |
| // Try to optimize fun.apply(receiver, arguments) pattern. |
| bool TryCallApply(Call* expr); |
| - bool TryInline(Call* expr, bool drop_extra = false); |
| + bool TryInline(CallKind call_kind, |
| + Handle<JSFunction> target, |
| + ZoneList<Expression*>* arguments, |
| + HValue* receiver, |
| + int ast_id, |
| + int return_id, |
| + bool drop_extra, |
| + bool is_construct); |
| + |
| + bool TryInlineCall(Call* expr, bool drop_extra = false); |
| + bool TryInlineConstruct(CallNew* expr, HValue* receiver); |
| bool TryInlineBuiltinFunction(Call* expr, |
| HValue* receiver, |
| Handle<Map> receiver_map, |