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

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

Issue 148593004: A64: Synchronize with r18084. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/mips/assembler-mips-inl.h ('k') | 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // -- sp[...]: constructor arguments 115 // -- sp[...]: constructor arguments
116 // ----------------------------------- 116 // -----------------------------------
117 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; 117 Label generic_array_code, one_or_more_arguments, two_or_more_arguments;
118 118
119 // Get the InternalArray function. 119 // Get the InternalArray function.
120 GenerateLoadInternalArrayFunction(masm, a1); 120 GenerateLoadInternalArrayFunction(masm, a1);
121 121
122 if (FLAG_debug_code) { 122 if (FLAG_debug_code) {
123 // Initial map for the builtin InternalArray functions should be maps. 123 // Initial map for the builtin InternalArray functions should be maps.
124 __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); 124 __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
125 __ And(t0, a2, Operand(kSmiTagMask)); 125 __ SmiTst(a2, t0);
126 __ Assert(ne, kUnexpectedInitialMapForInternalArrayFunction, 126 __ Assert(ne, kUnexpectedInitialMapForInternalArrayFunction,
127 t0, Operand(zero_reg)); 127 t0, Operand(zero_reg));
128 __ GetObjectType(a2, a3, t0); 128 __ GetObjectType(a2, a3, t0);
129 __ Assert(eq, kUnexpectedInitialMapForInternalArrayFunction, 129 __ Assert(eq, kUnexpectedInitialMapForInternalArrayFunction,
130 t0, Operand(MAP_TYPE)); 130 t0, Operand(MAP_TYPE));
131 } 131 }
132 132
133 // Run the native code for the InternalArray function called as a normal 133 // Run the native code for the InternalArray function called as a normal
134 // function. 134 // function.
135 // Tail call a stub. 135 // Tail call a stub.
136 InternalArrayConstructorStub stub(masm->isolate()); 136 InternalArrayConstructorStub stub(masm->isolate());
137 __ TailCallStub(&stub); 137 __ TailCallStub(&stub);
138 } 138 }
139 139
140 140
141 void Builtins::Generate_ArrayCode(MacroAssembler* masm) { 141 void Builtins::Generate_ArrayCode(MacroAssembler* masm) {
142 // ----------- S t a t e ------------- 142 // ----------- S t a t e -------------
143 // -- a0 : number of arguments 143 // -- a0 : number of arguments
144 // -- ra : return address 144 // -- ra : return address
145 // -- sp[...]: constructor arguments 145 // -- sp[...]: constructor arguments
146 // ----------------------------------- 146 // -----------------------------------
147 Label generic_array_code; 147 Label generic_array_code;
148 148
149 // Get the Array function. 149 // Get the Array function.
150 GenerateLoadArrayFunction(masm, a1); 150 GenerateLoadArrayFunction(masm, a1);
151 151
152 if (FLAG_debug_code) { 152 if (FLAG_debug_code) {
153 // Initial map for the builtin Array functions should be maps. 153 // Initial map for the builtin Array functions should be maps.
154 __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); 154 __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
155 __ And(t0, a2, Operand(kSmiTagMask)); 155 __ SmiTst(a2, t0);
156 __ Assert(ne, kUnexpectedInitialMapForArrayFunction1, 156 __ Assert(ne, kUnexpectedInitialMapForArrayFunction1,
157 t0, Operand(zero_reg)); 157 t0, Operand(zero_reg));
158 __ GetObjectType(a2, a3, t0); 158 __ GetObjectType(a2, a3, t0);
159 __ Assert(eq, kUnexpectedInitialMapForArrayFunction2, 159 __ Assert(eq, kUnexpectedInitialMapForArrayFunction2,
160 t0, Operand(MAP_TYPE)); 160 t0, Operand(MAP_TYPE));
161 } 161 }
162 162
163 // Run the native code for the Array function called as a normal function. 163 // Run the native code for the Array function called as a normal function.
164 // Tail call a stub. 164 // Tail call a stub.
165 Handle<Object> undefined_sentinel( 165 Handle<Object> undefined_sentinel(
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 } 806 }
807 807
808 808
809 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { 809 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
810 // For now, we are relying on the fact that make_code_young doesn't do any 810 // For now, we are relying on the fact that make_code_young doesn't do any
811 // garbage collection which allows us to save/restore the registers without 811 // garbage collection which allows us to save/restore the registers without
812 // worrying about which of them contain pointers. We also don't build an 812 // worrying about which of them contain pointers. We also don't build an
813 // internal frame to make the code faster, since we shouldn't have to do stack 813 // internal frame to make the code faster, since we shouldn't have to do stack
814 // crawls in MakeCodeYoung. This seems a bit fragile. 814 // crawls in MakeCodeYoung. This seems a bit fragile.
815 815
816 __ mov(a0, ra); 816 // Set a0 to point to the head of the PlatformCodeAge sequence.
817 // Adjust a0 to point to the head of the PlatformCodeAge sequence
818 __ Subu(a0, a0, 817 __ Subu(a0, a0,
819 Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize)); 818 Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize));
820 // Restore the original return address of the function
821 __ mov(ra, at);
822 819
823 // The following registers must be saved and restored when calling through to 820 // The following registers must be saved and restored when calling through to
824 // the runtime: 821 // the runtime:
825 // a0 - contains return address (beginning of patch sequence) 822 // a0 - contains return address (beginning of patch sequence)
826 // a1 - isolate 823 // a1 - isolate
827 RegList saved_regs = 824 RegList saved_regs =
828 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); 825 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit();
829 FrameScope scope(masm, StackFrame::MANUAL); 826 FrameScope scope(masm, StackFrame::MANUAL);
830 __ MultiPush(saved_regs); 827 __ MultiPush(saved_regs);
831 __ PrepareCallCFunction(1, 0, a2); 828 __ PrepareCallCFunction(1, 0, a2);
(...skipping 16 matching lines...) Expand all
848 CODE_AGE_LIST(DEFINE_CODE_AGE_BUILTIN_GENERATOR) 845 CODE_AGE_LIST(DEFINE_CODE_AGE_BUILTIN_GENERATOR)
849 #undef DEFINE_CODE_AGE_BUILTIN_GENERATOR 846 #undef DEFINE_CODE_AGE_BUILTIN_GENERATOR
850 847
851 848
852 void Builtins::Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm) { 849 void Builtins::Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm) {
853 // For now, as in GenerateMakeCodeYoungAgainCommon, we are relying on the fact 850 // For now, as in GenerateMakeCodeYoungAgainCommon, we are relying on the fact
854 // that make_code_young doesn't do any garbage collection which allows us to 851 // that make_code_young doesn't do any garbage collection which allows us to
855 // save/restore the registers without worrying about which of them contain 852 // save/restore the registers without worrying about which of them contain
856 // pointers. 853 // pointers.
857 854
858 __ mov(a0, ra); 855 // Set a0 to point to the head of the PlatformCodeAge sequence.
859 // Adjust a0 to point to the head of the PlatformCodeAge sequence
860 __ Subu(a0, a0, 856 __ Subu(a0, a0,
861 Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize)); 857 Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize));
862 // Restore the original return address of the function
863 __ mov(ra, at);
864 858
865 // The following registers must be saved and restored when calling through to 859 // The following registers must be saved and restored when calling through to
866 // the runtime: 860 // the runtime:
867 // a0 - contains return address (beginning of patch sequence) 861 // a0 - contains return address (beginning of patch sequence)
868 // a1 - isolate 862 // a1 - isolate
869 RegList saved_regs = 863 RegList saved_regs =
870 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); 864 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit();
871 FrameScope scope(masm, StackFrame::MANUAL); 865 FrameScope scope(masm, StackFrame::MANUAL);
872 __ MultiPush(saved_regs); 866 __ MultiPush(saved_regs);
873 __ PrepareCallCFunction(1, 0, a2); 867 __ PrepareCallCFunction(1, 0, a2);
874 __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate()))); 868 __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate())));
875 __ CallCFunction( 869 __ CallCFunction(
876 ExternalReference::get_mark_code_as_executed_function(masm->isolate()), 870 ExternalReference::get_mark_code_as_executed_function(masm->isolate()),
877 2); 871 2);
878 __ MultiPop(saved_regs); 872 __ MultiPop(saved_regs);
879 873
880 // Perform prologue operations usually performed by the young code stub. 874 // Perform prologue operations usually performed by the young code stub.
881 __ Push(ra, fp, cp, a1); 875 __ Push(ra, fp, cp, a1);
882 __ Addu(fp, sp, Operand(2 * kPointerSize)); 876 __ Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
883 877
884 // Jump to point after the code-age stub. 878 // Jump to point after the code-age stub.
885 __ Addu(a0, a0, Operand((kNoCodeAgeSequenceLength) * Assembler::kInstrSize)); 879 __ Addu(a0, a0, Operand((kNoCodeAgeSequenceLength) * Assembler::kInstrSize));
886 __ Jump(a0); 880 __ Jump(a0);
887 } 881 }
888 882
889 883
890 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) { 884 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) {
891 GenerateMakeCodeYoungAgainCommon(masm); 885 GenerateMakeCodeYoungAgainCommon(masm);
892 } 886 }
893 887
894 888
895 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { 889 static void Generate_NotifyStubFailureHelper(MacroAssembler* masm,
890 SaveFPRegsMode save_doubles) {
896 { 891 {
897 FrameScope scope(masm, StackFrame::INTERNAL); 892 FrameScope scope(masm, StackFrame::INTERNAL);
898 893
899 // Preserve registers across notification, this is important for compiled 894 // Preserve registers across notification, this is important for compiled
900 // stubs that tail call the runtime on deopts passing their parameters in 895 // stubs that tail call the runtime on deopts passing their parameters in
901 // registers. 896 // registers.
902 __ MultiPush(kJSCallerSaved | kCalleeSaved); 897 __ MultiPush(kJSCallerSaved | kCalleeSaved);
903 // Pass the function and deoptimization type to the runtime system. 898 // Pass the function and deoptimization type to the runtime system.
904 __ CallRuntime(Runtime::kNotifyStubFailure, 0); 899 __ CallRuntime(Runtime::kNotifyStubFailure, 0, save_doubles);
905 __ MultiPop(kJSCallerSaved | kCalleeSaved); 900 __ MultiPop(kJSCallerSaved | kCalleeSaved);
906 } 901 }
907 902
908 __ Addu(sp, sp, Operand(kPointerSize)); // Ignore state 903 __ Addu(sp, sp, Operand(kPointerSize)); // Ignore state
909 __ Jump(ra); // Jump to miss handler 904 __ Jump(ra); // Jump to miss handler
910 } 905 }
911 906
912 907
908 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
909 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs);
910 }
911
912
913 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) {
914 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
915 }
916
917
913 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, 918 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
914 Deoptimizer::BailoutType type) { 919 Deoptimizer::BailoutType type) {
915 { 920 {
916 FrameScope scope(masm, StackFrame::INTERNAL); 921 FrameScope scope(masm, StackFrame::INTERNAL);
917 // Pass the function and deoptimization type to the runtime system. 922 // Pass the function and deoptimization type to the runtime system.
918 __ li(a0, Operand(Smi::FromInt(static_cast<int>(type)))); 923 __ li(a0, Operand(Smi::FromInt(static_cast<int>(type))));
919 __ push(a0); 924 __ push(a0);
920 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); 925 __ CallRuntime(Runtime::kNotifyDeoptimized, 1);
921 } 926 }
922 927
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1206 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1202 RelocInfo::CODE_TARGET, ne, a2, Operand(a0)); 1207 RelocInfo::CODE_TARGET, ne, a2, Operand(a0));
1203 1208
1204 ParameterCount expected(0); 1209 ParameterCount expected(0);
1205 __ InvokeCode(a3, expected, expected, JUMP_FUNCTION, 1210 __ InvokeCode(a3, expected, expected, JUMP_FUNCTION,
1206 NullCallWrapper(), CALL_AS_METHOD); 1211 NullCallWrapper(), CALL_AS_METHOD);
1207 } 1212 }
1208 1213
1209 1214
1210 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { 1215 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1211 const int kIndexOffset = -5 * kPointerSize; 1216 const int kIndexOffset =
1212 const int kLimitOffset = -4 * kPointerSize; 1217 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize);
1213 const int kArgsOffset = 2 * kPointerSize; 1218 const int kLimitOffset =
1214 const int kRecvOffset = 3 * kPointerSize; 1219 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize);
1215 const int kFunctionOffset = 4 * kPointerSize; 1220 const int kArgsOffset = 2 * kPointerSize;
1221 const int kRecvOffset = 3 * kPointerSize;
1222 const int kFunctionOffset = 4 * kPointerSize;
1216 1223
1217 { 1224 {
1218 FrameScope frame_scope(masm, StackFrame::INTERNAL); 1225 FrameScope frame_scope(masm, StackFrame::INTERNAL);
1219 __ lw(a0, MemOperand(fp, kFunctionOffset)); // Get the function. 1226 __ lw(a0, MemOperand(fp, kFunctionOffset)); // Get the function.
1220 __ push(a0); 1227 __ push(a0);
1221 __ lw(a0, MemOperand(fp, kArgsOffset)); // Get the args array. 1228 __ lw(a0, MemOperand(fp, kArgsOffset)); // Get the args array.
1222 __ push(a0); 1229 __ push(a0);
1223 // Returns (in v0) number of arguments to copy to stack as Smi. 1230 // Returns (in v0) number of arguments to copy to stack as Smi.
1224 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); 1231 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION);
1225 1232
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 1371
1365 __ Ret(USE_DELAY_SLOT); 1372 __ Ret(USE_DELAY_SLOT);
1366 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot. 1373 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot.
1367 } 1374 }
1368 1375
1369 1376
1370 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { 1377 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
1371 __ sll(a0, a0, kSmiTagSize); 1378 __ sll(a0, a0, kSmiTagSize);
1372 __ li(t0, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 1379 __ li(t0, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
1373 __ MultiPush(a0.bit() | a1.bit() | t0.bit() | fp.bit() | ra.bit()); 1380 __ MultiPush(a0.bit() | a1.bit() | t0.bit() | fp.bit() | ra.bit());
1374 __ Addu(fp, sp, Operand(3 * kPointerSize)); 1381 __ Addu(fp, sp,
1382 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize));
1375 } 1383 }
1376 1384
1377 1385
1378 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { 1386 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) {
1379 // ----------- S t a t e ------------- 1387 // ----------- S t a t e -------------
1380 // -- v0 : result being passed through 1388 // -- v0 : result being passed through
1381 // ----------------------------------- 1389 // -----------------------------------
1382 // Get the number of arguments passed (as a smi), tear down the frame and 1390 // Get the number of arguments passed (as a smi), tear down the frame and
1383 // then tear down the parameters. 1391 // then tear down the parameters.
1384 __ lw(a1, MemOperand(fp, -3 * kPointerSize)); 1392 __ lw(a1, MemOperand(fp, -(StandardFrameConstants::kFixedFrameSizeFromFp +
1393 kPointerSize)));
1385 __ mov(sp, fp); 1394 __ mov(sp, fp);
1386 __ MultiPop(fp.bit() | ra.bit()); 1395 __ MultiPop(fp.bit() | ra.bit());
1387 __ sll(t0, a1, kPointerSizeLog2 - kSmiTagSize); 1396 __ sll(t0, a1, kPointerSizeLog2 - kSmiTagSize);
1388 __ Addu(sp, sp, t0); 1397 __ Addu(sp, sp, t0);
1389 // Adjust for the receiver. 1398 // Adjust for the receiver.
1390 __ Addu(sp, sp, Operand(kPointerSize)); 1399 __ Addu(sp, sp, Operand(kPointerSize));
1391 } 1400 }
1392 1401
1393 1402
1394 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { 1403 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 __ Branch(USE_DELAY_SLOT, &copy, ne, a0, Operand(t3)); 1481 __ Branch(USE_DELAY_SLOT, &copy, ne, a0, Operand(t3));
1473 __ sw(t0, MemOperand(sp)); // In the delay slot. 1482 __ sw(t0, MemOperand(sp)); // In the delay slot.
1474 1483
1475 // Fill the remaining expected arguments with undefined. 1484 // Fill the remaining expected arguments with undefined.
1476 // a1: function 1485 // a1: function
1477 // a2: expected number of arguments 1486 // a2: expected number of arguments
1478 // a3: code entry to call 1487 // a3: code entry to call
1479 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex); 1488 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex);
1480 __ sll(t2, a2, kPointerSizeLog2); 1489 __ sll(t2, a2, kPointerSizeLog2);
1481 __ Subu(a2, fp, Operand(t2)); 1490 __ Subu(a2, fp, Operand(t2));
1482 __ Addu(a2, a2, Operand(-4 * kPointerSize)); // Adjust for frame. 1491 // Adjust for frame.
1492 __ Subu(a2, a2, Operand(StandardFrameConstants::kFixedFrameSizeFromFp +
1493 2 * kPointerSize));
1483 1494
1484 Label fill; 1495 Label fill;
1485 __ bind(&fill); 1496 __ bind(&fill);
1486 __ Subu(sp, sp, kPointerSize); 1497 __ Subu(sp, sp, kPointerSize);
1487 __ Branch(USE_DELAY_SLOT, &fill, ne, sp, Operand(a2)); 1498 __ Branch(USE_DELAY_SLOT, &fill, ne, sp, Operand(a2));
1488 __ sw(t0, MemOperand(sp)); 1499 __ sw(t0, MemOperand(sp));
1489 } 1500 }
1490 1501
1491 // Call the entry point. 1502 // Call the entry point.
1492 __ bind(&invoke); 1503 __ bind(&invoke);
(...skipping 14 matching lines...) Expand all
1507 __ bind(&dont_adapt_arguments); 1518 __ bind(&dont_adapt_arguments);
1508 __ Jump(a3); 1519 __ Jump(a3);
1509 } 1520 }
1510 1521
1511 1522
1512 #undef __ 1523 #undef __
1513 1524
1514 } } // namespace v8::internal 1525 } } // namespace v8::internal
1515 1526
1516 #endif // V8_TARGET_ARCH_MIPS 1527 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/assembler-mips-inl.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698