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

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

Issue 1605093002: MIPS64: Use the Lsa() and Dlsa() macro/r6 instructions in existing code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 | « src/mips/code-stubs-mips.cc ('k') | src/mips64/code-stubs-mips64.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // -- sp[(argc - n - 1) * 8] : arg[n] (zero based) 149 // -- sp[(argc - n - 1) * 8] : arg[n] (zero based)
150 // -- sp[argc * 8] : receiver 150 // -- sp[argc * 8] : receiver
151 // ----------------------------------- 151 // -----------------------------------
152 152
153 // 1. Load the first argument into a0 and get rid of the rest (including the 153 // 1. Load the first argument into a0 and get rid of the rest (including the
154 // receiver). 154 // receiver).
155 Label no_arguments; 155 Label no_arguments;
156 { 156 {
157 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); 157 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg));
158 __ Dsubu(a0, a0, Operand(1)); 158 __ Dsubu(a0, a0, Operand(1));
159 __ dsll(a0, a0, kPointerSizeLog2); 159 __ Dlsa(sp, sp, a0, kPointerSizeLog2);
160 __ Daddu(sp, a0, sp);
161 __ ld(a0, MemOperand(sp)); 160 __ ld(a0, MemOperand(sp));
162 __ Drop(2); 161 __ Drop(2);
163 } 162 }
164 163
165 // 2a. Convert first argument to number. 164 // 2a. Convert first argument to number.
166 ToNumberStub stub(masm->isolate()); 165 ToNumberStub stub(masm->isolate());
167 __ TailCallStub(&stub); 166 __ TailCallStub(&stub);
168 167
169 // 2b. No arguments, return +0. 168 // 2b. No arguments, return +0.
170 __ bind(&no_arguments); 169 __ bind(&no_arguments);
(...skipping 14 matching lines...) Expand all
185 184
186 // 1. Make sure we operate in the context of the called function. 185 // 1. Make sure we operate in the context of the called function.
187 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 186 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
188 187
189 // 2. Load the first argument into a0 and get rid of the rest (including the 188 // 2. Load the first argument into a0 and get rid of the rest (including the
190 // receiver). 189 // receiver).
191 { 190 {
192 Label no_arguments, done; 191 Label no_arguments, done;
193 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); 192 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg));
194 __ Dsubu(a0, a0, Operand(1)); 193 __ Dsubu(a0, a0, Operand(1));
195 __ dsll(a0, a0, kPointerSizeLog2); 194 __ Dlsa(sp, sp, a0, kPointerSizeLog2);
196 __ Daddu(sp, a0, sp);
197 __ ld(a0, MemOperand(sp)); 195 __ ld(a0, MemOperand(sp));
198 __ Drop(2); 196 __ Drop(2);
199 __ jmp(&done); 197 __ jmp(&done);
200 __ bind(&no_arguments); 198 __ bind(&no_arguments);
201 __ Move(a0, Smi::FromInt(0)); 199 __ Move(a0, Smi::FromInt(0));
202 __ Drop(1); 200 __ Drop(1);
203 __ bind(&done); 201 __ bind(&done);
204 } 202 }
205 203
206 // 3. Make sure a0 is a number. 204 // 3. Make sure a0 is a number.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // -- sp[(argc - n - 1) * 8] : arg[n] (zero based) 248 // -- sp[(argc - n - 1) * 8] : arg[n] (zero based)
251 // -- sp[argc * 8] : receiver 249 // -- sp[argc * 8] : receiver
252 // ----------------------------------- 250 // -----------------------------------
253 251
254 // 1. Load the first argument into a0 and get rid of the rest (including the 252 // 1. Load the first argument into a0 and get rid of the rest (including the
255 // receiver). 253 // receiver).
256 Label no_arguments; 254 Label no_arguments;
257 { 255 {
258 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); 256 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg));
259 __ Dsubu(a0, a0, Operand(1)); 257 __ Dsubu(a0, a0, Operand(1));
260 __ dsll(a0, a0, kPointerSizeLog2); 258 __ Dlsa(sp, sp, a0, kPointerSizeLog2);
261 __ Daddu(sp, a0, sp);
262 __ ld(a0, MemOperand(sp)); 259 __ ld(a0, MemOperand(sp));
263 __ Drop(2); 260 __ Drop(2);
264 } 261 }
265 262
266 // 2a. At least one argument, return a0 if it's a string, otherwise 263 // 2a. At least one argument, return a0 if it's a string, otherwise
267 // dispatch to appropriate conversion. 264 // dispatch to appropriate conversion.
268 Label to_string, symbol_descriptive_string; 265 Label to_string, symbol_descriptive_string;
269 { 266 {
270 __ JumpIfSmi(a0, &to_string); 267 __ JumpIfSmi(a0, &to_string);
271 __ GetObjectType(a0, a1, a1); 268 __ GetObjectType(a0, a1, a1);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 309
313 // 1. Make sure we operate in the context of the called function. 310 // 1. Make sure we operate in the context of the called function.
314 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 311 __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
315 312
316 // 2. Load the first argument into a0 and get rid of the rest (including the 313 // 2. Load the first argument into a0 and get rid of the rest (including the
317 // receiver). 314 // receiver).
318 { 315 {
319 Label no_arguments, done; 316 Label no_arguments, done;
320 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); 317 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg));
321 __ Dsubu(a0, a0, Operand(1)); 318 __ Dsubu(a0, a0, Operand(1));
322 __ dsll(a0, a0, kPointerSizeLog2); 319 __ Dlsa(sp, sp, a0, kPointerSizeLog2);
323 __ Daddu(sp, a0, sp);
324 __ ld(a0, MemOperand(sp)); 320 __ ld(a0, MemOperand(sp));
325 __ Drop(2); 321 __ Drop(2);
326 __ jmp(&done); 322 __ jmp(&done);
327 __ bind(&no_arguments); 323 __ bind(&no_arguments);
328 __ LoadRoot(a0, Heap::kempty_stringRootIndex); 324 __ LoadRoot(a0, Heap::kempty_stringRootIndex);
329 __ Drop(1); 325 __ Drop(1);
330 __ bind(&done); 326 __ bind(&done);
331 } 327 }
332 328
333 // 3. Make sure a0 is a string. 329 // 3. Make sure a0 is a string.
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 // a2: address of last argument (caller sp) 600 // a2: address of last argument (caller sp)
605 // a3: new target 601 // a3: new target
606 // t0: number of arguments (smi-tagged) 602 // t0: number of arguments (smi-tagged)
607 // sp[0]: receiver 603 // sp[0]: receiver
608 // sp[1]: receiver 604 // sp[1]: receiver
609 // sp[2]: number of arguments (smi-tagged) 605 // sp[2]: number of arguments (smi-tagged)
610 Label loop, entry; 606 Label loop, entry;
611 __ mov(t0, a0); 607 __ mov(t0, a0);
612 __ jmp(&entry); 608 __ jmp(&entry);
613 __ bind(&loop); 609 __ bind(&loop);
614 __ dsll(a4, t0, kPointerSizeLog2); 610 __ Dlsa(a4, a2, t0, kPointerSizeLog2);
615 __ Daddu(a4, a2, Operand(a4));
616 __ ld(a5, MemOperand(a4)); 611 __ ld(a5, MemOperand(a4));
617 __ push(a5); 612 __ push(a5);
618 __ bind(&entry); 613 __ bind(&entry);
619 __ Daddu(t0, t0, Operand(-1)); 614 __ Daddu(t0, t0, Operand(-1));
620 __ Branch(&loop, greater_equal, t0, Operand(zero_reg)); 615 __ Branch(&loop, greater_equal, t0, Operand(zero_reg));
621 616
622 // Call the function. 617 // Call the function.
623 // a0: number of arguments 618 // a0: number of arguments
624 // a1: constructor function 619 // a1: constructor function
625 // a3: new target 620 // a3: new target
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 // Clobbers a2. 786 // Clobbers a2.
792 Generate_CheckStackOverflow(masm, a3, kArgcIsUntaggedInt); 787 Generate_CheckStackOverflow(masm, a3, kArgcIsUntaggedInt);
793 788
794 // Remember new.target. 789 // Remember new.target.
795 __ mov(a5, a0); 790 __ mov(a5, a0);
796 791
797 // Copy arguments to the stack in a loop. 792 // Copy arguments to the stack in a loop.
798 // a3: argc 793 // a3: argc
799 // s0: argv, i.e. points to first arg 794 // s0: argv, i.e. points to first arg
800 Label loop, entry; 795 Label loop, entry;
801 __ dsll(a4, a3, kPointerSizeLog2); 796 __ Dlsa(a6, s0, a3, kPointerSizeLog2);
802 __ daddu(a6, s0, a4);
803 __ b(&entry); 797 __ b(&entry);
804 __ nop(); // Branch delay slot nop. 798 __ nop(); // Branch delay slot nop.
805 // a6 points past last arg. 799 // a6 points past last arg.
806 __ bind(&loop); 800 __ bind(&loop);
807 __ ld(a4, MemOperand(s0)); // Read next parameter. 801 __ ld(a4, MemOperand(s0)); // Read next parameter.
808 __ daddiu(s0, s0, kPointerSize); 802 __ daddiu(s0, s0, kPointerSize);
809 __ ld(a4, MemOperand(a4)); // Dereference handle. 803 __ ld(a4, MemOperand(a4)); // Dereference handle.
810 __ push(a4); // Push parameter. 804 __ push(a4); // Push parameter.
811 __ bind(&entry); 805 __ bind(&entry);
812 __ Branch(&loop, ne, s0, Operand(a6)); 806 __ Branch(&loop, ne, s0, Operand(a6));
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); 942 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
949 __ LoadRoot(kInterpreterDispatchTableRegister, 943 __ LoadRoot(kInterpreterDispatchTableRegister,
950 Heap::kInterpreterTableRootIndex); 944 Heap::kInterpreterTableRootIndex);
951 __ Daddu(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, 945 __ Daddu(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister,
952 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 946 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
953 947
954 // Dispatch to the first bytecode handler for the function. 948 // Dispatch to the first bytecode handler for the function.
955 __ Daddu(a0, kInterpreterBytecodeArrayRegister, 949 __ Daddu(a0, kInterpreterBytecodeArrayRegister,
956 kInterpreterBytecodeOffsetRegister); 950 kInterpreterBytecodeOffsetRegister);
957 __ lbu(a0, MemOperand(a0)); 951 __ lbu(a0, MemOperand(a0));
958 __ dsll(at, a0, kPointerSizeLog2); 952 __ Dlsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2);
959 __ Daddu(at, kInterpreterDispatchTableRegister, at);
960 __ ld(at, MemOperand(at)); 953 __ ld(at, MemOperand(at));
961 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging 954 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging
962 // and header removal. 955 // and header removal.
963 __ Daddu(at, at, Operand(Code::kHeaderSize - kHeapObjectTag)); 956 __ Daddu(at, at, Operand(Code::kHeaderSize - kHeapObjectTag));
964 __ Call(at); 957 __ Call(at);
965 } 958 }
966 959
967 960
968 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { 961 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
969 // TODO(rmcilroy): List of things not currently dealt with here but done in 962 // TODO(rmcilroy): List of things not currently dealt with here but done in
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 __ ld(kInterpreterBytecodeOffsetRegister, 1095 __ ld(kInterpreterBytecodeOffsetRegister,
1103 MemOperand( 1096 MemOperand(
1104 kInterpreterRegisterFileRegister, 1097 kInterpreterRegisterFileRegister,
1105 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); 1098 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer));
1106 __ SmiUntag(kInterpreterBytecodeOffsetRegister); 1099 __ SmiUntag(kInterpreterBytecodeOffsetRegister);
1107 1100
1108 // Dispatch to the target bytecode. 1101 // Dispatch to the target bytecode.
1109 __ Daddu(a1, kInterpreterBytecodeArrayRegister, 1102 __ Daddu(a1, kInterpreterBytecodeArrayRegister,
1110 kInterpreterBytecodeOffsetRegister); 1103 kInterpreterBytecodeOffsetRegister);
1111 __ lbu(a1, MemOperand(a1)); 1104 __ lbu(a1, MemOperand(a1));
1112 __ dsll(a1, a1, kPointerSizeLog2); 1105 __ Dlsa(a1, kInterpreterDispatchTableRegister, a1, kPointerSizeLog2);
1113 __ Daddu(a1, kInterpreterDispatchTableRegister, a1);
1114 __ ld(a1, MemOperand(a1)); 1106 __ ld(a1, MemOperand(a1));
1115 __ Daddu(a1, a1, Operand(Code::kHeaderSize - kHeapObjectTag)); 1107 __ Daddu(a1, a1, Operand(Code::kHeaderSize - kHeapObjectTag));
1116 __ Jump(a1); 1108 __ Jump(a1);
1117 } 1109 }
1118 1110
1119 1111
1120 void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) { 1112 void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) {
1121 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); 1113 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER);
1122 } 1114 }
1123 1115
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 // -- sp[8 * (argc - 1)] : first argument 1382 // -- sp[8 * (argc - 1)] : first argument
1391 // -- sp[8 * argc] : receiver 1383 // -- sp[8 * argc] : receiver
1392 // ----------------------------------- 1384 // -----------------------------------
1393 1385
1394 // Load the FunctionTemplateInfo. 1386 // Load the FunctionTemplateInfo.
1395 __ ld(t1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 1387 __ ld(t1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
1396 __ ld(t1, FieldMemOperand(t1, SharedFunctionInfo::kFunctionDataOffset)); 1388 __ ld(t1, FieldMemOperand(t1, SharedFunctionInfo::kFunctionDataOffset));
1397 1389
1398 // Do the compatible receiver check 1390 // Do the compatible receiver check
1399 Label receiver_check_failed; 1391 Label receiver_check_failed;
1400 __ sll(at, a0, kPointerSizeLog2); 1392 __ Dlsa(t8, sp, a0, kPointerSizeLog2);
1401 __ Daddu(t8, sp, at);
1402 __ ld(t0, MemOperand(t8)); 1393 __ ld(t0, MemOperand(t8));
1403 CompatibleReceiverCheck(masm, t0, t1, &receiver_check_failed); 1394 CompatibleReceiverCheck(masm, t0, t1, &receiver_check_failed);
1404 1395
1405 // Get the callback offset from the FunctionTemplateInfo, and jump to the 1396 // Get the callback offset from the FunctionTemplateInfo, and jump to the
1406 // beginning of the code. 1397 // beginning of the code.
1407 __ ld(t2, FieldMemOperand(t1, FunctionTemplateInfo::kCallCodeOffset)); 1398 __ ld(t2, FieldMemOperand(t1, FunctionTemplateInfo::kCallCodeOffset));
1408 __ ld(t2, FieldMemOperand(t2, CallHandlerInfo::kFastHandlerOffset)); 1399 __ ld(t2, FieldMemOperand(t2, CallHandlerInfo::kFastHandlerOffset));
1409 __ Daddu(t2, t2, Operand(Code::kHeaderSize - kHeapObjectTag)); 1400 __ Daddu(t2, t2, Operand(Code::kHeaderSize - kHeapObjectTag));
1410 __ Jump(t2); 1401 __ Jump(t2);
1411 1402
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 // ----------------------------------- 1516 // -----------------------------------
1526 1517
1527 // 1. Load receiver into a1, argArray into a0 (if present), remove all 1518 // 1. Load receiver into a1, argArray into a0 (if present), remove all
1528 // arguments from the stack (including the receiver), and push thisArg (if 1519 // arguments from the stack (including the receiver), and push thisArg (if
1529 // present) instead. 1520 // present) instead.
1530 { 1521 {
1531 Label no_arg; 1522 Label no_arg;
1532 Register scratch = a4; 1523 Register scratch = a4;
1533 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); 1524 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
1534 __ mov(a3, a2); 1525 __ mov(a3, a2);
1526 // Dlsa() cannot be used hare as scratch value used later.
1535 __ dsll(scratch, a0, kPointerSizeLog2); 1527 __ dsll(scratch, a0, kPointerSizeLog2);
1536 __ Daddu(a0, sp, Operand(scratch)); 1528 __ Daddu(a0, sp, Operand(scratch));
1537 __ ld(a1, MemOperand(a0)); // receiver 1529 __ ld(a1, MemOperand(a0)); // receiver
1538 __ Dsubu(a0, a0, Operand(kPointerSize)); 1530 __ Dsubu(a0, a0, Operand(kPointerSize));
1539 __ Branch(&no_arg, lt, a0, Operand(sp)); 1531 __ Branch(&no_arg, lt, a0, Operand(sp));
1540 __ ld(a2, MemOperand(a0)); // thisArg 1532 __ ld(a2, MemOperand(a0)); // thisArg
1541 __ Dsubu(a0, a0, Operand(kPointerSize)); 1533 __ Dsubu(a0, a0, Operand(kPointerSize));
1542 __ Branch(&no_arg, lt, a0, Operand(sp)); 1534 __ Branch(&no_arg, lt, a0, Operand(sp));
1543 __ ld(a3, MemOperand(a0)); // argArray 1535 __ ld(a3, MemOperand(a0)); // argArray
1544 __ bind(&no_arg); 1536 __ bind(&no_arg);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 { 1587 {
1596 Label done; 1588 Label done;
1597 __ Branch(&done, ne, a0, Operand(zero_reg)); 1589 __ Branch(&done, ne, a0, Operand(zero_reg));
1598 __ PushRoot(Heap::kUndefinedValueRootIndex); 1590 __ PushRoot(Heap::kUndefinedValueRootIndex);
1599 __ Daddu(a0, a0, Operand(1)); 1591 __ Daddu(a0, a0, Operand(1));
1600 __ bind(&done); 1592 __ bind(&done);
1601 } 1593 }
1602 1594
1603 // 2. Get the function to call (passed as receiver) from the stack. 1595 // 2. Get the function to call (passed as receiver) from the stack.
1604 // a0: actual number of arguments 1596 // a0: actual number of arguments
1605 __ dsll(at, a0, kPointerSizeLog2); 1597 __ Dlsa(at, sp, a0, kPointerSizeLog2);
1606 __ daddu(at, sp, at);
1607 __ ld(a1, MemOperand(at)); 1598 __ ld(a1, MemOperand(at));
1608 1599
1609 // 3. Shift arguments and return address one slot down on the stack 1600 // 3. Shift arguments and return address one slot down on the stack
1610 // (overwriting the original receiver). Adjust argument count to make 1601 // (overwriting the original receiver). Adjust argument count to make
1611 // the original first argument the new receiver. 1602 // the original first argument the new receiver.
1612 // a0: actual number of arguments 1603 // a0: actual number of arguments
1613 // a1: function 1604 // a1: function
1614 { 1605 {
1615 Label loop; 1606 Label loop;
1616 // Calculate the copy start address (destination). Copy end address is sp. 1607 // Calculate the copy start address (destination). Copy end address is sp.
1617 __ dsll(at, a0, kPointerSizeLog2); 1608 __ Dlsa(a2, sp, a0, kPointerSizeLog2);
1618 __ daddu(a2, sp, at);
1619 1609
1620 __ bind(&loop); 1610 __ bind(&loop);
1621 __ ld(at, MemOperand(a2, -kPointerSize)); 1611 __ ld(at, MemOperand(a2, -kPointerSize));
1622 __ sd(at, MemOperand(a2)); 1612 __ sd(at, MemOperand(a2));
1623 __ Dsubu(a2, a2, Operand(kPointerSize)); 1613 __ Dsubu(a2, a2, Operand(kPointerSize));
1624 __ Branch(&loop, ne, a2, Operand(sp)); 1614 __ Branch(&loop, ne, a2, Operand(sp));
1625 // Adjust the actual number of arguments and remove the top element 1615 // Adjust the actual number of arguments and remove the top element
1626 // (which is a copy of the last argument). 1616 // (which is a copy of the last argument).
1627 __ Dsubu(a0, a0, Operand(1)); 1617 __ Dsubu(a0, a0, Operand(1));
1628 __ Pop(); 1618 __ Pop();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 1698
1709 // 1. Load target into a1 (if present), argumentsList into a0 (if present), 1699 // 1. Load target into a1 (if present), argumentsList into a0 (if present),
1710 // new.target into a3 (if present, otherwise use target), remove all 1700 // new.target into a3 (if present, otherwise use target), remove all
1711 // arguments from the stack (including the receiver), and push thisArgument 1701 // arguments from the stack (including the receiver), and push thisArgument
1712 // (if present) instead. 1702 // (if present) instead.
1713 { 1703 {
1714 Label no_arg; 1704 Label no_arg;
1715 Register scratch = a4; 1705 Register scratch = a4;
1716 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); 1706 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex);
1717 __ mov(a2, a1); 1707 __ mov(a2, a1);
1708 // Dlsa() cannot be used hare as scratch value used later.
1718 __ dsll(scratch, a0, kPointerSizeLog2); 1709 __ dsll(scratch, a0, kPointerSizeLog2);
1719 __ Daddu(a0, sp, Operand(scratch)); 1710 __ Daddu(a0, sp, Operand(scratch));
1720 __ sd(a2, MemOperand(a0)); // receiver 1711 __ sd(a2, MemOperand(a0)); // receiver
1721 __ Dsubu(a0, a0, Operand(kPointerSize)); 1712 __ Dsubu(a0, a0, Operand(kPointerSize));
1722 __ Branch(&no_arg, lt, a0, Operand(sp)); 1713 __ Branch(&no_arg, lt, a0, Operand(sp));
1723 __ ld(a1, MemOperand(a0)); // target 1714 __ ld(a1, MemOperand(a0)); // target
1724 __ mov(a3, a1); // new.target defaults to target 1715 __ mov(a3, a1); // new.target defaults to target
1725 __ Dsubu(a0, a0, Operand(kPointerSize)); 1716 __ Dsubu(a0, a0, Operand(kPointerSize));
1726 __ Branch(&no_arg, lt, a0, Operand(sp)); 1717 __ Branch(&no_arg, lt, a0, Operand(sp));
1727 __ ld(a2, MemOperand(a0)); // argumentsList 1718 __ ld(a2, MemOperand(a0)); // argumentsList
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 // -- a3 : new.target (checked to be constructor or undefined) 1910 // -- a3 : new.target (checked to be constructor or undefined)
1920 // -- sp[0] : thisArgument 1911 // -- sp[0] : thisArgument
1921 // ----------------------------------- 1912 // -----------------------------------
1922 1913
1923 // Push arguments onto the stack (thisArgument is already on the stack). 1914 // Push arguments onto the stack (thisArgument is already on the stack).
1924 { 1915 {
1925 __ mov(a4, zero_reg); 1916 __ mov(a4, zero_reg);
1926 Label done, loop; 1917 Label done, loop;
1927 __ bind(&loop); 1918 __ bind(&loop);
1928 __ Branch(&done, eq, a4, Operand(a2)); 1919 __ Branch(&done, eq, a4, Operand(a2));
1929 __ dsll(at, a4, kPointerSizeLog2); 1920 __ Dlsa(at, a0, a4, kPointerSizeLog2);
1930 __ Daddu(at, a0, at);
1931 __ ld(at, FieldMemOperand(at, FixedArray::kHeaderSize)); 1921 __ ld(at, FieldMemOperand(at, FixedArray::kHeaderSize));
1932 __ Push(at); 1922 __ Push(at);
1933 __ Daddu(a4, a4, Operand(1)); 1923 __ Daddu(a4, a4, Operand(1));
1934 __ Branch(&loop); 1924 __ Branch(&loop);
1935 __ bind(&done); 1925 __ bind(&done);
1936 __ Move(a0, a4); 1926 __ Move(a0, a4);
1937 } 1927 }
1938 1928
1939 // Dispatch to Call or Construct depending on whether new.target is undefined. 1929 // Dispatch to Call or Construct depending on whether new.target is undefined.
1940 { 1930 {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1983 // -- a1 : the function to call (checked to be a JSFunction) 1973 // -- a1 : the function to call (checked to be a JSFunction)
1984 // -- a2 : the shared function info. 1974 // -- a2 : the shared function info.
1985 // -- cp : the function context. 1975 // -- cp : the function context.
1986 // ----------------------------------- 1976 // -----------------------------------
1987 1977
1988 if (mode == ConvertReceiverMode::kNullOrUndefined) { 1978 if (mode == ConvertReceiverMode::kNullOrUndefined) {
1989 // Patch receiver to global proxy. 1979 // Patch receiver to global proxy.
1990 __ LoadGlobalProxy(a3); 1980 __ LoadGlobalProxy(a3);
1991 } else { 1981 } else {
1992 Label convert_to_object, convert_receiver; 1982 Label convert_to_object, convert_receiver;
1993 __ dsll(at, a0, kPointerSizeLog2); 1983 __ Dlsa(at, sp, a0, kPointerSizeLog2);
1994 __ daddu(at, sp, at);
1995 __ ld(a3, MemOperand(at)); 1984 __ ld(a3, MemOperand(at));
1996 __ JumpIfSmi(a3, &convert_to_object); 1985 __ JumpIfSmi(a3, &convert_to_object);
1997 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); 1986 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
1998 __ GetObjectType(a3, a4, a4); 1987 __ GetObjectType(a3, a4, a4);
1999 __ Branch(&done_convert, hs, a4, Operand(FIRST_JS_RECEIVER_TYPE)); 1988 __ Branch(&done_convert, hs, a4, Operand(FIRST_JS_RECEIVER_TYPE));
2000 if (mode != ConvertReceiverMode::kNotNullOrUndefined) { 1989 if (mode != ConvertReceiverMode::kNotNullOrUndefined) {
2001 Label convert_global_proxy; 1990 Label convert_global_proxy;
2002 __ JumpIfRoot(a3, Heap::kUndefinedValueRootIndex, 1991 __ JumpIfRoot(a3, Heap::kUndefinedValueRootIndex,
2003 &convert_global_proxy); 1992 &convert_global_proxy);
2004 __ JumpIfNotRoot(a3, Heap::kNullValueRootIndex, &convert_to_object); 1993 __ JumpIfNotRoot(a3, Heap::kNullValueRootIndex, &convert_to_object);
(...skipping 15 matching lines...) Expand all
2020 __ mov(a0, a3); 2009 __ mov(a0, a3);
2021 ToObjectStub stub(masm->isolate()); 2010 ToObjectStub stub(masm->isolate());
2022 __ CallStub(&stub); 2011 __ CallStub(&stub);
2023 __ mov(a3, v0); 2012 __ mov(a3, v0);
2024 __ Pop(a0, a1); 2013 __ Pop(a0, a1);
2025 __ SmiUntag(a0); 2014 __ SmiUntag(a0);
2026 } 2015 }
2027 __ ld(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 2016 __ ld(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
2028 __ bind(&convert_receiver); 2017 __ bind(&convert_receiver);
2029 } 2018 }
2030 __ dsll(at, a0, kPointerSizeLog2); 2019 __ Dlsa(at, sp, a0, kPointerSizeLog2);
2031 __ daddu(at, sp, at);
2032 __ sd(a3, MemOperand(at)); 2020 __ sd(a3, MemOperand(at));
2033 } 2021 }
2034 __ bind(&done_convert); 2022 __ bind(&done_convert);
2035 2023
2036 // ----------- S t a t e ------------- 2024 // ----------- S t a t e -------------
2037 // -- a0 : the number of arguments (not including the receiver) 2025 // -- a0 : the number of arguments (not including the receiver)
2038 // -- a1 : the function to call (checked to be a JSFunction) 2026 // -- a1 : the function to call (checked to be a JSFunction)
2039 // -- a2 : the shared function info. 2027 // -- a2 : the shared function info.
2040 // -- cp : the function context. 2028 // -- cp : the function context.
2041 // ----------------------------------- 2029 // -----------------------------------
(...skipping 19 matching lines...) Expand all
2061 void Builtins::Generate_CallBoundFunction(MacroAssembler* masm) { 2049 void Builtins::Generate_CallBoundFunction(MacroAssembler* masm) {
2062 // ----------- S t a t e ------------- 2050 // ----------- S t a t e -------------
2063 // -- a0 : the number of arguments (not including the receiver) 2051 // -- a0 : the number of arguments (not including the receiver)
2064 // -- a1 : the function to call (checked to be a JSBoundFunction) 2052 // -- a1 : the function to call (checked to be a JSBoundFunction)
2065 // ----------------------------------- 2053 // -----------------------------------
2066 __ AssertBoundFunction(a1); 2054 __ AssertBoundFunction(a1);
2067 2055
2068 // Patch the receiver to [[BoundThis]]. 2056 // Patch the receiver to [[BoundThis]].
2069 { 2057 {
2070 __ ld(at, FieldMemOperand(a1, JSBoundFunction::kBoundThisOffset)); 2058 __ ld(at, FieldMemOperand(a1, JSBoundFunction::kBoundThisOffset));
2071 __ dsll(a4, a0, kPointerSizeLog2); 2059 __ Dlsa(a4, sp, a0, kPointerSizeLog2);
2072 __ daddu(a4, a4, sp);
2073 __ sd(at, MemOperand(a4)); 2060 __ sd(at, MemOperand(a4));
2074 } 2061 }
2075 2062
2076 // Load [[BoundArguments]] into a2 and length of that into a4. 2063 // Load [[BoundArguments]] into a2 and length of that into a4.
2077 __ ld(a2, FieldMemOperand(a1, JSBoundFunction::kBoundArgumentsOffset)); 2064 __ ld(a2, FieldMemOperand(a1, JSBoundFunction::kBoundArgumentsOffset));
2078 __ ld(a4, FieldMemOperand(a2, FixedArray::kLengthOffset)); 2065 __ ld(a4, FieldMemOperand(a2, FixedArray::kLengthOffset));
2079 __ SmiUntag(a4); 2066 __ SmiUntag(a4);
2080 2067
2081 // ----------- S t a t e ------------- 2068 // ----------- S t a t e -------------
2082 // -- a0 : the number of arguments (not including the receiver) 2069 // -- a0 : the number of arguments (not including the receiver)
(...skipping 20 matching lines...) Expand all
2103 } 2090 }
2104 __ bind(&done); 2091 __ bind(&done);
2105 } 2092 }
2106 2093
2107 // Relocate arguments down the stack. 2094 // Relocate arguments down the stack.
2108 { 2095 {
2109 Label loop, done_loop; 2096 Label loop, done_loop;
2110 __ mov(a5, zero_reg); 2097 __ mov(a5, zero_reg);
2111 __ bind(&loop); 2098 __ bind(&loop);
2112 __ Branch(&done_loop, gt, a5, Operand(a0)); 2099 __ Branch(&done_loop, gt, a5, Operand(a0));
2113 __ dsll(a6, a4, kPointerSizeLog2); 2100 __ Dlsa(a6, sp, a4, kPointerSizeLog2);
2114 __ daddu(a6, a6, sp);
2115 __ ld(at, MemOperand(a6)); 2101 __ ld(at, MemOperand(a6));
2116 __ dsll(a6, a5, kPointerSizeLog2); 2102 __ Dlsa(a6, sp, a5, kPointerSizeLog2);
2117 __ daddu(a6, a6, sp);
2118 __ sd(at, MemOperand(a6)); 2103 __ sd(at, MemOperand(a6));
2119 __ Daddu(a4, a4, Operand(1)); 2104 __ Daddu(a4, a4, Operand(1));
2120 __ Daddu(a5, a5, Operand(1)); 2105 __ Daddu(a5, a5, Operand(1));
2121 __ Branch(&loop); 2106 __ Branch(&loop);
2122 __ bind(&done_loop); 2107 __ bind(&done_loop);
2123 } 2108 }
2124 2109
2125 // Copy [[BoundArguments]] to the stack (below the arguments). 2110 // Copy [[BoundArguments]] to the stack (below the arguments).
2126 { 2111 {
2127 Label loop, done_loop; 2112 Label loop, done_loop;
2128 __ ld(a4, FieldMemOperand(a2, FixedArray::kLengthOffset)); 2113 __ ld(a4, FieldMemOperand(a2, FixedArray::kLengthOffset));
2129 __ SmiUntag(a4); 2114 __ SmiUntag(a4);
2130 __ Daddu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 2115 __ Daddu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
2131 __ bind(&loop); 2116 __ bind(&loop);
2132 __ Dsubu(a4, a4, Operand(1)); 2117 __ Dsubu(a4, a4, Operand(1));
2133 __ Branch(&done_loop, lt, a4, Operand(zero_reg)); 2118 __ Branch(&done_loop, lt, a4, Operand(zero_reg));
2134 __ dsll(a5, a4, kPointerSizeLog2); 2119 __ Dlsa(a5, a2, a4, kPointerSizeLog2);
2135 __ daddu(a5, a5, a2);
2136 __ ld(at, MemOperand(a5)); 2120 __ ld(at, MemOperand(a5));
2137 __ dsll(a5, a0, kPointerSizeLog2); 2121 __ Dlsa(a5, sp, a0, kPointerSizeLog2);
2138 __ daddu(a5, a5, sp);
2139 __ sd(at, MemOperand(a5)); 2122 __ sd(at, MemOperand(a5));
2140 __ Daddu(a0, a0, Operand(1)); 2123 __ Daddu(a0, a0, Operand(1));
2141 __ Branch(&loop); 2124 __ Branch(&loop);
2142 __ bind(&done_loop); 2125 __ bind(&done_loop);
2143 } 2126 }
2144 2127
2145 // Call the [[BoundTargetFunction]] via the Call builtin. 2128 // Call the [[BoundTargetFunction]] via the Call builtin.
2146 __ ld(a1, FieldMemOperand(a1, JSBoundFunction::kBoundTargetFunctionOffset)); 2129 __ ld(a1, FieldMemOperand(a1, JSBoundFunction::kBoundTargetFunctionOffset));
2147 __ li(at, Operand(ExternalReference(Builtins::kCall_ReceiverIsAny, 2130 __ li(at, Operand(ExternalReference(Builtins::kCall_ReceiverIsAny,
2148 masm->isolate()))); 2131 masm->isolate())));
(...skipping 30 matching lines...) Expand all
2179 ExternalReference(Runtime::kJSProxyCall, masm->isolate())); 2162 ExternalReference(Runtime::kJSProxyCall, masm->isolate()));
2180 2163
2181 // 2. Call to something else, which might have a [[Call]] internal method (if 2164 // 2. Call to something else, which might have a [[Call]] internal method (if
2182 // not we raise an exception). 2165 // not we raise an exception).
2183 __ bind(&non_function); 2166 __ bind(&non_function);
2184 // Check if target has a [[Call]] internal method. 2167 // Check if target has a [[Call]] internal method.
2185 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); 2168 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset));
2186 __ And(t1, t1, Operand(1 << Map::kIsCallable)); 2169 __ And(t1, t1, Operand(1 << Map::kIsCallable));
2187 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); 2170 __ Branch(&non_callable, eq, t1, Operand(zero_reg));
2188 // Overwrite the original receiver with the (original) target. 2171 // Overwrite the original receiver with the (original) target.
2189 __ dsll(at, a0, kPointerSizeLog2); 2172 __ Dlsa(at, sp, a0, kPointerSizeLog2);
2190 __ daddu(at, sp, at);
2191 __ sd(a1, MemOperand(at)); 2173 __ sd(a1, MemOperand(at));
2192 // Let the "call_as_function_delegate" take care of the rest. 2174 // Let the "call_as_function_delegate" take care of the rest.
2193 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1); 2175 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1);
2194 __ Jump(masm->isolate()->builtins()->CallFunction( 2176 __ Jump(masm->isolate()->builtins()->CallFunction(
2195 ConvertReceiverMode::kNotNullOrUndefined), 2177 ConvertReceiverMode::kNotNullOrUndefined),
2196 RelocInfo::CODE_TARGET); 2178 RelocInfo::CODE_TARGET);
2197 2179
2198 // 3. Call to something that is not callable. 2180 // 3. Call to something that is not callable.
2199 __ bind(&non_callable); 2181 __ bind(&non_callable);
2200 { 2182 {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2266 } 2248 }
2267 __ bind(&done); 2249 __ bind(&done);
2268 } 2250 }
2269 2251
2270 // Relocate arguments down the stack. 2252 // Relocate arguments down the stack.
2271 { 2253 {
2272 Label loop, done_loop; 2254 Label loop, done_loop;
2273 __ mov(a5, zero_reg); 2255 __ mov(a5, zero_reg);
2274 __ bind(&loop); 2256 __ bind(&loop);
2275 __ Branch(&done_loop, ge, a5, Operand(a0)); 2257 __ Branch(&done_loop, ge, a5, Operand(a0));
2276 __ dsll(a6, a4, kPointerSizeLog2); 2258 __ Dlsa(a6, sp, a4, kPointerSizeLog2);
2277 __ daddu(a6, a6, sp);
2278 __ ld(at, MemOperand(a6)); 2259 __ ld(at, MemOperand(a6));
2279 __ dsll(a6, a5, kPointerSizeLog2); 2260 __ Dlsa(a6, sp, a5, kPointerSizeLog2);
2280 __ daddu(a6, a6, sp);
2281 __ sd(at, MemOperand(a6)); 2261 __ sd(at, MemOperand(a6));
2282 __ Daddu(a4, a4, Operand(1)); 2262 __ Daddu(a4, a4, Operand(1));
2283 __ Daddu(a5, a5, Operand(1)); 2263 __ Daddu(a5, a5, Operand(1));
2284 __ Branch(&loop); 2264 __ Branch(&loop);
2285 __ bind(&done_loop); 2265 __ bind(&done_loop);
2286 } 2266 }
2287 2267
2288 // Copy [[BoundArguments]] to the stack (below the arguments). 2268 // Copy [[BoundArguments]] to the stack (below the arguments).
2289 { 2269 {
2290 Label loop, done_loop; 2270 Label loop, done_loop;
2291 __ ld(a4, FieldMemOperand(a2, FixedArray::kLengthOffset)); 2271 __ ld(a4, FieldMemOperand(a2, FixedArray::kLengthOffset));
2292 __ SmiUntag(a4); 2272 __ SmiUntag(a4);
2293 __ Daddu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 2273 __ Daddu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
2294 __ bind(&loop); 2274 __ bind(&loop);
2295 __ Dsubu(a4, a4, Operand(1)); 2275 __ Dsubu(a4, a4, Operand(1));
2296 __ Branch(&done_loop, lt, a4, Operand(zero_reg)); 2276 __ Branch(&done_loop, lt, a4, Operand(zero_reg));
2297 __ dsll(a5, a4, kPointerSizeLog2); 2277 __ Dlsa(a5, a2, a4, kPointerSizeLog2);
2298 __ daddu(a5, a5, a2);
2299 __ ld(at, MemOperand(a5)); 2278 __ ld(at, MemOperand(a5));
2300 __ dsll(a5, a0, kPointerSizeLog2); 2279 __ Dlsa(a5, sp, a0, kPointerSizeLog2);
2301 __ daddu(a5, a5, sp);
2302 __ sd(at, MemOperand(a5)); 2280 __ sd(at, MemOperand(a5));
2303 __ Daddu(a0, a0, Operand(1)); 2281 __ Daddu(a0, a0, Operand(1));
2304 __ Branch(&loop); 2282 __ Branch(&loop);
2305 __ bind(&done_loop); 2283 __ bind(&done_loop);
2306 } 2284 }
2307 2285
2308 // Patch new.target to [[BoundTargetFunction]] if new.target equals target. 2286 // Patch new.target to [[BoundTargetFunction]] if new.target equals target.
2309 { 2287 {
2310 Label skip_load; 2288 Label skip_load;
2311 __ Branch(&skip_load, ne, a1, Operand(a3)); 2289 __ Branch(&skip_load, ne, a1, Operand(a3));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 __ Jump(masm->isolate()->builtins()->ConstructBoundFunction(), 2348 __ Jump(masm->isolate()->builtins()->ConstructBoundFunction(),
2371 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_BOUND_FUNCTION_TYPE)); 2349 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_BOUND_FUNCTION_TYPE));
2372 2350
2373 // Only dispatch to proxies after checking whether they are constructors. 2351 // Only dispatch to proxies after checking whether they are constructors.
2374 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, 2352 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
2375 eq, t2, Operand(JS_PROXY_TYPE)); 2353 eq, t2, Operand(JS_PROXY_TYPE));
2376 2354
2377 // Called Construct on an exotic Object with a [[Construct]] internal method. 2355 // Called Construct on an exotic Object with a [[Construct]] internal method.
2378 { 2356 {
2379 // Overwrite the original receiver with the (original) target. 2357 // Overwrite the original receiver with the (original) target.
2380 __ dsll(at, a0, kPointerSizeLog2); 2358 __ Dlsa(at, sp, a0, kPointerSizeLog2);
2381 __ daddu(at, sp, at);
2382 __ sd(a1, MemOperand(at)); 2359 __ sd(a1, MemOperand(at));
2383 // Let the "call_as_constructor_delegate" take care of the rest. 2360 // Let the "call_as_constructor_delegate" take care of the rest.
2384 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1); 2361 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1);
2385 __ Jump(masm->isolate()->builtins()->CallFunction(), 2362 __ Jump(masm->isolate()->builtins()->CallFunction(),
2386 RelocInfo::CODE_TARGET); 2363 RelocInfo::CODE_TARGET);
2387 } 2364 }
2388 2365
2389 // Called Construct on an Object that doesn't have a [[Construct]] internal 2366 // Called Construct on an Object that doesn't have a [[Construct]] internal
2390 // method. 2367 // method.
2391 __ bind(&non_constructor); 2368 __ bind(&non_constructor);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2548 } 2525 }
2549 } 2526 }
2550 2527
2551 2528
2552 #undef __ 2529 #undef __
2553 2530
2554 } // namespace internal 2531 } // namespace internal
2555 } // namespace v8 2532 } // namespace v8
2556 2533
2557 #endif // V8_TARGET_ARCH_MIPS64 2534 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698