Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 10124008: Port function call type-feedback cells to x64 and ARM. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix regsiter for proxy check on ARM. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3610 matching lines...) Expand 10 before | Expand all | Expand 10 after
3621 // An uninitialized cache is patched with the function. 3621 // An uninitialized cache is patched with the function.
3622 __ bind(&initialize); 3622 __ bind(&initialize);
3623 __ movq(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), rdi); 3623 __ movq(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), rdi);
3624 // No need for a write barrier here - cells are rescanned. 3624 // No need for a write barrier here - cells are rescanned.
3625 3625
3626 __ bind(&done); 3626 __ bind(&done);
3627 } 3627 }
3628 3628
3629 3629
3630 void CallFunctionStub::Generate(MacroAssembler* masm) { 3630 void CallFunctionStub::Generate(MacroAssembler* masm) {
3631 // rbx : cache cell for call target
3631 // rdi : the function to call 3632 // rdi : the function to call
3632 // rbx : cache cell for call target 3633 Isolate* isolate = masm->isolate();
3633 Label slow, non_function; 3634 Label slow, non_function;
3634 3635
3635 // The receiver might implicitly be the global object. This is 3636 // The receiver might implicitly be the global object. This is
3636 // indicated by passing the hole as the receiver to the call 3637 // indicated by passing the hole as the receiver to the call
3637 // function stub. 3638 // function stub.
3638 if (ReceiverMightBeImplicit()) { 3639 if (ReceiverMightBeImplicit()) {
3639 Label call; 3640 Label call;
3640 // Get the receiver from the stack. 3641 // Get the receiver from the stack.
3641 // +1 ~ return address 3642 // +1 ~ return address
3642 __ movq(rax, Operand(rsp, (argc_ + 1) * kPointerSize)); 3643 __ movq(rax, Operand(rsp, (argc_ + 1) * kPointerSize));
3643 // Call as function is indicated with the hole. 3644 // Call as function is indicated with the hole.
3644 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex); 3645 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
3645 __ j(not_equal, &call, Label::kNear); 3646 __ j(not_equal, &call, Label::kNear);
3646 // Patch the receiver on the stack with the global receiver object. 3647 // Patch the receiver on the stack with the global receiver object.
3647 __ movq(rbx, GlobalObjectOperand()); 3648 __ movq(rcx, GlobalObjectOperand());
3648 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset)); 3649 __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalReceiverOffset));
3649 __ movq(Operand(rsp, (argc_ + 1) * kPointerSize), rbx); 3650 __ movq(Operand(rsp, (argc_ + 1) * kPointerSize), rcx);
3650 __ bind(&call); 3651 __ bind(&call);
3651 } 3652 }
3652 3653
3653 // Check that the function really is a JavaScript function. 3654 // Check that the function really is a JavaScript function.
3654 __ JumpIfSmi(rdi, &non_function); 3655 __ JumpIfSmi(rdi, &non_function);
3655 // Goto slow case if we do not have a function. 3656 // Goto slow case if we do not have a function.
3656 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); 3657 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
3657 __ j(not_equal, &slow); 3658 __ j(not_equal, &slow);
3658 3659
3660 if (RecordCallTarget()) {
3661 GenerateRecordCallTarget(masm);
3662 }
3663
3659 // Fast-case: Just invoke the function. 3664 // Fast-case: Just invoke the function.
3660 ParameterCount actual(argc_); 3665 ParameterCount actual(argc_);
3661 3666
3662 if (ReceiverMightBeImplicit()) { 3667 if (ReceiverMightBeImplicit()) {
3663 Label call_as_function; 3668 Label call_as_function;
3664 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex); 3669 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
3665 __ j(equal, &call_as_function); 3670 __ j(equal, &call_as_function);
3666 __ InvokeFunction(rdi, 3671 __ InvokeFunction(rdi,
3667 actual, 3672 actual,
3668 JUMP_FUNCTION, 3673 JUMP_FUNCTION,
3669 NullCallWrapper(), 3674 NullCallWrapper(),
3670 CALL_AS_METHOD); 3675 CALL_AS_METHOD);
3671 __ bind(&call_as_function); 3676 __ bind(&call_as_function);
3672 } 3677 }
3673 __ InvokeFunction(rdi, 3678 __ InvokeFunction(rdi,
3674 actual, 3679 actual,
3675 JUMP_FUNCTION, 3680 JUMP_FUNCTION,
3676 NullCallWrapper(), 3681 NullCallWrapper(),
3677 CALL_AS_FUNCTION); 3682 CALL_AS_FUNCTION);
3678 3683
3679 // Slow-case: Non-function called. 3684 // Slow-case: Non-function called.
3680 __ bind(&slow); 3685 __ bind(&slow);
3686 if (RecordCallTarget()) {
3687 // If there is a call target cache, mark it megamorphic in the
3688 // non-function case. MegamorphicSentinel is an immortal immovable
3689 // object (undefined) so no write barrier is needed.
3690 __ Move(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset),
3691 TypeFeedbackCells::MegamorphicSentinel(isolate));
3692 }
3681 // Check for function proxy. 3693 // Check for function proxy.
3682 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); 3694 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE);
3683 __ j(not_equal, &non_function); 3695 __ j(not_equal, &non_function);
3684 __ pop(rcx); 3696 __ pop(rcx);
3685 __ push(rdi); // put proxy as additional argument under return address 3697 __ push(rdi); // put proxy as additional argument under return address
3686 __ push(rcx); 3698 __ push(rcx);
3687 __ Set(rax, argc_ + 1); 3699 __ Set(rax, argc_ + 1);
3688 __ Set(rbx, 0); 3700 __ Set(rbx, 0);
3689 __ SetCallKind(rcx, CALL_AS_METHOD); 3701 __ SetCallKind(rcx, CALL_AS_METHOD);
3690 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY); 3702 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY);
(...skipping 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after
6314 xmm0, 6326 xmm0,
6315 &slow_elements); 6327 &slow_elements);
6316 __ ret(0); 6328 __ ret(0);
6317 } 6329 }
6318 6330
6319 #undef __ 6331 #undef __
6320 6332
6321 } } // namespace v8::internal 6333 } } // namespace v8::internal
6322 6334
6323 #endif // V8_TARGET_ARCH_X64 6335 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698