Index: src/crankshaft/hydrogen.h |
diff --git a/src/crankshaft/hydrogen.h b/src/crankshaft/hydrogen.h |
index 857484c0001bc125bf47f3094564f8f320f2e0a8..70bbd3973e0d95b602e9147483da4e231fcc1e70 100644 |
--- a/src/crankshaft/hydrogen.h |
+++ b/src/crankshaft/hydrogen.h |
@@ -501,10 +501,10 @@ enum FrameType { |
JS_GETTER, |
JS_SETTER, |
ARGUMENTS_ADAPTOR, |
+ TAIL_CALLER_FUNCTION, |
STUB |
}; |
- |
class HEnvironment final : public ZoneObject { |
public: |
HEnvironment(HEnvironment* outer, |
@@ -613,15 +613,17 @@ class HEnvironment final : public ZoneObject { |
// Create an "inlined version" of this environment, where the original |
// environment is the outer environment but the top expression stack |
// elements are moved to an inner environment as parameters. |
- HEnvironment* CopyForInlining(Handle<JSFunction> target, |
- int arguments, |
- FunctionLiteral* function, |
- HConstant* undefined, |
- InliningKind inlining_kind) const; |
+ HEnvironment* CopyForInlining(Handle<JSFunction> target, int arguments, |
+ FunctionLiteral* function, HConstant* undefined, |
+ InliningKind inlining_kind, |
+ TailCallMode syntactic_tail_call_mode) const; |
HEnvironment* DiscardInlined(bool drop_extra) { |
HEnvironment* outer = outer_; |
- while (outer->frame_type() != JS_FUNCTION) outer = outer->outer_; |
+ while (outer->frame_type() != JS_FUNCTION && |
+ outer->frame_type() != TAIL_CALLER_FUNCTION) { |
+ outer = outer->outer_; |
+ } |
if (drop_extra) outer->Drop(1); |
return outer; |
} |
@@ -680,6 +682,10 @@ class HEnvironment final : public ZoneObject { |
FrameType frame_type, |
int arguments) const; |
+ // Marks current environment as tail caller by setting frame type to |
+ // TAIL_CALLER_FUNCTION. |
+ void MarkAsTailCaller(); |
+ |
// True if index is included in the expression stack part of the environment. |
bool HasExpressionAt(int index) const; |
@@ -1278,6 +1284,26 @@ class HGraphBuilder { |
return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7, p8)); |
} |
+ template <class I, class P1, class P2, class P3, class P4, class P5, class P6, |
+ class P7, class P8, class P9> |
+ I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9) { |
+ return I::New(isolate(), zone(), context(), p1, p2, p3, p4, p5, p6, p7, p8, |
+ p9); |
+ } |
+ |
+ template <class I, class P1, class P2, class P3, class P4, class P5, class P6, |
+ class P7, class P8, class P9> |
+ HInstruction* AddUncasted(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, |
+ P8 p8, P9 p9) { |
+ return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8, p8)); |
+ } |
+ |
+ template <class I, class P1, class P2, class P3, class P4, class P5, class P6, |
+ class P7, class P8, class P9> |
+ I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9) { |
+ return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7, p8, p9)); |
+ } |
+ |
void AddSimulate(BailoutId id, RemovableSimulate removable = FIXED_SIMULATE); |
// When initializing arrays, we'll unfold the loop if the number of elements |