| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
| (...skipping 5198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5209 ExternalReference::delete_handle_scope_extensions(isolate)); | 5209 ExternalReference::delete_handle_scope_extensions(isolate)); |
| 5210 __ call(rax); | 5210 __ call(rax); |
| 5211 __ movp(rax, prev_limit_reg); | 5211 __ movp(rax, prev_limit_reg); |
| 5212 __ jmp(&leave_exit_frame); | 5212 __ jmp(&leave_exit_frame); |
| 5213 } | 5213 } |
| 5214 | 5214 |
| 5215 | 5215 |
| 5216 static void CallApiFunctionStubHelper(MacroAssembler* masm, | 5216 static void CallApiFunctionStubHelper(MacroAssembler* masm, |
| 5217 const ParameterCount& argc, | 5217 const ParameterCount& argc, |
| 5218 bool return_first_arg, | 5218 bool return_first_arg, |
| 5219 bool call_data_undefined) { | 5219 bool call_data_undefined, bool is_lazy) { |
| 5220 // ----------- S t a t e ------------- | 5220 // ----------- S t a t e ------------- |
| 5221 // -- rdi : callee | 5221 // -- rdi : callee |
| 5222 // -- rbx : call_data | 5222 // -- rbx : call_data |
| 5223 // -- rcx : holder | 5223 // -- rcx : holder |
| 5224 // -- rdx : api_function_address | 5224 // -- rdx : api_function_address |
| 5225 // -- rsi : context | 5225 // -- rsi : context |
| 5226 // -- rax : number of arguments if argc is a register | 5226 // -- rax : number of arguments if argc is a register |
| 5227 // -- rsp[0] : return address | 5227 // -- rsp[0] : return address |
| 5228 // -- rsp[8] : last argument | 5228 // -- rsp[8] : last argument |
| 5229 // -- ... | 5229 // -- ... |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5272 // isolate | 5272 // isolate |
| 5273 __ Move(scratch, ExternalReference::isolate_address(masm->isolate())); | 5273 __ Move(scratch, ExternalReference::isolate_address(masm->isolate())); |
| 5274 __ Push(scratch); | 5274 __ Push(scratch); |
| 5275 // holder | 5275 // holder |
| 5276 __ Push(holder); | 5276 __ Push(holder); |
| 5277 | 5277 |
| 5278 __ movp(scratch, rsp); | 5278 __ movp(scratch, rsp); |
| 5279 // Push return address back on stack. | 5279 // Push return address back on stack. |
| 5280 __ PushReturnAddressFrom(return_address); | 5280 __ PushReturnAddressFrom(return_address); |
| 5281 | 5281 |
| 5282 // load context from callee | 5282 if (!is_lazy) { |
| 5283 __ movp(context, FieldOperand(callee, JSFunction::kContextOffset)); | 5283 // load context from callee |
| 5284 __ movp(context, FieldOperand(callee, JSFunction::kContextOffset)); |
| 5285 } |
| 5284 | 5286 |
| 5285 // Allocate the v8::Arguments structure in the arguments' space since | 5287 // Allocate the v8::Arguments structure in the arguments' space since |
| 5286 // it's not controlled by GC. | 5288 // it's not controlled by GC. |
| 5287 const int kApiStackSpace = 4; | 5289 const int kApiStackSpace = 4; |
| 5288 | 5290 |
| 5289 PrepareCallApiFunction(masm, kApiStackSpace); | 5291 PrepareCallApiFunction(masm, kApiStackSpace); |
| 5290 | 5292 |
| 5291 // FunctionCallbackInfo::implicit_args_. | 5293 // FunctionCallbackInfo::implicit_args_. |
| 5292 __ movp(StackSpaceOperand(0), scratch); | 5294 __ movp(StackSpaceOperand(0), scratch); |
| 5293 if (argc.is_immediate()) { | 5295 if (argc.is_immediate()) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5346 } | 5348 } |
| 5347 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, callback_arg, | 5349 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, callback_arg, |
| 5348 stack_space, stack_space_operand, | 5350 stack_space, stack_space_operand, |
| 5349 return_value_operand, &context_restore_operand); | 5351 return_value_operand, &context_restore_operand); |
| 5350 } | 5352 } |
| 5351 | 5353 |
| 5352 | 5354 |
| 5353 void CallApiFunctionStub::Generate(MacroAssembler* masm) { | 5355 void CallApiFunctionStub::Generate(MacroAssembler* masm) { |
| 5354 bool call_data_undefined = this->call_data_undefined(); | 5356 bool call_data_undefined = this->call_data_undefined(); |
| 5355 CallApiFunctionStubHelper(masm, ParameterCount(rax), false, | 5357 CallApiFunctionStubHelper(masm, ParameterCount(rax), false, |
| 5356 call_data_undefined); | 5358 call_data_undefined, false); |
| 5357 } | 5359 } |
| 5358 | 5360 |
| 5359 | 5361 |
| 5360 void CallApiAccessorStub::Generate(MacroAssembler* masm) { | 5362 void CallApiAccessorStub::Generate(MacroAssembler* masm) { |
| 5361 bool is_store = this->is_store(); | 5363 bool is_store = this->is_store(); |
| 5362 int argc = this->argc(); | 5364 int argc = this->argc(); |
| 5363 bool call_data_undefined = this->call_data_undefined(); | 5365 bool call_data_undefined = this->call_data_undefined(); |
| 5366 bool is_lazy = this->is_lazy(); |
| 5364 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, | 5367 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, |
| 5365 call_data_undefined); | 5368 call_data_undefined, is_lazy); |
| 5366 } | 5369 } |
| 5367 | 5370 |
| 5368 | 5371 |
| 5369 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5372 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5370 // ----------- S t a t e ------------- | 5373 // ----------- S t a t e ------------- |
| 5371 // -- rsp[0] : return address | 5374 // -- rsp[0] : return address |
| 5372 // -- rsp[8] : name | 5375 // -- rsp[8] : name |
| 5373 // -- rsp[16 - kArgsLength*8] : PropertyCallbackArguments object | 5376 // -- rsp[16 - kArgsLength*8] : PropertyCallbackArguments object |
| 5374 // -- ... | 5377 // -- ... |
| 5375 // -- r8 : api_function_address | 5378 // -- r8 : api_function_address |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5423 kStackSpace, nullptr, return_value_operand, NULL); | 5426 kStackSpace, nullptr, return_value_operand, NULL); |
| 5424 } | 5427 } |
| 5425 | 5428 |
| 5426 | 5429 |
| 5427 #undef __ | 5430 #undef __ |
| 5428 | 5431 |
| 5429 } // namespace internal | 5432 } // namespace internal |
| 5430 } // namespace v8 | 5433 } // namespace v8 |
| 5431 | 5434 |
| 5432 #endif // V8_TARGET_ARCH_X64 | 5435 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |