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