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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 EmitDebugCheckDeclarationContext(variable); | 802 EmitDebugCheckDeclarationContext(variable); |
803 __ mov(ContextOperand(esi, variable->index()), | 803 __ mov(ContextOperand(esi, variable->index()), |
804 Immediate(isolate()->factory()->the_hole_value())); | 804 Immediate(isolate()->factory()->the_hole_value())); |
805 // No write barrier since the hole value is in old space. | 805 // No write barrier since the hole value is in old space. |
806 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 806 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); |
807 } | 807 } |
808 break; | 808 break; |
809 | 809 |
810 case VariableLocation::LOOKUP: { | 810 case VariableLocation::LOOKUP: { |
811 Comment cmnt(masm_, "[ VariableDeclaration"); | 811 Comment cmnt(masm_, "[ VariableDeclaration"); |
812 __ push(esi); | |
813 __ push(Immediate(variable->name())); | 812 __ push(Immediate(variable->name())); |
814 // VariableDeclaration nodes are always introduced in one of four modes. | 813 // VariableDeclaration nodes are always introduced in one of four modes. |
815 DCHECK(IsDeclaredVariableMode(mode)); | 814 DCHECK(IsDeclaredVariableMode(mode)); |
816 PropertyAttributes attr = | |
817 IsImmutableVariableMode(mode) ? READ_ONLY : NONE; | |
818 __ push(Immediate(Smi::FromInt(attr))); | |
819 // Push initial value, if any. | 815 // Push initial value, if any. |
820 // Note: For variables we must not push an initial value (such as | 816 // Note: For variables we must not push an initial value (such as |
821 // 'undefined') because we may have a (legal) redeclaration and we | 817 // 'undefined') because we may have a (legal) redeclaration and we |
822 // must not destroy the current value. | 818 // must not destroy the current value. |
823 if (hole_init) { | 819 if (hole_init) { |
824 __ push(Immediate(isolate()->factory()->the_hole_value())); | 820 __ push(Immediate(isolate()->factory()->the_hole_value())); |
825 } else { | 821 } else { |
826 __ push(Immediate(Smi::FromInt(0))); // Indicates no initial value. | 822 __ push(Immediate(Smi::FromInt(0))); // Indicates no initial value. |
827 } | 823 } |
828 __ CallRuntime(Runtime::kDeclareLookupSlot, 4); | 824 __ CallRuntime(IsImmutableVariableMode(mode) |
| 825 ? Runtime::kDeclareReadOnlyLookupSlot |
| 826 : Runtime::kDeclareLookupSlot, |
| 827 2); |
829 break; | 828 break; |
830 } | 829 } |
831 } | 830 } |
832 } | 831 } |
833 | 832 |
834 | 833 |
835 void FullCodeGenerator::VisitFunctionDeclaration( | 834 void FullCodeGenerator::VisitFunctionDeclaration( |
836 FunctionDeclaration* declaration) { | 835 FunctionDeclaration* declaration) { |
837 VariableProxy* proxy = declaration->proxy(); | 836 VariableProxy* proxy = declaration->proxy(); |
838 Variable* variable = proxy->var(); | 837 Variable* variable = proxy->var(); |
(...skipping 29 matching lines...) Expand all Loading... |
868 ecx, | 867 ecx, |
869 kDontSaveFPRegs, | 868 kDontSaveFPRegs, |
870 EMIT_REMEMBERED_SET, | 869 EMIT_REMEMBERED_SET, |
871 OMIT_SMI_CHECK); | 870 OMIT_SMI_CHECK); |
872 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 871 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); |
873 break; | 872 break; |
874 } | 873 } |
875 | 874 |
876 case VariableLocation::LOOKUP: { | 875 case VariableLocation::LOOKUP: { |
877 Comment cmnt(masm_, "[ FunctionDeclaration"); | 876 Comment cmnt(masm_, "[ FunctionDeclaration"); |
878 __ push(esi); | |
879 __ push(Immediate(variable->name())); | 877 __ push(Immediate(variable->name())); |
880 __ push(Immediate(Smi::FromInt(NONE))); | |
881 VisitForStackValue(declaration->fun()); | 878 VisitForStackValue(declaration->fun()); |
882 __ CallRuntime(Runtime::kDeclareLookupSlot, 4); | 879 __ CallRuntime(Runtime::kDeclareLookupSlot, 2); |
883 break; | 880 break; |
884 } | 881 } |
885 } | 882 } |
886 } | 883 } |
887 | 884 |
888 | 885 |
889 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 886 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
890 // Call the runtime to declare the globals. | 887 // Call the runtime to declare the globals. |
891 __ push(esi); // The context is the first argument. | |
892 __ Push(pairs); | 888 __ Push(pairs); |
893 __ Push(Smi::FromInt(DeclareGlobalsFlags())); | 889 __ Push(Smi::FromInt(DeclareGlobalsFlags())); |
894 __ CallRuntime(Runtime::kDeclareGlobals, 3); | 890 __ CallRuntime(Runtime::kDeclareGlobals, 2); |
895 // Return value is ignored. | 891 // Return value is ignored. |
896 } | 892 } |
897 | 893 |
898 | 894 |
899 void FullCodeGenerator::DeclareModules(Handle<FixedArray> descriptions) { | 895 void FullCodeGenerator::DeclareModules(Handle<FixedArray> descriptions) { |
900 // Call the runtime to declare the modules. | 896 // Call the runtime to declare the modules. |
901 __ Push(descriptions); | 897 __ Push(descriptions); |
902 __ CallRuntime(Runtime::kDeclareModules, 1); | 898 __ CallRuntime(Runtime::kDeclareModules, 1); |
903 // Return value is ignored. | 899 // Return value is ignored. |
904 } | 900 } |
(...skipping 4436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5341 Assembler::target_address_at(call_target_address, | 5337 Assembler::target_address_at(call_target_address, |
5342 unoptimized_code)); | 5338 unoptimized_code)); |
5343 return OSR_AFTER_STACK_CHECK; | 5339 return OSR_AFTER_STACK_CHECK; |
5344 } | 5340 } |
5345 | 5341 |
5346 | 5342 |
5347 } // namespace internal | 5343 } // namespace internal |
5348 } // namespace v8 | 5344 } // namespace v8 |
5349 | 5345 |
5350 #endif // V8_TARGET_ARCH_IA32 | 5346 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |