OLD | NEW |
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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 // No write barrier since the hole value is in old space. | 755 // No write barrier since the hole value is in old space. |
756 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); | 756 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); |
757 } | 757 } |
758 break; | 758 break; |
759 | 759 |
760 case VariableLocation::LOOKUP: { | 760 case VariableLocation::LOOKUP: { |
761 Comment cmnt(masm_, "[ VariableDeclaration"); | 761 Comment cmnt(masm_, "[ VariableDeclaration"); |
762 __ Push(variable->name()); | 762 __ Push(variable->name()); |
763 // Declaration nodes are always introduced in one of four modes. | 763 // Declaration nodes are always introduced in one of four modes. |
764 DCHECK(IsDeclaredVariableMode(mode)); | 764 DCHECK(IsDeclaredVariableMode(mode)); |
765 // Push initial value, if any. | 765 DCHECK(!hole_init); |
766 // Note: For variables we must not push an initial value (such as | 766 __ Push(Smi::FromInt(0)); // Indicates no initial value. |
767 // 'undefined') because we may have a (legal) redeclaration and we | |
768 // must not destroy the current value. | |
769 if (hole_init) { | |
770 __ PushRoot(Heap::kTheHoleValueRootIndex); | |
771 } else { | |
772 __ Push(Smi::FromInt(0)); // Indicates no initial value. | |
773 } | |
774 __ Push(Smi::FromInt(variable->DeclarationPropertyAttributes())); | 767 __ Push(Smi::FromInt(variable->DeclarationPropertyAttributes())); |
775 __ CallRuntime(Runtime::kDeclareLookupSlot); | 768 __ CallRuntime(Runtime::kDeclareLookupSlot); |
776 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); | 769 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); |
777 break; | 770 break; |
778 } | 771 } |
779 } | 772 } |
780 } | 773 } |
781 | 774 |
782 | 775 |
783 void FullCodeGenerator::VisitFunctionDeclaration( | 776 void FullCodeGenerator::VisitFunctionDeclaration( |
(...skipping 2920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3704 DCHECK_EQ( | 3697 DCHECK_EQ( |
3705 isolate->builtins()->OnStackReplacement()->entry(), | 3698 isolate->builtins()->OnStackReplacement()->entry(), |
3706 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3699 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3707 return ON_STACK_REPLACEMENT; | 3700 return ON_STACK_REPLACEMENT; |
3708 } | 3701 } |
3709 | 3702 |
3710 } // namespace internal | 3703 } // namespace internal |
3711 } // namespace v8 | 3704 } // namespace v8 |
3712 | 3705 |
3713 #endif // V8_TARGET_ARCH_X64 | 3706 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |