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::kZero); | 476 __ Move(ecx, Smi::FromInt(0)); |
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::kZero); | 1013 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); |
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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1916 __ SmiTag(ecx); | 1916 __ SmiTag(ecx); |
1917 | 1917 |
1918 // 2. Load the first argument into ebx. | 1918 // 2. Load the first argument into ebx. |
1919 { | 1919 { |
1920 Label no_arguments, done; | 1920 Label no_arguments, done; |
1921 __ test(eax, eax); | 1921 __ test(eax, eax); |
1922 __ j(zero, &no_arguments, Label::kNear); | 1922 __ j(zero, &no_arguments, Label::kNear); |
1923 __ mov(ebx, Operand(esp, eax, times_pointer_size, 0)); | 1923 __ mov(ebx, Operand(esp, eax, times_pointer_size, 0)); |
1924 __ jmp(&done, Label::kNear); | 1924 __ jmp(&done, Label::kNear); |
1925 __ bind(&no_arguments); | 1925 __ bind(&no_arguments); |
1926 __ Move(ebx, Smi::kZero); | 1926 __ Move(ebx, Smi::FromInt(0)); |
1927 __ bind(&done); | 1927 __ bind(&done); |
1928 } | 1928 } |
1929 | 1929 |
1930 // 3. Make sure ebx is a number. | 1930 // 3. Make sure ebx is a number. |
1931 { | 1931 { |
1932 Label done_convert; | 1932 Label done_convert; |
1933 __ JumpIfSmi(ebx, &done_convert); | 1933 __ JumpIfSmi(ebx, &done_convert); |
1934 __ CompareRoot(FieldOperand(ebx, HeapObject::kMapOffset), | 1934 __ CompareRoot(FieldOperand(ebx, HeapObject::kMapOffset), |
1935 Heap::kHeapNumberMapRootIndex); | 1935 Heap::kHeapNumberMapRootIndex); |
1936 __ j(equal, &done_convert); | 1936 __ j(equal, &done_convert); |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2814 // static | 2814 // static |
2815 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { | 2815 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { |
2816 // ----------- S t a t e ------------- | 2816 // ----------- S t a t e ------------- |
2817 // -- edx : requested object size (untagged) | 2817 // -- edx : requested object size (untagged) |
2818 // -- esp[0] : return address | 2818 // -- esp[0] : return address |
2819 // ----------------------------------- | 2819 // ----------------------------------- |
2820 __ SmiTag(edx); | 2820 __ SmiTag(edx); |
2821 __ PopReturnAddressTo(ecx); | 2821 __ PopReturnAddressTo(ecx); |
2822 __ Push(edx); | 2822 __ Push(edx); |
2823 __ PushReturnAddressFrom(ecx); | 2823 __ PushReturnAddressFrom(ecx); |
2824 __ Move(esi, Smi::kZero); | 2824 __ Move(esi, Smi::FromInt(0)); |
2825 __ TailCallRuntime(Runtime::kAllocateInNewSpace); | 2825 __ TailCallRuntime(Runtime::kAllocateInNewSpace); |
2826 } | 2826 } |
2827 | 2827 |
2828 // static | 2828 // static |
2829 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { | 2829 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { |
2830 // ----------- S t a t e ------------- | 2830 // ----------- S t a t e ------------- |
2831 // -- edx : requested object size (untagged) | 2831 // -- edx : requested object size (untagged) |
2832 // -- esp[0] : return address | 2832 // -- esp[0] : return address |
2833 // ----------------------------------- | 2833 // ----------------------------------- |
2834 __ SmiTag(edx); | 2834 __ SmiTag(edx); |
2835 __ PopReturnAddressTo(ecx); | 2835 __ PopReturnAddressTo(ecx); |
2836 __ Push(edx); | 2836 __ Push(edx); |
2837 __ Push(Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); | 2837 __ Push(Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); |
2838 __ PushReturnAddressFrom(ecx); | 2838 __ PushReturnAddressFrom(ecx); |
2839 __ Move(esi, Smi::kZero); | 2839 __ Move(esi, Smi::FromInt(0)); |
2840 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); | 2840 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); |
2841 } | 2841 } |
2842 | 2842 |
2843 // static | 2843 // static |
2844 void Builtins::Generate_Abort(MacroAssembler* masm) { | 2844 void Builtins::Generate_Abort(MacroAssembler* masm) { |
2845 // ----------- S t a t e ------------- | 2845 // ----------- S t a t e ------------- |
2846 // -- edx : message_id as Smi | 2846 // -- edx : message_id as Smi |
2847 // -- esp[0] : return address | 2847 // -- esp[0] : return address |
2848 // ----------------------------------- | 2848 // ----------------------------------- |
2849 __ PopReturnAddressTo(ecx); | 2849 __ PopReturnAddressTo(ecx); |
2850 __ Push(edx); | 2850 __ Push(edx); |
2851 __ PushReturnAddressFrom(ecx); | 2851 __ PushReturnAddressFrom(ecx); |
2852 __ Move(esi, Smi::kZero); | 2852 __ Move(esi, Smi::FromInt(0)); |
2853 __ TailCallRuntime(Runtime::kAbort); | 2853 __ TailCallRuntime(Runtime::kAbort); |
2854 } | 2854 } |
2855 | 2855 |
2856 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2856 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2857 // ----------- S t a t e ------------- | 2857 // ----------- S t a t e ------------- |
2858 // -- eax : actual number of arguments | 2858 // -- eax : actual number of arguments |
2859 // -- ebx : expected number of arguments | 2859 // -- ebx : expected number of arguments |
2860 // -- edx : new target (passed through to callee) | 2860 // -- edx : new target (passed through to callee) |
2861 // -- edi : function (passed through to callee) | 2861 // -- edi : function (passed through to callee) |
2862 // ----------------------------------- | 2862 // ----------------------------------- |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3126 | 3126 |
3127 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3127 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
3128 Generate_OnStackReplacementHelper(masm, true); | 3128 Generate_OnStackReplacementHelper(masm, true); |
3129 } | 3129 } |
3130 | 3130 |
3131 #undef __ | 3131 #undef __ |
3132 } // namespace internal | 3132 } // namespace internal |
3133 } // namespace v8 | 3133 } // namespace v8 |
3134 | 3134 |
3135 #endif // V8_TARGET_ARCH_IA32 | 3135 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |