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

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

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