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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 EmitDebugCheckDeclarationContext(variable); | 752 EmitDebugCheckDeclarationContext(variable); |
753 __ LoadRoot(kScratchRegister, Heap::kTheHoleValueRootIndex); | 753 __ LoadRoot(kScratchRegister, Heap::kTheHoleValueRootIndex); |
754 __ movp(ContextOperand(rsi, variable->index()), kScratchRegister); | 754 __ movp(ContextOperand(rsi, variable->index()), kScratchRegister); |
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 DCHECK_EQ(VAR, mode); |
| 763 DCHECK(!hole_init); |
762 __ Push(variable->name()); | 764 __ Push(variable->name()); |
763 // Declaration nodes are always introduced in one of four modes. | 765 __ CallRuntime(Runtime::kDeclareEvalVar); |
764 DCHECK(IsDeclaredVariableMode(mode)); | |
765 DCHECK(!hole_init); | |
766 __ Push(Smi::FromInt(0)); // Indicates no initial value. | |
767 __ Push(Smi::FromInt(variable->DeclarationPropertyAttributes())); | |
768 __ CallRuntime(Runtime::kDeclareLookupSlot); | |
769 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); | 766 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); |
770 break; | 767 break; |
771 } | 768 } |
772 } | 769 } |
773 } | 770 } |
774 | 771 |
775 | 772 |
776 void FullCodeGenerator::VisitFunctionDeclaration( | 773 void FullCodeGenerator::VisitFunctionDeclaration( |
777 FunctionDeclaration* declaration) { | 774 FunctionDeclaration* declaration) { |
778 VariableProxy* proxy = declaration->proxy(); | 775 VariableProxy* proxy = declaration->proxy(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 EMIT_REMEMBERED_SET, | 809 EMIT_REMEMBERED_SET, |
813 OMIT_SMI_CHECK); | 810 OMIT_SMI_CHECK); |
814 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); | 811 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); |
815 break; | 812 break; |
816 } | 813 } |
817 | 814 |
818 case VariableLocation::LOOKUP: { | 815 case VariableLocation::LOOKUP: { |
819 Comment cmnt(masm_, "[ FunctionDeclaration"); | 816 Comment cmnt(masm_, "[ FunctionDeclaration"); |
820 PushOperand(variable->name()); | 817 PushOperand(variable->name()); |
821 VisitForStackValue(declaration->fun()); | 818 VisitForStackValue(declaration->fun()); |
822 PushOperand(Smi::FromInt(variable->DeclarationPropertyAttributes())); | 819 CallRuntimeWithOperands(Runtime::kDeclareEvalFunction); |
823 CallRuntimeWithOperands(Runtime::kDeclareLookupSlot); | |
824 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); | 820 PrepareForBailoutForId(proxy->id(), BailoutState::NO_REGISTERS); |
825 break; | 821 break; |
826 } | 822 } |
827 } | 823 } |
828 } | 824 } |
829 | 825 |
830 | 826 |
831 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 827 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
832 // Call the runtime to declare the globals. | 828 // Call the runtime to declare the globals. |
833 __ Push(pairs); | 829 __ Push(pairs); |
(...skipping 2862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3696 DCHECK_EQ( | 3692 DCHECK_EQ( |
3697 isolate->builtins()->OnStackReplacement()->entry(), | 3693 isolate->builtins()->OnStackReplacement()->entry(), |
3698 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3694 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3699 return ON_STACK_REPLACEMENT; | 3695 return ON_STACK_REPLACEMENT; |
3700 } | 3696 } |
3701 | 3697 |
3702 } // namespace internal | 3698 } // namespace internal |
3703 } // namespace v8 | 3699 } // namespace v8 |
3704 | 3700 |
3705 #endif // V8_TARGET_ARCH_X64 | 3701 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |