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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 // Do the allocation of all three objects in one go. | 885 // Do the allocation of all three objects in one go. |
886 __ Allocate(ebx, eax, edi, no_reg, &runtime, TAG_OBJECT); | 886 __ Allocate(ebx, eax, edi, no_reg, &runtime, TAG_OBJECT); |
887 | 887 |
888 // eax = address of new object(s) (tagged) | 888 // eax = address of new object(s) (tagged) |
889 // ecx = argument count (smi-tagged) | 889 // ecx = argument count (smi-tagged) |
890 // esp[0] = mapped parameter count (tagged) | 890 // esp[0] = mapped parameter count (tagged) |
891 // esp[4] = function | 891 // esp[4] = function |
892 // esp[8] = parameter count (tagged) | 892 // esp[8] = parameter count (tagged) |
893 // Get the arguments map from the current native context into edi. | 893 // Get the arguments map from the current native context into edi. |
894 Label has_mapped_parameters, instantiate; | 894 Label has_mapped_parameters, instantiate; |
895 __ mov(edi, NativeContextOperand()); | 895 __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 896 __ mov(edi, FieldOperand(edi, JSGlobalObject::kNativeContextOffset)); |
896 __ mov(ebx, Operand(esp, 0 * kPointerSize)); | 897 __ mov(ebx, Operand(esp, 0 * kPointerSize)); |
897 __ test(ebx, ebx); | 898 __ test(ebx, ebx); |
898 __ j(not_zero, &has_mapped_parameters, Label::kNear); | 899 __ j(not_zero, &has_mapped_parameters, Label::kNear); |
899 __ mov( | 900 __ mov( |
900 edi, | 901 edi, |
901 Operand(edi, Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX))); | 902 Operand(edi, Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX))); |
902 __ jmp(&instantiate, Label::kNear); | 903 __ jmp(&instantiate, Label::kNear); |
903 | 904 |
904 __ bind(&has_mapped_parameters); | 905 __ bind(&has_mapped_parameters); |
905 __ mov(edi, Operand(edi, Context::SlotOffset( | 906 __ mov(edi, Operand(edi, Context::SlotOffset( |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 __ test(eax, eax); | 1089 __ test(eax, eax); |
1089 __ j(zero, &add_arguments_object, Label::kNear); | 1090 __ j(zero, &add_arguments_object, Label::kNear); |
1090 __ lea(eax, Operand(eax, times_2, FixedArray::kHeaderSize)); | 1091 __ lea(eax, Operand(eax, times_2, FixedArray::kHeaderSize)); |
1091 __ bind(&add_arguments_object); | 1092 __ bind(&add_arguments_object); |
1092 __ add(eax, Immediate(Heap::kStrictArgumentsObjectSize)); | 1093 __ add(eax, Immediate(Heap::kStrictArgumentsObjectSize)); |
1093 | 1094 |
1094 // Do the allocation of both objects in one go. | 1095 // Do the allocation of both objects in one go. |
1095 __ Allocate(eax, eax, ebx, no_reg, &runtime, TAG_OBJECT); | 1096 __ Allocate(eax, eax, ebx, no_reg, &runtime, TAG_OBJECT); |
1096 | 1097 |
1097 // Get the arguments map from the current native context. | 1098 // Get the arguments map from the current native context. |
1098 __ mov(edi, NativeContextOperand()); | 1099 __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
1099 __ mov(edi, ContextOperand(edi, Context::STRICT_ARGUMENTS_MAP_INDEX)); | 1100 __ mov(edi, FieldOperand(edi, JSGlobalObject::kNativeContextOffset)); |
| 1101 const int offset = Context::SlotOffset(Context::STRICT_ARGUMENTS_MAP_INDEX); |
| 1102 __ mov(edi, Operand(edi, offset)); |
1100 | 1103 |
1101 __ mov(FieldOperand(eax, JSObject::kMapOffset), edi); | 1104 __ mov(FieldOperand(eax, JSObject::kMapOffset), edi); |
1102 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), | 1105 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), |
1103 masm->isolate()->factory()->empty_fixed_array()); | 1106 masm->isolate()->factory()->empty_fixed_array()); |
1104 __ mov(FieldOperand(eax, JSObject::kElementsOffset), | 1107 __ mov(FieldOperand(eax, JSObject::kElementsOffset), |
1105 masm->isolate()->factory()->empty_fixed_array()); | 1108 masm->isolate()->factory()->empty_fixed_array()); |
1106 | 1109 |
1107 // Get the length (smi tagged) and set that as an in-object property too. | 1110 // Get the length (smi tagged) and set that as an in-object property too. |
1108 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 1111 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
1109 __ AssertSmi(ecx); | 1112 __ AssertSmi(ecx); |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2178 // Goto miss case if we do not have a function. | 2181 // Goto miss case if we do not have a function. |
2179 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 2182 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
2180 __ j(not_equal, &miss); | 2183 __ j(not_equal, &miss); |
2181 | 2184 |
2182 // Make sure the function is not the Array() function, which requires special | 2185 // Make sure the function is not the Array() function, which requires special |
2183 // behavior on MISS. | 2186 // behavior on MISS. |
2184 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); | 2187 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); |
2185 __ cmp(edi, ecx); | 2188 __ cmp(edi, ecx); |
2186 __ j(equal, &miss); | 2189 __ j(equal, &miss); |
2187 | 2190 |
2188 // Make sure the function belongs to the same native context. | 2191 // Make sure the function belongs to the same native context (which implies |
| 2192 // the same global object). |
2189 __ mov(ecx, FieldOperand(edi, JSFunction::kContextOffset)); | 2193 __ mov(ecx, FieldOperand(edi, JSFunction::kContextOffset)); |
2190 __ mov(ecx, ContextOperand(ecx, Context::NATIVE_CONTEXT_INDEX)); | 2194 __ mov(ecx, ContextOperand(ecx, Context::GLOBAL_OBJECT_INDEX)); |
2191 __ cmp(ecx, NativeContextOperand()); | 2195 __ cmp(ecx, GlobalObjectOperand()); |
2192 __ j(not_equal, &miss); | 2196 __ j(not_equal, &miss); |
2193 | 2197 |
2194 // Update stats. | 2198 // Update stats. |
2195 __ add(FieldOperand(ebx, with_types_offset), Immediate(Smi::FromInt(1))); | 2199 __ add(FieldOperand(ebx, with_types_offset), Immediate(Smi::FromInt(1))); |
2196 | 2200 |
2197 // Initialize the call counter. | 2201 // Initialize the call counter. |
2198 __ mov(FieldOperand(ebx, edx, times_half_pointer_size, | 2202 __ mov(FieldOperand(ebx, edx, times_half_pointer_size, |
2199 FixedArray::kHeaderSize + kPointerSize), | 2203 FixedArray::kHeaderSize + kPointerSize), |
2200 Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 2204 Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
2201 | 2205 |
(...skipping 3436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5638 Operand(ebp, 7 * kPointerSize), NULL); | 5642 Operand(ebp, 7 * kPointerSize), NULL); |
5639 } | 5643 } |
5640 | 5644 |
5641 | 5645 |
5642 #undef __ | 5646 #undef __ |
5643 | 5647 |
5644 } // namespace internal | 5648 } // namespace internal |
5645 } // namespace v8 | 5649 } // namespace v8 |
5646 | 5650 |
5647 #endif // V8_TARGET_ARCH_IA32 | 5651 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |