 Chromium Code Reviews
 Chromium Code Reviews Issue 1496503002:
  [runtime] [proxy] removing JSFunctionProxy and related code.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 1496503002:
  [runtime] [proxy] removing JSFunctionProxy and related code.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| 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_X64 | 5 #if V8_TARGET_ARCH_X64 | 
| 6 | 6 | 
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" | 
| 8 #include "src/codegen.h" | 8 #include "src/codegen.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 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1742 // -- rdi : the target to call (can be any Object) | 1742 // -- rdi : the target to call (can be any Object) | 
| 1743 // ----------------------------------- | 1743 // ----------------------------------- | 
| 1744 StackArgumentsAccessor args(rsp, rax); | 1744 StackArgumentsAccessor args(rsp, rax); | 
| 1745 | 1745 | 
| 1746 Label non_callable, non_function, non_smi; | 1746 Label non_callable, non_function, non_smi; | 
| 1747 __ JumpIfSmi(rdi, &non_callable); | 1747 __ JumpIfSmi(rdi, &non_callable); | 
| 1748 __ bind(&non_smi); | 1748 __ bind(&non_smi); | 
| 1749 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); | 1749 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); | 
| 1750 __ j(equal, masm->isolate()->builtins()->CallFunction(mode), | 1750 __ j(equal, masm->isolate()->builtins()->CallFunction(mode), | 
| 1751 RelocInfo::CODE_TARGET); | 1751 RelocInfo::CODE_TARGET); | 
| 1752 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); | 1752 __ CmpInstanceType(rcx, JS_PROXY_TYPE); | 
| 1753 __ j(not_equal, &non_function); | 1753 __ j(not_equal, &non_function); | 
| 1754 | 1754 | 
| 1755 // 1. Call to function proxy. | 1755 // 1. Call to function proxy. | 
| 1756 // TODO(neis): This doesn't match the ES6 spec for [[Call]] on proxies. | 1756 // TODO(neis): Implement [[Call]] on proxies. | 
| 1757 __ movp(rdi, FieldOperand(rdi, JSFunctionProxy::kCallTrapOffset)); | |
| 1758 __ AssertNotSmi(rdi); | |
| 1759 __ jmp(&non_smi); | 1757 __ jmp(&non_smi); | 
| 
Toon Verwaest
2015/12/03 11:48:42
drop branch
 
Camillo Bruni
2015/12/03 12:18:26
done
 | |
| 1760 | 1758 | 
| 1761 // 2. Call to something else, which might have a [[Call]] internal method (if | 1759 // 2. Call to something else, which might have a [[Call]] internal method (if | 
| 1762 // not we raise an exception). | 1760 // not we raise an exception). | 
| 1763 __ bind(&non_function); | 1761 __ bind(&non_function); | 
| 1764 // Check if target has a [[Call]] internal method. | 1762 // Check if target has a [[Call]] internal method. | 
| 1765 __ testb(FieldOperand(rcx, Map::kBitFieldOffset), | 1763 __ testb(FieldOperand(rcx, Map::kBitFieldOffset), | 
| 1766 Immediate(1 << Map::kIsCallable)); | 1764 Immediate(1 << Map::kIsCallable)); | 
| 1767 __ j(zero, &non_callable, Label::kNear); | 1765 __ j(zero, &non_callable, Label::kNear); | 
| 1768 // Overwrite the original receiver with the (original) target. | 1766 // Overwrite the original receiver with the (original) target. | 
| 1769 __ movp(args.GetReceiverOperand(), rdi); | 1767 __ movp(args.GetReceiverOperand(), rdi); | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1804 __ jmp(rcx); | 1802 __ jmp(rcx); | 
| 1805 } | 1803 } | 
| 1806 | 1804 | 
| 1807 | 1805 | 
| 1808 // static | 1806 // static | 
| 1809 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1807 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 
| 1810 // ----------- S t a t e ------------- | 1808 // ----------- S t a t e ------------- | 
| 1811 // -- rax : the number of arguments (not including the receiver) | 1809 // -- rax : the number of arguments (not including the receiver) | 
| 1812 // -- rdx : the new target (either the same as the constructor or | 1810 // -- rdx : the new target (either the same as the constructor or | 
| 1813 // the JSFunction on which new was invoked initially) | 1811 // the JSFunction on which new was invoked initially) | 
| 1814 // -- rdi : the constructor to call (checked to be a JSFunctionProxy) | 1812 // -- rdi : the constructor to call (checked to be a JSProxy) | 
| 1815 // ----------------------------------- | 1813 // ----------------------------------- | 
| 1816 | 1814 | 
| 1817 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1815 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 
| 1818 __ movp(rdi, FieldOperand(rdi, JSFunctionProxy::kConstructTrapOffset)); | |
| 1819 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1816 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 
| 1820 } | 1817 } | 
| 1821 | 1818 | 
| 1822 | 1819 | 
| 1823 // static | 1820 // static | 
| 1824 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1821 void Builtins::Generate_Construct(MacroAssembler* masm) { | 
| 1825 // ----------- S t a t e ------------- | 1822 // ----------- S t a t e ------------- | 
| 1826 // -- rax : the number of arguments (not including the receiver) | 1823 // -- rax : the number of arguments (not including the receiver) | 
| 1827 // -- rdx : the new target (either the same as the constructor or | 1824 // -- rdx : the new target (either the same as the constructor or | 
| 1828 // the JSFunction on which new was invoked initially) | 1825 // the JSFunction on which new was invoked initially) | 
| 1829 // -- rdi : the constructor to call (can be any Object) | 1826 // -- rdi : the constructor to call (can be any Object) | 
| 1830 // ----------------------------------- | 1827 // ----------------------------------- | 
| 1831 StackArgumentsAccessor args(rsp, rax); | 1828 StackArgumentsAccessor args(rsp, rax); | 
| 1832 | 1829 | 
| 1833 // Check if target is a Smi. | 1830 // Check if target is a Smi. | 
| 1834 Label non_constructor; | 1831 Label non_constructor; | 
| 1835 __ JumpIfSmi(rdi, &non_constructor, Label::kNear); | 1832 __ JumpIfSmi(rdi, &non_constructor, Label::kNear); | 
| 1836 | 1833 | 
| 1837 // Dispatch based on instance type. | 1834 // Dispatch based on instance type. | 
| 1838 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); | 1835 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); | 
| 1839 __ j(equal, masm->isolate()->builtins()->ConstructFunction(), | 1836 __ j(equal, masm->isolate()->builtins()->ConstructFunction(), | 
| 1840 RelocInfo::CODE_TARGET); | 1837 RelocInfo::CODE_TARGET); | 
| 1841 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); | 1838 __ CmpInstanceType(rcx, JS_PROXY_TYPE); | 
| 1842 __ j(equal, masm->isolate()->builtins()->ConstructProxy(), | 1839 __ j(equal, masm->isolate()->builtins()->ConstructProxy(), | 
| 1843 RelocInfo::CODE_TARGET); | 1840 RelocInfo::CODE_TARGET); | 
| 1844 | 1841 | 
| 1845 // Check if target has a [[Construct]] internal method. | 1842 // Check if target has a [[Construct]] internal method. | 
| 1846 __ testb(FieldOperand(rcx, Map::kBitFieldOffset), | 1843 __ testb(FieldOperand(rcx, Map::kBitFieldOffset), | 
| 1847 Immediate(1 << Map::kIsConstructor)); | 1844 Immediate(1 << Map::kIsConstructor)); | 
| 1848 __ j(zero, &non_constructor, Label::kNear); | 1845 __ j(zero, &non_constructor, Label::kNear); | 
| 1849 | 1846 | 
| 1850 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1847 // Called Construct on an exotic Object with a [[Construct]] internal method. | 
| 1851 { | 1848 { | 
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2045 __ ret(0); | 2042 __ ret(0); | 
| 2046 } | 2043 } | 
| 2047 | 2044 | 
| 2048 | 2045 | 
| 2049 #undef __ | 2046 #undef __ | 
| 2050 | 2047 | 
| 2051 } // namespace internal | 2048 } // namespace internal | 
| 2052 } // namespace v8 | 2049 } // namespace v8 | 
| 2053 | 2050 | 
| 2054 #endif // V8_TARGET_ARCH_X64 | 2051 #endif // V8_TARGET_ARCH_X64 | 
| OLD | NEW |