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

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 1964993002: [cleanup] Global variable declarations are never hole initialized (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/crankshaft/hydrogen.h" 5 #include "src/crankshaft/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/allocation-site-scopes.h" 9 #include "src/allocation-site-scopes.h"
10 #include "src/ast/ast-numbering.h" 10 #include "src/ast/ast-numbering.h"
(...skipping 12316 matching lines...) Expand 10 before | Expand all | Expand 10 after
12327 12327
12328 void HOptimizedGraphBuilder::VisitVariableDeclaration( 12328 void HOptimizedGraphBuilder::VisitVariableDeclaration(
12329 VariableDeclaration* declaration) { 12329 VariableDeclaration* declaration) {
12330 VariableProxy* proxy = declaration->proxy(); 12330 VariableProxy* proxy = declaration->proxy();
12331 VariableMode mode = declaration->mode(); 12331 VariableMode mode = declaration->mode();
12332 Variable* variable = proxy->var(); 12332 Variable* variable = proxy->var();
12333 bool hole_init = mode == LET || mode == CONST; 12333 bool hole_init = mode == LET || mode == CONST;
12334 switch (variable->location()) { 12334 switch (variable->location()) {
12335 case VariableLocation::GLOBAL: 12335 case VariableLocation::GLOBAL:
12336 case VariableLocation::UNALLOCATED: 12336 case VariableLocation::UNALLOCATED:
12337 DCHECK(!variable->binding_needs_init());
12337 globals_.Add(variable->name(), zone()); 12338 globals_.Add(variable->name(), zone());
12338 globals_.Add(variable->binding_needs_init() 12339 globals_.Add(isolate()->factory()->undefined_value(), zone());
12339 ? isolate()->factory()->the_hole_value()
12340 : isolate()->factory()->undefined_value(), zone());
12341 return; 12340 return;
12342 case VariableLocation::PARAMETER: 12341 case VariableLocation::PARAMETER:
12343 case VariableLocation::LOCAL: 12342 case VariableLocation::LOCAL:
12344 if (hole_init) { 12343 if (hole_init) {
12345 HValue* value = graph()->GetConstantHole(); 12344 HValue* value = graph()->GetConstantHole();
12346 environment()->Bind(variable, value); 12345 environment()->Bind(variable, value);
12347 } 12346 }
12348 break; 12347 break;
12349 case VariableLocation::CONTEXT: 12348 case VariableLocation::CONTEXT:
12350 if (hole_init) { 12349 if (hole_init) {
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after
13784 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13783 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13785 } 13784 }
13786 13785
13787 #ifdef DEBUG 13786 #ifdef DEBUG
13788 graph_->Verify(false); // No full verify. 13787 graph_->Verify(false); // No full verify.
13789 #endif 13788 #endif
13790 } 13789 }
13791 13790
13792 } // namespace internal 13791 } // namespace internal
13793 } // namespace v8 13792 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698