Chromium Code Reviews| 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 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1690 // -- a0 : the number of arguments (not including the receiver) | 1690 // -- a0 : the number of arguments (not including the receiver) |
| 1691 // -- a1 : the target to call (can be any Object). | 1691 // -- a1 : the target to call (can be any Object). |
| 1692 // ----------------------------------- | 1692 // ----------------------------------- |
| 1693 | 1693 |
| 1694 Label non_callable, non_function, non_smi; | 1694 Label non_callable, non_function, non_smi; |
| 1695 __ JumpIfSmi(a1, &non_callable); | 1695 __ JumpIfSmi(a1, &non_callable); |
| 1696 __ bind(&non_smi); | 1696 __ bind(&non_smi); |
| 1697 __ GetObjectType(a1, t1, t2); | 1697 __ GetObjectType(a1, t1, t2); |
| 1698 __ Jump(masm->isolate()->builtins()->CallFunction(mode), | 1698 __ Jump(masm->isolate()->builtins()->CallFunction(mode), |
| 1699 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); | 1699 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); |
| 1700 __ Branch(&non_function, ne, t2, Operand(JS_FUNCTION_PROXY_TYPE)); | 1700 __ Branch(&non_function, ne, t2, Operand(JS_PROXY_TYPE)); |
| 1701 | 1701 |
| 1702 // 1. Call to function proxy. | 1702 // 1. Call to function proxy. |
| 1703 // TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies. | 1703 // TODO(neis): Implement [[Call]] on proxies. |
| 1704 __ ld(a1, FieldMemOperand(a1, JSFunctionProxy::kCallTrapOffset)); | |
| 1705 __ AssertNotSmi(a1); | |
| 1706 __ Branch(&non_smi); | 1704 __ Branch(&non_smi); |
|
Toon Verwaest
2015/12/03 11:48:42
drop the branch
Camillo Bruni
2015/12/03 12:18:26
done
| |
| 1707 | 1705 |
| 1708 // 2. Call to something else, which might have a [[Call]] internal method (if | 1706 // 2. Call to something else, which might have a [[Call]] internal method (if |
| 1709 // not we raise an exception). | 1707 // not we raise an exception). |
| 1710 __ bind(&non_function); | 1708 __ bind(&non_function); |
| 1711 // Check if target has a [[Call]] internal method. | 1709 // Check if target has a [[Call]] internal method. |
| 1712 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); | 1710 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); |
| 1713 __ And(t1, t1, Operand(1 << Map::kIsCallable)); | 1711 __ And(t1, t1, Operand(1 << Map::kIsCallable)); |
| 1714 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); | 1712 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); |
| 1715 // Overwrite the original receiver with the (original) target. | 1713 // Overwrite the original receiver with the (original) target. |
| 1716 __ dsll(at, a0, kPointerSizeLog2); | 1714 __ dsll(at, a0, kPointerSizeLog2); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1750 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset)); | 1748 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset)); |
| 1751 __ Daddu(at, a4, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1749 __ Daddu(at, a4, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1752 __ Jump(at); | 1750 __ Jump(at); |
| 1753 } | 1751 } |
| 1754 | 1752 |
| 1755 | 1753 |
| 1756 // static | 1754 // static |
| 1757 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1755 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
| 1758 // ----------- S t a t e ------------- | 1756 // ----------- S t a t e ------------- |
| 1759 // -- a0 : the number of arguments (not including the receiver) | 1757 // -- a0 : the number of arguments (not including the receiver) |
| 1760 // -- a1 : the constructor to call (checked to be a JSFunctionProxy) | 1758 // -- a1 : the constructor to call (checked to be a JSProxy) |
| 1761 // -- a3 : the new target (either the same as the constructor or | 1759 // -- a3 : the new target (either the same as the constructor or |
| 1762 // the JSFunction on which new was invoked initially) | 1760 // the JSFunction on which new was invoked initially) |
| 1763 // ----------------------------------- | 1761 // ----------------------------------- |
| 1764 | 1762 |
| 1765 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1763 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
| 1766 __ ld(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset)); | |
| 1767 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1764 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1768 } | 1765 } |
| 1769 | 1766 |
| 1770 | 1767 |
| 1771 // static | 1768 // static |
| 1772 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1769 void Builtins::Generate_Construct(MacroAssembler* masm) { |
| 1773 // ----------- S t a t e ------------- | 1770 // ----------- S t a t e ------------- |
| 1774 // -- a0 : the number of arguments (not including the receiver) | 1771 // -- a0 : the number of arguments (not including the receiver) |
| 1775 // -- a1 : the constructor to call (can be any Object) | 1772 // -- a1 : the constructor to call (can be any Object) |
| 1776 // -- a3 : the new target (either the same as the constructor or | 1773 // -- a3 : the new target (either the same as the constructor or |
| 1777 // the JSFunction on which new was invoked initially) | 1774 // the JSFunction on which new was invoked initially) |
| 1778 // ----------------------------------- | 1775 // ----------------------------------- |
| 1779 | 1776 |
| 1780 // Check if target is a Smi. | 1777 // Check if target is a Smi. |
| 1781 Label non_constructor; | 1778 Label non_constructor; |
| 1782 __ JumpIfSmi(a1, &non_constructor); | 1779 __ JumpIfSmi(a1, &non_constructor); |
| 1783 | 1780 |
| 1784 // Dispatch based on instance type. | 1781 // Dispatch based on instance type. |
| 1785 __ ld(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); | 1782 __ ld(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); |
| 1786 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); | 1783 __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset)); |
| 1787 __ Jump(masm->isolate()->builtins()->ConstructFunction(), | 1784 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
| 1788 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); | 1785 RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE)); |
| 1789 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, | 1786 __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET, |
| 1790 eq, t2, Operand(JS_FUNCTION_PROXY_TYPE)); | 1787 eq, t2, Operand(JS_PROXY_TYPE)); |
| 1791 | 1788 |
| 1792 // Check if target has a [[Construct]] internal method. | 1789 // Check if target has a [[Construct]] internal method. |
| 1793 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); | 1790 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); |
| 1794 __ And(t2, t2, Operand(1 << Map::kIsCallable)); | 1791 __ And(t2, t2, Operand(1 << Map::kIsCallable)); |
| 1795 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); | 1792 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); |
| 1796 | 1793 |
| 1797 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1794 // Called Construct on an exotic Object with a [[Construct]] internal method. |
| 1798 { | 1795 { |
| 1799 // Overwrite the original receiver with the (original) target. | 1796 // Overwrite the original receiver with the (original) target. |
| 1800 __ dsll(at, a0, kPointerSizeLog2); | 1797 __ dsll(at, a0, kPointerSizeLog2); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1968 } | 1965 } |
| 1969 } | 1966 } |
| 1970 | 1967 |
| 1971 | 1968 |
| 1972 #undef __ | 1969 #undef __ |
| 1973 | 1970 |
| 1974 } // namespace internal | 1971 } // namespace internal |
| 1975 } // namespace v8 | 1972 } // namespace v8 |
| 1976 | 1973 |
| 1977 #endif // V8_TARGET_ARCH_MIPS64 | 1974 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |