| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 __ addu(at, sp, at); | 1406 __ addu(at, sp, at); |
| 1407 __ lw(a1, MemOperand(at)); | 1407 __ lw(a1, MemOperand(at)); |
| 1408 __ JumpIfSmi(a1, &non_function); | 1408 __ JumpIfSmi(a1, &non_function); |
| 1409 __ GetObjectType(a1, a2, a2); | 1409 __ GetObjectType(a1, a2, a2); |
| 1410 __ Branch(&slow, ne, a2, Operand(JS_FUNCTION_TYPE)); | 1410 __ Branch(&slow, ne, a2, Operand(JS_FUNCTION_TYPE)); |
| 1411 | 1411 |
| 1412 // 3a. Patch the first argument if necessary when calling a function. | 1412 // 3a. Patch the first argument if necessary when calling a function. |
| 1413 // a0: actual number of arguments | 1413 // a0: actual number of arguments |
| 1414 // a1: function | 1414 // a1: function |
| 1415 Label shift_arguments; | 1415 Label shift_arguments; |
| 1416 __ li(t0, Operand(0, RelocInfo::NONE)); // Indicate regular JS_FUNCTION. | 1416 __ li(t0, Operand(0, RelocInfo::NONE32)); // Indicate regular JS_FUNCTION. |
| 1417 { Label convert_to_object, use_global_receiver, patch_receiver; | 1417 { Label convert_to_object, use_global_receiver, patch_receiver; |
| 1418 // Change context eagerly in case we need the global receiver. | 1418 // Change context eagerly in case we need the global receiver. |
| 1419 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 1419 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
| 1420 | 1420 |
| 1421 // Do not transform the receiver for strict mode functions. | 1421 // Do not transform the receiver for strict mode functions. |
| 1422 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 1422 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
| 1423 __ lw(a3, FieldMemOperand(a2, SharedFunctionInfo::kCompilerHintsOffset)); | 1423 __ lw(a3, FieldMemOperand(a2, SharedFunctionInfo::kCompilerHintsOffset)); |
| 1424 __ And(t3, a3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + | 1424 __ And(t3, a3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + |
| 1425 kSmiTagSize))); | 1425 kSmiTagSize))); |
| 1426 __ Branch(&shift_arguments, ne, t3, Operand(zero_reg)); | 1426 __ Branch(&shift_arguments, ne, t3, Operand(zero_reg)); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1460 __ mov(a2, v0); | 1460 __ mov(a2, v0); |
| 1461 | 1461 |
| 1462 __ pop(a0); | 1462 __ pop(a0); |
| 1463 __ sra(a0, a0, kSmiTagSize); // Un-tag. | 1463 __ sra(a0, a0, kSmiTagSize); // Un-tag. |
| 1464 // Leave internal frame. | 1464 // Leave internal frame. |
| 1465 } | 1465 } |
| 1466 // Restore the function to a1, and the flag to t0. | 1466 // Restore the function to a1, and the flag to t0. |
| 1467 __ sll(at, a0, kPointerSizeLog2); | 1467 __ sll(at, a0, kPointerSizeLog2); |
| 1468 __ addu(at, sp, at); | 1468 __ addu(at, sp, at); |
| 1469 __ lw(a1, MemOperand(at)); | 1469 __ lw(a1, MemOperand(at)); |
| 1470 __ li(t0, Operand(0, RelocInfo::NONE)); | 1470 __ li(t0, Operand(0, RelocInfo::NONE32)); |
| 1471 __ Branch(&patch_receiver); | 1471 __ Branch(&patch_receiver); |
| 1472 | 1472 |
| 1473 // Use the global receiver object from the called function as the | 1473 // Use the global receiver object from the called function as the |
| 1474 // receiver. | 1474 // receiver. |
| 1475 __ bind(&use_global_receiver); | 1475 __ bind(&use_global_receiver); |
| 1476 const int kGlobalIndex = | 1476 const int kGlobalIndex = |
| 1477 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | 1477 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
| 1478 __ lw(a2, FieldMemOperand(cp, kGlobalIndex)); | 1478 __ lw(a2, FieldMemOperand(cp, kGlobalIndex)); |
| 1479 __ lw(a2, FieldMemOperand(a2, GlobalObject::kNativeContextOffset)); | 1479 __ lw(a2, FieldMemOperand(a2, GlobalObject::kNativeContextOffset)); |
| 1480 __ lw(a2, FieldMemOperand(a2, kGlobalIndex)); | 1480 __ lw(a2, FieldMemOperand(a2, kGlobalIndex)); |
| 1481 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalReceiverOffset)); | 1481 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalReceiverOffset)); |
| 1482 | 1482 |
| 1483 __ bind(&patch_receiver); | 1483 __ bind(&patch_receiver); |
| 1484 __ sll(at, a0, kPointerSizeLog2); | 1484 __ sll(at, a0, kPointerSizeLog2); |
| 1485 __ addu(a3, sp, at); | 1485 __ addu(a3, sp, at); |
| 1486 __ sw(a2, MemOperand(a3, -kPointerSize)); | 1486 __ sw(a2, MemOperand(a3, -kPointerSize)); |
| 1487 | 1487 |
| 1488 __ Branch(&shift_arguments); | 1488 __ Branch(&shift_arguments); |
| 1489 } | 1489 } |
| 1490 | 1490 |
| 1491 // 3b. Check for function proxy. | 1491 // 3b. Check for function proxy. |
| 1492 __ bind(&slow); | 1492 __ bind(&slow); |
| 1493 __ li(t0, Operand(1, RelocInfo::NONE)); // Indicate function proxy. | 1493 __ li(t0, Operand(1, RelocInfo::NONE32)); // Indicate function proxy. |
| 1494 __ Branch(&shift_arguments, eq, a2, Operand(JS_FUNCTION_PROXY_TYPE)); | 1494 __ Branch(&shift_arguments, eq, a2, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 1495 | 1495 |
| 1496 __ bind(&non_function); | 1496 __ bind(&non_function); |
| 1497 __ li(t0, Operand(2, RelocInfo::NONE)); // Indicate non-function. | 1497 __ li(t0, Operand(2, RelocInfo::NONE32)); // Indicate non-function. |
| 1498 | 1498 |
| 1499 // 3c. Patch the first argument when calling a non-function. The | 1499 // 3c. Patch the first argument when calling a non-function. The |
| 1500 // CALL_NON_FUNCTION builtin expects the non-function callee as | 1500 // CALL_NON_FUNCTION builtin expects the non-function callee as |
| 1501 // receiver, so overwrite the first argument which will ultimately | 1501 // receiver, so overwrite the first argument which will ultimately |
| 1502 // become the receiver. | 1502 // become the receiver. |
| 1503 // a0: actual number of arguments | 1503 // a0: actual number of arguments |
| 1504 // a1: function | 1504 // a1: function |
| 1505 // t0: call type (0: JS function, 1: function proxy, 2: non-function) | 1505 // t0: call type (0: JS function, 1: function proxy, 2: non-function) |
| 1506 __ sll(at, a0, kPointerSizeLog2); | 1506 __ sll(at, a0, kPointerSizeLog2); |
| 1507 __ addu(a2, sp, at); | 1507 __ addu(a2, sp, at); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1718 NullCallWrapper(), CALL_AS_METHOD); | 1718 NullCallWrapper(), CALL_AS_METHOD); |
| 1719 | 1719 |
| 1720 frame_scope.GenerateLeaveFrame(); | 1720 frame_scope.GenerateLeaveFrame(); |
| 1721 __ Ret(USE_DELAY_SLOT); | 1721 __ Ret(USE_DELAY_SLOT); |
| 1722 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot. | 1722 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot. |
| 1723 | 1723 |
| 1724 // Invoke the function proxy. | 1724 // Invoke the function proxy. |
| 1725 __ bind(&call_proxy); | 1725 __ bind(&call_proxy); |
| 1726 __ push(a1); // Add function proxy as last argument. | 1726 __ push(a1); // Add function proxy as last argument. |
| 1727 __ Addu(a0, a0, Operand(1)); | 1727 __ Addu(a0, a0, Operand(1)); |
| 1728 __ li(a2, Operand(0, RelocInfo::NONE)); | 1728 __ li(a2, Operand(0, RelocInfo::NONE32)); |
| 1729 __ SetCallKind(t1, CALL_AS_METHOD); | 1729 __ SetCallKind(t1, CALL_AS_METHOD); |
| 1730 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY); | 1730 __ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY); |
| 1731 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1731 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1732 RelocInfo::CODE_TARGET); | 1732 RelocInfo::CODE_TARGET); |
| 1733 // Tear down the internal frame and remove function, receiver and args. | 1733 // Tear down the internal frame and remove function, receiver and args. |
| 1734 } | 1734 } |
| 1735 | 1735 |
| 1736 __ Ret(USE_DELAY_SLOT); | 1736 __ Ret(USE_DELAY_SLOT); |
| 1737 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot. | 1737 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot. |
| 1738 } | 1738 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1878 __ bind(&dont_adapt_arguments); | 1878 __ bind(&dont_adapt_arguments); |
| 1879 __ Jump(a3); | 1879 __ Jump(a3); |
| 1880 } | 1880 } |
| 1881 | 1881 |
| 1882 | 1882 |
| 1883 #undef __ | 1883 #undef __ |
| 1884 | 1884 |
| 1885 } } // namespace v8::internal | 1885 } } // namespace v8::internal |
| 1886 | 1886 |
| 1887 #endif // V8_TARGET_ARCH_MIPS | 1887 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |