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

Side by Side Diff: runtime/vm/stub_code_mips.cc

Issue 2371983002: Prefer loading Smi 0 instead of null into a runtime call result slot. (Closed)
Patch Set: Created 4 years, 2 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 | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/stub_code_x64.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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 // Input parameters: 293 // Input parameters:
294 // S4: arguments descriptor array. 294 // S4: arguments descriptor array.
295 void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { 295 void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) {
296 __ Comment("CallStaticFunctionStub"); 296 __ Comment("CallStaticFunctionStub");
297 __ EnterStubFrame(); 297 __ EnterStubFrame();
298 // Setup space on stack for return value and preserve arguments descriptor. 298 // Setup space on stack for return value and preserve arguments descriptor.
299 299
300 __ addiu(SP, SP, Immediate(-2 * kWordSize)); 300 __ addiu(SP, SP, Immediate(-2 * kWordSize));
301 __ sw(S4, Address(SP, 1 * kWordSize)); 301 __ sw(S4, Address(SP, 1 * kWordSize));
302 __ LoadObject(TMP, Object::null_object()); 302 __ sw(ZR, Address(SP, 0 * kWordSize));
303 __ sw(TMP, Address(SP, 0 * kWordSize));
304 303
305 __ CallRuntime(kPatchStaticCallRuntimeEntry, 0); 304 __ CallRuntime(kPatchStaticCallRuntimeEntry, 0);
306 __ Comment("CallStaticFunctionStub return"); 305 __ Comment("CallStaticFunctionStub return");
307 306
308 // Get Code object result and restore arguments descriptor array. 307 // Get Code object result and restore arguments descriptor array.
309 __ lw(CODE_REG, Address(SP, 0 * kWordSize)); 308 __ lw(CODE_REG, Address(SP, 0 * kWordSize));
310 __ lw(S4, Address(SP, 1 * kWordSize)); 309 __ lw(S4, Address(SP, 1 * kWordSize));
311 __ addiu(SP, SP, Immediate(2 * kWordSize)); 310 __ addiu(SP, SP, Immediate(2 * kWordSize));
312 311
313 __ lw(T0, FieldAddress(CODE_REG, Code::entry_point_offset())); 312 __ lw(T0, FieldAddress(CODE_REG, Code::entry_point_offset()));
(...skipping 10 matching lines...) Expand all
324 // Load code pointer to this stub from the thread: 323 // Load code pointer to this stub from the thread:
325 // The one that is passed in, is not correct - it points to the code object 324 // The one that is passed in, is not correct - it points to the code object
326 // that needs to be replaced. 325 // that needs to be replaced.
327 __ lw(CODE_REG, Address(THR, Thread::fix_callers_target_code_offset())); 326 __ lw(CODE_REG, Address(THR, Thread::fix_callers_target_code_offset()));
328 // Create a stub frame as we are pushing some objects on the stack before 327 // Create a stub frame as we are pushing some objects on the stack before
329 // calling into the runtime. 328 // calling into the runtime.
330 __ EnterStubFrame(); 329 __ EnterStubFrame();
331 // Setup space on stack for return value and preserve arguments descriptor. 330 // Setup space on stack for return value and preserve arguments descriptor.
332 __ addiu(SP, SP, Immediate(-2 * kWordSize)); 331 __ addiu(SP, SP, Immediate(-2 * kWordSize));
333 __ sw(S4, Address(SP, 1 * kWordSize)); 332 __ sw(S4, Address(SP, 1 * kWordSize));
334 __ LoadObject(TMP, Object::null_object()); 333 __ sw(ZR, Address(SP, 0 * kWordSize));
335 __ sw(TMP, Address(SP, 0 * kWordSize));
336 __ CallRuntime(kFixCallersTargetRuntimeEntry, 0); 334 __ CallRuntime(kFixCallersTargetRuntimeEntry, 0);
337 // Get Code object result and restore arguments descriptor array. 335 // Get Code object result and restore arguments descriptor array.
338 __ lw(CODE_REG, Address(SP, 0 * kWordSize)); 336 __ lw(CODE_REG, Address(SP, 0 * kWordSize));
339 __ lw(S4, Address(SP, 1 * kWordSize)); 337 __ lw(S4, Address(SP, 1 * kWordSize));
340 __ addiu(SP, SP, Immediate(2 * kWordSize)); 338 __ addiu(SP, SP, Immediate(2 * kWordSize));
341 339
342 // Jump to the dart function. 340 // Jump to the dart function.
343 __ lw(T0, FieldAddress(CODE_REG, Code::entry_point_offset())); 341 __ lw(T0, FieldAddress(CODE_REG, Code::entry_point_offset()));
344 342
345 // Remove the stub frame. 343 // Remove the stub frame.
346 __ LeaveStubFrameAndReturn(T0); 344 __ LeaveStubFrameAndReturn(T0);
347 } 345 }
348 346
349 347
350 // Called from object allocate instruction when the allocation stub has been 348 // Called from object allocate instruction when the allocation stub has been
351 // disabled. 349 // disabled.
352 void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) { 350 void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) {
353 // Load code pointer to this stub from the thread: 351 // Load code pointer to this stub from the thread:
354 // The one that is passed in, is not correct - it points to the code object 352 // The one that is passed in, is not correct - it points to the code object
355 // that needs to be replaced. 353 // that needs to be replaced.
356 __ lw(CODE_REG, Address(THR, Thread::fix_allocation_stub_code_offset())); 354 __ lw(CODE_REG, Address(THR, Thread::fix_allocation_stub_code_offset()));
357 __ EnterStubFrame(); 355 __ EnterStubFrame();
358 // Setup space on stack for return value. 356 // Setup space on stack for return value.
359 __ addiu(SP, SP, Immediate(-1 * kWordSize)); 357 __ addiu(SP, SP, Immediate(-1 * kWordSize));
360 __ LoadObject(TMP, Object::null_object()); 358 __ sw(ZR, Address(SP, 0 * kWordSize));
361 __ sw(TMP, Address(SP, 0 * kWordSize));
362 __ CallRuntime(kFixAllocationStubTargetRuntimeEntry, 0); 359 __ CallRuntime(kFixAllocationStubTargetRuntimeEntry, 0);
363 // Get Code object result. 360 // Get Code object result.
364 __ lw(CODE_REG, Address(SP, 0 * kWordSize)); 361 __ lw(CODE_REG, Address(SP, 0 * kWordSize));
365 __ addiu(SP, SP, Immediate(1 * kWordSize)); 362 __ addiu(SP, SP, Immediate(1 * kWordSize));
366 363
367 // Jump to the dart function. 364 // Jump to the dart function.
368 __ lw(T0, FieldAddress(CODE_REG, Code::entry_point_offset())); 365 __ lw(T0, FieldAddress(CODE_REG, Code::entry_point_offset()));
369 366
370 // Remove the stub frame. 367 // Remove the stub frame.
371 __ LeaveStubFrameAndReturn(T0); 368 __ LeaveStubFrameAndReturn(T0);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 __ sll(TMP, A1, 1); // A1 is a Smi. 554 __ sll(TMP, A1, 1); // A1 is a Smi.
558 __ addu(TMP, FP, TMP); 555 __ addu(TMP, FP, TMP);
559 __ lw(T6, Address(TMP, kParamEndSlotFromFp * kWordSize)); 556 __ lw(T6, Address(TMP, kParamEndSlotFromFp * kWordSize));
560 557
561 // Push space for the return value. 558 // Push space for the return value.
562 // Push the receiver. 559 // Push the receiver.
563 // Push ICData/MegamorphicCache object. 560 // Push ICData/MegamorphicCache object.
564 // Push arguments descriptor array. 561 // Push arguments descriptor array.
565 // Push original arguments array. 562 // Push original arguments array.
566 __ addiu(SP, SP, Immediate(-4 * kWordSize)); 563 __ addiu(SP, SP, Immediate(-4 * kWordSize));
567 __ LoadObject(TMP, Object::null_object()); 564 __ sw(ZR, Address(SP, 3 * kWordSize));
568 __ sw(TMP, Address(SP, 3 * kWordSize));
569 __ sw(T6, Address(SP, 2 * kWordSize)); 565 __ sw(T6, Address(SP, 2 * kWordSize));
570 __ sw(S5, Address(SP, 1 * kWordSize)); 566 __ sw(S5, Address(SP, 1 * kWordSize));
571 __ sw(S4, Address(SP, 0 * kWordSize)); 567 __ sw(S4, Address(SP, 0 * kWordSize));
572 // A1: Smi-tagged arguments array length. 568 // A1: Smi-tagged arguments array length.
573 PushArgumentsArray(assembler); 569 PushArgumentsArray(assembler);
574 const intptr_t kNumArgs = 4; 570 const intptr_t kNumArgs = 4;
575 __ CallRuntime(kInvokeNoSuchMethodDispatcherRuntimeEntry, kNumArgs); 571 __ CallRuntime(kInvokeNoSuchMethodDispatcherRuntimeEntry, kNumArgs);
576 __ lw(V0, Address(SP, 4 * kWordSize)); // Return value. 572 __ lw(V0, Address(SP, 4 * kWordSize)); // Return value.
577 __ addiu(SP, SP, Immediate(5 * kWordSize)); 573 __ addiu(SP, SP, Immediate(5 * kWordSize));
578 __ LeaveStubFrame(); 574 __ LeaveStubFrame();
(...skipping 12 matching lines...) Expand all
591 587
592 // Preserve IC data and arguments descriptor. 588 // Preserve IC data and arguments descriptor.
593 __ addiu(SP, SP, Immediate(-6 * kWordSize)); 589 __ addiu(SP, SP, Immediate(-6 * kWordSize));
594 __ sw(S5, Address(SP, 5 * kWordSize)); 590 __ sw(S5, Address(SP, 5 * kWordSize));
595 __ sw(S4, Address(SP, 4 * kWordSize)); 591 __ sw(S4, Address(SP, 4 * kWordSize));
596 592
597 // Push space for the return value. 593 // Push space for the return value.
598 // Push the receiver. 594 // Push the receiver.
599 // Push IC data object. 595 // Push IC data object.
600 // Push arguments descriptor array. 596 // Push arguments descriptor array.
601 __ LoadObject(TMP, Object::null_object()); 597 __ sw(ZR, Address(SP, 3 * kWordSize));
602 __ sw(TMP, Address(SP, 3 * kWordSize));
603 __ sw(T6, Address(SP, 2 * kWordSize)); 598 __ sw(T6, Address(SP, 2 * kWordSize));
604 __ sw(S5, Address(SP, 1 * kWordSize)); 599 __ sw(S5, Address(SP, 1 * kWordSize));
605 __ sw(S4, Address(SP, 0 * kWordSize)); 600 __ sw(S4, Address(SP, 0 * kWordSize));
606 601
607 __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry, 3); 602 __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry, 3);
608 603
609 __ lw(T0, Address(SP, 3 * kWordSize)); // Get result function. 604 __ lw(T0, Address(SP, 3 * kWordSize)); // Get result function.
610 __ lw(S4, Address(SP, 4 * kWordSize)); // Restore argument descriptor. 605 __ lw(S4, Address(SP, 4 * kWordSize)); // Restore argument descriptor.
611 __ lw(S5, Address(SP, 5 * kWordSize)); // Restore IC data. 606 __ lw(S5, Address(SP, 5 * kWordSize)); // Restore IC data.
612 __ addiu(SP, SP, Immediate(6 * kWordSize)); 607 __ addiu(SP, SP, Immediate(6 * kWordSize));
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 745
751 // Unable to allocate the array using the fast inline code, just call 746 // Unable to allocate the array using the fast inline code, just call
752 // into the runtime. 747 // into the runtime.
753 __ Bind(&slow_case); 748 __ Bind(&slow_case);
754 // Create a stub frame as we are pushing some objects on the stack before 749 // Create a stub frame as we are pushing some objects on the stack before
755 // calling into the runtime. 750 // calling into the runtime.
756 __ EnterStubFrame(); 751 __ EnterStubFrame();
757 // Setup space on stack for return value. 752 // Setup space on stack for return value.
758 // Push array length as Smi and element type. 753 // Push array length as Smi and element type.
759 __ addiu(SP, SP, Immediate(-3 * kWordSize)); 754 __ addiu(SP, SP, Immediate(-3 * kWordSize));
760 __ LoadObject(TMP, Object::null_object()); 755 __ sw(ZR, Address(SP, 2 * kWordSize));
761 __ sw(TMP, Address(SP, 2 * kWordSize));
762 __ sw(A1, Address(SP, 1 * kWordSize)); 756 __ sw(A1, Address(SP, 1 * kWordSize));
763 __ sw(A0, Address(SP, 0 * kWordSize)); 757 __ sw(A0, Address(SP, 0 * kWordSize));
764 __ CallRuntime(kAllocateArrayRuntimeEntry, 2); 758 __ CallRuntime(kAllocateArrayRuntimeEntry, 2);
765 __ Comment("AllocateArrayStub return"); 759 __ Comment("AllocateArrayStub return");
766 // Pop arguments; result is popped in IP. 760 // Pop arguments; result is popped in IP.
767 __ lw(V0, Address(SP, 2 * kWordSize)); 761 __ lw(V0, Address(SP, 2 * kWordSize));
768 __ lw(A1, Address(SP, 1 * kWordSize)); 762 __ lw(A1, Address(SP, 1 * kWordSize));
769 __ lw(A0, Address(SP, 0 * kWordSize)); 763 __ lw(A0, Address(SP, 0 * kWordSize));
770 __ addiu(SP, SP, Immediate(3 * kWordSize)); 764 __ addiu(SP, SP, Immediate(3 * kWordSize));
771 765
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 __ lw(A1, FieldAddress(S4, ArgumentsDescriptor::count_offset())); 1247 __ lw(A1, FieldAddress(S4, ArgumentsDescriptor::count_offset()));
1254 __ sll(TMP, A1, 1); // A1 is a Smi. 1248 __ sll(TMP, A1, 1); // A1 is a Smi.
1255 __ addu(TMP, FP, TMP); 1249 __ addu(TMP, FP, TMP);
1256 __ lw(T6, Address(TMP, kParamEndSlotFromFp * kWordSize)); 1250 __ lw(T6, Address(TMP, kParamEndSlotFromFp * kWordSize));
1257 1251
1258 // Push space for the return value. 1252 // Push space for the return value.
1259 // Push the receiver. 1253 // Push the receiver.
1260 // Push arguments descriptor array. 1254 // Push arguments descriptor array.
1261 const intptr_t kNumArgs = 3; 1255 const intptr_t kNumArgs = 3;
1262 __ addiu(SP, SP, Immediate(-kNumArgs * kWordSize)); 1256 __ addiu(SP, SP, Immediate(-kNumArgs * kWordSize));
1263 __ LoadObject(TMP, Object::null_object()); 1257 __ sw(ZR, Address(SP, 2 * kWordSize));
1264 __ sw(TMP, Address(SP, 2 * kWordSize));
1265 __ sw(T6, Address(SP, 1 * kWordSize)); 1258 __ sw(T6, Address(SP, 1 * kWordSize));
1266 __ sw(S4, Address(SP, 0 * kWordSize)); 1259 __ sw(S4, Address(SP, 0 * kWordSize));
1267 1260
1268 // A1: Smi-tagged arguments array length. 1261 // A1: Smi-tagged arguments array length.
1269 PushArgumentsArray(assembler); 1262 PushArgumentsArray(assembler);
1270 1263
1271 __ CallRuntime(kInvokeClosureNoSuchMethodRuntimeEntry, kNumArgs); 1264 __ CallRuntime(kInvokeClosureNoSuchMethodRuntimeEntry, kNumArgs);
1272 // noSuchMethod on closures always throws an error, so it will never return. 1265 // noSuchMethod on closures always throws an error, so it will never return.
1273 __ break_(0); 1266 __ break_(0);
1274 } 1267 }
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 // T1: address of receiver. 1510 // T1: address of receiver.
1518 // Create a stub frame as we are pushing some objects on the stack before 1511 // Create a stub frame as we are pushing some objects on the stack before
1519 // calling into the runtime. 1512 // calling into the runtime.
1520 __ EnterStubFrame(); 1513 __ EnterStubFrame();
1521 // Preserve IC data object and arguments descriptor array and 1514 // Preserve IC data object and arguments descriptor array and
1522 // setup space on stack for result (target code object). 1515 // setup space on stack for result (target code object).
1523 int num_slots = num_args + 4; 1516 int num_slots = num_args + 4;
1524 __ addiu(SP, SP, Immediate(-num_slots * kWordSize)); 1517 __ addiu(SP, SP, Immediate(-num_slots * kWordSize));
1525 __ sw(S5, Address(SP, (num_slots - 1) * kWordSize)); 1518 __ sw(S5, Address(SP, (num_slots - 1) * kWordSize));
1526 __ sw(S4, Address(SP, (num_slots - 2) * kWordSize)); 1519 __ sw(S4, Address(SP, (num_slots - 2) * kWordSize));
1527 __ LoadObject(TMP, Object::null_object()); 1520 __ sw(ZR, Address(SP, (num_slots - 3) * kWordSize));
1528 __ sw(TMP, Address(SP, (num_slots - 3) * kWordSize));
1529 // Push call arguments. 1521 // Push call arguments.
1530 for (intptr_t i = 0; i < num_args; i++) { 1522 for (intptr_t i = 0; i < num_args; i++) {
1531 __ lw(TMP, Address(T1, -i * kWordSize)); 1523 __ lw(TMP, Address(T1, -i * kWordSize));
1532 __ sw(TMP, Address(SP, (num_slots - i - 4) * kWordSize)); 1524 __ sw(TMP, Address(SP, (num_slots - i - 4) * kWordSize));
1533 } 1525 }
1534 // Pass IC data object. 1526 // Pass IC data object.
1535 __ sw(S5, Address(SP, (num_slots - num_args - 4) * kWordSize)); 1527 __ sw(S5, Address(SP, (num_slots - num_args - 4) * kWordSize));
1536 __ CallRuntime(handle_ic_miss, num_args + 1); 1528 __ CallRuntime(handle_ic_miss, num_args + 1);
1537 __ Comment("NArgsCheckInlineCacheStub return"); 1529 __ Comment("NArgsCheckInlineCacheStub return");
1538 // Pop returned function object into T3. 1530 // Pop returned function object into T3.
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 __ jr(T2); 1762 __ jr(T2);
1771 } 1763 }
1772 1764
1773 1765
1774 // S5: Contains an ICData. 1766 // S5: Contains an ICData.
1775 void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) { 1767 void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) {
1776 __ Comment("ICCallBreakpoint stub"); 1768 __ Comment("ICCallBreakpoint stub");
1777 __ EnterStubFrame(); 1769 __ EnterStubFrame();
1778 __ addiu(SP, SP, Immediate(-2 * kWordSize)); 1770 __ addiu(SP, SP, Immediate(-2 * kWordSize));
1779 __ sw(S5, Address(SP, 1 * kWordSize)); 1771 __ sw(S5, Address(SP, 1 * kWordSize));
1780 __ LoadObject(TMP, Object::null_object()); 1772 __ sw(ZR, Address(SP, 0 * kWordSize));
1781 __ sw(TMP, Address(SP, 0 * kWordSize));
1782 1773
1783 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); 1774 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
1784 1775
1785 __ lw(S5, Address(SP, 1 * kWordSize)); 1776 __ lw(S5, Address(SP, 1 * kWordSize));
1786 __ lw(CODE_REG, Address(SP, 0 * kWordSize)); 1777 __ lw(CODE_REG, Address(SP, 0 * kWordSize));
1787 __ addiu(SP, SP, Immediate(2 * kWordSize)); 1778 __ addiu(SP, SP, Immediate(2 * kWordSize));
1788 __ LeaveStubFrame(); 1779 __ LeaveStubFrame();
1789 __ lw(T0, FieldAddress(CODE_REG, Code::entry_point_offset())); 1780 __ lw(T0, FieldAddress(CODE_REG, Code::entry_point_offset()));
1790 __ jr(T0); 1781 __ jr(T0);
1791 } 1782 }
1792 1783
1793 1784
1794 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) { 1785 void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) {
1795 __ Comment("RuntimeCallBreakpoint stub"); 1786 __ Comment("RuntimeCallBreakpoint stub");
1796 __ EnterStubFrame(); 1787 __ EnterStubFrame();
1797 __ addiu(SP, SP, Immediate(-1 * kWordSize)); 1788 __ addiu(SP, SP, Immediate(-1 * kWordSize));
1798 __ LoadObject(TMP, Object::null_object()); 1789 __ sw(ZR, Address(SP, 0 * kWordSize));
1799 __ sw(TMP, Address(SP, 0 * kWordSize));
1800 1790
1801 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0); 1791 __ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
1802 1792
1803 __ lw(CODE_REG, Address(SP, 0 * kWordSize)); 1793 __ lw(CODE_REG, Address(SP, 0 * kWordSize));
1804 __ addiu(SP, SP, Immediate(3 * kWordSize)); 1794 __ addiu(SP, SP, Immediate(3 * kWordSize));
1805 __ LeaveStubFrame(); 1795 __ LeaveStubFrame();
1806 __ lw(T0, FieldAddress(CODE_REG, Code::entry_point_offset())); 1796 __ lw(T0, FieldAddress(CODE_REG, Code::entry_point_offset()));
1807 __ jr(T0); 1797 __ jr(T0);
1808 } 1798 }
1809 1799
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 1975
1986 // Calls to the runtime to optimize the given function. 1976 // Calls to the runtime to optimize the given function.
1987 // T0: function to be reoptimized. 1977 // T0: function to be reoptimized.
1988 // S4: argument descriptor (preserved). 1978 // S4: argument descriptor (preserved).
1989 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { 1979 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) {
1990 __ Comment("OptimizeFunctionStub"); 1980 __ Comment("OptimizeFunctionStub");
1991 __ EnterStubFrame(); 1981 __ EnterStubFrame();
1992 __ addiu(SP, SP, Immediate(-3 * kWordSize)); 1982 __ addiu(SP, SP, Immediate(-3 * kWordSize));
1993 __ sw(S4, Address(SP, 2 * kWordSize)); 1983 __ sw(S4, Address(SP, 2 * kWordSize));
1994 // Setup space on stack for return value. 1984 // Setup space on stack for return value.
1995 __ LoadObject(TMP, Object::null_object()); 1985 __ sw(ZR, Address(SP, 1 * kWordSize));
1996 __ sw(TMP, Address(SP, 1 * kWordSize));
1997 __ sw(T0, Address(SP, 0 * kWordSize)); 1986 __ sw(T0, Address(SP, 0 * kWordSize));
1998 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1); 1987 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1);
1999 __ Comment("OptimizeFunctionStub return"); 1988 __ Comment("OptimizeFunctionStub return");
2000 __ lw(CODE_REG, Address(SP, 1 * kWordSize)); // Get Code object 1989 __ lw(CODE_REG, Address(SP, 1 * kWordSize)); // Get Code object
2001 __ lw(S4, Address(SP, 2 * kWordSize)); // Restore argument descriptor. 1990 __ lw(S4, Address(SP, 2 * kWordSize)); // Restore argument descriptor.
2002 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Discard argument. 1991 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Discard argument.
2003 1992
2004 __ lw(T0, FieldAddress(CODE_REG, Code::entry_point_offset())); 1993 __ lw(T0, FieldAddress(CODE_REG, Code::entry_point_offset()));
2005 __ LeaveStubFrameAndReturn(T0); 1994 __ LeaveStubFrameAndReturn(T0);
2006 __ break_(0); 1995 __ break_(0);
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2279 2268
2280 // Called from switchable IC calls. 2269 // Called from switchable IC calls.
2281 // T0: receiver 2270 // T0: receiver
2282 // S5: SingleTargetCache 2271 // S5: SingleTargetCache
2283 void StubCode::GenerateUnlinkedCallStub(Assembler* assembler) { 2272 void StubCode::GenerateUnlinkedCallStub(Assembler* assembler) {
2284 __ NoMonomorphicCheckedEntry(); 2273 __ NoMonomorphicCheckedEntry();
2285 2274
2286 __ EnterStubFrame(); 2275 __ EnterStubFrame();
2287 __ Push(T0); // Preserve receiver. 2276 __ Push(T0); // Preserve receiver.
2288 2277
2289 __ PushObject(Object::null_object()); // Result. 2278 __ Push(ZR); // Result slot.
2290 __ Push(T0); // Arg0: Receiver 2279 __ Push(T0); // Arg0: Receiver
2291 __ Push(S5); // Arg1: UnlinkedCall 2280 __ Push(S5); // Arg1: UnlinkedCall
2292 __ CallRuntime(kUnlinkedCallRuntimeEntry, 2); 2281 __ CallRuntime(kUnlinkedCallRuntimeEntry, 2);
2293 __ Drop(2); 2282 __ Drop(2);
2294 __ Pop(S5); // result = IC 2283 __ Pop(S5); // result = IC
2295 2284
2296 __ Pop(T0); // Restore receiver. 2285 __ Pop(T0); // Restore receiver.
2297 __ LeaveStubFrame(); 2286 __ LeaveStubFrame();
2298 2287
2299 __ lw(CODE_REG, Address(THR, Thread::ic_lookup_through_code_stub_offset())); 2288 __ lw(CODE_REG, Address(THR, Thread::ic_lookup_through_code_stub_offset()));
2300 __ lw(T1, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); 2289 __ lw(T1, FieldAddress(CODE_REG, Code::checked_entry_point_offset()));
2301 __ jr(T1); 2290 __ jr(T1);
(...skipping 18 matching lines...) Expand all
2320 __ BranchUnsignedGreater(T1, T3, &miss); 2309 __ BranchUnsignedGreater(T1, T3, &miss);
2321 2310
2322 __ lw(T1, FieldAddress(S5, SingleTargetCache::entry_point_offset())); 2311 __ lw(T1, FieldAddress(S5, SingleTargetCache::entry_point_offset()));
2323 __ lw(CODE_REG, FieldAddress(S5, SingleTargetCache::target_offset())); 2312 __ lw(CODE_REG, FieldAddress(S5, SingleTargetCache::target_offset()));
2324 __ jr(T1); 2313 __ jr(T1);
2325 2314
2326 __ Bind(&miss); 2315 __ Bind(&miss);
2327 __ EnterStubFrame(); 2316 __ EnterStubFrame();
2328 __ Push(T0); // Preserve receiver. 2317 __ Push(T0); // Preserve receiver.
2329 2318
2330 __ PushObject(Object::null_object()); // Result. 2319 __ Push(ZR); // Result slot.
2331 __ Push(T0); // Arg0: Receiver 2320 __ Push(T0); // Arg0: Receiver
2332 __ CallRuntime(kSingleTargetMissRuntimeEntry, 1); 2321 __ CallRuntime(kSingleTargetMissRuntimeEntry, 1);
2333 __ Drop(1); 2322 __ Drop(1);
2334 __ Pop(S5); // result = IC 2323 __ Pop(S5); // result = IC
2335 2324
2336 __ Pop(T0); // Restore receiver. 2325 __ Pop(T0); // Restore receiver.
2337 __ LeaveStubFrame(); 2326 __ LeaveStubFrame();
2338 2327
2339 __ lw(CODE_REG, Address(THR, Thread::ic_lookup_through_code_stub_offset())); 2328 __ lw(CODE_REG, Address(THR, Thread::ic_lookup_through_code_stub_offset()));
2340 __ lw(T1, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); 2329 __ lw(T1, FieldAddress(CODE_REG, Code::checked_entry_point_offset()));
2341 __ jr(T1); 2330 __ jr(T1);
2342 } 2331 }
2343 2332
2344 2333
2345 // Called from the monomorphic checked entry. 2334 // Called from the monomorphic checked entry.
2346 // T0: receiver 2335 // T0: receiver
2347 void StubCode::GenerateMonomorphicMissStub(Assembler* assembler) { 2336 void StubCode::GenerateMonomorphicMissStub(Assembler* assembler) {
2348 __ EnterStubFrame(); 2337 __ EnterStubFrame();
2349 __ Push(T0); // Preserve receiver. 2338 __ Push(T0); // Preserve receiver.
2350 2339
2351 __ PushObject(Object::null_object()); // Result. 2340 __ Push(ZR); // Result slot.
2352 __ Push(T0); // Arg0: Receiver 2341 __ Push(T0); // Arg0: Receiver
2353 __ CallRuntime(kMonomorphicMissRuntimeEntry, 1); 2342 __ CallRuntime(kMonomorphicMissRuntimeEntry, 1);
2354 __ Drop(1); 2343 __ Drop(1);
2355 __ Pop(S5); // result = IC 2344 __ Pop(S5); // result = IC
2356 2345
2357 __ Pop(T0); // Restore receiver. 2346 __ Pop(T0); // Restore receiver.
2358 __ LeaveStubFrame(); 2347 __ LeaveStubFrame();
2359 2348
2360 __ lw(CODE_REG, Address(THR, Thread::ic_lookup_through_code_stub_offset())); 2349 __ lw(CODE_REG, Address(THR, Thread::ic_lookup_through_code_stub_offset()));
2361 __ lw(T1, FieldAddress(CODE_REG, Code::checked_entry_point_offset())); 2350 __ lw(T1, FieldAddress(CODE_REG, Code::checked_entry_point_offset()));
2362 __ jr(T1); 2351 __ jr(T1);
2363 } 2352 }
2364 2353
2365 2354
2366 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { 2355 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) {
2367 __ break_(0); 2356 __ break_(0);
2368 } 2357 }
2369 2358
2370 } // namespace dart 2359 } // namespace dart
2371 2360
2372 #endif // defined TARGET_ARCH_MIPS 2361 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698