| 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/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 __ PushReturnAddressFrom(eax); // Return address. | 466 __ PushReturnAddressFrom(eax); // Return address. |
| 467 __ Push(ebp); // Caller's frame pointer. | 467 __ Push(ebp); // Caller's frame pointer. |
| 468 __ Move(ebp, esp); | 468 __ Move(ebp, esp); |
| 469 __ Push(esi); // Callee's context. | 469 __ Push(esi); // Callee's context. |
| 470 __ Push(edi); // Callee's JS Function. | 470 __ Push(edi); // Callee's JS Function. |
| 471 | 471 |
| 472 // Restore the operand stack. | 472 // Restore the operand stack. |
| 473 __ mov(eax, FieldOperand(ebx, JSGeneratorObject::kOperandStackOffset)); | 473 __ mov(eax, FieldOperand(ebx, JSGeneratorObject::kOperandStackOffset)); |
| 474 { | 474 { |
| 475 Label done_loop, loop; | 475 Label done_loop, loop; |
| 476 __ Move(ecx, Smi::FromInt(0)); | 476 __ Move(ecx, Smi::kZero); |
| 477 __ bind(&loop); | 477 __ bind(&loop); |
| 478 __ cmp(ecx, FieldOperand(eax, FixedArray::kLengthOffset)); | 478 __ cmp(ecx, FieldOperand(eax, FixedArray::kLengthOffset)); |
| 479 __ j(equal, &done_loop, Label::kNear); | 479 __ j(equal, &done_loop, Label::kNear); |
| 480 __ Push(FieldOperand(eax, ecx, times_half_pointer_size, | 480 __ Push(FieldOperand(eax, ecx, times_half_pointer_size, |
| 481 FixedArray::kHeaderSize)); | 481 FixedArray::kHeaderSize)); |
| 482 __ add(ecx, Immediate(Smi::FromInt(1))); | 482 __ add(ecx, Immediate(Smi::FromInt(1))); |
| 483 __ jmp(&loop); | 483 __ jmp(&loop); |
| 484 __ bind(&done_loop); | 484 __ bind(&done_loop); |
| 485 } | 485 } |
| 486 | 486 |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 // This should be unreachable. | 1003 // This should be unreachable. |
| 1004 __ int3(); | 1004 __ int3(); |
| 1005 } | 1005 } |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 1008 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
| 1009 // Set the return address to the correct point in the interpreter entry | 1009 // Set the return address to the correct point in the interpreter entry |
| 1010 // trampoline. | 1010 // trampoline. |
| 1011 Smi* interpreter_entry_return_pc_offset( | 1011 Smi* interpreter_entry_return_pc_offset( |
| 1012 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 1012 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
| 1013 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); | 1013 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::kZero); |
| 1014 __ LoadHeapObject(ebx, | 1014 __ LoadHeapObject(ebx, |
| 1015 masm->isolate()->builtins()->InterpreterEntryTrampoline()); | 1015 masm->isolate()->builtins()->InterpreterEntryTrampoline()); |
| 1016 __ add(ebx, Immediate(interpreter_entry_return_pc_offset->value() + | 1016 __ add(ebx, Immediate(interpreter_entry_return_pc_offset->value() + |
| 1017 Code::kHeaderSize - kHeapObjectTag)); | 1017 Code::kHeaderSize - kHeapObjectTag)); |
| 1018 __ push(ebx); | 1018 __ push(ebx); |
| 1019 | 1019 |
| 1020 // Initialize the dispatch table register. | 1020 // Initialize the dispatch table register. |
| 1021 __ mov(kInterpreterDispatchTableRegister, | 1021 __ mov(kInterpreterDispatchTableRegister, |
| 1022 Immediate(ExternalReference::interpreter_dispatch_table_address( | 1022 Immediate(ExternalReference::interpreter_dispatch_table_address( |
| 1023 masm->isolate()))); | 1023 masm->isolate()))); |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 __ SmiTag(ecx); | 1932 __ SmiTag(ecx); |
| 1933 | 1933 |
| 1934 // 2. Load the first argument into ebx. | 1934 // 2. Load the first argument into ebx. |
| 1935 { | 1935 { |
| 1936 Label no_arguments, done; | 1936 Label no_arguments, done; |
| 1937 __ test(eax, eax); | 1937 __ test(eax, eax); |
| 1938 __ j(zero, &no_arguments, Label::kNear); | 1938 __ j(zero, &no_arguments, Label::kNear); |
| 1939 __ mov(ebx, Operand(esp, eax, times_pointer_size, 0)); | 1939 __ mov(ebx, Operand(esp, eax, times_pointer_size, 0)); |
| 1940 __ jmp(&done, Label::kNear); | 1940 __ jmp(&done, Label::kNear); |
| 1941 __ bind(&no_arguments); | 1941 __ bind(&no_arguments); |
| 1942 __ Move(ebx, Smi::FromInt(0)); | 1942 __ Move(ebx, Smi::kZero); |
| 1943 __ bind(&done); | 1943 __ bind(&done); |
| 1944 } | 1944 } |
| 1945 | 1945 |
| 1946 // 3. Make sure ebx is a number. | 1946 // 3. Make sure ebx is a number. |
| 1947 { | 1947 { |
| 1948 Label done_convert; | 1948 Label done_convert; |
| 1949 __ JumpIfSmi(ebx, &done_convert); | 1949 __ JumpIfSmi(ebx, &done_convert); |
| 1950 __ CompareRoot(FieldOperand(ebx, HeapObject::kMapOffset), | 1950 __ CompareRoot(FieldOperand(ebx, HeapObject::kMapOffset), |
| 1951 Heap::kHeapNumberMapRootIndex); | 1951 Heap::kHeapNumberMapRootIndex); |
| 1952 __ j(equal, &done_convert); | 1952 __ j(equal, &done_convert); |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2830 // static | 2830 // static |
| 2831 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { | 2831 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { |
| 2832 // ----------- S t a t e ------------- | 2832 // ----------- S t a t e ------------- |
| 2833 // -- edx : requested object size (untagged) | 2833 // -- edx : requested object size (untagged) |
| 2834 // -- esp[0] : return address | 2834 // -- esp[0] : return address |
| 2835 // ----------------------------------- | 2835 // ----------------------------------- |
| 2836 __ SmiTag(edx); | 2836 __ SmiTag(edx); |
| 2837 __ PopReturnAddressTo(ecx); | 2837 __ PopReturnAddressTo(ecx); |
| 2838 __ Push(edx); | 2838 __ Push(edx); |
| 2839 __ PushReturnAddressFrom(ecx); | 2839 __ PushReturnAddressFrom(ecx); |
| 2840 __ Move(esi, Smi::FromInt(0)); | 2840 __ Move(esi, Smi::kZero); |
| 2841 __ TailCallRuntime(Runtime::kAllocateInNewSpace); | 2841 __ TailCallRuntime(Runtime::kAllocateInNewSpace); |
| 2842 } | 2842 } |
| 2843 | 2843 |
| 2844 // static | 2844 // static |
| 2845 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { | 2845 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { |
| 2846 // ----------- S t a t e ------------- | 2846 // ----------- S t a t e ------------- |
| 2847 // -- edx : requested object size (untagged) | 2847 // -- edx : requested object size (untagged) |
| 2848 // -- esp[0] : return address | 2848 // -- esp[0] : return address |
| 2849 // ----------------------------------- | 2849 // ----------------------------------- |
| 2850 __ SmiTag(edx); | 2850 __ SmiTag(edx); |
| 2851 __ PopReturnAddressTo(ecx); | 2851 __ PopReturnAddressTo(ecx); |
| 2852 __ Push(edx); | 2852 __ Push(edx); |
| 2853 __ Push(Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); | 2853 __ Push(Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); |
| 2854 __ PushReturnAddressFrom(ecx); | 2854 __ PushReturnAddressFrom(ecx); |
| 2855 __ Move(esi, Smi::FromInt(0)); | 2855 __ Move(esi, Smi::kZero); |
| 2856 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); | 2856 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); |
| 2857 } | 2857 } |
| 2858 | 2858 |
| 2859 // static | 2859 // static |
| 2860 void Builtins::Generate_Abort(MacroAssembler* masm) { | 2860 void Builtins::Generate_Abort(MacroAssembler* masm) { |
| 2861 // ----------- S t a t e ------------- | 2861 // ----------- S t a t e ------------- |
| 2862 // -- edx : message_id as Smi | 2862 // -- edx : message_id as Smi |
| 2863 // -- esp[0] : return address | 2863 // -- esp[0] : return address |
| 2864 // ----------------------------------- | 2864 // ----------------------------------- |
| 2865 __ PopReturnAddressTo(ecx); | 2865 __ PopReturnAddressTo(ecx); |
| 2866 __ Push(edx); | 2866 __ Push(edx); |
| 2867 __ PushReturnAddressFrom(ecx); | 2867 __ PushReturnAddressFrom(ecx); |
| 2868 __ Move(esi, Smi::FromInt(0)); | 2868 __ Move(esi, Smi::kZero); |
| 2869 __ TailCallRuntime(Runtime::kAbort); | 2869 __ TailCallRuntime(Runtime::kAbort); |
| 2870 } | 2870 } |
| 2871 | 2871 |
| 2872 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2872 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 2873 // ----------- S t a t e ------------- | 2873 // ----------- S t a t e ------------- |
| 2874 // -- eax : actual number of arguments | 2874 // -- eax : actual number of arguments |
| 2875 // -- ebx : expected number of arguments | 2875 // -- ebx : expected number of arguments |
| 2876 // -- edx : new target (passed through to callee) | 2876 // -- edx : new target (passed through to callee) |
| 2877 // -- edi : function (passed through to callee) | 2877 // -- edi : function (passed through to callee) |
| 2878 // ----------------------------------- | 2878 // ----------------------------------- |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3142 | 3142 |
| 3143 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3143 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 3144 Generate_OnStackReplacementHelper(masm, true); | 3144 Generate_OnStackReplacementHelper(masm, true); |
| 3145 } | 3145 } |
| 3146 | 3146 |
| 3147 #undef __ | 3147 #undef __ |
| 3148 } // namespace internal | 3148 } // namespace internal |
| 3149 } // namespace v8 | 3149 } // namespace v8 |
| 3150 | 3150 |
| 3151 #endif // V8_TARGET_ARCH_IA32 | 3151 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |