Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Unified Diff: src/crankshaft/hydrogen.h

Issue 1782743003: [crankshaft] Support inlining of function calls in tail position (in ES6 sense). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@tco-crank-4
Patch Set: ppc, s390 and x87 ports Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/crankshaft/arm64/lithium-arm64.cc ('k') | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/crankshaft/arm64/lithium-arm64.cc ('k') | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698