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

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

Issue 58853003: MIPS: Try to use Push instead of push sequences whenever possible. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Created 7 years, 1 month 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 __ CallRuntime(Runtime::kNewStringWrapper, 1); 294 __ CallRuntime(Runtime::kNewStringWrapper, 1);
295 } 295 }
296 __ Ret(); 296 __ Ret();
297 } 297 }
298 298
299 299
300 static void CallRuntimePassFunction(MacroAssembler* masm, 300 static void CallRuntimePassFunction(MacroAssembler* masm,
301 Runtime::FunctionId function_id) { 301 Runtime::FunctionId function_id) {
302 FrameScope scope(masm, StackFrame::INTERNAL); 302 FrameScope scope(masm, StackFrame::INTERNAL);
303 // Push a copy of the function onto the stack. 303 // Push a copy of the function onto the stack.
304 __ push(a1); 304 // Push call kind information and function as parameter to the runtime call.
305 // Push call kind information. 305 __ Push(a1, t1, a1);
306 __ push(t1);
307 // Function is also the parameter to the runtime call.
308 __ push(a1);
309 306
310 __ CallRuntime(function_id, 1); 307 __ CallRuntime(function_id, 1);
311 // Restore call kind information. 308 // Restore call kind information and receiver.
312 __ pop(t1); 309 __ Pop(a1, t1);
313 // Restore receiver.
314 __ pop(a1);
315 } 310 }
316 311
317 312
318 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { 313 static void GenerateTailCallToSharedCode(MacroAssembler* masm) {
319 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 314 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
320 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset)); 315 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset));
321 __ Addu(at, a2, Operand(Code::kHeaderSize - kHeapObjectTag)); 316 __ Addu(at, a2, Operand(Code::kHeaderSize - kHeapObjectTag));
322 __ Jump(at); 317 __ Jump(at);
323 } 318 }
324 319
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 Label allocate; 409 Label allocate;
415 // Decrease generous allocation count. 410 // Decrease generous allocation count.
416 __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 411 __ lw(a3, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
417 MemOperand constructor_count = 412 MemOperand constructor_count =
418 FieldMemOperand(a3, SharedFunctionInfo::kConstructionCountOffset); 413 FieldMemOperand(a3, SharedFunctionInfo::kConstructionCountOffset);
419 __ lbu(t0, constructor_count); 414 __ lbu(t0, constructor_count);
420 __ Subu(t0, t0, Operand(1)); 415 __ Subu(t0, t0, Operand(1));
421 __ sb(t0, constructor_count); 416 __ sb(t0, constructor_count);
422 __ Branch(&allocate, ne, t0, Operand(zero_reg)); 417 __ Branch(&allocate, ne, t0, Operand(zero_reg));
423 418
424 __ Push(a1, a2); 419 __ Push(a1, a2, a1); // a1 = Constructor.
425
426 __ push(a1); // Constructor.
427 // The call will replace the stub, so the countdown is only done once. 420 // The call will replace the stub, so the countdown is only done once.
428 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); 421 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1);
429 422
430 __ pop(a2); 423 __ Pop(a1, a2);
431 __ pop(a1);
432 424
433 __ bind(&allocate); 425 __ bind(&allocate);
434 } 426 }
435 427
436 // Now allocate the JSObject on the heap. 428 // Now allocate the JSObject on the heap.
437 // a1: constructor function 429 // a1: constructor function
438 // a2: initial map 430 // a2: initial map
439 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceSizeOffset)); 431 __ lbu(a3, FieldMemOperand(a2, Map::kInstanceSizeOffset));
440 __ Allocate(a3, t4, t5, t6, &rt_call, SIZE_IN_WORDS); 432 __ Allocate(a3, t4, t5, t6, &rt_call, SIZE_IN_WORDS);
441 433
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); 1230 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex);
1239 // Make a2 the space we have left. The stack might already be overflowed 1231 // Make a2 the space we have left. The stack might already be overflowed
1240 // here which will cause a2 to become negative. 1232 // here which will cause a2 to become negative.
1241 __ subu(a2, sp, a2); 1233 __ subu(a2, sp, a2);
1242 // Check if the arguments will overflow the stack. 1234 // Check if the arguments will overflow the stack.
1243 __ sll(t3, v0, kPointerSizeLog2 - kSmiTagSize); 1235 __ sll(t3, v0, kPointerSizeLog2 - kSmiTagSize);
1244 __ Branch(&okay, gt, a2, Operand(t3)); // Signed comparison. 1236 __ Branch(&okay, gt, a2, Operand(t3)); // Signed comparison.
1245 1237
1246 // Out of stack space. 1238 // Out of stack space.
1247 __ lw(a1, MemOperand(fp, kFunctionOffset)); 1239 __ lw(a1, MemOperand(fp, kFunctionOffset));
1248 __ push(a1); 1240 __ Push(a1, v0);
1249 __ push(v0);
1250 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION); 1241 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION);
1251 // End of stack check. 1242 // End of stack check.
1252 1243
1253 // Push current limit and index. 1244 // Push current limit and index.
1254 __ bind(&okay); 1245 __ bind(&okay);
1255 __ push(v0); // Limit. 1246 __ push(v0); // Limit.
1256 __ mov(a1, zero_reg); // Initial index. 1247 __ mov(a1, zero_reg); // Initial index.
1257 __ push(a1); 1248 __ push(a1);
1258 1249
1259 // Get the receiver. 1250 // Get the receiver.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 // Copy all arguments from the array to the stack. 1311 // Copy all arguments from the array to the stack.
1321 Label entry, loop; 1312 Label entry, loop;
1322 __ lw(a0, MemOperand(fp, kIndexOffset)); 1313 __ lw(a0, MemOperand(fp, kIndexOffset));
1323 __ Branch(&entry); 1314 __ Branch(&entry);
1324 1315
1325 // Load the current argument from the arguments array and push it to the 1316 // Load the current argument from the arguments array and push it to the
1326 // stack. 1317 // stack.
1327 // a0: current argument index 1318 // a0: current argument index
1328 __ bind(&loop); 1319 __ bind(&loop);
1329 __ lw(a1, MemOperand(fp, kArgsOffset)); 1320 __ lw(a1, MemOperand(fp, kArgsOffset));
1330 __ push(a1); 1321 __ Push(a1, a0);
1331 __ push(a0);
1332 1322
1333 // Call the runtime to access the property in the arguments array. 1323 // Call the runtime to access the property in the arguments array.
1334 __ CallRuntime(Runtime::kGetProperty, 2); 1324 __ CallRuntime(Runtime::kGetProperty, 2);
1335 __ push(v0); 1325 __ push(v0);
1336 1326
1337 // Use inline caching to access the arguments. 1327 // Use inline caching to access the arguments.
1338 __ lw(a0, MemOperand(fp, kIndexOffset)); 1328 __ lw(a0, MemOperand(fp, kIndexOffset));
1339 __ Addu(a0, a0, Operand(1 << kSmiTagSize)); 1329 __ Addu(a0, a0, Operand(1 << kSmiTagSize));
1340 __ sw(a0, MemOperand(fp, kIndexOffset)); 1330 __ sw(a0, MemOperand(fp, kIndexOffset));
1341 1331
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 __ bind(&dont_adapt_arguments); 1507 __ bind(&dont_adapt_arguments);
1518 __ Jump(a3); 1508 __ Jump(a3);
1519 } 1509 }
1520 1510
1521 1511
1522 #undef __ 1512 #undef __
1523 1513
1524 } } // namespace v8::internal 1514 } } // namespace v8::internal
1525 1515
1526 #endif // V8_TARGET_ARCH_MIPS 1516 #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