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

Side by Side Diff: src/x64/builtins-x64.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 | « src/snapshot/snapshot-common.cc ('k') | src/x64/code-stubs-x64.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_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 1231
1232 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { 1232 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) {
1233 // ----------- S t a t e ------------- 1233 // ----------- S t a t e -------------
1234 // -- rax : argc 1234 // -- rax : argc
1235 // -- rsp[0] : return address 1235 // -- rsp[0] : return address
1236 // -- rsp[8] : last argument 1236 // -- rsp[8] : last argument
1237 // ----------------------------------- 1237 // -----------------------------------
1238 Label generic_array_code; 1238 Label generic_array_code;
1239 1239
1240 // Get the InternalArray function. 1240 // Get the InternalArray function.
1241 __ LoadGlobalFunction(Context::INTERNAL_ARRAY_FUNCTION_INDEX, rdi); 1241 __ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, rdi);
1242 1242
1243 if (FLAG_debug_code) { 1243 if (FLAG_debug_code) {
1244 // Initial map for the builtin InternalArray functions should be maps. 1244 // Initial map for the builtin InternalArray functions should be maps.
1245 __ movp(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); 1245 __ movp(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset));
1246 // Will both indicate a NULL and a Smi. 1246 // Will both indicate a NULL and a Smi.
1247 STATIC_ASSERT(kSmiTag == 0); 1247 STATIC_ASSERT(kSmiTag == 0);
1248 Condition not_smi = NegateCondition(masm->CheckSmi(rbx)); 1248 Condition not_smi = NegateCondition(masm->CheckSmi(rbx));
1249 __ Check(not_smi, kUnexpectedInitialMapForInternalArrayFunction); 1249 __ Check(not_smi, kUnexpectedInitialMapForInternalArrayFunction);
1250 __ CmpObjectType(rbx, MAP_TYPE, rcx); 1250 __ CmpObjectType(rbx, MAP_TYPE, rcx);
1251 __ Check(equal, kUnexpectedInitialMapForInternalArrayFunction); 1251 __ Check(equal, kUnexpectedInitialMapForInternalArrayFunction);
1252 } 1252 }
1253 1253
1254 // Run the native code for the InternalArray function called as a normal 1254 // Run the native code for the InternalArray function called as a normal
1255 // function. 1255 // function.
1256 // tail call a stub 1256 // tail call a stub
1257 InternalArrayConstructorStub stub(masm->isolate()); 1257 InternalArrayConstructorStub stub(masm->isolate());
1258 __ TailCallStub(&stub); 1258 __ TailCallStub(&stub);
1259 } 1259 }
1260 1260
1261 1261
1262 void Builtins::Generate_ArrayCode(MacroAssembler* masm) { 1262 void Builtins::Generate_ArrayCode(MacroAssembler* masm) {
1263 // ----------- S t a t e ------------- 1263 // ----------- S t a t e -------------
1264 // -- rax : argc 1264 // -- rax : argc
1265 // -- rsp[0] : return address 1265 // -- rsp[0] : return address
1266 // -- rsp[8] : last argument 1266 // -- rsp[8] : last argument
1267 // ----------------------------------- 1267 // -----------------------------------
1268 Label generic_array_code; 1268 Label generic_array_code;
1269 1269
1270 // Get the Array function. 1270 // Get the Array function.
1271 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rdi); 1271 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, rdi);
1272 1272
1273 if (FLAG_debug_code) { 1273 if (FLAG_debug_code) {
1274 // Initial map for the builtin Array functions should be maps. 1274 // Initial map for the builtin Array functions should be maps.
1275 __ movp(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); 1275 __ movp(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset));
1276 // Will both indicate a NULL and a Smi. 1276 // Will both indicate a NULL and a Smi.
1277 STATIC_ASSERT(kSmiTag == 0); 1277 STATIC_ASSERT(kSmiTag == 0);
1278 Condition not_smi = NegateCondition(masm->CheckSmi(rbx)); 1278 Condition not_smi = NegateCondition(masm->CheckSmi(rbx));
1279 __ Check(not_smi, kUnexpectedInitialMapForArrayFunction); 1279 __ Check(not_smi, kUnexpectedInitialMapForArrayFunction);
1280 __ CmpObjectType(rbx, MAP_TYPE, rcx); 1280 __ CmpObjectType(rbx, MAP_TYPE, rcx);
1281 __ Check(equal, kUnexpectedInitialMapForArrayFunction); 1281 __ Check(equal, kUnexpectedInitialMapForArrayFunction);
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 // 2. Call to something else, which might have a [[Call]] internal method (if 1778 // 2. Call to something else, which might have a [[Call]] internal method (if
1779 // not we raise an exception). 1779 // not we raise an exception).
1780 __ bind(&non_function); 1780 __ bind(&non_function);
1781 // Check if target has a [[Call]] internal method. 1781 // Check if target has a [[Call]] internal method.
1782 __ testb(FieldOperand(rcx, Map::kBitFieldOffset), 1782 __ testb(FieldOperand(rcx, Map::kBitFieldOffset),
1783 Immediate(1 << Map::kIsCallable)); 1783 Immediate(1 << Map::kIsCallable));
1784 __ j(zero, &non_callable, Label::kNear); 1784 __ j(zero, &non_callable, Label::kNear);
1785 // Overwrite the original receiver with the (original) target. 1785 // Overwrite the original receiver with the (original) target.
1786 __ movp(args.GetReceiverOperand(), rdi); 1786 __ movp(args.GetReceiverOperand(), rdi);
1787 // Let the "call_as_function_delegate" take care of the rest. 1787 // Let the "call_as_function_delegate" take care of the rest.
1788 __ LoadGlobalFunction(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, rdi); 1788 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, rdi);
1789 __ Jump(masm->isolate()->builtins()->CallFunction( 1789 __ Jump(masm->isolate()->builtins()->CallFunction(
1790 ConvertReceiverMode::kNotNullOrUndefined), 1790 ConvertReceiverMode::kNotNullOrUndefined),
1791 RelocInfo::CODE_TARGET); 1791 RelocInfo::CODE_TARGET);
1792 1792
1793 // 3. Call to something that is not callable. 1793 // 3. Call to something that is not callable.
1794 __ bind(&non_callable); 1794 __ bind(&non_callable);
1795 { 1795 {
1796 FrameScope scope(masm, StackFrame::INTERNAL); 1796 FrameScope scope(masm, StackFrame::INTERNAL);
1797 __ Push(rdi); 1797 __ Push(rdi);
1798 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); 1798 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 // Check if target has a [[Construct]] internal method. 1862 // Check if target has a [[Construct]] internal method.
1863 __ testb(FieldOperand(rcx, Map::kBitFieldOffset), 1863 __ testb(FieldOperand(rcx, Map::kBitFieldOffset),
1864 Immediate(1 << Map::kIsConstructor)); 1864 Immediate(1 << Map::kIsConstructor));
1865 __ j(zero, &non_constructor, Label::kNear); 1865 __ j(zero, &non_constructor, Label::kNear);
1866 1866
1867 // Called Construct on an exotic Object with a [[Construct]] internal method. 1867 // Called Construct on an exotic Object with a [[Construct]] internal method.
1868 { 1868 {
1869 // Overwrite the original receiver with the (original) target. 1869 // Overwrite the original receiver with the (original) target.
1870 __ movp(args.GetReceiverOperand(), rdi); 1870 __ movp(args.GetReceiverOperand(), rdi);
1871 // Let the "call_as_constructor_delegate" take care of the rest. 1871 // Let the "call_as_constructor_delegate" take care of the rest.
1872 __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, rdi); 1872 __ LoadNativeContextSlot(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, rdi);
1873 __ Jump(masm->isolate()->builtins()->CallFunction(), 1873 __ Jump(masm->isolate()->builtins()->CallFunction(),
1874 RelocInfo::CODE_TARGET); 1874 RelocInfo::CODE_TARGET);
1875 } 1875 }
1876 1876
1877 // Called Construct on an Object that doesn't have a [[Construct]] internal 1877 // Called Construct on an Object that doesn't have a [[Construct]] internal
1878 // method. 1878 // method.
1879 __ bind(&non_constructor); 1879 __ bind(&non_constructor);
1880 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), 1880 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(),
1881 RelocInfo::CODE_TARGET); 1881 RelocInfo::CODE_TARGET);
1882 } 1882 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 CompatibleReceiverCheck(masm, rcx, rbx, rdx, r8, r9, &receiver_check_failed); 1984 CompatibleReceiverCheck(masm, rcx, rbx, rdx, r8, r9, &receiver_check_failed);
1985 1985
1986 // Get the callback offset from the FunctionTemplateInfo, and jump to the 1986 // Get the callback offset from the FunctionTemplateInfo, and jump to the
1987 // beginning of the code. 1987 // beginning of the code.
1988 __ movp(rdx, FieldOperand(rbx, FunctionTemplateInfo::kCallCodeOffset)); 1988 __ movp(rdx, FieldOperand(rbx, FunctionTemplateInfo::kCallCodeOffset));
1989 __ movp(rdx, FieldOperand(rdx, CallHandlerInfo::kFastHandlerOffset)); 1989 __ movp(rdx, FieldOperand(rdx, CallHandlerInfo::kFastHandlerOffset));
1990 __ addp(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag)); 1990 __ addp(rdx, Immediate(Code::kHeaderSize - kHeapObjectTag));
1991 __ jmp(rdx); 1991 __ jmp(rdx);
1992 1992
1993 __ bind(&set_global_proxy); 1993 __ bind(&set_global_proxy);
1994 __ movp(rcx, GlobalObjectOperand()); 1994 __ movp(rcx, NativeContextOperand());
1995 __ movp(rcx, FieldOperand(rcx, JSGlobalObject::kGlobalProxyOffset)); 1995 __ movp(rcx, ContextOperand(rcx, Context::GLOBAL_PROXY_INDEX));
1996 __ movp(args.GetReceiverOperand(), rcx); 1996 __ movp(args.GetReceiverOperand(), rcx);
1997 __ jmp(&valid_receiver, Label::kNear); 1997 __ jmp(&valid_receiver, Label::kNear);
1998 1998
1999 // Compatible receiver check failed: pop return address, arguments and 1999 // Compatible receiver check failed: pop return address, arguments and
2000 // receiver and throw an Illegal Invocation exception. 2000 // receiver and throw an Illegal Invocation exception.
2001 __ bind(&receiver_check_failed); 2001 __ bind(&receiver_check_failed);
2002 __ PopReturnAddressTo(rbx); 2002 __ PopReturnAddressTo(rbx);
2003 __ leap(rax, Operand(rax, times_pointer_size, 1 * kPointerSize)); 2003 __ leap(rax, Operand(rax, times_pointer_size, 1 * kPointerSize));
2004 __ addp(rsp, rax); 2004 __ addp(rsp, rax);
2005 __ PushReturnAddressFrom(rbx); 2005 __ PushReturnAddressFrom(rbx);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 __ ret(0); 2062 __ ret(0);
2063 } 2063 }
2064 2064
2065 2065
2066 #undef __ 2066 #undef __
2067 2067
2068 } // namespace internal 2068 } // namespace internal
2069 } // namespace v8 2069 } // namespace v8
2070 2070
2071 #endif // V8_TARGET_ARCH_X64 2071 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/snapshot/snapshot-common.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698