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/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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 __ PushReturnAddressFrom(eax); // Return address. | 467 __ PushReturnAddressFrom(eax); // Return address. |
468 __ Push(ebp); // Caller's frame pointer. | 468 __ Push(ebp); // Caller's frame pointer. |
469 __ Move(ebp, esp); | 469 __ Move(ebp, esp); |
470 __ Push(esi); // Callee's context. | 470 __ Push(esi); // Callee's context. |
471 __ Push(edi); // Callee's JS Function. | 471 __ Push(edi); // Callee's JS Function. |
472 | 472 |
473 // Restore the operand stack. | 473 // Restore the operand stack. |
474 __ mov(eax, FieldOperand(ebx, JSGeneratorObject::kOperandStackOffset)); | 474 __ mov(eax, FieldOperand(ebx, JSGeneratorObject::kOperandStackOffset)); |
475 { | 475 { |
476 Label done_loop, loop; | 476 Label done_loop, loop; |
477 __ Move(ecx, Smi::FromInt(0)); | 477 __ Move(ecx, Smi::kZero); |
478 __ bind(&loop); | 478 __ bind(&loop); |
479 __ cmp(ecx, FieldOperand(eax, FixedArray::kLengthOffset)); | 479 __ cmp(ecx, FieldOperand(eax, FixedArray::kLengthOffset)); |
480 __ j(equal, &done_loop, Label::kNear); | 480 __ j(equal, &done_loop, Label::kNear); |
481 __ Push(FieldOperand(eax, ecx, times_half_pointer_size, | 481 __ Push(FieldOperand(eax, ecx, times_half_pointer_size, |
482 FixedArray::kHeaderSize)); | 482 FixedArray::kHeaderSize)); |
483 __ add(ecx, Immediate(Smi::FromInt(1))); | 483 __ add(ecx, Immediate(Smi::FromInt(1))); |
484 __ jmp(&loop); | 484 __ jmp(&loop); |
485 __ bind(&done_loop); | 485 __ bind(&done_loop); |
486 } | 486 } |
487 | 487 |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 // This should be unreachable. | 1004 // This should be unreachable. |
1005 __ int3(); | 1005 __ int3(); |
1006 } | 1006 } |
1007 } | 1007 } |
1008 | 1008 |
1009 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 1009 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
1010 // Set the return address to the correct point in the interpreter entry | 1010 // Set the return address to the correct point in the interpreter entry |
1011 // trampoline. | 1011 // trampoline. |
1012 Smi* interpreter_entry_return_pc_offset( | 1012 Smi* interpreter_entry_return_pc_offset( |
1013 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 1013 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
1014 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); | 1014 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::kZero); |
1015 __ LoadHeapObject(ebx, | 1015 __ LoadHeapObject(ebx, |
1016 masm->isolate()->builtins()->InterpreterEntryTrampoline()); | 1016 masm->isolate()->builtins()->InterpreterEntryTrampoline()); |
1017 __ add(ebx, Immediate(interpreter_entry_return_pc_offset->value() + | 1017 __ add(ebx, Immediate(interpreter_entry_return_pc_offset->value() + |
1018 Code::kHeaderSize - kHeapObjectTag)); | 1018 Code::kHeaderSize - kHeapObjectTag)); |
1019 __ push(ebx); | 1019 __ push(ebx); |
1020 | 1020 |
1021 // Initialize the dispatch table register. | 1021 // Initialize the dispatch table register. |
1022 __ mov(kInterpreterDispatchTableRegister, | 1022 __ mov(kInterpreterDispatchTableRegister, |
1023 Immediate(ExternalReference::interpreter_dispatch_table_address( | 1023 Immediate(ExternalReference::interpreter_dispatch_table_address( |
1024 masm->isolate()))); | 1024 masm->isolate()))); |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1949 __ SmiTag(ecx); | 1949 __ SmiTag(ecx); |
1950 | 1950 |
1951 // 2. Load the first argument into ebx. | 1951 // 2. Load the first argument into ebx. |
1952 { | 1952 { |
1953 Label no_arguments, done; | 1953 Label no_arguments, done; |
1954 __ test(eax, eax); | 1954 __ test(eax, eax); |
1955 __ j(zero, &no_arguments, Label::kNear); | 1955 __ j(zero, &no_arguments, Label::kNear); |
1956 __ mov(ebx, Operand(esp, eax, times_pointer_size, 0)); | 1956 __ mov(ebx, Operand(esp, eax, times_pointer_size, 0)); |
1957 __ jmp(&done, Label::kNear); | 1957 __ jmp(&done, Label::kNear); |
1958 __ bind(&no_arguments); | 1958 __ bind(&no_arguments); |
1959 __ Move(ebx, Smi::FromInt(0)); | 1959 __ Move(ebx, Smi::kZero); |
1960 __ bind(&done); | 1960 __ bind(&done); |
1961 } | 1961 } |
1962 | 1962 |
1963 // 3. Make sure ebx is a number. | 1963 // 3. Make sure ebx is a number. |
1964 { | 1964 { |
1965 Label done_convert; | 1965 Label done_convert; |
1966 __ JumpIfSmi(ebx, &done_convert); | 1966 __ JumpIfSmi(ebx, &done_convert); |
1967 __ CompareRoot(FieldOperand(ebx, HeapObject::kMapOffset), | 1967 __ CompareRoot(FieldOperand(ebx, HeapObject::kMapOffset), |
1968 Heap::kHeapNumberMapRootIndex); | 1968 Heap::kHeapNumberMapRootIndex); |
1969 __ j(equal, &done_convert); | 1969 __ j(equal, &done_convert); |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2854 // static | 2854 // static |
2855 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { | 2855 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { |
2856 // ----------- S t a t e ------------- | 2856 // ----------- S t a t e ------------- |
2857 // -- edx : requested object size (untagged) | 2857 // -- edx : requested object size (untagged) |
2858 // -- esp[0] : return address | 2858 // -- esp[0] : return address |
2859 // ----------------------------------- | 2859 // ----------------------------------- |
2860 __ SmiTag(edx); | 2860 __ SmiTag(edx); |
2861 __ PopReturnAddressTo(ecx); | 2861 __ PopReturnAddressTo(ecx); |
2862 __ Push(edx); | 2862 __ Push(edx); |
2863 __ PushReturnAddressFrom(ecx); | 2863 __ PushReturnAddressFrom(ecx); |
2864 __ Move(esi, Smi::FromInt(0)); | 2864 __ Move(esi, Smi::kZero); |
2865 __ TailCallRuntime(Runtime::kAllocateInNewSpace); | 2865 __ TailCallRuntime(Runtime::kAllocateInNewSpace); |
2866 } | 2866 } |
2867 | 2867 |
2868 // static | 2868 // static |
2869 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { | 2869 void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { |
2870 // ----------- S t a t e ------------- | 2870 // ----------- S t a t e ------------- |
2871 // -- edx : requested object size (untagged) | 2871 // -- edx : requested object size (untagged) |
2872 // -- esp[0] : return address | 2872 // -- esp[0] : return address |
2873 // ----------------------------------- | 2873 // ----------------------------------- |
2874 __ SmiTag(edx); | 2874 __ SmiTag(edx); |
2875 __ PopReturnAddressTo(ecx); | 2875 __ PopReturnAddressTo(ecx); |
2876 __ Push(edx); | 2876 __ Push(edx); |
2877 __ Push(Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); | 2877 __ Push(Smi::FromInt(AllocateTargetSpace::encode(OLD_SPACE))); |
2878 __ PushReturnAddressFrom(ecx); | 2878 __ PushReturnAddressFrom(ecx); |
2879 __ Move(esi, Smi::FromInt(0)); | 2879 __ Move(esi, Smi::kZero); |
2880 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); | 2880 __ TailCallRuntime(Runtime::kAllocateInTargetSpace); |
2881 } | 2881 } |
2882 | 2882 |
2883 // static | 2883 // static |
2884 void Builtins::Generate_Abort(MacroAssembler* masm) { | 2884 void Builtins::Generate_Abort(MacroAssembler* masm) { |
2885 // ----------- S t a t e ------------- | 2885 // ----------- S t a t e ------------- |
2886 // -- edx : message_id as Smi | 2886 // -- edx : message_id as Smi |
2887 // -- esp[0] : return address | 2887 // -- esp[0] : return address |
2888 // ----------------------------------- | 2888 // ----------------------------------- |
2889 __ PopReturnAddressTo(ecx); | 2889 __ PopReturnAddressTo(ecx); |
2890 __ Push(edx); | 2890 __ Push(edx); |
2891 __ PushReturnAddressFrom(ecx); | 2891 __ PushReturnAddressFrom(ecx); |
2892 __ Move(esi, Smi::FromInt(0)); | 2892 __ Move(esi, Smi::kZero); |
2893 __ TailCallRuntime(Runtime::kAbort); | 2893 __ TailCallRuntime(Runtime::kAbort); |
2894 } | 2894 } |
2895 | 2895 |
2896 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 2896 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
2897 // ----------- S t a t e ------------- | 2897 // ----------- S t a t e ------------- |
2898 // -- eax : actual number of arguments | 2898 // -- eax : actual number of arguments |
2899 // -- ebx : expected number of arguments | 2899 // -- ebx : expected number of arguments |
2900 // -- edx : new target (passed through to callee) | 2900 // -- edx : new target (passed through to callee) |
2901 // -- edi : function (passed through to callee) | 2901 // -- edi : function (passed through to callee) |
2902 // ----------------------------------- | 2902 // ----------------------------------- |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3166 | 3166 |
3167 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3167 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
3168 Generate_OnStackReplacementHelper(masm, true); | 3168 Generate_OnStackReplacementHelper(masm, true); |
3169 } | 3169 } |
3170 | 3170 |
3171 #undef __ | 3171 #undef __ |
3172 } // namespace internal | 3172 } // namespace internal |
3173 } // namespace v8 | 3173 } // namespace v8 |
3174 | 3174 |
3175 #endif // V8_TARGET_ARCH_X87 | 3175 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |