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

Side by Side Diff: src/mips/builtins-mips.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_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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 __ Addu(a0, a0, num_extra_args + 1); 66 __ Addu(a0, a0, num_extra_args + 1);
67 __ bind(&done_argc); 67 __ bind(&done_argc);
68 68
69 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); 69 __ JumpToExternalReference(ExternalReference(id, masm->isolate()));
70 } 70 }
71 71
72 72
73 // Load the built-in InternalArray function from the current context. 73 // Load the built-in InternalArray function from the current context.
74 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, 74 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm,
75 Register result) { 75 Register result) {
76 // Load the native context.
77
78 __ lw(result,
79 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
80 __ lw(result, FieldMemOperand(result, JSGlobalObject::kNativeContextOffset));
81 // Load the InternalArray function from the native context. 76 // Load the InternalArray function from the native context.
82 __ lw(result, 77 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result);
83 MemOperand(result,
84 Context::SlotOffset(
85 Context::INTERNAL_ARRAY_FUNCTION_INDEX)));
86 } 78 }
87 79
88 80
89 // Load the built-in Array function from the current context. 81 // Load the built-in Array function from the current context.
90 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { 82 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) {
91 // Load the native context.
92
93 __ lw(result,
94 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
95 __ lw(result, FieldMemOperand(result, JSGlobalObject::kNativeContextOffset));
96 // Load the Array function from the native context. 83 // Load the Array function from the native context.
97 __ lw(result, 84 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, result);
98 MemOperand(result,
99 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX)));
100 } 85 }
101 86
102 87
103 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { 88 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) {
104 // ----------- S t a t e ------------- 89 // ----------- S t a t e -------------
105 // -- a0 : number of arguments 90 // -- a0 : number of arguments
106 // -- ra : return address 91 // -- ra : return address
107 // -- sp[...]: constructor arguments 92 // -- sp[...]: constructor arguments
108 // ----------------------------------- 93 // -----------------------------------
109 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; 94 Label generic_array_code, one_or_more_arguments, two_or_more_arguments;
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 __ bind(&non_function); 1727 __ bind(&non_function);
1743 // Check if target has a [[Call]] internal method. 1728 // Check if target has a [[Call]] internal method.
1744 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset)); 1729 __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset));
1745 __ And(t1, t1, Operand(1 << Map::kIsCallable)); 1730 __ And(t1, t1, Operand(1 << Map::kIsCallable));
1746 __ Branch(&non_callable, eq, t1, Operand(zero_reg)); 1731 __ Branch(&non_callable, eq, t1, Operand(zero_reg));
1747 // Overwrite the original receiver with the (original) target. 1732 // Overwrite the original receiver with the (original) target.
1748 __ sll(at, a0, kPointerSizeLog2); 1733 __ sll(at, a0, kPointerSizeLog2);
1749 __ addu(at, sp, at); 1734 __ addu(at, sp, at);
1750 __ sw(a1, MemOperand(at)); 1735 __ sw(a1, MemOperand(at));
1751 // Let the "call_as_function_delegate" take care of the rest. 1736 // Let the "call_as_function_delegate" take care of the rest.
1752 __ LoadGlobalFunction(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1); 1737 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, a1);
1753 __ Jump(masm->isolate()->builtins()->CallFunction( 1738 __ Jump(masm->isolate()->builtins()->CallFunction(
1754 ConvertReceiverMode::kNotNullOrUndefined), 1739 ConvertReceiverMode::kNotNullOrUndefined),
1755 RelocInfo::CODE_TARGET); 1740 RelocInfo::CODE_TARGET);
1756 1741
1757 // 3. Call to something that is not callable. 1742 // 3. Call to something that is not callable.
1758 __ bind(&non_callable); 1743 __ bind(&non_callable);
1759 { 1744 {
1760 FrameScope scope(masm, StackFrame::INTERNAL); 1745 FrameScope scope(masm, StackFrame::INTERNAL);
1761 __ Push(a1); 1746 __ Push(a1);
1762 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); 1747 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 __ And(t2, t2, Operand(1 << Map::kIsCallable)); 1813 __ And(t2, t2, Operand(1 << Map::kIsCallable));
1829 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); 1814 __ Branch(&non_constructor, eq, t2, Operand(zero_reg));
1830 1815
1831 // Called Construct on an exotic Object with a [[Construct]] internal method. 1816 // Called Construct on an exotic Object with a [[Construct]] internal method.
1832 { 1817 {
1833 // Overwrite the original receiver with the (original) target. 1818 // Overwrite the original receiver with the (original) target.
1834 __ sll(at, a0, kPointerSizeLog2); 1819 __ sll(at, a0, kPointerSizeLog2);
1835 __ addu(at, sp, at); 1820 __ addu(at, sp, at);
1836 __ sw(a1, MemOperand(at)); 1821 __ sw(a1, MemOperand(at));
1837 // Let the "call_as_constructor_delegate" take care of the rest. 1822 // Let the "call_as_constructor_delegate" take care of the rest.
1838 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1); 1823 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1);
1839 __ Jump(masm->isolate()->builtins()->CallFunction(), 1824 __ Jump(masm->isolate()->builtins()->CallFunction(),
1840 RelocInfo::CODE_TARGET); 1825 RelocInfo::CODE_TARGET);
1841 } 1826 }
1842 1827
1843 // Called Construct on an Object that doesn't have a [[Construct]] internal 1828 // Called Construct on an Object that doesn't have a [[Construct]] internal
1844 // method. 1829 // method.
1845 __ bind(&non_constructor); 1830 __ bind(&non_constructor);
1846 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), 1831 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(),
1847 RelocInfo::CODE_TARGET); 1832 RelocInfo::CODE_TARGET);
1848 } 1833 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 } 1987 }
2003 } 1988 }
2004 1989
2005 1990
2006 #undef __ 1991 #undef __
2007 1992
2008 } // namespace internal 1993 } // namespace internal
2009 } // namespace v8 1994 } // namespace v8
2010 1995
2011 #endif // V8_TARGET_ARCH_MIPS 1996 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698