| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 __ addi(r3, r3, Operand(num_extra_args + 1)); | 69 __ addi(r3, r3, Operand(num_extra_args + 1)); |
| 70 | 70 |
| 71 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 71 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
| 72 } | 72 } |
| 73 | 73 |
| 74 | 74 |
| 75 // Load the built-in InternalArray function from the current context. | 75 // Load the built-in InternalArray function from the current context. |
| 76 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, | 76 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, |
| 77 Register result) { | 77 Register result) { |
| 78 // Load the native context. | 78 // Load the InternalArray function from the current native context. |
| 79 | 79 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result); |
| 80 __ LoadP(result, | |
| 81 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
| 82 __ LoadP(result, | |
| 83 FieldMemOperand(result, JSGlobalObject::kNativeContextOffset)); | |
| 84 // Load the InternalArray function from the native context. | |
| 85 __ LoadP(result, | |
| 86 MemOperand(result, Context::SlotOffset( | |
| 87 Context::INTERNAL_ARRAY_FUNCTION_INDEX))); | |
| 88 } | 80 } |
| 89 | 81 |
| 90 | 82 |
| 91 // Load the built-in Array function from the current context. | 83 // Load the built-in Array function from the current context. |
| 92 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { | 84 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { |
| 93 // Load the native context. | 85 // Load the Array function from the current native context. |
| 94 | 86 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, result); |
| 95 __ LoadP(result, | |
| 96 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
| 97 __ LoadP(result, | |
| 98 FieldMemOperand(result, JSGlobalObject::kNativeContextOffset)); | |
| 99 // Load the Array function from the native context. | |
| 100 __ LoadP( | |
| 101 result, | |
| 102 MemOperand(result, Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); | |
| 103 } | 87 } |
| 104 | 88 |
| 105 | 89 |
| 106 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { | 90 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { |
| 107 // ----------- S t a t e ------------- | 91 // ----------- S t a t e ------------- |
| 108 // -- r3 : number of arguments | 92 // -- r3 : number of arguments |
| 109 // -- lr : return address | 93 // -- lr : return address |
| 110 // -- sp[...]: constructor arguments | 94 // -- sp[...]: constructor arguments |
| 111 // ----------------------------------- | 95 // ----------------------------------- |
| 112 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; | 96 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; |
| (...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1749 // not we raise an exception). | 1733 // not we raise an exception). |
| 1750 __ bind(&non_function); | 1734 __ bind(&non_function); |
| 1751 // Check if target has a [[Call]] internal method. | 1735 // Check if target has a [[Call]] internal method. |
| 1752 __ lbz(r7, FieldMemOperand(r7, Map::kBitFieldOffset)); | 1736 __ lbz(r7, FieldMemOperand(r7, Map::kBitFieldOffset)); |
| 1753 __ TestBit(r7, Map::kIsCallable, r0); | 1737 __ TestBit(r7, Map::kIsCallable, r0); |
| 1754 __ beq(&non_callable, cr0); | 1738 __ beq(&non_callable, cr0); |
| 1755 // Overwrite the original receiver the (original) target. | 1739 // Overwrite the original receiver the (original) target. |
| 1756 __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); | 1740 __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); |
| 1757 __ StorePX(r4, MemOperand(sp, r8)); | 1741 __ StorePX(r4, MemOperand(sp, r8)); |
| 1758 // Let the "call_as_function_delegate" take care of the rest. | 1742 // Let the "call_as_function_delegate" take care of the rest. |
| 1759 __ LoadGlobalFunction(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, r4); | 1743 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, r4); |
| 1760 __ Jump(masm->isolate()->builtins()->CallFunction( | 1744 __ Jump(masm->isolate()->builtins()->CallFunction( |
| 1761 ConvertReceiverMode::kNotNullOrUndefined), | 1745 ConvertReceiverMode::kNotNullOrUndefined), |
| 1762 RelocInfo::CODE_TARGET); | 1746 RelocInfo::CODE_TARGET); |
| 1763 | 1747 |
| 1764 // 3. Call to something that is not callable. | 1748 // 3. Call to something that is not callable. |
| 1765 __ bind(&non_callable); | 1749 __ bind(&non_callable); |
| 1766 { | 1750 { |
| 1767 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1751 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 1768 __ Push(r4); | 1752 __ Push(r4); |
| 1769 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); | 1753 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 __ lbz(r5, FieldMemOperand(r7, Map::kBitFieldOffset)); | 1817 __ lbz(r5, FieldMemOperand(r7, Map::kBitFieldOffset)); |
| 1834 __ TestBit(r5, Map::kIsConstructor, r0); | 1818 __ TestBit(r5, Map::kIsConstructor, r0); |
| 1835 __ beq(&non_constructor, cr0); | 1819 __ beq(&non_constructor, cr0); |
| 1836 | 1820 |
| 1837 // Called Construct on an exotic Object with a [[Construct]] internal method. | 1821 // Called Construct on an exotic Object with a [[Construct]] internal method. |
| 1838 { | 1822 { |
| 1839 // Overwrite the original receiver with the (original) target. | 1823 // Overwrite the original receiver with the (original) target. |
| 1840 __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); | 1824 __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); |
| 1841 __ StorePX(r4, MemOperand(sp, r8)); | 1825 __ StorePX(r4, MemOperand(sp, r8)); |
| 1842 // Let the "call_as_constructor_delegate" take care of the rest. | 1826 // Let the "call_as_constructor_delegate" take care of the rest. |
| 1843 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, r4); | 1827 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, r4); |
| 1844 __ Jump(masm->isolate()->builtins()->CallFunction(), | 1828 __ Jump(masm->isolate()->builtins()->CallFunction(), |
| 1845 RelocInfo::CODE_TARGET); | 1829 RelocInfo::CODE_TARGET); |
| 1846 } | 1830 } |
| 1847 | 1831 |
| 1848 // Called Construct on an Object that doesn't have a [[Construct]] internal | 1832 // Called Construct on an Object that doesn't have a [[Construct]] internal |
| 1849 // method. | 1833 // method. |
| 1850 __ bind(&non_constructor); | 1834 __ bind(&non_constructor); |
| 1851 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), | 1835 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), |
| 1852 RelocInfo::CODE_TARGET); | 1836 RelocInfo::CODE_TARGET); |
| 1853 } | 1837 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2010 __ bkpt(0); | 1994 __ bkpt(0); |
| 2011 } | 1995 } |
| 2012 } | 1996 } |
| 2013 | 1997 |
| 2014 | 1998 |
| 2015 #undef __ | 1999 #undef __ |
| 2016 } // namespace internal | 2000 } // namespace internal |
| 2017 } // namespace v8 | 2001 } // namespace v8 |
| 2018 | 2002 |
| 2019 #endif // V8_TARGET_ARCH_PPC | 2003 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |