| 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_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 DCHECK(IsDeclaredVariableMode(mode)); | 790 DCHECK(IsDeclaredVariableMode(mode)); |
| 791 // Push initial value, if any. | 791 // Push initial value, if any. |
| 792 // Note: For variables we must not push an initial value (such as | 792 // Note: For variables we must not push an initial value (such as |
| 793 // 'undefined') because we may have a (legal) redeclaration and we | 793 // 'undefined') because we may have a (legal) redeclaration and we |
| 794 // must not destroy the current value. | 794 // must not destroy the current value. |
| 795 if (hole_init) { | 795 if (hole_init) { |
| 796 __ push(Immediate(isolate()->factory()->the_hole_value())); | 796 __ push(Immediate(isolate()->factory()->the_hole_value())); |
| 797 } else { | 797 } else { |
| 798 __ push(Immediate(Smi::FromInt(0))); // Indicates no initial value. | 798 __ push(Immediate(Smi::FromInt(0))); // Indicates no initial value. |
| 799 } | 799 } |
| 800 __ CallRuntime(IsImmutableVariableMode(mode) | 800 __ push( |
| 801 ? Runtime::kDeclareReadOnlyLookupSlot | 801 Immediate(Smi::FromInt(variable->DeclarationPropertyAttributes()))); |
| 802 : Runtime::kDeclareLookupSlot, | 802 __ CallRuntime(Runtime::kDeclareLookupSlot, 3); |
| 803 2); | |
| 804 break; | 803 break; |
| 805 } | 804 } |
| 806 } | 805 } |
| 807 } | 806 } |
| 808 | 807 |
| 809 | |
| 810 void FullCodeGenerator::VisitFunctionDeclaration( | 808 void FullCodeGenerator::VisitFunctionDeclaration( |
| 811 FunctionDeclaration* declaration) { | 809 FunctionDeclaration* declaration) { |
| 812 VariableProxy* proxy = declaration->proxy(); | 810 VariableProxy* proxy = declaration->proxy(); |
| 813 Variable* variable = proxy->var(); | 811 Variable* variable = proxy->var(); |
| 814 switch (variable->location()) { | 812 switch (variable->location()) { |
| 815 case VariableLocation::GLOBAL: | 813 case VariableLocation::GLOBAL: |
| 816 case VariableLocation::UNALLOCATED: { | 814 case VariableLocation::UNALLOCATED: { |
| 817 globals_->Add(variable->name(), zone()); | 815 globals_->Add(variable->name(), zone()); |
| 818 Handle<SharedFunctionInfo> function = | 816 Handle<SharedFunctionInfo> function = |
| 819 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); | 817 Compiler::GetSharedFunctionInfo(declaration->fun(), script(), info_); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 841 result_register(), ecx, kDontSaveFPRegs, | 839 result_register(), ecx, kDontSaveFPRegs, |
| 842 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 840 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
| 843 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 841 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); |
| 844 break; | 842 break; |
| 845 } | 843 } |
| 846 | 844 |
| 847 case VariableLocation::LOOKUP: { | 845 case VariableLocation::LOOKUP: { |
| 848 Comment cmnt(masm_, "[ FunctionDeclaration"); | 846 Comment cmnt(masm_, "[ FunctionDeclaration"); |
| 849 __ push(Immediate(variable->name())); | 847 __ push(Immediate(variable->name())); |
| 850 VisitForStackValue(declaration->fun()); | 848 VisitForStackValue(declaration->fun()); |
| 851 __ CallRuntime(Runtime::kDeclareLookupSlot, 2); | 849 __ push( |
| 850 Immediate(Smi::FromInt(variable->DeclarationPropertyAttributes()))); |
| 851 __ CallRuntime(Runtime::kDeclareLookupSlot, 3); |
| 852 break; | 852 break; |
| 853 } | 853 } |
| 854 } | 854 } |
| 855 } | 855 } |
| 856 | 856 |
| 857 | 857 |
| 858 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { | 858 void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { |
| 859 // Call the runtime to declare the globals. | 859 // Call the runtime to declare the globals. |
| 860 __ Push(pairs); | 860 __ Push(pairs); |
| 861 __ Push(Smi::FromInt(DeclareGlobalsFlags())); | 861 __ Push(Smi::FromInt(DeclareGlobalsFlags())); |
| (...skipping 4271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5133 Assembler::target_address_at(call_target_address, | 5133 Assembler::target_address_at(call_target_address, |
| 5134 unoptimized_code)); | 5134 unoptimized_code)); |
| 5135 return OSR_AFTER_STACK_CHECK; | 5135 return OSR_AFTER_STACK_CHECK; |
| 5136 } | 5136 } |
| 5137 | 5137 |
| 5138 | 5138 |
| 5139 } // namespace internal | 5139 } // namespace internal |
| 5140 } // namespace v8 | 5140 } // namespace v8 |
| 5141 | 5141 |
| 5142 #endif // V8_TARGET_ARCH_X87 | 5142 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |