OLD | NEW |
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 __ IncrementCounter(counters->string_ctor_conversions(), 1, a3, a4); | 233 __ IncrementCounter(counters->string_ctor_conversions(), 1, a3, a4); |
234 __ Branch(&argument_is_string); | 234 __ Branch(&argument_is_string); |
235 | 235 |
236 // Invoke the conversion builtin and put the result into a2. | 236 // Invoke the conversion builtin and put the result into a2. |
237 __ bind(&convert_argument); | 237 __ bind(&convert_argument); |
238 __ push(function); // Preserve the function. | 238 __ push(function); // Preserve the function. |
239 __ IncrementCounter(counters->string_ctor_conversions(), 1, a3, a4); | 239 __ IncrementCounter(counters->string_ctor_conversions(), 1, a3, a4); |
240 { | 240 { |
241 FrameScope scope(masm, StackFrame::INTERNAL); | 241 FrameScope scope(masm, StackFrame::INTERNAL); |
242 __ push(a0); | 242 __ push(a0); |
243 __ InvokeBuiltin(Builtins::TO_STRING, CALL_FUNCTION); | 243 __ InvokeBuiltin(Context::TO_STRING_BUILTIN_INDEX, CALL_FUNCTION); |
244 } | 244 } |
245 __ pop(function); | 245 __ pop(function); |
246 __ mov(argument, v0); | 246 __ mov(argument, v0); |
247 __ Branch(&argument_is_string); | 247 __ Branch(&argument_is_string); |
248 | 248 |
249 // Load the empty string into a2, remove the receiver from the | 249 // Load the empty string into a2, remove the receiver from the |
250 // stack, and jump back to the case where the argument is a string. | 250 // stack, and jump back to the case where the argument is a string. |
251 __ bind(&no_arguments); | 251 __ bind(&no_arguments); |
252 __ LoadRoot(argument, Heap::kempty_stringRootIndex); | 252 __ LoadRoot(argument, Heap::kempty_stringRootIndex); |
253 __ Drop(1); | 253 __ Drop(1); |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 __ dsll(a7, argc, kPointerSizeLog2); | 755 __ dsll(a7, argc, kPointerSizeLog2); |
756 } | 756 } |
757 __ Branch(&okay, gt, a2, Operand(a7)); // Signed comparison. | 757 __ Branch(&okay, gt, a2, Operand(a7)); // Signed comparison. |
758 | 758 |
759 // Out of stack space. | 759 // Out of stack space. |
760 __ ld(a1, MemOperand(fp, calleeOffset)); | 760 __ ld(a1, MemOperand(fp, calleeOffset)); |
761 if (argc_is_tagged == kArgcIsUntaggedInt) { | 761 if (argc_is_tagged == kArgcIsUntaggedInt) { |
762 __ SmiTag(argc); | 762 __ SmiTag(argc); |
763 } | 763 } |
764 __ Push(a1, argc); | 764 __ Push(a1, argc); |
765 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 765 __ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION); |
766 | 766 |
767 __ bind(&okay); | 767 __ bind(&okay); |
768 } | 768 } |
769 | 769 |
770 | 770 |
771 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 771 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
772 bool is_construct) { | 772 bool is_construct) { |
773 // Called from JSEntryStub::GenerateBody | 773 // Called from JSEntryStub::GenerateBody |
774 | 774 |
775 // ----------- S t a t e ------------- | 775 // ----------- S t a t e ------------- |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 { | 902 { |
903 // Load frame size (word) from the BytecodeArray object. | 903 // Load frame size (word) from the BytecodeArray object. |
904 __ lw(a4, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 904 __ lw(a4, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
905 BytecodeArray::kFrameSizeOffset)); | 905 BytecodeArray::kFrameSizeOffset)); |
906 | 906 |
907 // Do a stack check to ensure we don't go over the limit. | 907 // Do a stack check to ensure we don't go over the limit. |
908 Label ok; | 908 Label ok; |
909 __ Dsubu(a5, sp, Operand(a4)); | 909 __ Dsubu(a5, sp, Operand(a4)); |
910 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); | 910 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); |
911 __ Branch(&ok, hs, a5, Operand(a2)); | 911 __ Branch(&ok, hs, a5, Operand(a2)); |
912 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 912 __ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION); |
913 __ bind(&ok); | 913 __ bind(&ok); |
914 | 914 |
915 // If ok, push undefined as the initial value for all register file entries. | 915 // If ok, push undefined as the initial value for all register file entries. |
916 Label loop_header; | 916 Label loop_header; |
917 Label loop_check; | 917 Label loop_check; |
918 __ LoadRoot(a5, Heap::kUndefinedValueRootIndex); | 918 __ LoadRoot(a5, Heap::kUndefinedValueRootIndex); |
919 __ Branch(&loop_check); | 919 __ Branch(&loop_check); |
920 __ bind(&loop_header); | 920 __ bind(&loop_header); |
921 // TODO(rmcilroy): Consider doing more than one push per loop iteration. | 921 // TODO(rmcilroy): Consider doing more than one push per loop iteration. |
922 __ push(a5); | 922 __ push(a5); |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 // a1: function | 1389 // a1: function |
1390 // a4: call type (0: JS function, 1: function proxy, 2: non-function) | 1390 // a4: call type (0: JS function, 1: function proxy, 2: non-function) |
1391 { Label function, non_proxy; | 1391 { Label function, non_proxy; |
1392 __ Branch(&function, eq, a4, Operand(zero_reg)); | 1392 __ Branch(&function, eq, a4, Operand(zero_reg)); |
1393 // Expected number of arguments is 0 for CALL_NON_FUNCTION. | 1393 // Expected number of arguments is 0 for CALL_NON_FUNCTION. |
1394 __ mov(a2, zero_reg); | 1394 __ mov(a2, zero_reg); |
1395 __ Branch(&non_proxy, ne, a4, Operand(1)); | 1395 __ Branch(&non_proxy, ne, a4, Operand(1)); |
1396 | 1396 |
1397 __ push(a1); // Re-add proxy object as additional argument. | 1397 __ push(a1); // Re-add proxy object as additional argument. |
1398 __ Daddu(a0, a0, Operand(1)); | 1398 __ Daddu(a0, a0, Operand(1)); |
1399 __ GetBuiltinFunction(a1, Builtins::CALL_FUNCTION_PROXY); | 1399 __ GetBuiltinFunction(a1, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX); |
1400 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1400 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
1401 RelocInfo::CODE_TARGET); | 1401 RelocInfo::CODE_TARGET); |
1402 | 1402 |
1403 __ bind(&non_proxy); | 1403 __ bind(&non_proxy); |
1404 __ GetBuiltinFunction(a1, Builtins::CALL_NON_FUNCTION); | 1404 __ GetBuiltinFunction(a1, Context::CALL_NON_FUNCTION_BUILTIN_INDEX); |
1405 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1405 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
1406 RelocInfo::CODE_TARGET); | 1406 RelocInfo::CODE_TARGET); |
1407 __ bind(&function); | 1407 __ bind(&function); |
1408 } | 1408 } |
1409 | 1409 |
1410 // 5b. Get the code to call from the function and check that the number of | 1410 // 5b. Get the code to call from the function and check that the number of |
1411 // expected arguments matches what we're providing. If so, jump | 1411 // expected arguments matches what we're providing. If so, jump |
1412 // (tail-call) to the code in register edx without checking arguments. | 1412 // (tail-call) to the code in register edx without checking arguments. |
1413 // a0: actual number of arguments | 1413 // a0: actual number of arguments |
1414 // a1: function | 1414 // a1: function |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 const int kReceiverOffset = kArgumentsOffset + kPointerSize; | 1486 const int kReceiverOffset = kArgumentsOffset + kPointerSize; |
1487 const int kFunctionOffset = kReceiverOffset + kPointerSize; | 1487 const int kFunctionOffset = kReceiverOffset + kPointerSize; |
1488 | 1488 |
1489 __ ld(a0, MemOperand(fp, kFunctionOffset)); // Get the function. | 1489 __ ld(a0, MemOperand(fp, kFunctionOffset)); // Get the function. |
1490 __ push(a0); | 1490 __ push(a0); |
1491 __ ld(a0, MemOperand(fp, kArgumentsOffset)); // Get the args array. | 1491 __ ld(a0, MemOperand(fp, kArgumentsOffset)); // Get the args array. |
1492 __ push(a0); | 1492 __ push(a0); |
1493 | 1493 |
1494 // Returns (in v0) number of arguments to copy to stack as Smi. | 1494 // Returns (in v0) number of arguments to copy to stack as Smi. |
1495 if (targetIsArgument) { | 1495 if (targetIsArgument) { |
1496 __ InvokeBuiltin(Builtins::REFLECT_APPLY_PREPARE, CALL_FUNCTION); | 1496 __ InvokeBuiltin(Context::REFLECT_APPLY_PREPARE_BUILTIN_INDEX, |
| 1497 CALL_FUNCTION); |
1497 } else { | 1498 } else { |
1498 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); | 1499 __ InvokeBuiltin(Context::APPLY_PREPARE_BUILTIN_INDEX, CALL_FUNCTION); |
1499 } | 1500 } |
1500 | 1501 |
1501 // Returns the result in v0. | 1502 // Returns the result in v0. |
1502 Generate_CheckStackOverflow(masm, kFunctionOffset, v0, kArgcIsSmiTagged); | 1503 Generate_CheckStackOverflow(masm, kFunctionOffset, v0, kArgcIsSmiTagged); |
1503 | 1504 |
1504 // Push current limit and index. | 1505 // Push current limit and index. |
1505 const int kIndexOffset = | 1506 const int kIndexOffset = |
1506 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1507 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); |
1507 const int kLimitOffset = | 1508 const int kLimitOffset = |
1508 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); | 1509 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 | 1581 |
1581 frame_scope.GenerateLeaveFrame(); | 1582 frame_scope.GenerateLeaveFrame(); |
1582 __ Ret(USE_DELAY_SLOT); | 1583 __ Ret(USE_DELAY_SLOT); |
1583 __ Daddu(sp, sp, Operand(kStackSize * kPointerSize)); // In delay slot. | 1584 __ Daddu(sp, sp, Operand(kStackSize * kPointerSize)); // In delay slot. |
1584 | 1585 |
1585 // Call the function proxy. | 1586 // Call the function proxy. |
1586 __ bind(&call_proxy); | 1587 __ bind(&call_proxy); |
1587 __ push(a1); // Add function proxy as last argument. | 1588 __ push(a1); // Add function proxy as last argument. |
1588 __ Daddu(a0, a0, Operand(1)); | 1589 __ Daddu(a0, a0, Operand(1)); |
1589 __ li(a2, Operand(0, RelocInfo::NONE32)); | 1590 __ li(a2, Operand(0, RelocInfo::NONE32)); |
1590 __ GetBuiltinFunction(a1, Builtins::CALL_FUNCTION_PROXY); | 1591 __ GetBuiltinFunction(a1, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX); |
1591 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1592 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
1592 RelocInfo::CODE_TARGET); | 1593 RelocInfo::CODE_TARGET); |
1593 // Tear down the internal frame and remove function, receiver and args. | 1594 // Tear down the internal frame and remove function, receiver and args. |
1594 } | 1595 } |
1595 | 1596 |
1596 __ Ret(USE_DELAY_SLOT); | 1597 __ Ret(USE_DELAY_SLOT); |
1597 __ Daddu(sp, sp, Operand(kStackSize * kPointerSize)); // In delay slot. | 1598 __ Daddu(sp, sp, Operand(kStackSize * kPointerSize)); // In delay slot. |
1598 } | 1599 } |
1599 | 1600 |
1600 | 1601 |
(...skipping 17 matching lines...) Expand all Loading... |
1618 | 1619 |
1619 // Validate arguments | 1620 // Validate arguments |
1620 __ bind(&validate_arguments); | 1621 __ bind(&validate_arguments); |
1621 __ ld(a0, MemOperand(fp, kFunctionOffset)); // get the function | 1622 __ ld(a0, MemOperand(fp, kFunctionOffset)); // get the function |
1622 __ push(a0); | 1623 __ push(a0); |
1623 __ ld(a0, MemOperand(fp, kArgumentsOffset)); // get the args array | 1624 __ ld(a0, MemOperand(fp, kArgumentsOffset)); // get the args array |
1624 __ push(a0); | 1625 __ push(a0); |
1625 __ ld(a0, MemOperand(fp, kNewTargetOffset)); // get the new.target | 1626 __ ld(a0, MemOperand(fp, kNewTargetOffset)); // get the new.target |
1626 __ push(a0); | 1627 __ push(a0); |
1627 // Returns argument count in v0. | 1628 // Returns argument count in v0. |
1628 __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); | 1629 __ InvokeBuiltin(Context::REFLECT_CONSTRUCT_PREPARE_BUILTIN_INDEX, |
| 1630 CALL_FUNCTION); |
1629 | 1631 |
1630 // Returns result in v0. | 1632 // Returns result in v0. |
1631 Generate_CheckStackOverflow(masm, kFunctionOffset, v0, kArgcIsSmiTagged); | 1633 Generate_CheckStackOverflow(masm, kFunctionOffset, v0, kArgcIsSmiTagged); |
1632 | 1634 |
1633 // Push current limit and index. | 1635 // Push current limit and index. |
1634 const int kIndexOffset = | 1636 const int kIndexOffset = |
1635 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1637 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); |
1636 const int kLimitOffset = | 1638 const int kLimitOffset = |
1637 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); | 1639 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); |
1638 __ push(v0); // limit | 1640 __ push(v0); // limit |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 // ------------------------------------------- | 1864 // ------------------------------------------- |
1863 // Don't adapt arguments. | 1865 // Don't adapt arguments. |
1864 // ------------------------------------------- | 1866 // ------------------------------------------- |
1865 __ bind(&dont_adapt_arguments); | 1867 __ bind(&dont_adapt_arguments); |
1866 __ Jump(a3); | 1868 __ Jump(a3); |
1867 | 1869 |
1868 __ bind(&stack_overflow); | 1870 __ bind(&stack_overflow); |
1869 { | 1871 { |
1870 FrameScope frame(masm, StackFrame::MANUAL); | 1872 FrameScope frame(masm, StackFrame::MANUAL); |
1871 EnterArgumentsAdaptorFrame(masm); | 1873 EnterArgumentsAdaptorFrame(masm); |
1872 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 1874 __ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION); |
1873 __ break_(0xCC); | 1875 __ break_(0xCC); |
1874 } | 1876 } |
1875 } | 1877 } |
1876 | 1878 |
1877 | 1879 |
1878 #undef __ | 1880 #undef __ |
1879 | 1881 |
1880 } // namespace internal | 1882 } // namespace internal |
1881 } // namespace v8 | 1883 } // namespace v8 |
1882 | 1884 |
1883 #endif // V8_TARGET_ARCH_MIPS64 | 1885 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |