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