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

Side by Side Diff: src/full-codegen/x64/full-codegen-x64.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/s390/full-codegen-s390.cc ('k') | src/full-codegen/x87/full-codegen-x87.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_X64 5 #if V8_TARGET_ARCH_X64
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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 // If it was not possible to allocate the variable at compile time, we 720 // If it was not possible to allocate the variable at compile time, we
721 // need to "declare" it at runtime to make sure it actually exists in the 721 // need to "declare" it at runtime to make sure it actually exists in the
722 // local context. 722 // local context.
723 VariableProxy* proxy = declaration->proxy(); 723 VariableProxy* proxy = declaration->proxy();
724 VariableMode mode = declaration->mode(); 724 VariableMode mode = declaration->mode();
725 Variable* variable = proxy->var(); 725 Variable* variable = proxy->var();
726 bool hole_init = mode == LET || mode == CONST; 726 bool hole_init = mode == LET || mode == CONST;
727 switch (variable->location()) { 727 switch (variable->location()) {
728 case VariableLocation::GLOBAL: 728 case VariableLocation::GLOBAL:
729 case VariableLocation::UNALLOCATED: 729 case VariableLocation::UNALLOCATED:
730 DCHECK(!variable->binding_needs_init());
730 globals_->Add(variable->name(), zone()); 731 globals_->Add(variable->name(), zone());
731 globals_->Add(variable->binding_needs_init() 732 globals_->Add(isolate()->factory()->undefined_value(), zone());
732 ? isolate()->factory()->the_hole_value()
733 : isolate()->factory()->undefined_value(),
734 zone());
735 break; 733 break;
736 734
737 case VariableLocation::PARAMETER: 735 case VariableLocation::PARAMETER:
738 case VariableLocation::LOCAL: 736 case VariableLocation::LOCAL:
739 if (hole_init) { 737 if (hole_init) {
740 Comment cmnt(masm_, "[ VariableDeclaration"); 738 Comment cmnt(masm_, "[ VariableDeclaration");
741 __ LoadRoot(kScratchRegister, Heap::kTheHoleValueRootIndex); 739 __ LoadRoot(kScratchRegister, Heap::kTheHoleValueRootIndex);
742 __ movp(StackOperand(variable), kScratchRegister); 740 __ movp(StackOperand(variable), kScratchRegister);
743 } 741 }
744 break; 742 break;
(...skipping 3066 matching lines...) Expand 10 before | Expand all | Expand 10 after
3811 DCHECK_EQ( 3809 DCHECK_EQ(
3812 isolate->builtins()->OnStackReplacement()->entry(), 3810 isolate->builtins()->OnStackReplacement()->entry(),
3813 Assembler::target_address_at(call_target_address, unoptimized_code)); 3811 Assembler::target_address_at(call_target_address, unoptimized_code));
3814 return ON_STACK_REPLACEMENT; 3812 return ON_STACK_REPLACEMENT;
3815 } 3813 }
3816 3814
3817 } // namespace internal 3815 } // namespace internal
3818 } // namespace v8 3816 } // namespace v8
3819 3817
3820 #endif // V8_TARGET_ARCH_X64 3818 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/s390/full-codegen-s390.cc ('k') | src/full-codegen/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698