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

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

Issue 669061: First take on custom call generators. (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 | « no previous file | src/array.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 // Handle call cache miss. 808 // Handle call cache miss.
809 __ bind(&miss); 809 __ bind(&miss);
810 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); 810 Handle<Code> ic = ComputeCallMiss(arguments().immediate());
811 __ Jump(ic, RelocInfo::CODE_TARGET); 811 __ Jump(ic, RelocInfo::CODE_TARGET);
812 812
813 // Return the generated code. 813 // Return the generated code.
814 return GetCode(FIELD, name); 814 return GetCode(FIELD, name);
815 } 815 }
816 816
817 817
818 Object* CallStubCompiler::CompileArrayPushCall(Object* object,
819 JSObject* holder,
820 JSFunction* function,
821 String* name,
822 CheckType check) {
823 // ----------- S t a t e -------------
824 // -- r2 : name
825 // -- lr : return address
826 // -----------------------------------
827
828 // TODO(639): faster implementation.
829 ASSERT(check == RECEIVER_MAP_CHECK);
830
831 Label miss;
832
833 // Get the receiver from the stack
834 const int argc = arguments().immediate();
835 __ ldr(r1, MemOperand(sp, argc * kPointerSize));
836
837 // Check that the receiver isn't a smi.
838 __ tst(r1, Operand(kSmiTagMask));
839 __ b(eq, &miss);
840
841 // Check that the maps haven't changed.
842 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r0, name, &miss);
843
844 if (object->IsGlobalObject()) {
845 __ ldr(r3, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset));
846 __ str(r3, MemOperand(sp, argc * kPointerSize));
847 }
848
849 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush),
850 argc + 1,
851 1);
852
853 // Handle call cache miss.
854 __ bind(&miss);
855 Handle<Code> ic = ComputeCallMiss(arguments().immediate());
856 __ Jump(ic, RelocInfo::CODE_TARGET);
857
858 // Return the generated code.
859 String* function_name = NULL;
860 if (function->shared()->name()->IsString()) {
861 function_name = String::cast(function->shared()->name());
862 }
863 return GetCode(CONSTANT_FUNCTION, function_name);
864 }
865
866
818 Object* CallStubCompiler::CompileCallConstant(Object* object, 867 Object* CallStubCompiler::CompileCallConstant(Object* object,
819 JSObject* holder, 868 JSObject* holder,
820 JSFunction* function, 869 JSFunction* function,
821 String* name, 870 String* name,
822 CheckType check) { 871 CheckType check) {
823 // ----------- S t a t e ------------- 872 // ----------- S t a t e -------------
824 // -- r2 : name 873 // -- r2 : name
825 // -- lr : return address 874 // -- lr : return address
826 // ----------------------------------- 875 // -----------------------------------
876 SharedFunctionInfo* function_info = function->shared();
877 if (function_info->HasCustomCallGenerator()) {
878 CustomCallGenerator generator =
879 ToCData<CustomCallGenerator>(function_info->function_data());
880 return generator(this, object, holder, function, name, check);
881 }
882
827 Label miss; 883 Label miss;
828 884
829 // Get the receiver from the stack 885 // Get the receiver from the stack
830 const int argc = arguments().immediate(); 886 const int argc = arguments().immediate();
831 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); 887 __ ldr(r1, MemOperand(sp, argc * kPointerSize));
832 888
833 // Check that the receiver isn't a smi. 889 // Check that the receiver isn't a smi.
834 if (check != NUMBER_CHECK) { 890 if (check != NUMBER_CHECK) {
835 __ tst(r1, Operand(kSmiTagMask)); 891 __ tst(r1, Operand(kSmiTagMask));
836 __ b(eq, &miss); 892 __ b(eq, &miss);
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); 1845 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
1790 1846
1791 // Return the generated code. 1847 // Return the generated code.
1792 return GetCode(); 1848 return GetCode();
1793 } 1849 }
1794 1850
1795 1851
1796 #undef __ 1852 #undef __
1797 1853
1798 } } // namespace v8::internal 1854 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/array.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698