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

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

Issue 110573004: Merge bleeding_edge 17696:18016. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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
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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 __ MultiPush(saved_regs); 872 __ MultiPush(saved_regs);
873 __ PrepareCallCFunction(1, 0, a2); 873 __ PrepareCallCFunction(1, 0, a2);
874 __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate()))); 874 __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate())));
875 __ CallCFunction( 875 __ CallCFunction(
876 ExternalReference::get_mark_code_as_executed_function(masm->isolate()), 876 ExternalReference::get_mark_code_as_executed_function(masm->isolate()),
877 2); 877 2);
878 __ MultiPop(saved_regs); 878 __ MultiPop(saved_regs);
879 879
880 // Perform prologue operations usually performed by the young code stub. 880 // Perform prologue operations usually performed by the young code stub.
881 __ Push(ra, fp, cp, a1); 881 __ Push(ra, fp, cp, a1);
882 __ Addu(fp, sp, Operand(2 * kPointerSize)); 882 __ Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
883 883
884 // Jump to point after the code-age stub. 884 // Jump to point after the code-age stub.
885 __ Addu(a0, a0, Operand((kNoCodeAgeSequenceLength) * Assembler::kInstrSize)); 885 __ Addu(a0, a0, Operand((kNoCodeAgeSequenceLength) * Assembler::kInstrSize));
886 __ Jump(a0); 886 __ Jump(a0);
887 } 887 }
888 888
889 889
890 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) { 890 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) {
891 GenerateMakeCodeYoungAgainCommon(masm); 891 GenerateMakeCodeYoungAgainCommon(masm);
892 } 892 }
893 893
894 894
895 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { 895 static void Generate_NotifyStubFailureHelper(MacroAssembler* masm,
896 SaveFPRegsMode save_doubles) {
896 { 897 {
897 FrameScope scope(masm, StackFrame::INTERNAL); 898 FrameScope scope(masm, StackFrame::INTERNAL);
898 899
899 // Preserve registers across notification, this is important for compiled 900 // Preserve registers across notification, this is important for compiled
900 // stubs that tail call the runtime on deopts passing their parameters in 901 // stubs that tail call the runtime on deopts passing their parameters in
901 // registers. 902 // registers.
902 __ MultiPush(kJSCallerSaved | kCalleeSaved); 903 __ MultiPush(kJSCallerSaved | kCalleeSaved);
903 // Pass the function and deoptimization type to the runtime system. 904 // Pass the function and deoptimization type to the runtime system.
904 __ CallRuntime(Runtime::kNotifyStubFailure, 0); 905 __ CallRuntime(Runtime::kNotifyStubFailure, 0, save_doubles);
905 __ MultiPop(kJSCallerSaved | kCalleeSaved); 906 __ MultiPop(kJSCallerSaved | kCalleeSaved);
906 } 907 }
907 908
908 __ Addu(sp, sp, Operand(kPointerSize)); // Ignore state 909 __ Addu(sp, sp, Operand(kPointerSize)); // Ignore state
909 __ Jump(ra); // Jump to miss handler 910 __ Jump(ra); // Jump to miss handler
910 } 911 }
911 912
912 913
914 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
915 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs);
916 }
917
918
919 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) {
920 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
921 }
922
923
913 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, 924 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
914 Deoptimizer::BailoutType type) { 925 Deoptimizer::BailoutType type) {
915 { 926 {
916 FrameScope scope(masm, StackFrame::INTERNAL); 927 FrameScope scope(masm, StackFrame::INTERNAL);
917 // Pass the function and deoptimization type to the runtime system. 928 // Pass the function and deoptimization type to the runtime system.
918 __ li(a0, Operand(Smi::FromInt(static_cast<int>(type)))); 929 __ li(a0, Operand(Smi::FromInt(static_cast<int>(type))));
919 __ push(a0); 930 __ push(a0);
920 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); 931 __ CallRuntime(Runtime::kNotifyDeoptimized, 1);
921 } 932 }
922 933
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1212 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1202 RelocInfo::CODE_TARGET, ne, a2, Operand(a0)); 1213 RelocInfo::CODE_TARGET, ne, a2, Operand(a0));
1203 1214
1204 ParameterCount expected(0); 1215 ParameterCount expected(0);
1205 __ InvokeCode(a3, expected, expected, JUMP_FUNCTION, 1216 __ InvokeCode(a3, expected, expected, JUMP_FUNCTION,
1206 NullCallWrapper(), CALL_AS_METHOD); 1217 NullCallWrapper(), CALL_AS_METHOD);
1207 } 1218 }
1208 1219
1209 1220
1210 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { 1221 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1211 const int kIndexOffset = -5 * kPointerSize; 1222 const int kIndexOffset =
1212 const int kLimitOffset = -4 * kPointerSize; 1223 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize);
1213 const int kArgsOffset = 2 * kPointerSize; 1224 const int kLimitOffset =
1214 const int kRecvOffset = 3 * kPointerSize; 1225 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize);
1215 const int kFunctionOffset = 4 * kPointerSize; 1226 const int kArgsOffset = 2 * kPointerSize;
1227 const int kRecvOffset = 3 * kPointerSize;
1228 const int kFunctionOffset = 4 * kPointerSize;
1216 1229
1217 { 1230 {
1218 FrameScope frame_scope(masm, StackFrame::INTERNAL); 1231 FrameScope frame_scope(masm, StackFrame::INTERNAL);
1219 __ lw(a0, MemOperand(fp, kFunctionOffset)); // Get the function. 1232 __ lw(a0, MemOperand(fp, kFunctionOffset)); // Get the function.
1220 __ push(a0); 1233 __ push(a0);
1221 __ lw(a0, MemOperand(fp, kArgsOffset)); // Get the args array. 1234 __ lw(a0, MemOperand(fp, kArgsOffset)); // Get the args array.
1222 __ push(a0); 1235 __ push(a0);
1223 // Returns (in v0) number of arguments to copy to stack as Smi. 1236 // Returns (in v0) number of arguments to copy to stack as Smi.
1224 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); 1237 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION);
1225 1238
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 1377
1365 __ Ret(USE_DELAY_SLOT); 1378 __ Ret(USE_DELAY_SLOT);
1366 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot. 1379 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot.
1367 } 1380 }
1368 1381
1369 1382
1370 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { 1383 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
1371 __ sll(a0, a0, kSmiTagSize); 1384 __ sll(a0, a0, kSmiTagSize);
1372 __ li(t0, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 1385 __ li(t0, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
1373 __ MultiPush(a0.bit() | a1.bit() | t0.bit() | fp.bit() | ra.bit()); 1386 __ MultiPush(a0.bit() | a1.bit() | t0.bit() | fp.bit() | ra.bit());
1374 __ Addu(fp, sp, Operand(3 * kPointerSize)); 1387 __ Addu(fp, sp,
1388 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize));
1375 } 1389 }
1376 1390
1377 1391
1378 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { 1392 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) {
1379 // ----------- S t a t e ------------- 1393 // ----------- S t a t e -------------
1380 // -- v0 : result being passed through 1394 // -- v0 : result being passed through
1381 // ----------------------------------- 1395 // -----------------------------------
1382 // Get the number of arguments passed (as a smi), tear down the frame and 1396 // Get the number of arguments passed (as a smi), tear down the frame and
1383 // then tear down the parameters. 1397 // then tear down the parameters.
1384 __ lw(a1, MemOperand(fp, -3 * kPointerSize)); 1398 __ lw(a1, MemOperand(fp, -(StandardFrameConstants::kFixedFrameSizeFromFp +
1399 kPointerSize)));
1385 __ mov(sp, fp); 1400 __ mov(sp, fp);
1386 __ MultiPop(fp.bit() | ra.bit()); 1401 __ MultiPop(fp.bit() | ra.bit());
1387 __ sll(t0, a1, kPointerSizeLog2 - kSmiTagSize); 1402 __ sll(t0, a1, kPointerSizeLog2 - kSmiTagSize);
1388 __ Addu(sp, sp, t0); 1403 __ Addu(sp, sp, t0);
1389 // Adjust for the receiver. 1404 // Adjust for the receiver.
1390 __ Addu(sp, sp, Operand(kPointerSize)); 1405 __ Addu(sp, sp, Operand(kPointerSize));
1391 } 1406 }
1392 1407
1393 1408
1394 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { 1409 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)); 1487 __ Branch(USE_DELAY_SLOT, &copy, ne, a0, Operand(t3));
1473 __ sw(t0, MemOperand(sp)); // In the delay slot. 1488 __ sw(t0, MemOperand(sp)); // In the delay slot.
1474 1489
1475 // Fill the remaining expected arguments with undefined. 1490 // Fill the remaining expected arguments with undefined.
1476 // a1: function 1491 // a1: function
1477 // a2: expected number of arguments 1492 // a2: expected number of arguments
1478 // a3: code entry to call 1493 // a3: code entry to call
1479 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex); 1494 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex);
1480 __ sll(t2, a2, kPointerSizeLog2); 1495 __ sll(t2, a2, kPointerSizeLog2);
1481 __ Subu(a2, fp, Operand(t2)); 1496 __ Subu(a2, fp, Operand(t2));
1482 __ Addu(a2, a2, Operand(-4 * kPointerSize)); // Adjust for frame. 1497 // Adjust for frame.
1498 __ Subu(a2, a2, Operand(StandardFrameConstants::kFixedFrameSizeFromFp +
1499 2 * kPointerSize));
1483 1500
1484 Label fill; 1501 Label fill;
1485 __ bind(&fill); 1502 __ bind(&fill);
1486 __ Subu(sp, sp, kPointerSize); 1503 __ Subu(sp, sp, kPointerSize);
1487 __ Branch(USE_DELAY_SLOT, &fill, ne, sp, Operand(a2)); 1504 __ Branch(USE_DELAY_SLOT, &fill, ne, sp, Operand(a2));
1488 __ sw(t0, MemOperand(sp)); 1505 __ sw(t0, MemOperand(sp));
1489 } 1506 }
1490 1507
1491 // Call the entry point. 1508 // Call the entry point.
1492 __ bind(&invoke); 1509 __ bind(&invoke);
(...skipping 14 matching lines...) Expand all
1507 __ bind(&dont_adapt_arguments); 1524 __ bind(&dont_adapt_arguments);
1508 __ Jump(a3); 1525 __ Jump(a3);
1509 } 1526 }
1510 1527
1511 1528
1512 #undef __ 1529 #undef __
1513 1530
1514 } } // namespace v8::internal 1531 } } // namespace v8::internal
1515 1532
1516 #endif // V8_TARGET_ARCH_MIPS 1533 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698