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

Side by Side Diff: src/mips/builtins-mips.cc

Issue 9298014: MIPS: Implement target cache for constructor calls. (Closed)
Patch Set: Created 8 years, 10 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/mips/code-stubs-mips.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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 __ IncrementCounter(counters->string_ctor_gc_required(), 1, a3, t0); 671 __ IncrementCounter(counters->string_ctor_gc_required(), 1, a3, t0);
672 { 672 {
673 FrameScope scope(masm, StackFrame::INTERNAL); 673 FrameScope scope(masm, StackFrame::INTERNAL);
674 __ push(argument); 674 __ push(argument);
675 __ CallRuntime(Runtime::kNewStringWrapper, 1); 675 __ CallRuntime(Runtime::kNewStringWrapper, 1);
676 } 676 }
677 __ Ret(); 677 __ Ret();
678 } 678 }
679 679
680 680
681 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { 681 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
682 bool is_api_function,
683 bool count_constructions) {
682 // ----------- S t a t e ------------- 684 // ----------- S t a t e -------------
683 // -- a0 : number of arguments 685 // -- a0 : number of arguments
684 // -- a1 : constructor function 686 // -- a1 : constructor function
685 // -- ra : return address 687 // -- ra : return address
686 // -- sp[...]: constructor arguments 688 // -- sp[...]: constructor arguments
687 // ----------------------------------- 689 // -----------------------------------
688 690
689 Label slow, non_function_call;
690 // Check that the function is not a smi.
691 __ JumpIfSmi(a1, &non_function_call);
692 // Check that the function is a JSFunction.
693 __ GetObjectType(a1, a2, a2);
694 __ Branch(&slow, ne, a2, Operand(JS_FUNCTION_TYPE));
695
696 // Jump to the function-specific construct stub.
697 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
698 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kConstructStubOffset));
699 __ Addu(t9, a2, Operand(Code::kHeaderSize - kHeapObjectTag));
700 __ Jump(t9);
701
702 // a0: number of arguments
703 // a1: called object
704 // a2: object type
705 Label do_call;
706 __ bind(&slow);
707 __ Branch(&non_function_call, ne, a2, Operand(JS_FUNCTION_PROXY_TYPE));
708 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR);
709 __ jmp(&do_call);
710
711 __ bind(&non_function_call);
712 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
713 __ bind(&do_call);
714 // CALL_NON_FUNCTION expects the non-function constructor as receiver
715 // (instead of the original receiver from the call site). The receiver is
716 // stack element argc.
717 // Set expected number of arguments to zero (not changing a0).
718 __ mov(a2, zero_reg);
719 __ SetCallKind(t1, CALL_AS_METHOD);
720 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
721 RelocInfo::CODE_TARGET);
722 }
723
724
725 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
726 bool is_api_function,
727 bool count_constructions) {
728 // Should never count constructions for api objects. 691 // Should never count constructions for api objects.
729 ASSERT(!is_api_function || !count_constructions); 692 ASSERT(!is_api_function || !count_constructions);
730 693
731 Isolate* isolate = masm->isolate(); 694 Isolate* isolate = masm->isolate();
732 695
733 // ----------- S t a t e ------------- 696 // ----------- S t a t e -------------
734 // -- a0 : number of arguments 697 // -- a0 : number of arguments
735 // -- a1 : constructor function 698 // -- a1 : constructor function
736 // -- ra : return address 699 // -- ra : return address
737 // -- sp[...]: constructor arguments 700 // -- sp[...]: constructor arguments
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 __ mov(s2, t0); 1103 __ mov(s2, t0);
1141 __ mov(s3, t0); 1104 __ mov(s3, t0);
1142 __ mov(s4, t0); 1105 __ mov(s4, t0);
1143 __ mov(s5, t0); 1106 __ mov(s5, t0);
1144 // s6 holds the root address. Do not clobber. 1107 // s6 holds the root address. Do not clobber.
1145 // s7 is cp. Do not init. 1108 // s7 is cp. Do not init.
1146 1109
1147 // Invoke the code and pass argc as a0. 1110 // Invoke the code and pass argc as a0.
1148 __ mov(a0, a3); 1111 __ mov(a0, a3);
1149 if (is_construct) { 1112 if (is_construct) {
1150 __ Call(masm->isolate()->builtins()->JSConstructCall()); 1113 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS);
1114 __ CallStub(&stub);
1151 } else { 1115 } else {
1152 ParameterCount actual(a0); 1116 ParameterCount actual(a0);
1153 __ InvokeFunction(a1, actual, CALL_FUNCTION, 1117 __ InvokeFunction(a1, actual, CALL_FUNCTION,
1154 NullCallWrapper(), CALL_AS_METHOD); 1118 NullCallWrapper(), CALL_AS_METHOD);
1155 } 1119 }
1156 1120
1157 // Leave internal frame. 1121 // Leave internal frame.
1158 } 1122 }
1159 1123
1160 __ Jump(ra); 1124 __ Jump(ra);
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 __ bind(&dont_adapt_arguments); 1773 __ bind(&dont_adapt_arguments);
1810 __ Jump(a3); 1774 __ Jump(a3);
1811 } 1775 }
1812 1776
1813 1777
1814 #undef __ 1778 #undef __
1815 1779
1816 } } // namespace v8::internal 1780 } } // namespace v8::internal
1817 1781
1818 #endif // V8_TARGET_ARCH_MIPS 1782 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698