| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 } | 1957 } |
| 1958 | 1958 |
| 1959 if (call_as_method) { | 1959 if (call_as_method) { |
| 1960 __ bind(&wrap); | 1960 __ bind(&wrap); |
| 1961 EmitWrapCase(masm, argc, &cont); | 1961 EmitWrapCase(masm, argc, &cont); |
| 1962 } | 1962 } |
| 1963 } | 1963 } |
| 1964 | 1964 |
| 1965 | 1965 |
| 1966 void CallFunctionStub::Generate(MacroAssembler* masm) { | 1966 void CallFunctionStub::Generate(MacroAssembler* masm) { |
| 1967 CallFunctionNoFeedback(masm, argc_, NeedsChecks(), CallAsMethod()); | 1967 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod()); |
| 1968 } | 1968 } |
| 1969 | 1969 |
| 1970 | 1970 |
| 1971 void CallConstructStub::Generate(MacroAssembler* masm) { | 1971 void CallConstructStub::Generate(MacroAssembler* masm) { |
| 1972 // eax : number of arguments | 1972 // eax : number of arguments |
| 1973 // ebx : feedback vector | 1973 // ebx : feedback vector |
| 1974 // edx : (only if ebx is not the megamorphic symbol) slot in feedback | 1974 // edx : (only if ebx is not the megamorphic symbol) slot in feedback |
| 1975 // vector (Smi) | 1975 // vector (Smi) |
| 1976 // edi : constructor function | 1976 // edi : constructor function |
| 1977 Label slow, non_function_call; | 1977 Label slow, non_function_call; |
| (...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4126 | 4126 |
| 4127 | 4127 |
| 4128 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { | 4128 void StubFailureTrampolineStub::Generate(MacroAssembler* masm) { |
| 4129 CEntryStub ces(isolate(), 1); | 4129 CEntryStub ces(isolate(), 1); |
| 4130 __ call(ces.GetCode(), RelocInfo::CODE_TARGET); | 4130 __ call(ces.GetCode(), RelocInfo::CODE_TARGET); |
| 4131 int parameter_count_offset = | 4131 int parameter_count_offset = |
| 4132 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 4132 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
| 4133 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); | 4133 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); |
| 4134 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 4134 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 4135 __ pop(ecx); | 4135 __ pop(ecx); |
| 4136 int additional_offset = function_mode_ == JS_FUNCTION_STUB_MODE | 4136 int additional_offset = |
| 4137 ? kPointerSize | 4137 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; |
| 4138 : 0; | |
| 4139 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset)); | 4138 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset)); |
| 4140 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. | 4139 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. |
| 4141 } | 4140 } |
| 4142 | 4141 |
| 4143 | 4142 |
| 4144 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 4143 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
| 4145 if (masm->isolate()->function_entry_hook() != NULL) { | 4144 if (masm->isolate()->function_entry_hook() != NULL) { |
| 4146 ProfileEntryHookStub stub(masm->isolate()); | 4145 ProfileEntryHookStub stub(masm->isolate()); |
| 4147 masm->CallStub(&stub); | 4146 masm->CallStub(&stub); |
| 4148 } | 4147 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4328 stubh2.GetCode(); | 4327 stubh2.GetCode(); |
| 4329 InternalArrayNArgumentsConstructorStub stubh3(isolate, kinds[i]); | 4328 InternalArrayNArgumentsConstructorStub stubh3(isolate, kinds[i]); |
| 4330 stubh3.GetCode(); | 4329 stubh3.GetCode(); |
| 4331 } | 4330 } |
| 4332 } | 4331 } |
| 4333 | 4332 |
| 4334 | 4333 |
| 4335 void ArrayConstructorStub::GenerateDispatchToArrayStub( | 4334 void ArrayConstructorStub::GenerateDispatchToArrayStub( |
| 4336 MacroAssembler* masm, | 4335 MacroAssembler* masm, |
| 4337 AllocationSiteOverrideMode mode) { | 4336 AllocationSiteOverrideMode mode) { |
| 4338 if (argument_count_ == ANY) { | 4337 if (argument_count() == ANY) { |
| 4339 Label not_zero_case, not_one_case; | 4338 Label not_zero_case, not_one_case; |
| 4340 __ test(eax, eax); | 4339 __ test(eax, eax); |
| 4341 __ j(not_zero, ¬_zero_case); | 4340 __ j(not_zero, ¬_zero_case); |
| 4342 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | 4341 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); |
| 4343 | 4342 |
| 4344 __ bind(¬_zero_case); | 4343 __ bind(¬_zero_case); |
| 4345 __ cmp(eax, 1); | 4344 __ cmp(eax, 1); |
| 4346 __ j(greater, ¬_one_case); | 4345 __ j(greater, ¬_one_case); |
| 4347 CreateArrayDispatchOneArgument(masm, mode); | 4346 CreateArrayDispatchOneArgument(masm, mode); |
| 4348 | 4347 |
| 4349 __ bind(¬_one_case); | 4348 __ bind(¬_one_case); |
| 4350 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); | 4349 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); |
| 4351 } else if (argument_count_ == NONE) { | 4350 } else if (argument_count() == NONE) { |
| 4352 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | 4351 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); |
| 4353 } else if (argument_count_ == ONE) { | 4352 } else if (argument_count() == ONE) { |
| 4354 CreateArrayDispatchOneArgument(masm, mode); | 4353 CreateArrayDispatchOneArgument(masm, mode); |
| 4355 } else if (argument_count_ == MORE_THAN_ONE) { | 4354 } else if (argument_count() == MORE_THAN_ONE) { |
| 4356 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); | 4355 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); |
| 4357 } else { | 4356 } else { |
| 4358 UNREACHABLE(); | 4357 UNREACHABLE(); |
| 4359 } | 4358 } |
| 4360 } | 4359 } |
| 4361 | 4360 |
| 4362 | 4361 |
| 4363 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 4362 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
| 4364 // ----------- S t a t e ------------- | 4363 // ----------- S t a t e ------------- |
| 4365 // -- eax : argc (only if argument_count_ == ANY) | 4364 // -- eax : argc (only if argument_count() == ANY) |
| 4366 // -- ebx : AllocationSite or undefined | 4365 // -- ebx : AllocationSite or undefined |
| 4367 // -- edi : constructor | 4366 // -- edi : constructor |
| 4368 // -- esp[0] : return address | 4367 // -- esp[0] : return address |
| 4369 // -- esp[4] : last argument | 4368 // -- esp[4] : last argument |
| 4370 // ----------------------------------- | 4369 // ----------------------------------- |
| 4371 if (FLAG_debug_code) { | 4370 if (FLAG_debug_code) { |
| 4372 // The array construct code is only set for the global and natives | 4371 // The array construct code is only set for the global and natives |
| 4373 // builtin Array functions which always have maps. | 4372 // builtin Array functions which always have maps. |
| 4374 | 4373 |
| 4375 // Initial map for the builtin Array function should be a map. | 4374 // Initial map for the builtin Array function should be a map. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4503 // -- esp[(argc + 1) * 4] : receiver | 4502 // -- esp[(argc + 1) * 4] : receiver |
| 4504 // ----------------------------------- | 4503 // ----------------------------------- |
| 4505 | 4504 |
| 4506 Register callee = eax; | 4505 Register callee = eax; |
| 4507 Register call_data = ebx; | 4506 Register call_data = ebx; |
| 4508 Register holder = ecx; | 4507 Register holder = ecx; |
| 4509 Register api_function_address = edx; | 4508 Register api_function_address = edx; |
| 4510 Register return_address = edi; | 4509 Register return_address = edi; |
| 4511 Register context = esi; | 4510 Register context = esi; |
| 4512 | 4511 |
| 4513 int argc = ArgumentBits::decode(bit_field_); | 4512 int argc = this->argc(); |
| 4514 bool is_store = IsStoreBits::decode(bit_field_); | 4513 bool is_store = this->is_store(); |
| 4515 bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_); | 4514 bool call_data_undefined = this->call_data_undefined(); |
| 4516 | 4515 |
| 4517 typedef FunctionCallbackArguments FCA; | 4516 typedef FunctionCallbackArguments FCA; |
| 4518 | 4517 |
| 4519 STATIC_ASSERT(FCA::kContextSaveIndex == 6); | 4518 STATIC_ASSERT(FCA::kContextSaveIndex == 6); |
| 4520 STATIC_ASSERT(FCA::kCalleeIndex == 5); | 4519 STATIC_ASSERT(FCA::kCalleeIndex == 5); |
| 4521 STATIC_ASSERT(FCA::kDataIndex == 4); | 4520 STATIC_ASSERT(FCA::kDataIndex == 4); |
| 4522 STATIC_ASSERT(FCA::kReturnValueOffset == 3); | 4521 STATIC_ASSERT(FCA::kReturnValueOffset == 3); |
| 4523 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); | 4522 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); |
| 4524 STATIC_ASSERT(FCA::kIsolateIndex == 1); | 4523 STATIC_ASSERT(FCA::kIsolateIndex == 1); |
| 4525 STATIC_ASSERT(FCA::kHolderIndex == 0); | 4524 STATIC_ASSERT(FCA::kHolderIndex == 0); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4645 Operand(ebp, 7 * kPointerSize), | 4644 Operand(ebp, 7 * kPointerSize), |
| 4646 NULL); | 4645 NULL); |
| 4647 } | 4646 } |
| 4648 | 4647 |
| 4649 | 4648 |
| 4650 #undef __ | 4649 #undef __ |
| 4651 | 4650 |
| 4652 } } // namespace v8::internal | 4651 } } // namespace v8::internal |
| 4653 | 4652 |
| 4654 #endif // V8_TARGET_ARCH_X87 | 4653 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |