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

Side by Side Diff: src/arm/builtins-arm.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: Add patch from Orion for interpreter cementation test. Disable obsolete/invalid tests. 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
« no previous file with comments | « no previous file | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ARM 5 #if V8_TARGET_ARCH_ARM
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 __ mov(r0, r2, LeaveCC, ne); 60 __ mov(r0, r2, LeaveCC, ne);
61 __ add(r0, r0, Operand(num_extra_args + 1)); 61 __ add(r0, r0, Operand(num_extra_args + 1));
62 62
63 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); 63 __ JumpToExternalReference(ExternalReference(id, masm->isolate()));
64 } 64 }
65 65
66 66
67 // Load the built-in InternalArray function from the current context. 67 // Load the built-in InternalArray function from the current context.
68 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, 68 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm,
69 Register result) { 69 Register result) {
70 // Load the native context. 70 // Load the InternalArray function from the current native context.
71 71 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result);
72 __ ldr(result,
73 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
74 __ ldr(result, FieldMemOperand(result, JSGlobalObject::kNativeContextOffset));
75 // Load the InternalArray function from the native context.
76 __ ldr(result,
77 MemOperand(result,
78 Context::SlotOffset(
79 Context::INTERNAL_ARRAY_FUNCTION_INDEX)));
80 } 72 }
81 73
82 74
83 // Load the built-in Array function from the current context. 75 // Load the built-in Array function from the current context.
84 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { 76 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) {
85 // Load the native context. 77 // Load the Array function from the current native context.
86 78 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, result);
87 __ ldr(result,
88 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
89 __ ldr(result, FieldMemOperand(result, JSGlobalObject::kNativeContextOffset));
90 // Load the Array function from the native context.
91 __ ldr(result,
92 MemOperand(result,
93 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX)));
94 } 79 }
95 80
96 81
97 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { 82 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) {
98 // ----------- S t a t e ------------- 83 // ----------- S t a t e -------------
99 // -- r0 : number of arguments 84 // -- r0 : number of arguments
100 // -- lr : return address 85 // -- lr : return address
101 // -- sp[...]: constructor arguments 86 // -- sp[...]: constructor arguments
102 // ----------------------------------- 87 // -----------------------------------
103 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; 88 Label generic_array_code, one_or_more_arguments, two_or_more_arguments;
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 CompatibleReceiverCheck(masm, r2, r3, r4, r5, r6, &receiver_check_failed); 1226 CompatibleReceiverCheck(masm, r2, r3, r4, r5, r6, &receiver_check_failed);
1242 1227
1243 // Get the callback offset from the FunctionTemplateInfo, and jump to the 1228 // Get the callback offset from the FunctionTemplateInfo, and jump to the
1244 // beginning of the code. 1229 // beginning of the code.
1245 __ ldr(r4, FieldMemOperand(r3, FunctionTemplateInfo::kCallCodeOffset)); 1230 __ ldr(r4, FieldMemOperand(r3, FunctionTemplateInfo::kCallCodeOffset));
1246 __ ldr(r4, FieldMemOperand(r4, CallHandlerInfo::kFastHandlerOffset)); 1231 __ ldr(r4, FieldMemOperand(r4, CallHandlerInfo::kFastHandlerOffset));
1247 __ add(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); 1232 __ add(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag));
1248 __ Jump(r4); 1233 __ Jump(r4);
1249 1234
1250 __ bind(&set_global_proxy); 1235 __ bind(&set_global_proxy);
1251 __ ldr(r2, GlobalObjectOperand()); 1236 __ LoadGlobalProxy(r2);
1252 __ ldr(r2, FieldMemOperand(r2, JSGlobalObject::kGlobalProxyOffset));
1253 __ str(r2, MemOperand(sp, r0, LSL, kPointerSizeLog2)); 1237 __ str(r2, MemOperand(sp, r0, LSL, kPointerSizeLog2));
1254 __ b(&valid_receiver); 1238 __ b(&valid_receiver);
1255 1239
1256 // Compatible receiver check failed: throw an Illegal Invocation exception. 1240 // Compatible receiver check failed: throw an Illegal Invocation exception.
1257 __ bind(&receiver_check_failed); 1241 __ bind(&receiver_check_failed);
1258 // Drop the arguments (including the receiver) 1242 // Drop the arguments (including the receiver)
1259 __ add(r0, r0, Operand(1)); 1243 __ add(r0, r0, Operand(1));
1260 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2)); 1244 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2));
1261 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0, 1); 1245 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0, 1);
1262 } 1246 }
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 // 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
1728 // not we raise an exception). 1712 // not we raise an exception).
1729 __ bind(&non_function); 1713 __ bind(&non_function);
1730 // Check if target has a [[Call]] internal method. 1714 // Check if target has a [[Call]] internal method.
1731 __ ldrb(r4, FieldMemOperand(r4, Map::kBitFieldOffset)); 1715 __ ldrb(r4, FieldMemOperand(r4, Map::kBitFieldOffset));
1732 __ tst(r4, Operand(1 << Map::kIsCallable)); 1716 __ tst(r4, Operand(1 << Map::kIsCallable));
1733 __ b(eq, &non_callable); 1717 __ b(eq, &non_callable);
1734 // Overwrite the original receiver the (original) target. 1718 // Overwrite the original receiver the (original) target.
1735 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); 1719 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2));
1736 // Let the "call_as_function_delegate" take care of the rest. 1720 // Let the "call_as_function_delegate" take care of the rest.
1737 __ LoadGlobalFunction(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, r1); 1721 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, r1);
1738 __ Jump(masm->isolate()->builtins()->CallFunction( 1722 __ Jump(masm->isolate()->builtins()->CallFunction(
1739 ConvertReceiverMode::kNotNullOrUndefined), 1723 ConvertReceiverMode::kNotNullOrUndefined),
1740 RelocInfo::CODE_TARGET); 1724 RelocInfo::CODE_TARGET);
1741 1725
1742 // 3. Call to something that is not callable. 1726 // 3. Call to something that is not callable.
1743 __ bind(&non_callable); 1727 __ bind(&non_callable);
1744 { 1728 {
1745 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 1729 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
1746 __ Push(r1); 1730 __ Push(r1);
1747 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); 1731 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 // Check if target has a [[Construct]] internal method. 1793 // Check if target has a [[Construct]] internal method.
1810 __ ldrb(r2, FieldMemOperand(r4, Map::kBitFieldOffset)); 1794 __ ldrb(r2, FieldMemOperand(r4, Map::kBitFieldOffset));
1811 __ tst(r2, Operand(1 << Map::kIsConstructor)); 1795 __ tst(r2, Operand(1 << Map::kIsConstructor));
1812 __ b(eq, &non_constructor); 1796 __ b(eq, &non_constructor);
1813 1797
1814 // Called Construct on an exotic Object with a [[Construct]] internal method. 1798 // Called Construct on an exotic Object with a [[Construct]] internal method.
1815 { 1799 {
1816 // Overwrite the original receiver with the (original) target. 1800 // Overwrite the original receiver with the (original) target.
1817 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); 1801 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2));
1818 // Let the "call_as_constructor_delegate" take care of the rest. 1802 // Let the "call_as_constructor_delegate" take care of the rest.
1819 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, r1); 1803 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, r1);
1820 __ Jump(masm->isolate()->builtins()->CallFunction(), 1804 __ Jump(masm->isolate()->builtins()->CallFunction(),
1821 RelocInfo::CODE_TARGET); 1805 RelocInfo::CODE_TARGET);
1822 } 1806 }
1823 1807
1824 // Called Construct on an Object that doesn't have a [[Construct]] internal 1808 // Called Construct on an Object that doesn't have a [[Construct]] internal
1825 // method. 1809 // method.
1826 __ bind(&non_constructor); 1810 __ bind(&non_constructor);
1827 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), 1811 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(),
1828 RelocInfo::CODE_TARGET); 1812 RelocInfo::CODE_TARGET);
1829 } 1813 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 } 1958 }
1975 } 1959 }
1976 1960
1977 1961
1978 #undef __ 1962 #undef __
1979 1963
1980 } // namespace internal 1964 } // namespace internal
1981 } // namespace v8 1965 } // namespace v8
1982 1966
1983 #endif // V8_TARGET_ARCH_ARM 1967 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698