Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: src/mips64/builtins-mips64.cc

Issue 1480003002: [runtime] Replace global object link with native context link in all contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 __ Daddu(a0, a0, num_extra_args + 1); 64 __ Daddu(a0, a0, num_extra_args + 1);
65 __ bind(&done_argc); 65 __ bind(&done_argc);
66 66
67 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); 67 __ JumpToExternalReference(ExternalReference(id, masm->isolate()));
68 } 68 }
69 69
70 70
71 // Load the built-in InternalArray function from the current context. 71 // Load the built-in InternalArray function from the current context.
72 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, 72 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm,
73 Register result) { 73 Register result) {
74 // Load the native context.
75
76 __ ld(result,
77 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
78 __ ld(result, FieldMemOperand(result, JSGlobalObject::kNativeContextOffset));
79 // Load the InternalArray function from the native context. 74 // Load the InternalArray function from the native context.
80 __ ld(result, 75 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result);
81 MemOperand(result,
82 Context::SlotOffset(
83 Context::INTERNAL_ARRAY_FUNCTION_INDEX)));
84 } 76 }
85 77
86 78
87 // Load the built-in Array function from the current context. 79 // Load the built-in Array function from the current context.
88 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { 80 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) {
89 // Load the native context.
90
91 __ ld(result,
92 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
93 __ ld(result, FieldMemOperand(result, JSGlobalObject::kNativeContextOffset));
94 // Load the Array function from the native context. 81 // Load the Array function from the native context.
95 __ ld(result, 82 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, result);
96 MemOperand(result,
97 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX)));
98 } 83 }
99 84
100 85
101 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { 86 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) {
102 // ----------- S t a t e ------------- 87 // ----------- S t a t e -------------
103 // -- a0 : number of arguments 88 // -- a0 : number of arguments
104 // -- ra : return address 89 // -- ra : return address
105 // -- sp[...]: constructor arguments 90 // -- sp[...]: constructor arguments
106 // ----------------------------------- 91 // -----------------------------------
107 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; 92 Label generic_array_code, one_or_more_arguments, two_or_more_arguments;
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 __ bind(&non_function); 1721 __ bind(&non_function);
1737 // Check if target has a [[Call]] internal method. 1722 // Check if target has a [[Call]] internal method.
1738 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); 1723 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset));
1739 __ And(t1, t1, Operand(1 << Map::kIsCallable)); 1724 __ And(t1, t1, Operand(1 << Map::kIsCallable));
1740 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); 1725 __ Branch(&non_callable, eq, t1, Operand(zero_reg));
1741 // Overwrite the original receiver with the (original) target. 1726 // Overwrite the original receiver with the (original) target.
1742 __ dsll(at, a0, kPointerSizeLog2); 1727 __ dsll(at, a0, kPointerSizeLog2);
1743 __ daddu(at, sp, at); 1728 __ daddu(at, sp, at);
1744 __ sd(a1, MemOperand(at)); 1729 __ sd(a1, MemOperand(at));
1745 // Let the "call_as_function_delegate" take care of the rest. 1730 // Let the "call_as_function_delegate" take care of the rest.
1746 __ LoadGlobalFunction(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1); 1731 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1);
1747 __ Jump(masm->isolate()->builtins()->CallFunction( 1732 __ Jump(masm->isolate()->builtins()->CallFunction(
1748 ConvertReceiverMode::kNotNullOrUndefined), 1733 ConvertReceiverMode::kNotNullOrUndefined),
1749 RelocInfo::CODE_TARGET); 1734 RelocInfo::CODE_TARGET);
1750 1735
1751 // 3. Call to something that is not callable. 1736 // 3. Call to something that is not callable.
1752 __ bind(&non_callable); 1737 __ bind(&non_callable);
1753 { 1738 {
1754 FrameScope scope(masm, StackFrame::INTERNAL); 1739 FrameScope scope(masm, StackFrame::INTERNAL);
1755 __ Push(a1); 1740 __ Push(a1);
1756 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); 1741 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 __ And(t2, t2, Operand(1 << Map::kIsCallable)); 1806 __ And(t2, t2, Operand(1 << Map::kIsCallable));
1822 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); 1807 __ Branch(&non_constructor, eq, t2, Operand(zero_reg));
1823 1808
1824 // Called Construct on an exotic Object with a [[Construct]] internal method. 1809 // Called Construct on an exotic Object with a [[Construct]] internal method.
1825 { 1810 {
1826 // Overwrite the original receiver with the (original) target. 1811 // Overwrite the original receiver with the (original) target.
1827 __ dsll(at, a0, kPointerSizeLog2); 1812 __ dsll(at, a0, kPointerSizeLog2);
1828 __ daddu(at, sp, at); 1813 __ daddu(at, sp, at);
1829 __ sd(a1, MemOperand(at)); 1814 __ sd(a1, MemOperand(at));
1830 // Let the "call_as_constructor_delegate" take care of the rest. 1815 // Let the "call_as_constructor_delegate" take care of the rest.
1831 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1); 1816 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1);
1832 __ Jump(masm->isolate()->builtins()->CallFunction(), 1817 __ Jump(masm->isolate()->builtins()->CallFunction(),
1833 RelocInfo::CODE_TARGET); 1818 RelocInfo::CODE_TARGET);
1834 } 1819 }
1835 1820
1836 // Called Construct on an Object that doesn't have a [[Construct]] internal 1821 // Called Construct on an Object that doesn't have a [[Construct]] internal
1837 // method. 1822 // method.
1838 __ bind(&non_constructor); 1823 __ bind(&non_constructor);
1839 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), 1824 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(),
1840 RelocInfo::CODE_TARGET); 1825 RelocInfo::CODE_TARGET);
1841 } 1826 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 } 1980 }
1996 } 1981 }
1997 1982
1998 1983
1999 #undef __ 1984 #undef __
2000 1985
2001 } // namespace internal 1986 } // namespace internal
2002 } // namespace v8 1987 } // namespace v8
2003 1988
2004 #endif // V8_TARGET_ARCH_MIPS64 1989 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698