| 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 5231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5242 __ movp(Operand(base_reg, kLimitOffset), prev_limit_reg); | 5242 __ movp(Operand(base_reg, kLimitOffset), prev_limit_reg); |
| 5243 __ movp(prev_limit_reg, rax); | 5243 __ movp(prev_limit_reg, rax); |
| 5244 __ LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate)); | 5244 __ LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate)); |
| 5245 __ LoadAddress(rax, | 5245 __ LoadAddress(rax, |
| 5246 ExternalReference::delete_handle_scope_extensions(isolate)); | 5246 ExternalReference::delete_handle_scope_extensions(isolate)); |
| 5247 __ call(rax); | 5247 __ call(rax); |
| 5248 __ movp(rax, prev_limit_reg); | 5248 __ movp(rax, prev_limit_reg); |
| 5249 __ jmp(&leave_exit_frame); | 5249 __ jmp(&leave_exit_frame); |
| 5250 } | 5250 } |
| 5251 | 5251 |
| 5252 | |
| 5253 static void CallApiFunctionStubHelper(MacroAssembler* masm, | 5252 static void CallApiFunctionStubHelper(MacroAssembler* masm, |
| 5254 const ParameterCount& argc, | 5253 const ParameterCount& argc, |
| 5255 bool return_first_arg, | 5254 bool return_first_arg, |
| 5256 bool call_data_undefined) { | 5255 bool call_data_undefined, bool is_lazy) { |
| 5257 // ----------- S t a t e ------------- | 5256 // ----------- S t a t e ------------- |
| 5258 // -- rdi : callee | 5257 // -- rdi : callee |
| 5259 // -- rbx : call_data | 5258 // -- rbx : call_data |
| 5260 // -- rcx : holder | 5259 // -- rcx : holder |
| 5261 // -- rdx : api_function_address | 5260 // -- rdx : api_function_address |
| 5262 // -- rsi : context | 5261 // -- rsi : context |
| 5263 // -- rax : number of arguments if argc is a register | 5262 // -- rax : number of arguments if argc is a register |
| 5264 // -- rsp[0] : return address | 5263 // -- rsp[0] : return address |
| 5265 // -- rsp[8] : last argument | 5264 // -- rsp[8] : last argument |
| 5266 // -- ... | 5265 // -- ... |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5309 // isolate | 5308 // isolate |
| 5310 __ Move(scratch, ExternalReference::isolate_address(masm->isolate())); | 5309 __ Move(scratch, ExternalReference::isolate_address(masm->isolate())); |
| 5311 __ Push(scratch); | 5310 __ Push(scratch); |
| 5312 // holder | 5311 // holder |
| 5313 __ Push(holder); | 5312 __ Push(holder); |
| 5314 | 5313 |
| 5315 __ movp(scratch, rsp); | 5314 __ movp(scratch, rsp); |
| 5316 // Push return address back on stack. | 5315 // Push return address back on stack. |
| 5317 __ PushReturnAddressFrom(return_address); | 5316 __ PushReturnAddressFrom(return_address); |
| 5318 | 5317 |
| 5319 // load context from callee | 5318 if (!is_lazy) { |
| 5320 __ movp(context, FieldOperand(callee, JSFunction::kContextOffset)); | 5319 // load context from callee |
| 5320 __ movp(context, FieldOperand(callee, JSFunction::kContextOffset)); |
| 5321 } |
| 5321 | 5322 |
| 5322 // Allocate the v8::Arguments structure in the arguments' space since | 5323 // Allocate the v8::Arguments structure in the arguments' space since |
| 5323 // it's not controlled by GC. | 5324 // it's not controlled by GC. |
| 5324 const int kApiStackSpace = 4; | 5325 const int kApiStackSpace = 4; |
| 5325 | 5326 |
| 5326 PrepareCallApiFunction(masm, kApiStackSpace); | 5327 PrepareCallApiFunction(masm, kApiStackSpace); |
| 5327 | 5328 |
| 5328 // FunctionCallbackInfo::implicit_args_. | 5329 // FunctionCallbackInfo::implicit_args_. |
| 5329 __ movp(StackSpaceOperand(0), scratch); | 5330 __ movp(StackSpaceOperand(0), scratch); |
| 5330 if (argc.is_immediate()) { | 5331 if (argc.is_immediate()) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5383 } | 5384 } |
| 5384 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, callback_arg, | 5385 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, callback_arg, |
| 5385 stack_space, stack_space_operand, | 5386 stack_space, stack_space_operand, |
| 5386 return_value_operand, &context_restore_operand); | 5387 return_value_operand, &context_restore_operand); |
| 5387 } | 5388 } |
| 5388 | 5389 |
| 5389 | 5390 |
| 5390 void CallApiFunctionStub::Generate(MacroAssembler* masm) { | 5391 void CallApiFunctionStub::Generate(MacroAssembler* masm) { |
| 5391 bool call_data_undefined = this->call_data_undefined(); | 5392 bool call_data_undefined = this->call_data_undefined(); |
| 5392 CallApiFunctionStubHelper(masm, ParameterCount(rax), false, | 5393 CallApiFunctionStubHelper(masm, ParameterCount(rax), false, |
| 5393 call_data_undefined); | 5394 call_data_undefined, false); |
| 5394 } | 5395 } |
| 5395 | 5396 |
| 5396 | 5397 |
| 5397 void CallApiAccessorStub::Generate(MacroAssembler* masm) { | 5398 void CallApiAccessorStub::Generate(MacroAssembler* masm) { |
| 5398 bool is_store = this->is_store(); | 5399 bool is_store = this->is_store(); |
| 5399 int argc = this->argc(); | 5400 int argc = this->argc(); |
| 5400 bool call_data_undefined = this->call_data_undefined(); | 5401 bool call_data_undefined = this->call_data_undefined(); |
| 5402 bool is_lazy = this->is_lazy(); |
| 5401 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, | 5403 CallApiFunctionStubHelper(masm, ParameterCount(argc), is_store, |
| 5402 call_data_undefined); | 5404 call_data_undefined, is_lazy); |
| 5403 } | 5405 } |
| 5404 | 5406 |
| 5405 | 5407 |
| 5406 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5408 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5407 // ----------- S t a t e ------------- | 5409 // ----------- S t a t e ------------- |
| 5408 // -- rsp[0] : return address | 5410 // -- rsp[0] : return address |
| 5409 // -- rsp[8] : name | 5411 // -- rsp[8] : name |
| 5410 // -- rsp[16 .. (16 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_ | 5412 // -- rsp[16 .. (16 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_ |
| 5411 // -- ... | 5413 // -- ... |
| 5412 // -- r8 : api_function_address | 5414 // -- r8 : api_function_address |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5461 NULL); | 5463 NULL); |
| 5462 } | 5464 } |
| 5463 | 5465 |
| 5464 | 5466 |
| 5465 #undef __ | 5467 #undef __ |
| 5466 | 5468 |
| 5467 } // namespace internal | 5469 } // namespace internal |
| 5468 } // namespace v8 | 5470 } // namespace v8 |
| 5469 | 5471 |
| 5470 #endif // V8_TARGET_ARCH_X64 | 5472 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |