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

Side by Side Diff: src/full-codegen/mips/full-codegen-mips.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_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 // If it was not possible to allocate the variable at compile time, we 758 // If it was not possible to allocate the variable at compile time, we
759 // need to "declare" it at runtime to make sure it actually exists in the 759 // need to "declare" it at runtime to make sure it actually exists in the
760 // local context. 760 // local context.
761 VariableProxy* proxy = declaration->proxy(); 761 VariableProxy* proxy = declaration->proxy();
762 VariableMode mode = declaration->mode(); 762 VariableMode mode = declaration->mode();
763 Variable* variable = proxy->var(); 763 Variable* variable = proxy->var();
764 bool hole_init = mode == LET || mode == CONST; 764 bool hole_init = mode == LET || mode == CONST;
765 switch (variable->location()) { 765 switch (variable->location()) {
766 case VariableLocation::GLOBAL: 766 case VariableLocation::GLOBAL:
767 case VariableLocation::UNALLOCATED: 767 case VariableLocation::UNALLOCATED:
768 DCHECK(!variable->binding_needs_init());
768 globals_->Add(variable->name(), zone()); 769 globals_->Add(variable->name(), zone());
769 globals_->Add(variable->binding_needs_init() 770 globals_->Add(isolate()->factory()->undefined_value(), zone());
770 ? isolate()->factory()->the_hole_value()
771 : isolate()->factory()->undefined_value(),
772 zone());
773 break; 771 break;
774 772
775 case VariableLocation::PARAMETER: 773 case VariableLocation::PARAMETER:
776 case VariableLocation::LOCAL: 774 case VariableLocation::LOCAL:
777 if (hole_init) { 775 if (hole_init) {
778 Comment cmnt(masm_, "[ VariableDeclaration"); 776 Comment cmnt(masm_, "[ VariableDeclaration");
779 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); 777 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
780 __ sw(t0, StackOperand(variable)); 778 __ sw(t0, StackOperand(variable));
781 } 779 }
782 break; 780 break;
(...skipping 3161 matching lines...) Expand 10 before | Expand all | Expand 10 after
3944 reinterpret_cast<uint32_t>( 3942 reinterpret_cast<uint32_t>(
3945 isolate->builtins()->OnStackReplacement()->entry())); 3943 isolate->builtins()->OnStackReplacement()->entry()));
3946 return ON_STACK_REPLACEMENT; 3944 return ON_STACK_REPLACEMENT;
3947 } 3945 }
3948 3946
3949 3947
3950 } // namespace internal 3948 } // namespace internal
3951 } // namespace v8 3949 } // namespace v8
3952 3950
3953 #endif // V8_TARGET_ARCH_MIPS 3951 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698