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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2051073004: Remove more dead code now that legacy const is gone (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix x64 build, add mips64 Created 4 years, 6 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/runtime/runtime-scopes.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/interpreter/bytecode-register-allocator.h" 10 #include "src/interpreter/bytecode-register-allocator.h"
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 } 752 }
753 break; 753 break;
754 case VariableLocation::CONTEXT: 754 case VariableLocation::CONTEXT:
755 if (hole_init) { 755 if (hole_init) {
756 builder()->LoadTheHole().StoreContextSlot(execution_context()->reg(), 756 builder()->LoadTheHole().StoreContextSlot(execution_context()->reg(),
757 variable->index()); 757 variable->index());
758 } 758 }
759 break; 759 break;
760 case VariableLocation::LOOKUP: { 760 case VariableLocation::LOOKUP: {
761 DCHECK(IsDeclaredVariableMode(mode)); 761 DCHECK(IsDeclaredVariableMode(mode));
762 DCHECK(!hole_init);
762 763
763 register_allocator()->PrepareForConsecutiveAllocations(3); 764 register_allocator()->PrepareForConsecutiveAllocations(3);
764 Register name = register_allocator()->NextConsecutiveRegister(); 765 Register name = register_allocator()->NextConsecutiveRegister();
765 Register init_value = register_allocator()->NextConsecutiveRegister(); 766 Register init_value = register_allocator()->NextConsecutiveRegister();
766 Register attributes = register_allocator()->NextConsecutiveRegister(); 767 Register attributes = register_allocator()->NextConsecutiveRegister();
767 768
768 builder()->LoadLiteral(variable->name()).StoreAccumulatorInRegister(name); 769 builder()->LoadLiteral(variable->name()).StoreAccumulatorInRegister(name);
769 if (hole_init) { 770 builder()
770 builder()->LoadTheHole().StoreAccumulatorInRegister(init_value); 771 ->LoadLiteral(Smi::FromInt(0))
771 } else { 772 .StoreAccumulatorInRegister(init_value);
772 // For variables, we must not use an initial value (such as 'undefined')
773 // because we may have a (legal) redeclaration and we must not destroy
774 // the current value.
775 builder()
776 ->LoadLiteral(Smi::FromInt(0))
777 .StoreAccumulatorInRegister(init_value);
778 }
779 builder() 773 builder()
780 ->LoadLiteral(Smi::FromInt(variable->DeclarationPropertyAttributes())) 774 ->LoadLiteral(Smi::FromInt(variable->DeclarationPropertyAttributes()))
781 .StoreAccumulatorInRegister(attributes) 775 .StoreAccumulatorInRegister(attributes)
782 .CallRuntime(Runtime::kDeclareLookupSlot, name, 3); 776 .CallRuntime(Runtime::kDeclareLookupSlot, name, 3);
783 break; 777 break;
784 } 778 }
785 } 779 }
786 } 780 }
787 781
788 void BytecodeGenerator::VisitFunctionDeclaration(FunctionDeclaration* decl) { 782 void BytecodeGenerator::VisitFunctionDeclaration(FunctionDeclaration* decl) {
(...skipping 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after
3196 return execution_context()->scope()->language_mode(); 3190 return execution_context()->scope()->language_mode();
3197 } 3191 }
3198 3192
3199 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3193 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3200 return TypeFeedbackVector::GetIndex(slot); 3194 return TypeFeedbackVector::GetIndex(slot);
3201 } 3195 }
3202 3196
3203 } // namespace interpreter 3197 } // namespace interpreter
3204 } // namespace internal 3198 } // namespace internal
3205 } // namespace v8 3199 } // namespace v8
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698