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

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 870007: Implement a custom call compiler for Array.pop. (Closed)
Patch Set: Ultimate version Created 10 years, 9 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
« no previous file with comments | « src/stub-cache.h ('k') | test/mjsunit/array-pop.js » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 // necessary. 690 // necessary.
691 if (object->IsGlobalObject()) { 691 if (object->IsGlobalObject()) {
692 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); 692 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset));
693 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); 693 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx);
694 } 694 }
695 695
696 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), 696 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush),
697 argc + 1, 697 argc + 1,
698 1); 698 1);
699 699
700 // Handle call cache miss.
701 __ bind(&miss);
702 Handle<Code> ic = ComputeCallMiss(arguments().immediate());
703 __ Jump(ic, RelocInfo::CODE_TARGET);
704
705 // Return the generated code.
706 String* function_name = NULL;
707 if (function->shared()->name()->IsString()) {
708 function_name = String::cast(function->shared()->name());
709 }
710 return GetCode(CONSTANT_FUNCTION, function_name);
711 }
712
713
714 Object* CallStubCompiler::CompileArrayPopCall(Object* object,
715 JSObject* holder,
716 JSFunction* function,
717 String* name,
718 CheckType check) {
719 // ----------- S t a t e -------------
720 // rcx : function name
721 // rsp[0] : return address
722 // rsp[8] : argument argc
723 // rsp[16] : argument argc - 1
724 // ...
725 // rsp[argc * 8] : argument 1
726 // rsp[(argc + 1) * 8] : argument 0 = receiver
727 // -----------------------------------
728
729 // TODO(642): faster implementation.
730 ASSERT(check == RECEIVER_MAP_CHECK);
731
732 Label miss;
733
734 // Get the receiver from the stack.
735 const int argc = arguments().immediate();
736 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
737
738 // Check that the receiver isn't a smi.
739 __ JumpIfSmi(rdx, &miss);
740
741 // Check that the maps haven't changed.
742 CheckPrototypes(JSObject::cast(object), rdx, holder,
743 rbx, rax, name, &miss);
744
745 // Patch the receiver on the stack with the global proxy if
746 // necessary.
747 if (object->IsGlobalObject()) {
748 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset));
749 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx);
750 }
751
752 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop),
753 argc + 1,
754 1);
700 755
701 // Handle call cache miss. 756 // Handle call cache miss.
702 __ bind(&miss); 757 __ bind(&miss);
703 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); 758 Handle<Code> ic = ComputeCallMiss(arguments().immediate());
704 __ Jump(ic, RelocInfo::CODE_TARGET); 759 __ Jump(ic, RelocInfo::CODE_TARGET);
705 760
706 // Return the generated code. 761 // Return the generated code.
707 String* function_name = NULL; 762 String* function_name = NULL;
708 if (function->shared()->name()->IsString()) { 763 if (function->shared()->name()->IsString()) {
709 function_name = String::cast(function->shared()->name()); 764 function_name = String::cast(function->shared()->name());
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1905 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); 1960 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
1906 1961
1907 // Return the generated code. 1962 // Return the generated code.
1908 return GetCode(); 1963 return GetCode();
1909 } 1964 }
1910 1965
1911 1966
1912 #undef __ 1967 #undef __
1913 1968
1914 } } // namespace v8::internal 1969 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | test/mjsunit/array-pop.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698