| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2357 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); | 2357 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); |
| 2358 __ j(not_equal, &slow); | 2358 __ j(not_equal, &slow); |
| 2359 | 2359 |
| 2360 if (RecordCallTarget()) { | 2360 if (RecordCallTarget()) { |
| 2361 GenerateRecordCallTarget(masm); | 2361 GenerateRecordCallTarget(masm); |
| 2362 } | 2362 } |
| 2363 | 2363 |
| 2364 // Fast-case: Just invoke the function. | 2364 // Fast-case: Just invoke the function. |
| 2365 ParameterCount actual(argc_); | 2365 ParameterCount actual(argc_); |
| 2366 | 2366 |
| 2367 __ InvokeFunction(rdi, | 2367 __ InvokeFunction(rdi, actual, JUMP_FUNCTION, NullCallWrapper()); |
| 2368 actual, | |
| 2369 JUMP_FUNCTION, | |
| 2370 NullCallWrapper(), | |
| 2371 CALL_AS_FUNCTION); | |
| 2372 | 2368 |
| 2373 // Slow-case: Non-function called. | 2369 // Slow-case: Non-function called. |
| 2374 __ bind(&slow); | 2370 __ bind(&slow); |
| 2375 if (RecordCallTarget()) { | 2371 if (RecordCallTarget()) { |
| 2376 // If there is a call target cache, mark it megamorphic in the | 2372 // If there is a call target cache, mark it megamorphic in the |
| 2377 // non-function case. MegamorphicSentinel is an immortal immovable | 2373 // non-function case. MegamorphicSentinel is an immortal immovable |
| 2378 // object (undefined) so no write barrier is needed. | 2374 // object (undefined) so no write barrier is needed. |
| 2379 __ Move(FieldOperand(rbx, Cell::kValueOffset), | 2375 __ Move(FieldOperand(rbx, Cell::kValueOffset), |
| 2380 TypeFeedbackCells::MegamorphicSentinel(isolate)); | 2376 TypeFeedbackCells::MegamorphicSentinel(isolate)); |
| 2381 } | 2377 } |
| 2382 // Check for function proxy. | 2378 // Check for function proxy. |
| 2383 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); | 2379 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); |
| 2384 __ j(not_equal, &non_function); | 2380 __ j(not_equal, &non_function); |
| 2385 __ PopReturnAddressTo(rcx); | 2381 __ PopReturnAddressTo(rcx); |
| 2386 __ push(rdi); // put proxy as additional argument under return address | 2382 __ push(rdi); // put proxy as additional argument under return address |
| 2387 __ PushReturnAddressFrom(rcx); | 2383 __ PushReturnAddressFrom(rcx); |
| 2388 __ Set(rax, argc_ + 1); | 2384 __ Set(rax, argc_ + 1); |
| 2389 __ Set(rbx, 0); | 2385 __ Set(rbx, 0); |
| 2390 __ SetCallKind(rcx, CALL_AS_FUNCTION); | |
| 2391 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY); | 2386 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY); |
| 2392 { | 2387 { |
| 2393 Handle<Code> adaptor = | 2388 Handle<Code> adaptor = |
| 2394 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 2389 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
| 2395 __ jmp(adaptor, RelocInfo::CODE_TARGET); | 2390 __ jmp(adaptor, RelocInfo::CODE_TARGET); |
| 2396 } | 2391 } |
| 2397 | 2392 |
| 2398 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 2393 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead |
| 2399 // of the original receiver from the call site). | 2394 // of the original receiver from the call site). |
| 2400 __ bind(&non_function); | 2395 __ bind(&non_function); |
| 2401 __ movq(args.GetReceiverOperand(), rdi); | 2396 __ movq(args.GetReceiverOperand(), rdi); |
| 2402 __ Set(rax, argc_); | 2397 __ Set(rax, argc_); |
| 2403 __ Set(rbx, 0); | 2398 __ Set(rbx, 0); |
| 2404 __ SetCallKind(rcx, CALL_AS_FUNCTION); | |
| 2405 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION); | 2399 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION); |
| 2406 Handle<Code> adaptor = | 2400 Handle<Code> adaptor = |
| 2407 isolate->builtins()->ArgumentsAdaptorTrampoline(); | 2401 isolate->builtins()->ArgumentsAdaptorTrampoline(); |
| 2408 __ Jump(adaptor, RelocInfo::CODE_TARGET); | 2402 __ Jump(adaptor, RelocInfo::CODE_TARGET); |
| 2409 } | 2403 } |
| 2410 | 2404 |
| 2411 | 2405 |
| 2412 void CallConstructStub::Generate(MacroAssembler* masm) { | 2406 void CallConstructStub::Generate(MacroAssembler* masm) { |
| 2413 // rax : number of arguments | 2407 // rax : number of arguments |
| 2414 // rbx : cache cell for call target | 2408 // rbx : cache cell for call target |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2441 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); | 2435 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); |
| 2442 __ j(not_equal, &non_function_call); | 2436 __ j(not_equal, &non_function_call); |
| 2443 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); | 2437 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); |
| 2444 __ jmp(&do_call); | 2438 __ jmp(&do_call); |
| 2445 | 2439 |
| 2446 __ bind(&non_function_call); | 2440 __ bind(&non_function_call); |
| 2447 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | 2441 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); |
| 2448 __ bind(&do_call); | 2442 __ bind(&do_call); |
| 2449 // Set expected number of arguments to zero (not changing rax). | 2443 // Set expected number of arguments to zero (not changing rax). |
| 2450 __ Set(rbx, 0); | 2444 __ Set(rbx, 0); |
| 2451 __ SetCallKind(rcx, CALL_AS_METHOD); | |
| 2452 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 2445 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 2453 RelocInfo::CODE_TARGET); | 2446 RelocInfo::CODE_TARGET); |
| 2454 } | 2447 } |
| 2455 | 2448 |
| 2456 | 2449 |
| 2457 bool CEntryStub::NeedsImmovableCode() { | 2450 bool CEntryStub::NeedsImmovableCode() { |
| 2458 return false; | 2451 return false; |
| 2459 } | 2452 } |
| 2460 | 2453 |
| 2461 | 2454 |
| (...skipping 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5104 __ movq(rdi, rax); | 5097 __ movq(rdi, rax); |
| 5105 int parameter_count_offset = | 5098 int parameter_count_offset = |
| 5106 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 5099 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
| 5107 __ movq(rax, MemOperand(rbp, parameter_count_offset)); | 5100 __ movq(rax, MemOperand(rbp, parameter_count_offset)); |
| 5108 // The parameter count above includes the receiver for the arguments passed to | 5101 // The parameter count above includes the receiver for the arguments passed to |
| 5109 // the deoptimization handler. Subtract the receiver for the parameter count | 5102 // the deoptimization handler. Subtract the receiver for the parameter count |
| 5110 // for the call. | 5103 // for the call. |
| 5111 __ subl(rax, Immediate(1)); | 5104 __ subl(rax, Immediate(1)); |
| 5112 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 5105 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 5113 ParameterCount argument_count(rax); | 5106 ParameterCount argument_count(rax); |
| 5114 __ InvokeFunction( | 5107 __ InvokeFunction(rdi, argument_count, JUMP_FUNCTION, NullCallWrapper()); |
| 5115 rdi, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | |
| 5116 } | 5108 } |
| 5117 | 5109 |
| 5118 | 5110 |
| 5119 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 5111 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
| 5120 if (masm->isolate()->function_entry_hook() != NULL) { | 5112 if (masm->isolate()->function_entry_hook() != NULL) { |
| 5121 ProfileEntryHookStub stub; | 5113 ProfileEntryHookStub stub; |
| 5122 masm->CallStub(&stub); | 5114 masm->CallStub(&stub); |
| 5123 } | 5115 } |
| 5124 } | 5116 } |
| 5125 | 5117 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5485 __ bind(&fast_elements_case); | 5477 __ bind(&fast_elements_case); |
| 5486 GenerateCase(masm, FAST_ELEMENTS); | 5478 GenerateCase(masm, FAST_ELEMENTS); |
| 5487 } | 5479 } |
| 5488 | 5480 |
| 5489 | 5481 |
| 5490 #undef __ | 5482 #undef __ |
| 5491 | 5483 |
| 5492 } } // namespace v8::internal | 5484 } } // namespace v8::internal |
| 5493 | 5485 |
| 5494 #endif // V8_TARGET_ARCH_X64 | 5486 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |