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

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

Issue 1608933003: MIPS: Use the Lsa() macro/r6 instruction 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/ic/mips/stub-cache-mips.cc ('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 // 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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) 150 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
151 // -- sp[argc * 4] : receiver 151 // -- sp[argc * 4] : receiver
152 // ----------------------------------- 152 // -----------------------------------
153 153
154 // 1. Load the first argument into a0 and get rid of the rest (including the 154 // 1. Load the first argument into a0 and get rid of the rest (including the
155 // receiver). 155 // receiver).
156 Label no_arguments; 156 Label no_arguments;
157 { 157 {
158 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); 158 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg));
159 __ Subu(a0, a0, Operand(1)); 159 __ Subu(a0, a0, Operand(1));
160 __ sll(a0, a0, kPointerSizeLog2); 160 __ Lsa(sp, sp, a0, kPointerSizeLog2);
161 __ Addu(sp, a0, sp);
162 __ lw(a0, MemOperand(sp)); 161 __ lw(a0, MemOperand(sp));
163 __ Drop(2); 162 __ Drop(2);
164 } 163 }
165 164
166 // 2a. Convert first argument to number. 165 // 2a. Convert first argument to number.
167 ToNumberStub stub(masm->isolate()); 166 ToNumberStub stub(masm->isolate());
168 __ TailCallStub(&stub); 167 __ TailCallStub(&stub);
169 168
170 // 2b. No arguments, return +0. 169 // 2b. No arguments, return +0.
171 __ bind(&no_arguments); 170 __ bind(&no_arguments);
(...skipping 15 matching lines...) Expand all
187 186
188 // 1. Make sure we operate in the context of the called function. 187 // 1. Make sure we operate in the context of the called function.
189 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 188 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
190 189
191 // 2. Load the first argument into a0 and get rid of the rest (including the 190 // 2. Load the first argument into a0 and get rid of the rest (including the
192 // receiver). 191 // receiver).
193 { 192 {
194 Label no_arguments, done; 193 Label no_arguments, done;
195 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); 194 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg));
196 __ Subu(a0, a0, Operand(1)); 195 __ Subu(a0, a0, Operand(1));
197 __ sll(a0, a0, kPointerSizeLog2); 196 __ Lsa(sp, sp, a0, kPointerSizeLog2);
198 __ Addu(sp, a0, sp);
199 __ lw(a0, MemOperand(sp)); 197 __ lw(a0, MemOperand(sp));
200 __ Drop(2); 198 __ Drop(2);
201 __ jmp(&done); 199 __ jmp(&done);
202 __ bind(&no_arguments); 200 __ bind(&no_arguments);
203 __ Move(a0, Smi::FromInt(0)); 201 __ Move(a0, Smi::FromInt(0));
204 __ Drop(1); 202 __ Drop(1);
205 __ bind(&done); 203 __ bind(&done);
206 } 204 }
207 205
208 // 3. Make sure a0 is a number. 206 // 3. Make sure a0 is a number.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) 250 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
253 // -- sp[argc * 4] : receiver 251 // -- sp[argc * 4] : receiver
254 // ----------------------------------- 252 // -----------------------------------
255 253
256 // 1. Load the first argument into a0 and get rid of the rest (including the 254 // 1. Load the first argument into a0 and get rid of the rest (including the
257 // receiver). 255 // receiver).
258 Label no_arguments; 256 Label no_arguments;
259 { 257 {
260 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); 258 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg));
261 __ Subu(a0, a0, Operand(1)); 259 __ Subu(a0, a0, Operand(1));
262 __ sll(a0, a0, kPointerSizeLog2); 260 __ Lsa(sp, sp, a0, kPointerSizeLog2);
263 __ Addu(sp, a0, sp);
264 __ lw(a0, MemOperand(sp)); 261 __ lw(a0, MemOperand(sp));
265 __ Drop(2); 262 __ Drop(2);
266 } 263 }
267 264
268 // 2a. At least one argument, return a0 if it's a string, otherwise 265 // 2a. At least one argument, return a0 if it's a string, otherwise
269 // dispatch to appropriate conversion. 266 // dispatch to appropriate conversion.
270 Label to_string, symbol_descriptive_string; 267 Label to_string, symbol_descriptive_string;
271 { 268 {
272 __ JumpIfSmi(a0, &to_string); 269 __ JumpIfSmi(a0, &to_string);
273 __ GetObjectType(a0, a1, a1); 270 __ GetObjectType(a0, a1, a1);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 312
316 // 1. Make sure we operate in the context of the called function. 313 // 1. Make sure we operate in the context of the called function.
317 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 314 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
318 315
319 // 2. Load the first argument into a0 and get rid of the rest (including the 316 // 2. Load the first argument into a0 and get rid of the rest (including the
320 // receiver). 317 // receiver).
321 { 318 {
322 Label no_arguments, done; 319 Label no_arguments, done;
323 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); 320 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg));
324 __ Subu(a0, a0, Operand(1)); 321 __ Subu(a0, a0, Operand(1));
325 __ sll(a0, a0, kPointerSizeLog2); 322 __ Lsa(sp, sp, a0, kPointerSizeLog2);
326 __ Addu(sp, a0, sp);
327 __ lw(a0, MemOperand(sp)); 323 __ lw(a0, MemOperand(sp));
328 __ Drop(2); 324 __ Drop(2);
329 __ jmp(&done); 325 __ jmp(&done);
330 __ bind(&no_arguments); 326 __ bind(&no_arguments);
331 __ LoadRoot(a0, Heap::kempty_stringRootIndex); 327 __ LoadRoot(a0, Heap::kempty_stringRootIndex);
332 __ Drop(1); 328 __ Drop(1);
333 __ bind(&done); 329 __ bind(&done);
334 } 330 }
335 331
336 // 3. Make sure a0 is a string. 332 // 3. Make sure a0 is a string.
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 // a2: address of last argument (caller sp) 607 // a2: address of last argument (caller sp)
612 // a3: new target 608 // a3: new target
613 // t4: number of arguments (smi-tagged) 609 // t4: number of arguments (smi-tagged)
614 // sp[0]: receiver 610 // sp[0]: receiver
615 // sp[1]: receiver 611 // sp[1]: receiver
616 // sp[2]: number of arguments (smi-tagged) 612 // sp[2]: number of arguments (smi-tagged)
617 Label loop, entry; 613 Label loop, entry;
618 __ SmiTag(t4, a0); 614 __ SmiTag(t4, a0);
619 __ jmp(&entry); 615 __ jmp(&entry);
620 __ bind(&loop); 616 __ bind(&loop);
621 __ sll(t0, t4, kPointerSizeLog2 - kSmiTagSize); 617 __ Lsa(t0, a2, t4, kPointerSizeLog2 - kSmiTagSize);
622 __ Addu(t0, a2, Operand(t0));
623 __ lw(t1, MemOperand(t0)); 618 __ lw(t1, MemOperand(t0));
624 __ push(t1); 619 __ push(t1);
625 __ bind(&entry); 620 __ bind(&entry);
626 __ Addu(t4, t4, Operand(-2)); 621 __ Addu(t4, t4, Operand(-2));
627 __ Branch(&loop, greater_equal, t4, Operand(zero_reg)); 622 __ Branch(&loop, greater_equal, t4, Operand(zero_reg));
628 623
629 // Call the function. 624 // Call the function.
630 // a0: number of arguments 625 // a0: number of arguments
631 // a1: constructor function 626 // a1: constructor function
632 // a3: new target 627 // a3: new target
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 if (check_derived_construct) { 686 if (check_derived_construct) {
692 Label dont_throw; 687 Label dont_throw;
693 __ JumpIfNotSmi(v0, &dont_throw); 688 __ JumpIfNotSmi(v0, &dont_throw);
694 { 689 {
695 FrameScope scope(masm, StackFrame::INTERNAL); 690 FrameScope scope(masm, StackFrame::INTERNAL);
696 __ CallRuntime(Runtime::kThrowDerivedConstructorReturnedNonObject); 691 __ CallRuntime(Runtime::kThrowDerivedConstructorReturnedNonObject);
697 } 692 }
698 __ bind(&dont_throw); 693 __ bind(&dont_throw);
699 } 694 }
700 695
701 __ sll(t0, a1, kPointerSizeLog2 - 1); 696 __ Lsa(sp, sp, a1, kPointerSizeLog2 - 1);
702 __ Addu(sp, sp, t0);
703 __ Addu(sp, sp, kPointerSize); 697 __ Addu(sp, sp, kPointerSize);
704 if (create_implicit_receiver) { 698 if (create_implicit_receiver) {
705 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, a1, a2); 699 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, a1, a2);
706 } 700 }
707 __ Ret(); 701 __ Ret();
708 } 702 }
709 703
710 704
711 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { 705 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
712 Generate_JSConstructStubHelper(masm, false, true, false); 706 Generate_JSConstructStubHelper(masm, false, true, false);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 // Clobbers a2. 794 // Clobbers a2.
801 Generate_CheckStackOverflow(masm, a3, kArgcIsUntaggedInt); 795 Generate_CheckStackOverflow(masm, a3, kArgcIsUntaggedInt);
802 796
803 // Remember new.target. 797 // Remember new.target.
804 __ mov(t1, a0); 798 __ mov(t1, a0);
805 799
806 // Copy arguments to the stack in a loop. 800 // Copy arguments to the stack in a loop.
807 // a3: argc 801 // a3: argc
808 // s0: argv, i.e. points to first arg 802 // s0: argv, i.e. points to first arg
809 Label loop, entry; 803 Label loop, entry;
810 __ sll(t0, a3, kPointerSizeLog2); 804 __ Lsa(t2, s0, a3, kPointerSizeLog2);
811 __ addu(t2, s0, t0);
812 __ b(&entry); 805 __ b(&entry);
813 __ nop(); // Branch delay slot nop. 806 __ nop(); // Branch delay slot nop.
814 // t2 points past last arg. 807 // t2 points past last arg.
815 __ bind(&loop); 808 __ bind(&loop);
816 __ lw(t0, MemOperand(s0)); // Read next parameter. 809 __ lw(t0, MemOperand(s0)); // Read next parameter.
817 __ addiu(s0, s0, kPointerSize); 810 __ addiu(s0, s0, kPointerSize);
818 __ lw(t0, MemOperand(t0)); // Dereference handle. 811 __ lw(t0, MemOperand(t0)); // Dereference handle.
819 __ push(t0); // Push parameter. 812 __ push(t0); // Push parameter.
820 __ bind(&entry); 813 __ bind(&entry);
821 __ Branch(&loop, ne, s0, Operand(t2)); 814 __ Branch(&loop, ne, s0, Operand(t2));
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); 951 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
959 __ LoadRoot(kInterpreterDispatchTableRegister, 952 __ LoadRoot(kInterpreterDispatchTableRegister,
960 Heap::kInterpreterTableRootIndex); 953 Heap::kInterpreterTableRootIndex);
961 __ Addu(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, 954 __ Addu(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister,
962 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 955 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
963 956
964 // Dispatch to the first bytecode handler for the function. 957 // Dispatch to the first bytecode handler for the function.
965 __ Addu(a0, kInterpreterBytecodeArrayRegister, 958 __ Addu(a0, kInterpreterBytecodeArrayRegister,
966 kInterpreterBytecodeOffsetRegister); 959 kInterpreterBytecodeOffsetRegister);
967 __ lbu(a0, MemOperand(a0)); 960 __ lbu(a0, MemOperand(a0));
968 __ sll(at, a0, kPointerSizeLog2); 961 __ Lsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2);
969 __ Addu(at, kInterpreterDispatchTableRegister, at);
970 __ lw(at, MemOperand(at)); 962 __ lw(at, MemOperand(at));
971 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging 963 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging
972 // and header removal. 964 // and header removal.
973 __ Addu(at, at, Operand(Code::kHeaderSize - kHeapObjectTag)); 965 __ Addu(at, at, Operand(Code::kHeaderSize - kHeapObjectTag));
974 __ Call(at); 966 __ Call(at);
975 } 967 }
976 968
977 969
978 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { 970 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
979 // TODO(rmcilroy): List of things not currently dealt with here but done in 971 // 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
1112 __ lw(kInterpreterBytecodeOffsetRegister, 1104 __ lw(kInterpreterBytecodeOffsetRegister,
1113 MemOperand( 1105 MemOperand(
1114 kInterpreterRegisterFileRegister, 1106 kInterpreterRegisterFileRegister,
1115 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); 1107 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer));
1116 __ SmiUntag(kInterpreterBytecodeOffsetRegister); 1108 __ SmiUntag(kInterpreterBytecodeOffsetRegister);
1117 1109
1118 // Dispatch to the target bytecode. 1110 // Dispatch to the target bytecode.
1119 __ Addu(a1, kInterpreterBytecodeArrayRegister, 1111 __ Addu(a1, kInterpreterBytecodeArrayRegister,
1120 kInterpreterBytecodeOffsetRegister); 1112 kInterpreterBytecodeOffsetRegister);
1121 __ lbu(a1, MemOperand(a1)); 1113 __ lbu(a1, MemOperand(a1));
1122 __ sll(a1, a1, kPointerSizeLog2); 1114 __ Lsa(a1, kInterpreterDispatchTableRegister, a1, kPointerSizeLog2);
1123 __ Addu(a1, kInterpreterDispatchTableRegister, a1);
1124 __ lw(a1, MemOperand(a1)); 1115 __ lw(a1, MemOperand(a1));
1125 __ Addu(a1, a1, Operand(Code::kHeaderSize - kHeapObjectTag)); 1116 __ Addu(a1, a1, Operand(Code::kHeaderSize - kHeapObjectTag));
1126 __ Jump(a1); 1117 __ Jump(a1);
1127 } 1118 }
1128 1119
1129 1120
1130 void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) { 1121 void Builtins::Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm) {
1131 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); 1122 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::EAGER);
1132 } 1123 }
1133 1124
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 // -- sp[4 * (argc - 1)] : first argument 1391 // -- sp[4 * (argc - 1)] : first argument
1401 // -- sp[4 * argc] : receiver 1392 // -- sp[4 * argc] : receiver
1402 // ----------------------------------- 1393 // -----------------------------------
1403 1394
1404 // Load the FunctionTemplateInfo. 1395 // Load the FunctionTemplateInfo.
1405 __ lw(t1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 1396 __ lw(t1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
1406 __ lw(t1, FieldMemOperand(t1, SharedFunctionInfo::kFunctionDataOffset)); 1397 __ lw(t1, FieldMemOperand(t1, SharedFunctionInfo::kFunctionDataOffset));
1407 1398
1408 // Do the compatible receiver check. 1399 // Do the compatible receiver check.
1409 Label receiver_check_failed; 1400 Label receiver_check_failed;
1410 __ sll(at, a0, kPointerSizeLog2); 1401 __ Lsa(t8, sp, a0, kPointerSizeLog2);
1411 __ Addu(t8, sp, at);
1412 __ lw(t0, MemOperand(t8)); 1402 __ lw(t0, MemOperand(t8));
1413 CompatibleReceiverCheck(masm, t0, t1, &receiver_check_failed); 1403 CompatibleReceiverCheck(masm, t0, t1, &receiver_check_failed);
1414 1404
1415 // Get the callback offset from the FunctionTemplateInfo, and jump to the 1405 // Get the callback offset from the FunctionTemplateInfo, and jump to the
1416 // beginning of the code. 1406 // beginning of the code.
1417 __ lw(t2, FieldMemOperand(t1, FunctionTemplateInfo::kCallCodeOffset)); 1407 __ lw(t2, FieldMemOperand(t1, FunctionTemplateInfo::kCallCodeOffset));
1418 __ lw(t2, FieldMemOperand(t2, CallHandlerInfo::kFastHandlerOffset)); 1408 __ lw(t2, FieldMemOperand(t2, CallHandlerInfo::kFastHandlerOffset));
1419 __ Addu(t2, t2, Operand(Code::kHeaderSize - kHeapObjectTag)); 1409 __ Addu(t2, t2, Operand(Code::kHeaderSize - kHeapObjectTag));
1420 __ Jump(t2); 1410 __ Jump(t2);
1421 1411
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 // ----------------------------------- 1525 // -----------------------------------
1536 1526
1537 // 1. Load receiver into a1, argArray into a0 (if present), remove all 1527 // 1. Load receiver into a1, argArray into a0 (if present), remove all
1538 // arguments from the stack (including the receiver), and push thisArg (if 1528 // arguments from the stack (including the receiver), and push thisArg (if
1539 // present) instead. 1529 // present) instead.
1540 { 1530 {
1541 Label no_arg; 1531 Label no_arg;
1542 Register scratch = t0; 1532 Register scratch = t0;
1543 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); 1533 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
1544 __ mov(a3, a2); 1534 __ mov(a3, a2);
1535 // Lsa() cannot be used hare as scratch value used later.
1545 __ sll(scratch, a0, kPointerSizeLog2); 1536 __ sll(scratch, a0, kPointerSizeLog2);
1546 __ Addu(a0, sp, Operand(scratch)); 1537 __ Addu(a0, sp, Operand(scratch));
1547 __ lw(a1, MemOperand(a0)); // receiver 1538 __ lw(a1, MemOperand(a0)); // receiver
1548 __ Subu(a0, a0, Operand(kPointerSize)); 1539 __ Subu(a0, a0, Operand(kPointerSize));
1549 __ Branch(&no_arg, lt, a0, Operand(sp)); 1540 __ Branch(&no_arg, lt, a0, Operand(sp));
1550 __ lw(a2, MemOperand(a0)); // thisArg 1541 __ lw(a2, MemOperand(a0)); // thisArg
1551 __ Subu(a0, a0, Operand(kPointerSize)); 1542 __ Subu(a0, a0, Operand(kPointerSize));
1552 __ Branch(&no_arg, lt, a0, Operand(sp)); 1543 __ Branch(&no_arg, lt, a0, Operand(sp));
1553 __ lw(a3, MemOperand(a0)); // argArray 1544 __ lw(a3, MemOperand(a0)); // argArray
1554 __ bind(&no_arg); 1545 __ bind(&no_arg);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 { 1596 {
1606 Label done; 1597 Label done;
1607 __ Branch(&done, ne, a0, Operand(zero_reg)); 1598 __ Branch(&done, ne, a0, Operand(zero_reg));
1608 __ PushRoot(Heap::kUndefinedValueRootIndex); 1599 __ PushRoot(Heap::kUndefinedValueRootIndex);
1609 __ Addu(a0, a0, Operand(1)); 1600 __ Addu(a0, a0, Operand(1));
1610 __ bind(&done); 1601 __ bind(&done);
1611 } 1602 }
1612 1603
1613 // 2. Get the function to call (passed as receiver) from the stack. 1604 // 2. Get the function to call (passed as receiver) from the stack.
1614 // a0: actual number of arguments 1605 // a0: actual number of arguments
1615 __ sll(at, a0, kPointerSizeLog2); 1606 __ Lsa(at, sp, a0, kPointerSizeLog2);
1616 __ addu(at, sp, at);
1617 __ lw(a1, MemOperand(at)); 1607 __ lw(a1, MemOperand(at));
1618 1608
1619 // 3. Shift arguments and return address one slot down on the stack 1609 // 3. Shift arguments and return address one slot down on the stack
1620 // (overwriting the original receiver). Adjust argument count to make 1610 // (overwriting the original receiver). Adjust argument count to make
1621 // the original first argument the new receiver. 1611 // the original first argument the new receiver.
1622 // a0: actual number of arguments 1612 // a0: actual number of arguments
1623 // a1: function 1613 // a1: function
1624 { 1614 {
1625 Label loop; 1615 Label loop;
1626 // Calculate the copy start address (destination). Copy end address is sp. 1616 // Calculate the copy start address (destination). Copy end address is sp.
1627 __ sll(at, a0, kPointerSizeLog2); 1617 __ Lsa(a2, sp, a0, kPointerSizeLog2);
1628 __ addu(a2, sp, at);
1629 1618
1630 __ bind(&loop); 1619 __ bind(&loop);
1631 __ lw(at, MemOperand(a2, -kPointerSize)); 1620 __ lw(at, MemOperand(a2, -kPointerSize));
1632 __ sw(at, MemOperand(a2)); 1621 __ sw(at, MemOperand(a2));
1633 __ Subu(a2, a2, Operand(kPointerSize)); 1622 __ Subu(a2, a2, Operand(kPointerSize));
1634 __ Branch(&loop, ne, a2, Operand(sp)); 1623 __ Branch(&loop, ne, a2, Operand(sp));
1635 // Adjust the actual number of arguments and remove the top element 1624 // Adjust the actual number of arguments and remove the top element
1636 // (which is a copy of the last argument). 1625 // (which is a copy of the last argument).
1637 __ Subu(a0, a0, Operand(1)); 1626 __ Subu(a0, a0, Operand(1));
1638 __ Pop(); 1627 __ Pop();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 1707
1719 // 1. Load target into a1 (if present), argumentsList into a0 (if present), 1708 // 1. Load target into a1 (if present), argumentsList into a0 (if present),
1720 // new.target into a3 (if present, otherwise use target), remove all 1709 // new.target into a3 (if present, otherwise use target), remove all
1721 // arguments from the stack (including the receiver), and push thisArgument 1710 // arguments from the stack (including the receiver), and push thisArgument
1722 // (if present) instead. 1711 // (if present) instead.
1723 { 1712 {
1724 Label no_arg; 1713 Label no_arg;
1725 Register scratch = t0; 1714 Register scratch = t0;
1726 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); 1715 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex);
1727 __ mov(a2, a1); 1716 __ mov(a2, a1);
1717 // Lsa() cannot be used hare as scratch value used later.
1728 __ sll(scratch, a0, kPointerSizeLog2); 1718 __ sll(scratch, a0, kPointerSizeLog2);
1729 __ Addu(a0, sp, Operand(scratch)); 1719 __ Addu(a0, sp, Operand(scratch));
1730 __ sw(a2, MemOperand(a0)); // receiver 1720 __ sw(a2, MemOperand(a0)); // receiver
1731 __ Subu(a0, a0, Operand(kPointerSize)); 1721 __ Subu(a0, a0, Operand(kPointerSize));
1732 __ Branch(&no_arg, lt, a0, Operand(sp)); 1722 __ Branch(&no_arg, lt, a0, Operand(sp));
1733 __ lw(a1, MemOperand(a0)); // target 1723 __ lw(a1, MemOperand(a0)); // target
1734 __ mov(a3, a1); // new.target defaults to target 1724 __ mov(a3, a1); // new.target defaults to target
1735 __ Subu(a0, a0, Operand(kPointerSize)); 1725 __ Subu(a0, a0, Operand(kPointerSize));
1736 __ Branch(&no_arg, lt, a0, Operand(sp)); 1726 __ Branch(&no_arg, lt, a0, Operand(sp));
1737 __ lw(a2, MemOperand(a0)); // argumentsList 1727 __ lw(a2, MemOperand(a0)); // argumentsList
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { 1809 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) {
1820 // ----------- S t a t e ------------- 1810 // ----------- S t a t e -------------
1821 // -- v0 : result being passed through 1811 // -- v0 : result being passed through
1822 // ----------------------------------- 1812 // -----------------------------------
1823 // Get the number of arguments passed (as a smi), tear down the frame and 1813 // Get the number of arguments passed (as a smi), tear down the frame and
1824 // then tear down the parameters. 1814 // then tear down the parameters.
1825 __ lw(a1, MemOperand(fp, -(StandardFrameConstants::kFixedFrameSizeFromFp + 1815 __ lw(a1, MemOperand(fp, -(StandardFrameConstants::kFixedFrameSizeFromFp +
1826 kPointerSize))); 1816 kPointerSize)));
1827 __ mov(sp, fp); 1817 __ mov(sp, fp);
1828 __ MultiPop(fp.bit() | ra.bit()); 1818 __ MultiPop(fp.bit() | ra.bit());
1829 __ sll(t0, a1, kPointerSizeLog2 - kSmiTagSize); 1819 __ Lsa(sp, sp, a1, kPointerSizeLog2 - kSmiTagSize);
1830 __ Addu(sp, sp, t0);
1831 // Adjust for the receiver. 1820 // Adjust for the receiver.
1832 __ Addu(sp, sp, Operand(kPointerSize)); 1821 __ Addu(sp, sp, Operand(kPointerSize));
1833 } 1822 }
1834 1823
1835 1824
1836 // static 1825 // static
1837 void Builtins::Generate_Apply(MacroAssembler* masm) { 1826 void Builtins::Generate_Apply(MacroAssembler* masm) {
1838 // ----------- S t a t e ------------- 1827 // ----------- S t a t e -------------
1839 // -- a0 : argumentsList 1828 // -- a0 : argumentsList
1840 // -- a1 : target 1829 // -- a1 : target
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 // -- a3 : new.target (checked to be constructor or undefined) 1917 // -- a3 : new.target (checked to be constructor or undefined)
1929 // -- sp[0] : thisArgument 1918 // -- sp[0] : thisArgument
1930 // ----------------------------------- 1919 // -----------------------------------
1931 1920
1932 // Push arguments onto the stack (thisArgument is already on the stack). 1921 // Push arguments onto the stack (thisArgument is already on the stack).
1933 { 1922 {
1934 __ mov(t0, zero_reg); 1923 __ mov(t0, zero_reg);
1935 Label done, loop; 1924 Label done, loop;
1936 __ bind(&loop); 1925 __ bind(&loop);
1937 __ Branch(&done, eq, t0, Operand(a2)); 1926 __ Branch(&done, eq, t0, Operand(a2));
1938 __ sll(at, t0, kPointerSizeLog2); 1927 __ Lsa(at, a0, t0, kPointerSizeLog2);
1939 __ Addu(at, a0, at);
1940 __ lw(at, FieldMemOperand(at, FixedArray::kHeaderSize)); 1928 __ lw(at, FieldMemOperand(at, FixedArray::kHeaderSize));
1941 __ Push(at); 1929 __ Push(at);
1942 __ Addu(t0, t0, Operand(1)); 1930 __ Addu(t0, t0, Operand(1));
1943 __ Branch(&loop); 1931 __ Branch(&loop);
1944 __ bind(&done); 1932 __ bind(&done);
1945 __ Move(a0, t0); 1933 __ Move(a0, t0);
1946 } 1934 }
1947 1935
1948 // Dispatch to Call or Construct depending on whether new.target is undefined. 1936 // Dispatch to Call or Construct depending on whether new.target is undefined.
1949 { 1937 {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 // -- a1 : the function to call (checked to be a JSFunction) 1980 // -- a1 : the function to call (checked to be a JSFunction)
1993 // -- a2 : the shared function info. 1981 // -- a2 : the shared function info.
1994 // -- cp : the function context. 1982 // -- cp : the function context.
1995 // ----------------------------------- 1983 // -----------------------------------
1996 1984
1997 if (mode == ConvertReceiverMode::kNullOrUndefined) { 1985 if (mode == ConvertReceiverMode::kNullOrUndefined) {
1998 // Patch receiver to global proxy. 1986 // Patch receiver to global proxy.
1999 __ LoadGlobalProxy(a3); 1987 __ LoadGlobalProxy(a3);
2000 } else { 1988 } else {
2001 Label convert_to_object, convert_receiver; 1989 Label convert_to_object, convert_receiver;
2002 __ sll(at, a0, kPointerSizeLog2); 1990 __ Lsa(at, sp, a0, kPointerSizeLog2);
2003 __ addu(at, sp, at);
2004 __ lw(a3, MemOperand(at)); 1991 __ lw(a3, MemOperand(at));
2005 __ JumpIfSmi(a3, &convert_to_object); 1992 __ JumpIfSmi(a3, &convert_to_object);
2006 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); 1993 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
2007 __ GetObjectType(a3, t0, t0); 1994 __ GetObjectType(a3, t0, t0);
2008 __ Branch(&done_convert, hs, t0, Operand(FIRST_JS_RECEIVER_TYPE)); 1995 __ Branch(&done_convert, hs, t0, Operand(FIRST_JS_RECEIVER_TYPE));
2009 if (mode != ConvertReceiverMode::kNotNullOrUndefined) { 1996 if (mode != ConvertReceiverMode::kNotNullOrUndefined) {
2010 Label convert_global_proxy; 1997 Label convert_global_proxy;
2011 __ JumpIfRoot(a3, Heap::kUndefinedValueRootIndex, 1998 __ JumpIfRoot(a3, Heap::kUndefinedValueRootIndex,
2012 &convert_global_proxy); 1999 &convert_global_proxy);
2013 __ JumpIfNotRoot(a3, Heap::kNullValueRootIndex, &convert_to_object); 2000 __ JumpIfNotRoot(a3, Heap::kNullValueRootIndex, &convert_to_object);
(...skipping 15 matching lines...) Expand all
2029 __ mov(a0, a3); 2016 __ mov(a0, a3);
2030 ToObjectStub stub(masm->isolate()); 2017 ToObjectStub stub(masm->isolate());
2031 __ CallStub(&stub); 2018 __ CallStub(&stub);
2032 __ mov(a3, v0); 2019 __ mov(a3, v0);
2033 __ Pop(a0, a1); 2020 __ Pop(a0, a1);
2034 __ sra(a0, a0, kSmiTagSize); // Un-tag. 2021 __ sra(a0, a0, kSmiTagSize); // Un-tag.
2035 } 2022 }
2036 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 2023 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
2037 __ bind(&convert_receiver); 2024 __ bind(&convert_receiver);
2038 } 2025 }
2039 __ sll(at, a0, kPointerSizeLog2); 2026 __ Lsa(at, sp, a0, kPointerSizeLog2);
2040 __ addu(at, sp, at);
2041 __ sw(a3, MemOperand(at)); 2027 __ sw(a3, MemOperand(at));
2042 } 2028 }
2043 __ bind(&done_convert); 2029 __ bind(&done_convert);
2044 2030
2045 // ----------- S t a t e ------------- 2031 // ----------- S t a t e -------------
2046 // -- a0 : the number of arguments (not including the receiver) 2032 // -- a0 : the number of arguments (not including the receiver)
2047 // -- a1 : the function to call (checked to be a JSFunction) 2033 // -- a1 : the function to call (checked to be a JSFunction)
2048 // -- a2 : the shared function info. 2034 // -- a2 : the shared function info.
2049 // -- cp : the function context. 2035 // -- cp : the function context.
2050 // ----------------------------------- 2036 // -----------------------------------
(...skipping 20 matching lines...) Expand all
2071 void Builtins::Generate_CallBoundFunction(MacroAssembler* masm) { 2057 void Builtins::Generate_CallBoundFunction(MacroAssembler* masm) {
2072 // ----------- S t a t e ------------- 2058 // ----------- S t a t e -------------
2073 // -- a0 : the number of arguments (not including the receiver) 2059 // -- a0 : the number of arguments (not including the receiver)
2074 // -- a1 : the function to call (checked to be a JSBoundFunction) 2060 // -- a1 : the function to call (checked to be a JSBoundFunction)
2075 // ----------------------------------- 2061 // -----------------------------------
2076 __ AssertBoundFunction(a1); 2062 __ AssertBoundFunction(a1);
2077 2063
2078 // Patch the receiver to [[BoundThis]]. 2064 // Patch the receiver to [[BoundThis]].
2079 { 2065 {
2080 __ lw(at, FieldMemOperand(a1, JSBoundFunction::kBoundThisOffset)); 2066 __ lw(at, FieldMemOperand(a1, JSBoundFunction::kBoundThisOffset));
2081 __ sll(t0, a0, kPointerSizeLog2); 2067 __ Lsa(t0, sp, a0, kPointerSizeLog2);
2082 __ addu(t0, t0, sp);
2083 __ sw(at, MemOperand(t0)); 2068 __ sw(at, MemOperand(t0));
2084 } 2069 }
2085 2070
2086 // Load [[BoundArguments]] into a2 and length of that into t0. 2071 // Load [[BoundArguments]] into a2 and length of that into t0.
2087 __ lw(a2, FieldMemOperand(a1, JSBoundFunction::kBoundArgumentsOffset)); 2072 __ lw(a2, FieldMemOperand(a1, JSBoundFunction::kBoundArgumentsOffset));
2088 __ lw(t0, FieldMemOperand(a2, FixedArray::kLengthOffset)); 2073 __ lw(t0, FieldMemOperand(a2, FixedArray::kLengthOffset));
2089 __ SmiUntag(t0); 2074 __ SmiUntag(t0);
2090 2075
2091 // ----------- S t a t e ------------- 2076 // ----------- S t a t e -------------
2092 // -- a0 : the number of arguments (not including the receiver) 2077 // -- a0 : the number of arguments (not including the receiver)
(...skipping 20 matching lines...) Expand all
2113 } 2098 }
2114 __ bind(&done); 2099 __ bind(&done);
2115 } 2100 }
2116 2101
2117 // Relocate arguments down the stack. 2102 // Relocate arguments down the stack.
2118 { 2103 {
2119 Label loop, done_loop; 2104 Label loop, done_loop;
2120 __ mov(t1, zero_reg); 2105 __ mov(t1, zero_reg);
2121 __ bind(&loop); 2106 __ bind(&loop);
2122 __ Branch(&done_loop, gt, t1, Operand(a0)); 2107 __ Branch(&done_loop, gt, t1, Operand(a0));
2123 __ sll(t2, t0, kPointerSizeLog2); 2108 __ Lsa(t2, sp, t0, kPointerSizeLog2);
2124 __ addu(t2, t2, sp);
2125 __ lw(at, MemOperand(t2)); 2109 __ lw(at, MemOperand(t2));
2126 __ sll(t2, t1, kPointerSizeLog2); 2110 __ Lsa(t2, sp, t1, kPointerSizeLog2);
2127 __ addu(t2, t2, sp);
2128 __ sw(at, MemOperand(t2)); 2111 __ sw(at, MemOperand(t2));
2129 __ Addu(t0, t0, Operand(1)); 2112 __ Addu(t0, t0, Operand(1));
2130 __ Addu(t1, t1, Operand(1)); 2113 __ Addu(t1, t1, Operand(1));
2131 __ Branch(&loop); 2114 __ Branch(&loop);
2132 __ bind(&done_loop); 2115 __ bind(&done_loop);
2133 } 2116 }
2134 2117
2135 // Copy [[BoundArguments]] to the stack (below the arguments). 2118 // Copy [[BoundArguments]] to the stack (below the arguments).
2136 { 2119 {
2137 Label loop, done_loop; 2120 Label loop, done_loop;
2138 __ lw(t0, FieldMemOperand(a2, FixedArray::kLengthOffset)); 2121 __ lw(t0, FieldMemOperand(a2, FixedArray::kLengthOffset));
2139 __ SmiUntag(t0); 2122 __ SmiUntag(t0);
2140 __ Addu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 2123 __ Addu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
2141 __ bind(&loop); 2124 __ bind(&loop);
2142 __ Subu(t0, t0, Operand(1)); 2125 __ Subu(t0, t0, Operand(1));
2143 __ Branch(&done_loop, lt, t0, Operand(zero_reg)); 2126 __ Branch(&done_loop, lt, t0, Operand(zero_reg));
2144 __ sll(t1, t0, kPointerSizeLog2); 2127 __ Lsa(t1, a2, t0, kPointerSizeLog2);
2145 __ addu(t1, t1, a2);
2146 __ lw(at, MemOperand(t1)); 2128 __ lw(at, MemOperand(t1));
2147 __ sll(t1, a0, kPointerSizeLog2); 2129 __ Lsa(t1, sp, a0, kPointerSizeLog2);
2148 __ addu(t1, t1, sp);
2149 __ sw(at, MemOperand(t1)); 2130 __ sw(at, MemOperand(t1));
2150 __ Addu(a0, a0, Operand(1)); 2131 __ Addu(a0, a0, Operand(1));
2151 __ Branch(&loop); 2132 __ Branch(&loop);
2152 __ bind(&done_loop); 2133 __ bind(&done_loop);
2153 } 2134 }
2154 2135
2155 // Call the [[BoundTargetFunction]] via the Call builtin. 2136 // Call the [[BoundTargetFunction]] via the Call builtin.
2156 __ lw(a1, FieldMemOperand(a1, JSBoundFunction::kBoundTargetFunctionOffset)); 2137 __ lw(a1, FieldMemOperand(a1, JSBoundFunction::kBoundTargetFunctionOffset));
2157 __ li(at, Operand(ExternalReference(Builtins::kCall_ReceiverIsAny, 2138 __ li(at, Operand(ExternalReference(Builtins::kCall_ReceiverIsAny,
2158 masm->isolate()))); 2139 masm->isolate())));
(...skipping 30 matching lines...) Expand all
2189 ExternalReference(Runtime::kJSProxyCall, masm->isolate())); 2170 ExternalReference(Runtime::kJSProxyCall, masm->isolate()));
2190 2171
2191 // 2. Call to something else, which might have a [[Call]] internal method (if 2172 // 2. Call to something else, which might have a [[Call]] internal method (if
2192 // not we raise an exception). 2173 // not we raise an exception).
2193 __ bind(&non_function); 2174 __ bind(&non_function);
2194 // Check if target has a [[Call]] internal method. 2175 // Check if target has a [[Call]] internal method.
2195 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); 2176 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset));
2196 __ And(t1, t1, Operand(1 << Map::kIsCallable)); 2177 __ And(t1, t1, Operand(1 << Map::kIsCallable));
2197 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); 2178 __ Branch(&non_callable, eq, t1, Operand(zero_reg));
2198 // Overwrite the original receiver with the (original) target. 2179 // Overwrite the original receiver with the (original) target.
2199 __ sll(at, a0, kPointerSizeLog2); 2180 __ Lsa(at, sp, a0, kPointerSizeLog2);
2200 __ addu(at, sp, at);
2201 __ sw(a1, MemOperand(at)); 2181 __ sw(a1, MemOperand(at));
2202 // Let the "call_as_function_delegate" take care of the rest. 2182 // Let the "call_as_function_delegate" take care of the rest.
2203 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1); 2183 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1);
2204 __ Jump(masm->isolate()->builtins()->CallFunction( 2184 __ Jump(masm->isolate()->builtins()->CallFunction(
2205 ConvertReceiverMode::kNotNullOrUndefined), 2185 ConvertReceiverMode::kNotNullOrUndefined),
2206 RelocInfo::CODE_TARGET); 2186 RelocInfo::CODE_TARGET);
2207 2187
2208 // 3. Call to something that is not callable. 2188 // 3. Call to something that is not callable.
2209 __ bind(&non_callable); 2189 __ bind(&non_callable);
2210 { 2190 {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 } 2257 }
2278 __ bind(&done); 2258 __ bind(&done);
2279 } 2259 }
2280 2260
2281 // Relocate arguments down the stack. 2261 // Relocate arguments down the stack.
2282 { 2262 {
2283 Label loop, done_loop; 2263 Label loop, done_loop;
2284 __ mov(t1, zero_reg); 2264 __ mov(t1, zero_reg);
2285 __ bind(&loop); 2265 __ bind(&loop);
2286 __ Branch(&done_loop, ge, t1, Operand(a0)); 2266 __ Branch(&done_loop, ge, t1, Operand(a0));
2287 __ sll(t2, t0, kPointerSizeLog2); 2267 __ Lsa(t2, sp, t0, kPointerSizeLog2);
2288 __ addu(t2, t2, sp);
2289 __ lw(at, MemOperand(t2)); 2268 __ lw(at, MemOperand(t2));
2290 __ sll(t2, t1, kPointerSizeLog2); 2269 __ Lsa(t2, sp, t1, kPointerSizeLog2);
2291 __ addu(t2, t2, sp);
2292 __ sw(at, MemOperand(t2)); 2270 __ sw(at, MemOperand(t2));
2293 __ Addu(t0, t0, Operand(1)); 2271 __ Addu(t0, t0, Operand(1));
2294 __ Addu(t1, t1, Operand(1)); 2272 __ Addu(t1, t1, Operand(1));
2295 __ Branch(&loop); 2273 __ Branch(&loop);
2296 __ bind(&done_loop); 2274 __ bind(&done_loop);
2297 } 2275 }
2298 2276
2299 // Copy [[BoundArguments]] to the stack (below the arguments). 2277 // Copy [[BoundArguments]] to the stack (below the arguments).
2300 { 2278 {
2301 Label loop, done_loop; 2279 Label loop, done_loop;
2302 __ lw(t0, FieldMemOperand(a2, FixedArray::kLengthOffset)); 2280 __ lw(t0, FieldMemOperand(a2, FixedArray::kLengthOffset));
2303 __ SmiUntag(t0); 2281 __ SmiUntag(t0);
2304 __ Addu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 2282 __ Addu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
2305 __ bind(&loop); 2283 __ bind(&loop);
2306 __ Subu(t0, t0, Operand(1)); 2284 __ Subu(t0, t0, Operand(1));
2307 __ Branch(&done_loop, lt, t0, Operand(zero_reg)); 2285 __ Branch(&done_loop, lt, t0, Operand(zero_reg));
2308 __ sll(t1, t0, kPointerSizeLog2); 2286 __ Lsa(t1, a2, t0, kPointerSizeLog2);
2309 __ addu(t1, t1, a2);
2310 __ lw(at, MemOperand(t1)); 2287 __ lw(at, MemOperand(t1));
2311 __ sll(t1, a0, kPointerSizeLog2); 2288 __ Lsa(t1, sp, a0, kPointerSizeLog2);
2312 __ addu(t1, t1, sp);
2313 __ sw(at, MemOperand(t1)); 2289 __ sw(at, MemOperand(t1));
2314 __ Addu(a0, a0, Operand(1)); 2290 __ Addu(a0, a0, Operand(1));
2315 __ Branch(&loop); 2291 __ Branch(&loop);
2316 __ bind(&done_loop); 2292 __ bind(&done_loop);
2317 } 2293 }
2318 2294
2319 // Patch new.target to [[BoundTargetFunction]] if new.target equals target. 2295 // Patch new.target to [[BoundTargetFunction]] if new.target equals target.
2320 { 2296 {
2321 Label skip_load; 2297 Label skip_load;
2322 __ Branch(&skip_load, ne, a1, Operand(a3)); 2298 __ Branch(&skip_load, ne, a1, Operand(a3));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 __ Jump(masm->isolate()->builtins()->ConstructBoundFunction(), 2357 __ Jump(masm->isolate()->builtins()->ConstructBoundFunction(),
2382 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_BOUND_FUNCTION_TYPE)); 2358 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_BOUND_FUNCTION_TYPE));
2383 2359
2384 // Only dispatch to proxies after checking whether they are constructors. 2360 // Only dispatch to proxies after checking whether they are constructors.
2385 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, 2361 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
2386 eq, t2, Operand(JS_PROXY_TYPE)); 2362 eq, t2, Operand(JS_PROXY_TYPE));
2387 2363
2388 // Called Construct on an exotic Object with a [[Construct]] internal method. 2364 // Called Construct on an exotic Object with a [[Construct]] internal method.
2389 { 2365 {
2390 // Overwrite the original receiver with the (original) target. 2366 // Overwrite the original receiver with the (original) target.
2391 __ sll(at, a0, kPointerSizeLog2); 2367 __ Lsa(at, sp, a0, kPointerSizeLog2);
2392 __ addu(at, sp, at);
2393 __ sw(a1, MemOperand(at)); 2368 __ sw(a1, MemOperand(at));
2394 // Let the "call_as_constructor_delegate" take care of the rest. 2369 // Let the "call_as_constructor_delegate" take care of the rest.
2395 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1); 2370 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1);
2396 __ Jump(masm->isolate()->builtins()->CallFunction(), 2371 __ Jump(masm->isolate()->builtins()->CallFunction(),
2397 RelocInfo::CODE_TARGET); 2372 RelocInfo::CODE_TARGET);
2398 } 2373 }
2399 2374
2400 // Called Construct on an Object that doesn't have a [[Construct]] internal 2375 // Called Construct on an Object that doesn't have a [[Construct]] internal
2401 // method. 2376 // method.
2402 __ bind(&non_constructor); 2377 __ bind(&non_constructor);
(...skipping 22 matching lines...) Expand all
2425 { // Enough parameters: actual >= expected. 2400 { // Enough parameters: actual >= expected.
2426 // a0: actual number of arguments as a smi 2401 // a0: actual number of arguments as a smi
2427 // a1: function 2402 // a1: function
2428 // a2: expected number of arguments 2403 // a2: expected number of arguments
2429 // a3: new target (passed through to callee) 2404 // a3: new target (passed through to callee)
2430 __ bind(&enough); 2405 __ bind(&enough);
2431 EnterArgumentsAdaptorFrame(masm); 2406 EnterArgumentsAdaptorFrame(masm);
2432 ArgumentAdaptorStackCheck(masm, &stack_overflow); 2407 ArgumentAdaptorStackCheck(masm, &stack_overflow);
2433 2408
2434 // Calculate copy start address into a0 and copy end address into t1. 2409 // Calculate copy start address into a0 and copy end address into t1.
2435 __ sll(a0, a0, kPointerSizeLog2 - kSmiTagSize); 2410 __ Lsa(a0, fp, a0, kPointerSizeLog2 - kSmiTagSize);
2436 __ Addu(a0, fp, a0);
2437 // Adjust for return address and receiver. 2411 // Adjust for return address and receiver.
2438 __ Addu(a0, a0, Operand(2 * kPointerSize)); 2412 __ Addu(a0, a0, Operand(2 * kPointerSize));
2439 // Compute copy end address. 2413 // Compute copy end address.
2440 __ sll(t1, a2, kPointerSizeLog2); 2414 __ sll(t1, a2, kPointerSizeLog2);
2441 __ subu(t1, a0, t1); 2415 __ subu(t1, a0, t1);
2442 2416
2443 // Copy the arguments (including the receiver) to the new stack frame. 2417 // Copy the arguments (including the receiver) to the new stack frame.
2444 // a0: copy start address 2418 // a0: copy start address
2445 // a1: function 2419 // a1: function
2446 // a2: expected number of arguments 2420 // a2: expected number of arguments
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2481 2455
2482 __ bind(&no_strong_error); 2456 __ bind(&no_strong_error);
2483 EnterArgumentsAdaptorFrame(masm); 2457 EnterArgumentsAdaptorFrame(masm);
2484 ArgumentAdaptorStackCheck(masm, &stack_overflow); 2458 ArgumentAdaptorStackCheck(masm, &stack_overflow);
2485 2459
2486 // Calculate copy start address into a0 and copy end address into t3. 2460 // Calculate copy start address into a0 and copy end address into t3.
2487 // a0: actual number of arguments as a smi 2461 // a0: actual number of arguments as a smi
2488 // a1: function 2462 // a1: function
2489 // a2: expected number of arguments 2463 // a2: expected number of arguments
2490 // a3: new target (passed through to callee) 2464 // a3: new target (passed through to callee)
2491 __ sll(a0, a0, kPointerSizeLog2 - kSmiTagSize); 2465 __ Lsa(a0, fp, a0, kPointerSizeLog2 - kSmiTagSize);
2492 __ Addu(a0, fp, a0);
2493 // Adjust for return address and receiver. 2466 // Adjust for return address and receiver.
2494 __ Addu(a0, a0, Operand(2 * kPointerSize)); 2467 __ Addu(a0, a0, Operand(2 * kPointerSize));
2495 // Compute copy end address. Also adjust for return address. 2468 // Compute copy end address. Also adjust for return address.
2496 __ Addu(t3, fp, kPointerSize); 2469 __ Addu(t3, fp, kPointerSize);
2497 2470
2498 // Copy the arguments (including the receiver) to the new stack frame. 2471 // Copy the arguments (including the receiver) to the new stack frame.
2499 // a0: copy start address 2472 // a0: copy start address
2500 // a1: function 2473 // a1: function
2501 // a2: expected number of arguments 2474 // a2: expected number of arguments
2502 // a3: new target (passed through to callee) 2475 // a3: new target (passed through to callee)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 } 2532 }
2560 } 2533 }
2561 2534
2562 2535
2563 #undef __ 2536 #undef __
2564 2537
2565 } // namespace internal 2538 } // namespace internal
2566 } // namespace v8 2539 } // namespace v8
2567 2540
2568 #endif // V8_TARGET_ARCH_MIPS 2541 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ic/mips/stub-cache-mips.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698