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