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

Side by Side Diff: src/full-codegen/x87/full-codegen-x87.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/full-codegen/x64/full-codegen-x64.cc ('k') | src/interpreter/bytecode-generator.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #if V8_TARGET_ARCH_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 // If it was not possible to allocate the variable at compile time, we 705 // If it was not possible to allocate the variable at compile time, we
706 // need to "declare" it at runtime to make sure it actually exists in the 706 // need to "declare" it at runtime to make sure it actually exists in the
707 // local context. 707 // local context.
708 VariableProxy* proxy = declaration->proxy(); 708 VariableProxy* proxy = declaration->proxy();
709 VariableMode mode = declaration->mode(); 709 VariableMode mode = declaration->mode();
710 Variable* variable = proxy->var(); 710 Variable* variable = proxy->var();
711 bool hole_init = mode == LET || mode == CONST; 711 bool hole_init = mode == LET || mode == CONST;
712 switch (variable->location()) { 712 switch (variable->location()) {
713 case VariableLocation::GLOBAL: 713 case VariableLocation::GLOBAL:
714 case VariableLocation::UNALLOCATED: 714 case VariableLocation::UNALLOCATED:
715 DCHECK(!variable->binding_needs_init());
715 globals_->Add(variable->name(), zone()); 716 globals_->Add(variable->name(), zone());
716 globals_->Add(variable->binding_needs_init() 717 globals_->Add(isolate()->factory()->undefined_value(), zone());
717 ? isolate()->factory()->the_hole_value()
718 : isolate()->factory()->undefined_value(), zone());
719 break; 718 break;
720 719
721 case VariableLocation::PARAMETER: 720 case VariableLocation::PARAMETER:
722 case VariableLocation::LOCAL: 721 case VariableLocation::LOCAL:
723 if (hole_init) { 722 if (hole_init) {
724 Comment cmnt(masm_, "[ VariableDeclaration"); 723 Comment cmnt(masm_, "[ VariableDeclaration");
725 __ mov(StackOperand(variable), 724 __ mov(StackOperand(variable),
726 Immediate(isolate()->factory()->the_hole_value())); 725 Immediate(isolate()->factory()->the_hole_value()));
727 } 726 }
728 break; 727 break;
(...skipping 3091 matching lines...) Expand 10 before | Expand all | Expand 10 after
3820 isolate->builtins()->OnStackReplacement()->entry(), 3819 isolate->builtins()->OnStackReplacement()->entry(),
3821 Assembler::target_address_at(call_target_address, unoptimized_code)); 3820 Assembler::target_address_at(call_target_address, unoptimized_code));
3822 return ON_STACK_REPLACEMENT; 3821 return ON_STACK_REPLACEMENT;
3823 } 3822 }
3824 3823
3825 3824
3826 } // namespace internal 3825 } // namespace internal
3827 } // namespace v8 3826 } // namespace v8
3828 3827
3829 #endif // V8_TARGET_ARCH_X87 3828 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698