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

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: 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
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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 break; 759 break;
760 case VariableLocation::LOOKUP: { 760 case VariableLocation::LOOKUP: {
761 DCHECK(IsDeclaredVariableMode(mode)); 761 DCHECK(IsDeclaredVariableMode(mode));
762 762
763 register_allocator()->PrepareForConsecutiveAllocations(3); 763 register_allocator()->PrepareForConsecutiveAllocations(3);
764 Register name = register_allocator()->NextConsecutiveRegister(); 764 Register name = register_allocator()->NextConsecutiveRegister();
765 Register init_value = register_allocator()->NextConsecutiveRegister(); 765 Register init_value = register_allocator()->NextConsecutiveRegister();
766 Register attributes = register_allocator()->NextConsecutiveRegister(); 766 Register attributes = register_allocator()->NextConsecutiveRegister();
767 767
768 builder()->LoadLiteral(variable->name()).StoreAccumulatorInRegister(name); 768 builder()->LoadLiteral(variable->name()).StoreAccumulatorInRegister(name);
769 if (hole_init) { 769 builder()
770 builder()->LoadTheHole().StoreAccumulatorInRegister(init_value); 770 ->LoadLiteral(Smi::FromInt(0))
771 } else { 771 .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() 772 builder()
780 ->LoadLiteral(Smi::FromInt(variable->DeclarationPropertyAttributes())) 773 ->LoadLiteral(Smi::FromInt(variable->DeclarationPropertyAttributes()))
781 .StoreAccumulatorInRegister(attributes) 774 .StoreAccumulatorInRegister(attributes)
782 .CallRuntime(Runtime::kDeclareLookupSlot, name, 3); 775 .CallRuntime(Runtime::kDeclareLookupSlot, name, 3);
783 break; 776 break;
784 } 777 }
785 } 778 }
786 } 779 }
787 780
788 void BytecodeGenerator::VisitFunctionDeclaration(FunctionDeclaration* decl) { 781 void BytecodeGenerator::VisitFunctionDeclaration(FunctionDeclaration* decl) {
(...skipping 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after
3196 return execution_context()->scope()->language_mode(); 3189 return execution_context()->scope()->language_mode();
3197 } 3190 }
3198 3191
3199 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3192 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3200 return TypeFeedbackVector::GetIndex(slot); 3193 return TypeFeedbackVector::GetIndex(slot);
3201 } 3194 }
3202 3195
3203 } // namespace interpreter 3196 } // namespace interpreter
3204 } // namespace internal 3197 } // namespace internal
3205 } // namespace v8 3198 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698