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

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

Issue 1178903003: Add script context with context-allocated "const this" (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Add test Created 5 years, 6 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/bootstrapper.cc ('k') | src/hydrogen.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 43d402094539cfae9c31dd3f2f3395888a17db86..cf7bbc99a52a8e830c5b3b5d78fd6e8635649402 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -2420,37 +2420,17 @@ void AstGraphBuilder::VisitCall(Call* expr) {
// Create node to ask for help resolving potential eval call. This will
// provide a fully resolved callee and the corresponding receiver.
Node* function = GetFunctionClosure();
- // TODO(wingo): ResolvePossibleDirectEval doesn't really need a receiver,
- // now that eval scopes don't have "this" declarations. Remove this hack
- // once ResolvePossibleDirectEval changes.
- Node* receiver;
- {
- Variable* variable = info()->scope()->LookupThis();
- if (variable->IsStackAllocated()) {
- receiver = environment()->Lookup(variable);
- } else {
- DCHECK(variable->IsContextSlot());
- int depth = current_scope()->ContextChainLength(variable->scope());
- bool immutable = variable->maybe_assigned() == kNotAssigned;
- const Operator* op =
- javascript()->LoadContext(depth, variable->index(), immutable);
- receiver = NewNode(op, current_context());
- }
- }
Node* language = jsgraph()->Constant(language_mode());
Node* position = jsgraph()->Constant(current_scope()->start_position());
const Operator* op =
- javascript()->CallRuntime(Runtime::kResolvePossiblyDirectEval, 6);
- Node* pair =
- NewNode(op, callee, source, function, receiver, language, position);
- PrepareFrameState(pair, expr->EvalOrLookupId(),
+ javascript()->CallRuntime(Runtime::kResolvePossiblyDirectEval, 5);
+ Node* new_callee =
+ NewNode(op, callee, source, function, language, position);
+ PrepareFrameState(new_callee, expr->EvalOrLookupId(),
OutputFrameStateCombine::PokeAt(arg_count + 1));
- Node* new_callee = NewNode(common()->Projection(0), pair);
- Node* new_receiver = NewNode(common()->Projection(1), pair);
- // Patch callee and receiver on the environment.
+ // Patch callee on the environment.
environment()->Poke(arg_count + 1, new_callee);
- environment()->Poke(arg_count + 0, new_receiver);
}
// Create node to perform the function call.
@@ -2873,7 +2853,9 @@ void AstGraphBuilder::VisitDelete(UnaryOperation* expr) {
// Delete of an unqualified identifier is only allowed in classic mode but
// deleting "this" is allowed in all language modes.
Variable* variable = expr->expression()->AsVariableProxy()->var();
- DCHECK(is_sloppy(language_mode()) || variable->is_this());
+ // Delete of an unqualified identifier is disallowed in strict mode but
+ // "delete this" is allowed.
+ DCHECK(is_sloppy(language_mode()) || variable->HasThisName(isolate()));
value = BuildVariableDelete(variable, expr->id(),
ast_context()->GetStateCombine());
} else if (expr->expression()->IsProperty()) {
@@ -3321,9 +3303,10 @@ Node* AstGraphBuilder::BuildVariableDelete(Variable* variable,
}
case Variable::PARAMETER:
case Variable::LOCAL:
- case Variable::CONTEXT:
+ case Variable::CONTEXT: {
// Local var, const, or let variable or context variable.
- return jsgraph()->BooleanConstant(variable->is_this());
+ return jsgraph()->BooleanConstant(variable->HasThisName(isolate()));
+ }
case Variable::LOOKUP: {
// Dynamic lookup of context variable (anywhere in the chain).
Node* name = jsgraph()->Constant(variable->name());
« no previous file with comments | « src/bootstrapper.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698