| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 EmitDebugCheckDeclarationContext(variable); | 816 EmitDebugCheckDeclarationContext(variable); |
| 817 __ LoadRoot(kScratchRegister, Heap::kTheHoleValueRootIndex); | 817 __ LoadRoot(kScratchRegister, Heap::kTheHoleValueRootIndex); |
| 818 __ movp(ContextOperand(rsi, variable->index()), kScratchRegister); | 818 __ movp(ContextOperand(rsi, variable->index()), kScratchRegister); |
| 819 // No write barrier since the hole value is in old space. | 819 // No write barrier since the hole value is in old space. |
| 820 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 820 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); |
| 821 } | 821 } |
| 822 break; | 822 break; |
| 823 | 823 |
| 824 case VariableLocation::LOOKUP: { | 824 case VariableLocation::LOOKUP: { |
| 825 Comment cmnt(masm_, "[ VariableDeclaration"); | 825 Comment cmnt(masm_, "[ VariableDeclaration"); |
| 826 __ Push(rsi); | |
| 827 __ Push(variable->name()); | 826 __ Push(variable->name()); |
| 828 // Declaration nodes are always introduced in one of four modes. | 827 // Declaration nodes are always introduced in one of four modes. |
| 829 DCHECK(IsDeclaredVariableMode(mode)); | 828 DCHECK(IsDeclaredVariableMode(mode)); |
| 830 PropertyAttributes attr = | |
| 831 IsImmutableVariableMode(mode) ? READ_ONLY : NONE; | |
| 832 __ Push(Smi::FromInt(attr)); | |
| 833 // Push initial value, if any. | 829 // Push initial value, if any. |
| 834 // Note: For variables we must not push an initial value (such as | 830 // Note: For variables we must not push an initial value (such as |
| 835 // 'undefined') because we may have a (legal) redeclaration and we | 831 // 'undefined') because we may have a (legal) redeclaration and we |
| 836 // must not destroy the current value. | 832 // must not destroy the current value. |
| 837 if (hole_init) { | 833 if (hole_init) { |
| 838 __ PushRoot(Heap::kTheHoleValueRootIndex); | 834 __ PushRoot(Heap::kTheHoleValueRootIndex); |
| 839 } else { | 835 } else { |
| 840 __ Push(Smi::FromInt(0)); // Indicates no initial value. | 836 __ Push(Smi::FromInt(0)); // Indicates no initial value. |
| 841 } | 837 } |
| 842 __ CallRuntime(Runtime::kDeclareLookupSlot, 4); | 838 __ CallRuntime(IsImmutableVariableMode(mode) |
| 839 ? Runtime::kDeclareReadOnlyLookupSlot |
| 840 : Runtime::kDeclareLookupSlot, |
| 841 2); |
| 843 break; | 842 break; |
| 844 } | 843 } |
| 845 } | 844 } |
| 846 } | 845 } |
| 847 | 846 |
| 848 | 847 |
| 849 void FullCodeGenerator::VisitFunctionDeclaration( | 848 void FullCodeGenerator::VisitFunctionDeclaration( |
| 850 FunctionDeclaration* declaration) { | 849 FunctionDeclaration* declaration) { |
| 851 VariableProxy* proxy = declaration->proxy(); | 850 VariableProxy* proxy = declaration->proxy(); |
| 852 Variable* variable = proxy->var(); | 851 Variable* variable = proxy->var(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 883 rcx, | 882 rcx, |
| 884 kDontSaveFPRegs, | 883 kDontSaveFPRegs, |
| 885 EMIT_REMEMBERED_SET, | 884 EMIT_REMEMBERED_SET, |
| 886 OMIT_SMI_CHECK); | 885 OMIT_SMI_CHECK); |
| 887 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 886 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); |
| 888 break; | 887 break; |
| 889 } | 888 } |
| 890 | 889 |
| 891 case VariableLocation::LOOKUP: { | 890 case VariableLocation::LOOKUP: { |
| 892 Comment cmnt(masm_, "[ FunctionDeclaration"); | 891 Comment cmnt(masm_, "[ FunctionDeclaration"); |
| 893 __ Push(rsi); | |
| 894 __ Push(variable->name()); | 892 __ Push(variable->name()); |
| 895 __ Push(Smi::FromInt(NONE)); | |
| 896 VisitForStackValue(declaration->fun()); | 893 VisitForStackValue(declaration->fun()); |
| 897 __ CallRuntime(Runtime::kDeclareLookupSlot, 4); | 894 __ CallRuntime(Runtime::kDeclareLookupSlot, 2); |
| 898 break; | 895 break; |
| 899 } | 896 } |
| 900 } | 897 } |
| 901 } | 898 } |
| 902 | 899 |
| 903 | 900 |
| 904 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 901 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
| 905 // Call the runtime to declare the globals. | 902 // Call the runtime to declare the globals. |
| 906 __ Push(rsi); // The context is the first argument. | |
| 907 __ Push(pairs); | 903 __ Push(pairs); |
| 908 __ Push(Smi::FromInt(DeclareGlobalsFlags())); | 904 __ Push(Smi::FromInt(DeclareGlobalsFlags())); |
| 909 __ CallRuntime(Runtime::kDeclareGlobals, 3); | 905 __ CallRuntime(Runtime::kDeclareGlobals, 2); |
| 910 // Return value is ignored. | 906 // Return value is ignored. |
| 911 } | 907 } |
| 912 | 908 |
| 913 | 909 |
| 914 void FullCodeGenerator::DeclareModules(Handle<FixedArray> descriptions) { | 910 void FullCodeGenerator::DeclareModules(Handle<FixedArray> descriptions) { |
| 915 // Call the runtime to declare the modules. | 911 // Call the runtime to declare the modules. |
| 916 __ Push(descriptions); | 912 __ Push(descriptions); |
| 917 __ CallRuntime(Runtime::kDeclareModules, 1); | 913 __ CallRuntime(Runtime::kDeclareModules, 1); |
| 918 // Return value is ignored. | 914 // Return value is ignored. |
| 919 } | 915 } |
| (...skipping 4440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5360 Assembler::target_address_at(call_target_address, | 5356 Assembler::target_address_at(call_target_address, |
| 5361 unoptimized_code)); | 5357 unoptimized_code)); |
| 5362 return OSR_AFTER_STACK_CHECK; | 5358 return OSR_AFTER_STACK_CHECK; |
| 5363 } | 5359 } |
| 5364 | 5360 |
| 5365 | 5361 |
| 5366 } // namespace internal | 5362 } // namespace internal |
| 5367 } // namespace v8 | 5363 } // namespace v8 |
| 5368 | 5364 |
| 5369 #endif // V8_TARGET_ARCH_X64 | 5365 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |