| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 __ bind(&ok); | 116 __ bind(&ok); |
| 117 GenerateTailCallToSharedCode(masm); | 117 GenerateTailCallToSharedCode(masm); |
| 118 } | 118 } |
| 119 | 119 |
| 120 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 120 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
| 121 bool is_api_function, | 121 bool is_api_function, |
| 122 bool create_implicit_receiver, | 122 bool create_implicit_receiver, |
| 123 bool check_derived_construct) { | 123 bool check_derived_construct) { |
| 124 // ----------- S t a t e ------------- | 124 // ----------- S t a t e ------------- |
| 125 // -- eax: number of arguments | 125 // -- eax: number of arguments |
| 126 // -- esi: context |
| 126 // -- edi: constructor function | 127 // -- edi: constructor function |
| 127 // -- ebx: allocation site or undefined | 128 // -- ebx: allocation site or undefined |
| 128 // -- edx: new target | 129 // -- edx: new target |
| 129 // ----------------------------------- | 130 // ----------------------------------- |
| 130 | 131 |
| 131 // Enter a construct frame. | 132 // Enter a construct frame. |
| 132 { | 133 { |
| 133 FrameScope scope(masm, StackFrame::CONSTRUCT); | 134 FrameScope scope(masm, StackFrame::CONSTRUCT); |
| 134 | 135 |
| 135 // Preserve the incoming parameters on the stack. | 136 // Preserve the incoming parameters on the stack. |
| 136 __ AssertUndefinedOrAllocationSite(ebx); | 137 __ AssertUndefinedOrAllocationSite(ebx); |
| 138 __ push(esi); |
| 137 __ push(ebx); | 139 __ push(ebx); |
| 138 __ SmiTag(eax); | 140 __ SmiTag(eax); |
| 139 __ push(eax); | 141 __ push(eax); |
| 140 | 142 |
| 141 if (create_implicit_receiver) { | 143 if (create_implicit_receiver) { |
| 142 // Allocate the new receiver object. | 144 // Allocate the new receiver object. |
| 143 __ Push(edi); | 145 __ Push(edi); |
| 144 __ Push(edx); | 146 __ Push(edx); |
| 145 FastNewObjectStub stub(masm->isolate()); | 147 FastNewObjectStub stub(masm->isolate()); |
| 146 __ CallStub(&stub); | 148 __ CallStub(&stub); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 __ InvokeFunction(edi, edx, actual, CALL_FUNCTION, | 196 __ InvokeFunction(edi, edx, actual, CALL_FUNCTION, |
| 195 CheckDebugStepCallWrapper()); | 197 CheckDebugStepCallWrapper()); |
| 196 } | 198 } |
| 197 | 199 |
| 198 // Store offset of return address for deoptimizer. | 200 // Store offset of return address for deoptimizer. |
| 199 if (create_implicit_receiver && !is_api_function) { | 201 if (create_implicit_receiver && !is_api_function) { |
| 200 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); | 202 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); |
| 201 } | 203 } |
| 202 | 204 |
| 203 // Restore context from the frame. | 205 // Restore context from the frame. |
| 204 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 206 __ mov(esi, Operand(ebp, ConstructFrameConstants::kContextOffset)); |
| 205 | 207 |
| 206 if (create_implicit_receiver) { | 208 if (create_implicit_receiver) { |
| 207 // If the result is an object (in the ECMA sense), we should get rid | 209 // If the result is an object (in the ECMA sense), we should get rid |
| 208 // of the receiver and use the result. | 210 // of the receiver and use the result. |
| 209 Label use_receiver, exit; | 211 Label use_receiver, exit; |
| 210 | 212 |
| 211 // If the result is a smi, it is *not* an object in the ECMA sense. | 213 // If the result is a smi, it is *not* an object in the ECMA sense. |
| 212 __ JumpIfSmi(eax, &use_receiver); | 214 __ JumpIfSmi(eax, &use_receiver); |
| 213 | 215 |
| 214 // If the type of the result (stored in its map) is less than | 216 // If the type of the result (stored in its map) is less than |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 __ CallRuntime(Runtime::kThrowStackOverflow); | 319 __ CallRuntime(Runtime::kThrowStackOverflow); |
| 318 | 320 |
| 319 __ bind(&okay); | 321 __ bind(&okay); |
| 320 } | 322 } |
| 321 | 323 |
| 322 | 324 |
| 323 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 325 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
| 324 bool is_construct) { | 326 bool is_construct) { |
| 325 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 327 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
| 326 | 328 |
| 327 // Clear the context before we push it when entering the internal frame. | |
| 328 __ Move(esi, Immediate(0)); | |
| 329 | |
| 330 { | 329 { |
| 331 FrameScope scope(masm, StackFrame::INTERNAL); | 330 FrameScope scope(masm, StackFrame::INTERNAL); |
| 332 | 331 |
| 333 // Setup the context (we need to use the caller context from the isolate). | 332 // Setup the context (we need to use the caller context from the isolate). |
| 334 ExternalReference context_address(Isolate::kContextAddress, | 333 ExternalReference context_address(Isolate::kContextAddress, |
| 335 masm->isolate()); | 334 masm->isolate()); |
| 336 __ mov(esi, Operand::StaticVariable(context_address)); | 335 __ mov(esi, Operand::StaticVariable(context_address)); |
| 337 | 336 |
| 338 // Load the previous frame pointer (ebx) to access C arguments | 337 // Load the previous frame pointer (ebx) to access C arguments |
| 339 __ mov(ebx, Operand(ebp, 0)); | 338 __ mov(ebx, Operand(ebp, 0)); |
| (...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1856 Label done; | 1855 Label done; |
| 1857 ExternalReference debug_is_active = | 1856 ExternalReference debug_is_active = |
| 1858 ExternalReference::debug_is_active_address(masm->isolate()); | 1857 ExternalReference::debug_is_active_address(masm->isolate()); |
| 1859 __ movzx_b(scratch1, Operand::StaticVariable(debug_is_active)); | 1858 __ movzx_b(scratch1, Operand::StaticVariable(debug_is_active)); |
| 1860 __ cmp(scratch1, Immediate(0)); | 1859 __ cmp(scratch1, Immediate(0)); |
| 1861 __ j(not_equal, &done, Label::kNear); | 1860 __ j(not_equal, &done, Label::kNear); |
| 1862 | 1861 |
| 1863 // Drop possible interpreter handler/stub frame. | 1862 // Drop possible interpreter handler/stub frame. |
| 1864 { | 1863 { |
| 1865 Label no_interpreter_frame; | 1864 Label no_interpreter_frame; |
| 1866 __ cmp(Operand(ebp, StandardFrameConstants::kMarkerOffset), | 1865 __ cmp(Operand(ebp, CommonFrameConstants::kContextOrFrameTypeOffset), |
| 1867 Immediate(Smi::FromInt(StackFrame::STUB))); | 1866 Immediate(Smi::FromInt(StackFrame::STUB))); |
| 1868 __ j(not_equal, &no_interpreter_frame, Label::kNear); | 1867 __ j(not_equal, &no_interpreter_frame, Label::kNear); |
| 1869 __ mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 1868 __ mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
| 1870 __ bind(&no_interpreter_frame); | 1869 __ bind(&no_interpreter_frame); |
| 1871 } | 1870 } |
| 1872 | 1871 |
| 1873 // Check if next frame is an arguments adaptor frame. | 1872 // Check if next frame is an arguments adaptor frame. |
| 1874 Label no_arguments_adaptor, formal_parameter_count_loaded; | 1873 Label no_arguments_adaptor, formal_parameter_count_loaded; |
| 1875 __ mov(scratch2, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 1874 __ mov(scratch2, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
| 1876 __ cmp(Operand(scratch2, StandardFrameConstants::kContextOffset), | 1875 __ cmp(Operand(scratch2, CommonFrameConstants::kContextOrFrameTypeOffset), |
| 1877 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 1876 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 1878 __ j(not_equal, &no_arguments_adaptor, Label::kNear); | 1877 __ j(not_equal, &no_arguments_adaptor, Label::kNear); |
| 1879 | 1878 |
| 1880 // Drop arguments adaptor frame and load arguments count. | 1879 // Drop arguments adaptor frame and load arguments count. |
| 1881 __ mov(ebp, scratch2); | 1880 __ mov(ebp, scratch2); |
| 1882 __ mov(scratch1, Operand(ebp, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 1881 __ mov(scratch1, Operand(ebp, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 1883 __ SmiUntag(scratch1); | 1882 __ SmiUntag(scratch1); |
| 1884 __ jmp(&formal_parameter_count_loaded, Label::kNear); | 1883 __ jmp(&formal_parameter_count_loaded, Label::kNear); |
| 1885 | 1884 |
| 1886 __ bind(&no_arguments_adaptor); | 1885 __ bind(&no_arguments_adaptor); |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2650 | 2649 |
| 2651 __ bind(&ok); | 2650 __ bind(&ok); |
| 2652 __ ret(0); | 2651 __ ret(0); |
| 2653 } | 2652 } |
| 2654 | 2653 |
| 2655 #undef __ | 2654 #undef __ |
| 2656 } // namespace internal | 2655 } // namespace internal |
| 2657 } // namespace v8 | 2656 } // namespace v8 |
| 2658 | 2657 |
| 2659 #endif // V8_TARGET_ARCH_IA32 | 2658 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |