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

Side by Side Diff: src/full-codegen/ia32/full-codegen-ia32.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
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_IA32 5 #if V8_TARGET_ARCH_IA32
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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 // If it was not possible to allocate the variable at compile time, we 708 // If it was not possible to allocate the variable at compile time, we
709 // need to "declare" it at runtime to make sure it actually exists in the 709 // need to "declare" it at runtime to make sure it actually exists in the
710 // local context. 710 // local context.
711 VariableProxy* proxy = declaration->proxy(); 711 VariableProxy* proxy = declaration->proxy();
712 VariableMode mode = declaration->mode(); 712 VariableMode mode = declaration->mode();
713 Variable* variable = proxy->var(); 713 Variable* variable = proxy->var();
714 bool hole_init = mode == LET || mode == CONST; 714 bool hole_init = mode == LET || mode == CONST;
715 switch (variable->location()) { 715 switch (variable->location()) {
716 case VariableLocation::GLOBAL: 716 case VariableLocation::GLOBAL:
717 case VariableLocation::UNALLOCATED: 717 case VariableLocation::UNALLOCATED:
718 DCHECK(!variable->binding_needs_init());
718 globals_->Add(variable->name(), zone()); 719 globals_->Add(variable->name(), zone());
719 globals_->Add(variable->binding_needs_init() 720 globals_->Add(isolate()->factory()->undefined_value(), zone());
720 ? isolate()->factory()->the_hole_value()
721 : isolate()->factory()->undefined_value(), zone());
722 break; 721 break;
723 722
724 case VariableLocation::PARAMETER: 723 case VariableLocation::PARAMETER:
725 case VariableLocation::LOCAL: 724 case VariableLocation::LOCAL:
726 if (hole_init) { 725 if (hole_init) {
727 Comment cmnt(masm_, "[ VariableDeclaration"); 726 Comment cmnt(masm_, "[ VariableDeclaration");
728 __ mov(StackOperand(variable), 727 __ mov(StackOperand(variable),
729 Immediate(isolate()->factory()->the_hole_value())); 728 Immediate(isolate()->factory()->the_hole_value()));
730 } 729 }
731 break; 730 break;
(...skipping 3096 matching lines...) Expand 10 before | Expand all | Expand 10 after
3828 isolate->builtins()->OnStackReplacement()->entry(), 3827 isolate->builtins()->OnStackReplacement()->entry(),
3829 Assembler::target_address_at(call_target_address, unoptimized_code)); 3828 Assembler::target_address_at(call_target_address, unoptimized_code));
3830 return ON_STACK_REPLACEMENT; 3829 return ON_STACK_REPLACEMENT;
3831 } 3830 }
3832 3831
3833 3832
3834 } // namespace internal 3833 } // namespace internal
3835 } // namespace v8 3834 } // namespace v8
3836 3835
3837 #endif // V8_TARGET_ARCH_IA32 3836 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/arm64/full-codegen-arm64.cc ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698