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/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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 // Do the allocation of all three objects in one go. | 586 // Do the allocation of all three objects in one go. |
587 __ Allocate(ebx, eax, edi, no_reg, &runtime, TAG_OBJECT); | 587 __ Allocate(ebx, eax, edi, no_reg, &runtime, TAG_OBJECT); |
588 | 588 |
589 // eax = address of new object(s) (tagged) | 589 // eax = address of new object(s) (tagged) |
590 // ecx = argument count (smi-tagged) | 590 // ecx = argument count (smi-tagged) |
591 // esp[0] = mapped parameter count (tagged) | 591 // esp[0] = mapped parameter count (tagged) |
592 // esp[4] = function | 592 // esp[4] = function |
593 // esp[8] = parameter count (tagged) | 593 // esp[8] = parameter count (tagged) |
594 // Get the arguments map from the current native context into edi. | 594 // Get the arguments map from the current native context into edi. |
595 Label has_mapped_parameters, instantiate; | 595 Label has_mapped_parameters, instantiate; |
596 __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 596 __ mov(edi, NativeContextOperand()); |
597 __ mov(edi, FieldOperand(edi, JSGlobalObject::kNativeContextOffset)); | |
598 __ mov(ebx, Operand(esp, 0 * kPointerSize)); | 597 __ mov(ebx, Operand(esp, 0 * kPointerSize)); |
599 __ test(ebx, ebx); | 598 __ test(ebx, ebx); |
600 __ j(not_zero, &has_mapped_parameters, Label::kNear); | 599 __ j(not_zero, &has_mapped_parameters, Label::kNear); |
601 __ mov( | 600 __ mov( |
602 edi, | 601 edi, |
603 Operand(edi, Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX))); | 602 Operand(edi, Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX))); |
604 __ jmp(&instantiate, Label::kNear); | 603 __ jmp(&instantiate, Label::kNear); |
605 | 604 |
606 __ bind(&has_mapped_parameters); | 605 __ bind(&has_mapped_parameters); |
607 __ mov(edi, Operand(edi, Context::SlotOffset( | 606 __ mov(edi, Operand(edi, Context::SlotOffset( |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 __ test(eax, eax); | 789 __ test(eax, eax); |
791 __ j(zero, &add_arguments_object, Label::kNear); | 790 __ j(zero, &add_arguments_object, Label::kNear); |
792 __ lea(eax, Operand(eax, times_2, FixedArray::kHeaderSize)); | 791 __ lea(eax, Operand(eax, times_2, FixedArray::kHeaderSize)); |
793 __ bind(&add_arguments_object); | 792 __ bind(&add_arguments_object); |
794 __ add(eax, Immediate(Heap::kStrictArgumentsObjectSize)); | 793 __ add(eax, Immediate(Heap::kStrictArgumentsObjectSize)); |
795 | 794 |
796 // Do the allocation of both objects in one go. | 795 // Do the allocation of both objects in one go. |
797 __ Allocate(eax, eax, ebx, no_reg, &runtime, TAG_OBJECT); | 796 __ Allocate(eax, eax, ebx, no_reg, &runtime, TAG_OBJECT); |
798 | 797 |
799 // Get the arguments map from the current native context. | 798 // Get the arguments map from the current native context. |
800 __ mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 799 __ mov(edi, NativeContextOperand()); |
801 __ mov(edi, FieldOperand(edi, JSGlobalObject::kNativeContextOffset)); | 800 __ mov(edi, ContextOperand(edi, Context::STRICT_ARGUMENTS_MAP_INDEX)); |
802 const int offset = Context::SlotOffset(Context::STRICT_ARGUMENTS_MAP_INDEX); | |
803 __ mov(edi, Operand(edi, offset)); | |
804 | 801 |
805 __ mov(FieldOperand(eax, JSObject::kMapOffset), edi); | 802 __ mov(FieldOperand(eax, JSObject::kMapOffset), edi); |
806 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), | 803 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), |
807 masm->isolate()->factory()->empty_fixed_array()); | 804 masm->isolate()->factory()->empty_fixed_array()); |
808 __ mov(FieldOperand(eax, JSObject::kElementsOffset), | 805 __ mov(FieldOperand(eax, JSObject::kElementsOffset), |
809 masm->isolate()->factory()->empty_fixed_array()); | 806 masm->isolate()->factory()->empty_fixed_array()); |
810 | 807 |
811 // Get the length (smi tagged) and set that as an in-object property too. | 808 // Get the length (smi tagged) and set that as an in-object property too. |
812 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 809 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
813 __ AssertSmi(ecx); | 810 __ AssertSmi(ecx); |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1888 // Goto miss case if we do not have a function. | 1885 // Goto miss case if we do not have a function. |
1889 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 1886 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
1890 __ j(not_equal, &miss); | 1887 __ j(not_equal, &miss); |
1891 | 1888 |
1892 // Make sure the function is not the Array() function, which requires special | 1889 // Make sure the function is not the Array() function, which requires special |
1893 // behavior on MISS. | 1890 // behavior on MISS. |
1894 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); | 1891 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); |
1895 __ cmp(edi, ecx); | 1892 __ cmp(edi, ecx); |
1896 __ j(equal, &miss); | 1893 __ j(equal, &miss); |
1897 | 1894 |
1898 // Make sure the function belongs to the same native context (which implies | 1895 // Make sure the function belongs to the same native context. |
1899 // the same global object). | |
1900 __ mov(ecx, FieldOperand(edi, JSFunction::kContextOffset)); | 1896 __ mov(ecx, FieldOperand(edi, JSFunction::kContextOffset)); |
1901 __ mov(ecx, ContextOperand(ecx, Context::GLOBAL_OBJECT_INDEX)); | 1897 __ mov(ecx, ContextOperand(ecx, Context::NATIVE_CONTEXT_INDEX)); |
1902 __ cmp(ecx, GlobalObjectOperand()); | 1898 __ cmp(ecx, NativeContextOperand()); |
1903 __ j(not_equal, &miss); | 1899 __ j(not_equal, &miss); |
1904 | 1900 |
1905 // Update stats. | 1901 // Update stats. |
1906 __ add(FieldOperand(ebx, with_types_offset), Immediate(Smi::FromInt(1))); | 1902 __ add(FieldOperand(ebx, with_types_offset), Immediate(Smi::FromInt(1))); |
1907 | 1903 |
1908 // Initialize the call counter. | 1904 // Initialize the call counter. |
1909 __ mov(FieldOperand(ebx, edx, times_half_pointer_size, | 1905 __ mov(FieldOperand(ebx, edx, times_half_pointer_size, |
1910 FixedArray::kHeaderSize + kPointerSize), | 1906 FixedArray::kHeaderSize + kPointerSize), |
1911 Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 1907 Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
1912 | 1908 |
(...skipping 3411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5324 Operand(ebp, 7 * kPointerSize), NULL); | 5320 Operand(ebp, 7 * kPointerSize), NULL); |
5325 } | 5321 } |
5326 | 5322 |
5327 | 5323 |
5328 #undef __ | 5324 #undef __ |
5329 | 5325 |
5330 } // namespace internal | 5326 } // namespace internal |
5331 } // namespace v8 | 5327 } // namespace v8 |
5332 | 5328 |
5333 #endif // V8_TARGET_ARCH_X87 | 5329 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |