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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1222843004: [turbofan] Unify various bailout hacks for super call. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-frame-constants-1
Patch Set: Fix throwing of reference error. Created 5 years, 5 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/compiler/ast-graph-builder.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index e802cd8399682122e6fbd1bfc64749f036551bbc..b11e2a8bee4c7d982e8ffc7828344de469a2a772 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -2535,15 +2535,21 @@ void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
return VisitCallJSRuntime(expr);
}
+ // TODO(mstarzinger): This bailout is a gigantic hack, the owner is ashamed.
+ if (function->function_id == Runtime::kInlineGeneratorNext ||
+ function->function_id == Runtime::kInlineGeneratorThrow ||
+ function->function_id == Runtime::kInlineDefaultConstructorCallSuper ||
+ function->function_id == Runtime::kInlineCallSuperWithSpread) {
+ ast_context()->ProduceValue(jsgraph()->TheHoleConstant());
+ return SetStackOverflow();
+ }
+
// Evaluate all arguments to the runtime call.
ZoneList<Expression*>* args = expr->arguments();
VisitForValues(args);
// Create node to perform the runtime call.
Runtime::FunctionId functionId = function->function_id;
- // TODO(mstarzinger): This bailout is a gigantic hack, the owner is ashamed.
- if (functionId == Runtime::kInlineGeneratorNext) SetStackOverflow();
- if (functionId == Runtime::kInlineGeneratorThrow) SetStackOverflow();
const Operator* call = javascript()->CallRuntime(functionId, args->length());
FrameStateBeforeAndAfter states(this, expr->CallId());
Node* value = ProcessArguments(call, args->length());
@@ -2816,7 +2822,10 @@ void AstGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
}
-void AstGraphBuilder::VisitSpread(Spread* expr) { UNREACHABLE(); }
+void AstGraphBuilder::VisitSpread(Spread* expr) {
+ // Handled entirely by the parser itself.
+ UNREACHABLE();
+}
void AstGraphBuilder::VisitThisFunction(ThisFunction* expr) {
@@ -2827,20 +2836,21 @@ void AstGraphBuilder::VisitThisFunction(ThisFunction* expr) {
void AstGraphBuilder::VisitSuperPropertyReference(
SuperPropertyReference* expr) {
- // TODO(turbofan): Implement super here.
- SetStackOverflow();
- ast_context()->ProduceValue(jsgraph()->UndefinedConstant());
+ Node* value = BuildThrowUnsupportedSuperError(expr->id());
arv (Not doing code reviews) 2015/07/07 15:48:09 Shouldn't this be UNREACHABLE? We are supposed to
Michael Starzinger 2015/07/07 15:59:58 Yeah, I though so too. Please admire patch set #1
arv (Not doing code reviews) 2015/07/07 16:04:43 I see. This one comes from delete (super.prop)
+ ast_context()->ProduceValue(value);
}
void AstGraphBuilder::VisitSuperCallReference(SuperCallReference* expr) {
- // TODO(turbofan): Implement super here.
- SetStackOverflow();
- ast_context()->ProduceValue(jsgraph()->UndefinedConstant());
+ Node* value = BuildThrowUnsupportedSuperError(expr->id());
arv (Not doing code reviews) 2015/07/07 15:48:09 Same here. I don't see how these errors can ever b
Michael Starzinger 2015/07/07 15:59:58 Likewise.
arv (Not doing code reviews) 2015/07/07 16:04:43 This one on the other hand I don't think we can ge
+ ast_context()->ProduceValue(value);
}
-void AstGraphBuilder::VisitCaseClause(CaseClause* expr) { UNREACHABLE(); }
+void AstGraphBuilder::VisitCaseClause(CaseClause* expr) {
+ // Handled entirely in VisitSwitch.
+ UNREACHABLE();
+}
void AstGraphBuilder::VisitDeclarations(ZoneList<Declaration*>* declarations) {
@@ -3271,9 +3281,12 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
}
} else if (mode == LET || mode == CONST) {
// Perform check for uninitialized let/const variables.
+ // TODO(mstarzinger): For now we cannot use the below optimization for
+ // the {this} parameter, because JSConstructStubForDerived magically
+ // passes {the_hole} as a receiver.
if (value->op() == the_hole->op()) {
value = BuildThrowReferenceError(variable, bailout_id);
- } else if (value->opcode() == IrOpcode::kPhi) {
+ } else if (value->opcode() == IrOpcode::kPhi || variable->is_this()) {
value = BuildHoleCheckThrow(value, variable, value, bailout_id);
}
}
@@ -3790,6 +3803,17 @@ Node* AstGraphBuilder::BuildThrowStaticPrototypeError(BailoutId bailout_id) {
}
+Node* AstGraphBuilder::BuildThrowUnsupportedSuperError(BailoutId bailout_id) {
+ const Operator* op =
+ javascript()->CallRuntime(Runtime::kThrowUnsupportedSuperError, 0);
+ Node* call = NewNode(op);
+ PrepareFrameState(call, bailout_id);
+ Node* control = NewNode(common()->Throw(), call);
+ UpdateControlDependencyToLeaveFunction(control);
+ return call;
+}
+
+
Node* AstGraphBuilder::BuildReturn(Node* return_value) {
Node* control = NewNode(common()->Return(), return_value);
UpdateControlDependencyToLeaveFunction(control);
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698