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