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

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

Issue 1895973002: Remove all non-function-name uses of CONST_LEGACY (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix ignition Created 4 years, 8 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/ast/variables.cc ('k') | src/contexts.h » ('j') | src/globals.h » ('J')
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 26d078a322c0be84dca74699ba889bcf109e13f1..e8085a34f0cd8391eaedb5f15e4914ea3a763b1a 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -1083,7 +1083,7 @@ void AstGraphBuilder::Visit(Expression* expr) {
void AstGraphBuilder::VisitVariableDeclaration(VariableDeclaration* decl) {
Variable* variable = decl->proxy()->var();
VariableMode mode = decl->mode();
- bool hole_init = mode == CONST || mode == CONST_LEGACY || mode == LET;
+ bool hole_init = mode == CONST || mode == LET;
switch (variable->location()) {
case VariableLocation::GLOBAL:
case VariableLocation::UNALLOCATED: {
@@ -3376,15 +3376,7 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
case VariableLocation::LOCAL: {
// Local var, const, or let variable.
Node* value = environment()->Lookup(variable);
- if (mode == CONST_LEGACY) {
- // Perform check for uninitialized legacy const variables.
- if (value->op() == the_hole->op()) {
- value = jsgraph()->UndefinedConstant();
- } else if (value->opcode() == IrOpcode::kPhi) {
- Node* undefined = jsgraph()->UndefinedConstant();
- value = BuildHoleCheckSilent(value, undefined, value);
Michael Starzinger 2016/04/18 22:49:16 There should be no more call-sites of BuildHoleChe
adamk 2016/04/18 23:15:34 Done. Also removed a few analogous bits from hydro
- }
- } else if (mode == LET || mode == CONST) {
+ if (mode == LET || mode == CONST) {
// Perform check for uninitialized let/const variables.
if (value->op() == the_hole->op()) {
value = BuildThrowReferenceError(variable, bailout_id);
@@ -3404,11 +3396,7 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
// TODO(titzer): initialization checks are redundant for already
// initialized immutable context loads, but only specialization knows.
// Maybe specializer should be a parameter to the graph builder?
- if (mode == CONST_LEGACY) {
- // Perform check for uninitialized legacy const variables.
- Node* undefined = jsgraph()->UndefinedConstant();
- value = BuildHoleCheckSilent(value, undefined, value);
- } else if (mode == LET || mode == CONST) {
+ if (mode == LET || mode == CONST) {
// Perform check for uninitialized let/const variables.
value = BuildHoleCheckThenThrow(value, variable, value, bailout_id);
}
@@ -3485,13 +3473,7 @@ Node* AstGraphBuilder::BuildVariableAssignment(
case VariableLocation::PARAMETER:
case VariableLocation::LOCAL:
// Local var, const, or let variable.
- if (mode == CONST_LEGACY && op == Token::INIT) {
- // Perform an initialization check for legacy const variables.
- Node* current = environment()->Lookup(variable);
- if (current->op() != the_hole->op()) {
- value = BuildHoleCheckSilent(current, value, current);
- }
- } else if (mode == CONST_LEGACY && op != Token::INIT) {
+ if (mode == CONST_LEGACY && op != Token::INIT) {
// Non-initializing assignment to legacy const is
// - exception in strict mode.
// - ignored in sloppy mode.
@@ -3536,13 +3518,7 @@ Node* AstGraphBuilder::BuildVariableAssignment(
case VariableLocation::CONTEXT: {
// Context variable (potentially up the context chain).
int depth = current_scope()->ContextChainLength(variable->scope());
- if (mode == CONST_LEGACY && op == Token::INIT) {
- // Perform an initialization check for legacy const variables.
- const Operator* op =
- javascript()->LoadContext(depth, variable->index(), false);
- Node* current = NewNode(op, current_context());
- value = BuildHoleCheckSilent(current, value, current);
- } else if (mode == CONST_LEGACY && op != Token::INIT) {
+ if (mode == CONST_LEGACY && op != Token::INIT) {
// Non-initializing assignment to legacy const is
// - exception in strict mode.
// - ignored in sloppy mode.
@@ -3580,8 +3556,6 @@ Node* AstGraphBuilder::BuildVariableAssignment(
case VariableLocation::LOOKUP: {
// Dynamic lookup of context variable (anywhere in the chain).
Handle<Name> name = variable->name();
- // TODO(mstarzinger): Use Runtime::kInitializeLegacyConstLookupSlot for
- // initializations of const declarations.
Node* store = BuildDynamicStore(name, value);
PrepareFrameState(store, bailout_id, combine);
return store;
« no previous file with comments | « src/ast/variables.cc ('k') | src/contexts.h » ('j') | src/globals.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698