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 5347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5358 __ movp(Operand(base_reg, kLimitOffset), prev_limit_reg); | 5358 __ movp(Operand(base_reg, kLimitOffset), prev_limit_reg); |
5359 __ movp(prev_limit_reg, rax); | 5359 __ movp(prev_limit_reg, rax); |
5360 __ LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate)); | 5360 __ LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate)); |
5361 __ LoadAddress(rax, | 5361 __ LoadAddress(rax, |
5362 ExternalReference::delete_handle_scope_extensions(isolate)); | 5362 ExternalReference::delete_handle_scope_extensions(isolate)); |
5363 __ call(rax); | 5363 __ call(rax); |
5364 __ movp(rax, prev_limit_reg); | 5364 __ movp(rax, prev_limit_reg); |
5365 __ jmp(&leave_exit_frame); | 5365 __ jmp(&leave_exit_frame); |
5366 } | 5366 } |
5367 | 5367 |
| 5368 |
5368 static void CallApiFunctionStubHelper(MacroAssembler* masm, | 5369 static void CallApiFunctionStubHelper(MacroAssembler* masm, |
5369 const ParameterCount& argc, | 5370 const ParameterCount& argc, |
5370 bool return_first_arg, | 5371 bool return_first_arg, |
5371 bool call_data_undefined, bool is_lazy) { | 5372 bool call_data_undefined) { |
5372 // ----------- S t a t e ------------- | 5373 // ----------- S t a t e ------------- |
5373 // -- rdi : callee | 5374 // -- rdi : callee |
5374 // -- rbx : call_data | 5375 // -- rbx : call_data |
5375 // -- rcx : holder | 5376 // -- rcx : holder |
5376 // -- rdx : api_function_address | 5377 // -- rdx : api_function_address |
5377 // -- rsi : context | 5378 // -- rsi : context |
5378 // -- rax : number of arguments if argc is a register | 5379 // -- rax : number of arguments if argc is a register |
5379 // -- rsp[0] : return address | 5380 // -- rsp[0] : return address |
5380 // -- rsp[8] : last argument | 5381 // -- rsp[8] : last argument |
5381 // -- ... | 5382 // -- ... |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5424 // isolate | 5425 // isolate |
5425 __ Move(scratch, ExternalReference::isolate_address(masm->isolate())); | 5426 __ Move(scratch, ExternalReference::isolate_address(masm->isolate())); |
5426 __ Push(scratch); | 5427 __ Push(scratch); |
5427 // holder | 5428 // holder |
5428 __ Push(holder); | 5429 __ Push(holder); |
5429 | 5430 |
5430 __ movp(scratch, rsp); | 5431 __ movp(scratch, rsp); |
5431 // Push return address back on stack. | 5432 // Push return address back on stack. |
5432 __ PushReturnAddressFrom(return_address); | 5433 __ PushReturnAddressFrom(return_address); |
5433 | 5434 |
5434 if (!is_lazy) { | 5435 // load context from callee |
5435 // load context from callee | 5436 __ movp(context, FieldOperand(callee, JSFunction::kContextOffset)); |
5436 __ movp(context, FieldOperand(callee, JSFunction::kContextOffset)); | |
5437 } | |
5438 | 5437 |
5439 // Allocate the v8::Arguments structure in the arguments' space since | 5438 // Allocate the v8::Arguments structure in the arguments' space since |
5440 // it's not controlled by GC. | 5439 // it's not controlled by GC. |
5441 const int kApiStackSpace = 4; | 5440 const int kApiStackSpace = 4; |
5442 | 5441 |
5443 PrepareCallApiFunction(masm, kApiStackSpace); | 5442 PrepareCallApiFunction(masm, kApiStackSpace); |
5444 | 5443 |
5445 // FunctionCallbackInfo::implicit_args_. | 5444 // FunctionCallbackInfo::implicit_args_. |
5446 __ movp(StackSpaceOperand(0), scratch); | 5445 __ movp(StackSpaceOperand(0), scratch); |
5447 if (argc.is_immediate()) { | 5446 if (argc.is_immediate()) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5500 } | 5499 } |
5501 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, callback_arg, | 5500 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, callback_arg, |
5502 stack_space, stack_space_operand, | 5501 stack_space, stack_space_operand, |
5503 return_value_operand, &context_restore_operand); | 5502 return_value_operand, &context_restore_operand); |
5504 } | 5503 } |
5505 | 5504 |
5506 | 5505 |
5507 void CallApiFunctionStub::Generate(MacroAssembler* masm) { | 5506 void CallApiFunctionStub::Generate(MacroAssembler* masm) { |
5508 bool call_data_undefined = this->call_data_undefined(); | 5507 bool call_data_undefined = this->call_data_undefined(); |
5509 CallApiFunctionStubHelper(masm, ParameterCount(rax), false, | 5508 CallApiFunctionStubHelper(masm, ParameterCount(rax), false, |
5510 call_data_undefined, false); | 5509 call_data_undefined); |
5511 } | 5510 } |
5512 | 5511 |
5513 | 5512 |
5514 void CallApiAccessorStub::Generate(MacroAssembler* masm) { | 5513 void CallApiAccessorStub::Generate(MacroAssembler* masm) { |
5515 bool is_store = this->is_store(); | 5514 bool is_store = this->is_store(); |
5516 int argc = this->argc(); | 5515 int argc = this->argc(); |
5517 bool call_data_undefined = this->call_data_undefined(); | 5516 bool call_data_undefined = this->call_data_undefined(); |
5518 bool is_lazy = this->is_lazy(); | |
5519 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, | 5517 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, |
5520 call_data_undefined, is_lazy); | 5518 call_data_undefined); |
5521 } | 5519 } |
5522 | 5520 |
5523 | 5521 |
5524 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5522 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
5525 // ----------- S t a t e ------------- | 5523 // ----------- S t a t e ------------- |
5526 // -- rsp[0] : return address | 5524 // -- rsp[0] : return address |
5527 // -- rsp[8] : name | 5525 // -- rsp[8] : name |
5528 // -- rsp[16 .. (16 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_ | 5526 // -- rsp[16 .. (16 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_ |
5529 // -- ... | 5527 // -- ... |
5530 // -- r8 : api_function_address | 5528 // -- r8 : api_function_address |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5579 NULL); | 5577 NULL); |
5580 } | 5578 } |
5581 | 5579 |
5582 | 5580 |
5583 #undef __ | 5581 #undef __ |
5584 | 5582 |
5585 } // namespace internal | 5583 } // namespace internal |
5586 } // namespace v8 | 5584 } // namespace v8 |
5587 | 5585 |
5588 #endif // V8_TARGET_ARCH_X64 | 5586 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |