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

Side by Side Diff: src/a64/stub-cache-a64.cc

Issue 149403003: A64: Synchronize with r19234. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « src/a64/macro-assembler-a64.cc ('k') | src/accessors.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 Handle<JSObject> holder_obj, 737 Handle<JSObject> holder_obj,
738 IC::UtilityId id) { 738 IC::UtilityId id) {
739 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 739 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
740 740
741 __ CallExternalReference( 741 __ CallExternalReference(
742 ExternalReference(IC_Utility(id), masm->isolate()), 742 ExternalReference(IC_Utility(id), masm->isolate()),
743 StubCache::kInterceptorArgsLength); 743 StubCache::kInterceptorArgsLength);
744 } 744 }
745 745
746 746
747 static void GenerateFastApiCallBody(MacroAssembler* masm, 747 // Generate call to api function.
748 const CallOptimization& optimization, 748 static void GenerateFastApiCall(MacroAssembler* masm,
749 int argc, 749 const CallOptimization& optimization,
750 Register holder_in, 750 Handle<Map> receiver_map,
751 bool restore_context) { 751 Register receiver,
752 Register scratch,
753 int argc,
754 Register* values) {
755 ASSERT(!AreAliased(receiver, scratch));
756 __ Push(receiver);
757 // Write the arguments to stack frame.
758 for (int i = 0; i < argc; i++) {
759 // TODO(jbramley): Push these in as few Push() calls as possible.
760 Register arg = values[argc-1-i];
761 ASSERT(!AreAliased(receiver, scratch, arg));
762 __ Push(arg);
763 }
764
752 ASSERT(optimization.is_simple_api_call()); 765 ASSERT(optimization.is_simple_api_call());
753 766
754 // Abi for CallApiFunctionStub. 767 // Abi for CallApiFunctionStub.
755 Register callee = x0; 768 Register callee = x0;
756 Register call_data = x4; 769 Register call_data = x4;
757 Register holder = x2; 770 Register holder = x2;
758 Register api_function_address = x1; 771 Register api_function_address = x1;
759 772
760 // Put holder in place. 773 // Put holder in place.
761 __ Mov(holder, holder_in); 774 CallOptimization::HolderLookup holder_lookup;
775 Handle<JSObject> api_holder =
776 optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup);
777 switch (holder_lookup) {
778 case CallOptimization::kHolderIsReceiver:
779 __ Mov(holder, receiver);
780 break;
781 case CallOptimization::kHolderFound:
782 __ LoadObject(holder, api_holder);
783 break;
784 case CallOptimization::kHolderNotFound:
785 UNREACHABLE();
786 break;
787 }
762 788
763 Isolate* isolate = masm->isolate(); 789 Isolate* isolate = masm->isolate();
764 Handle<JSFunction> function = optimization.constant_function(); 790 Handle<JSFunction> function = optimization.constant_function();
765 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 791 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
766 Handle<Object> call_data_obj(api_call_info->data(), isolate); 792 Handle<Object> call_data_obj(api_call_info->data(), isolate);
767 793
768 // Put callee in place. 794 // Put callee in place.
769 __ LoadObject(callee, function); 795 __ LoadObject(callee, function);
770 796
771 bool call_data_undefined = false; 797 bool call_data_undefined = false;
(...skipping 10 matching lines...) Expand all
782 808
783 // Put api_function_address in place. 809 // Put api_function_address in place.
784 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 810 Address function_address = v8::ToCData<Address>(api_call_info->callback());
785 ApiFunction fun(function_address); 811 ApiFunction fun(function_address);
786 ExternalReference ref = ExternalReference(&fun, 812 ExternalReference ref = ExternalReference(&fun,
787 ExternalReference::DIRECT_API_CALL, 813 ExternalReference::DIRECT_API_CALL,
788 masm->isolate()); 814 masm->isolate());
789 __ Mov(api_function_address, Operand(ref)); 815 __ Mov(api_function_address, Operand(ref));
790 816
791 // Jump to stub. 817 // Jump to stub.
792 CallApiFunctionStub stub(restore_context, call_data_undefined, argc); 818 CallApiFunctionStub stub(true, call_data_undefined, argc);
793 __ TailCallStub(&stub); 819 __ TailCallStub(&stub);
794 } 820 }
795 821
796 822
797 // Generate call to api function.
798 static void GenerateFastApiCall(MacroAssembler* masm,
799 const CallOptimization& optimization,
800 Register receiver,
801 Register scratch,
802 int argc,
803 Register* values) {
804 ASSERT(!AreAliased(receiver, scratch));
805
806 __ Push(receiver);
807 // Write the arguments to stack frame.
808 for (int i = 0; i < argc; i++) {
809 // TODO(all): Groups pushes to minimize Push overhead.
810 Register arg = values[argc-1-i];
811 ASSERT(!receiver.is(arg));
812 ASSERT(!scratch.is(arg));
813 __ Push(arg);
814 }
815 // Stack now matches JSFunction ABI.
816 GenerateFastApiCallBody(masm,
817 optimization,
818 argc,
819 receiver,
820 true);
821 }
822
823
824 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { 823 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
825 __ Jump(code, RelocInfo::CODE_TARGET); 824 __ Jump(code, RelocInfo::CODE_TARGET);
826 } 825 }
827 826
828 827
829 #undef __ 828 #undef __
830 #define __ ACCESS_MASM(masm()) 829 #define __ ACCESS_MASM(masm())
831 830
832 831
833 Register StubCompiler::CheckPrototypes(Handle<HeapType> type, 832 Register StubCompiler::CheckPrototypes(Handle<HeapType> type,
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 1037
1039 1038
1040 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { 1039 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
1041 // Return the constant value. 1040 // Return the constant value.
1042 __ LoadObject(x0, value); 1041 __ LoadObject(x0, value);
1043 __ Ret(); 1042 __ Ret();
1044 } 1043 }
1045 1044
1046 1045
1047 void LoadStubCompiler::GenerateLoadCallback( 1046 void LoadStubCompiler::GenerateLoadCallback(
1048 const CallOptimization& call_optimization) { 1047 const CallOptimization& call_optimization,
1048 Handle<Map> receiver_map) {
1049 GenerateFastApiCall( 1049 GenerateFastApiCall(
1050 masm(), call_optimization, receiver(), scratch3(), 0, NULL); 1050 masm(), call_optimization, receiver_map, receiver(), scratch3(), 0, NULL);
1051 } 1051 }
1052 1052
1053 1053
1054 void LoadStubCompiler::GenerateLoadCallback( 1054 void LoadStubCompiler::GenerateLoadCallback(
1055 Register reg, 1055 Register reg,
1056 Handle<ExecutableAccessorInfo> callback) { 1056 Handle<ExecutableAccessorInfo> callback) {
1057 ASSERT(!AreAliased(scratch2(), scratch3(), scratch4(), reg)); 1057 ASSERT(!AreAliased(scratch2(), scratch3(), scratch4(), reg));
1058 1058
1059 // Build ExecutableAccessorInfo::args_ list on the stack and push property 1059 // Build ExecutableAccessorInfo::args_ list on the stack and push property
1060 // name below the exit frame to make GC aware of them and store pointers to 1060 // name below the exit frame to make GC aware of them and store pointers to
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 return GetCode(kind(), Code::FAST, name); 1235 return GetCode(kind(), Code::FAST, name);
1236 } 1236 }
1237 1237
1238 1238
1239 #undef __ 1239 #undef __
1240 #define __ ACCESS_MASM(masm) 1240 #define __ ACCESS_MASM(masm)
1241 1241
1242 1242
1243 void StoreStubCompiler::GenerateStoreViaSetter( 1243 void StoreStubCompiler::GenerateStoreViaSetter(
1244 MacroAssembler* masm, 1244 MacroAssembler* masm,
1245 Handle<HeapType> type,
1245 Handle<JSFunction> setter) { 1246 Handle<JSFunction> setter) {
1246 // ----------- S t a t e ------------- 1247 // ----------- S t a t e -------------
1247 // -- x0 : value 1248 // -- x0 : value
1248 // -- x1 : receiver 1249 // -- x1 : receiver
1249 // -- x2 : name 1250 // -- x2 : name
1250 // -- lr : return address 1251 // -- lr : return address
1251 // ----------------------------------- 1252 // -----------------------------------
1252 Register value_reg = x0; 1253 Register value = x0;
1253 Register receiver_reg = x1; 1254 Register receiver = x1;
1254 Label miss; 1255 Label miss;
1255 1256
1256 { 1257 {
1257 FrameScope scope(masm, StackFrame::INTERNAL); 1258 FrameScope scope(masm, StackFrame::INTERNAL);
1258 1259
1259 // Save value register, so we can restore it later. 1260 // Save value register, so we can restore it later.
1260 __ Push(value_reg); 1261 __ Push(value);
1261 1262
1262 if (!setter.is_null()) { 1263 if (!setter.is_null()) {
1263 // Call the JavaScript setter with receiver and value on the stack. 1264 // Call the JavaScript setter with receiver and value on the stack.
1264 __ Push(receiver_reg, value_reg); 1265 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
1266 // Swap in the global receiver.
1267 __ Ldr(receiver,
1268 FieldMemOperand(
1269 receiver, JSGlobalObject::kGlobalReceiverOffset));
1270 }
1271 __ Push(receiver, value);
1265 ParameterCount actual(1); 1272 ParameterCount actual(1);
1266 ParameterCount expected(setter); 1273 ParameterCount expected(setter);
1267 __ InvokeFunction(setter, expected, actual, 1274 __ InvokeFunction(setter, expected, actual,
1268 CALL_FUNCTION, NullCallWrapper()); 1275 CALL_FUNCTION, NullCallWrapper());
1269 } else { 1276 } else {
1270 // If we generate a global code snippet for deoptimization only, remember 1277 // If we generate a global code snippet for deoptimization only, remember
1271 // the place to continue after deoptimization. 1278 // the place to continue after deoptimization.
1272 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); 1279 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset());
1273 } 1280 }
1274 1281
1275 // We have to return the passed value, not the return value of the setter. 1282 // We have to return the passed value, not the return value of the setter.
1276 __ Pop(value_reg); 1283 __ Pop(value);
1277 1284
1278 // Restore context register. 1285 // Restore context register.
1279 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 1286 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1280 } 1287 }
1281 __ Ret(); 1288 __ Ret();
1282 } 1289 }
1283 1290
1284 1291
1285 #undef __ 1292 #undef __
1286 #define __ ACCESS_MASM(masm()) 1293 #define __ ACCESS_MASM(masm())
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 // receiver, name, value, scratch1, scratch2, scratch3. 1374 // receiver, name, value, scratch1, scratch2, scratch3.
1368 static Register registers[] = { x2, x1, x0, x3, x4, x5 }; 1375 static Register registers[] = { x2, x1, x0, x3, x4, x5 };
1369 return registers; 1376 return registers;
1370 } 1377 }
1371 1378
1372 1379
1373 #undef __ 1380 #undef __
1374 #define __ ACCESS_MASM(masm) 1381 #define __ ACCESS_MASM(masm)
1375 1382
1376 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm, 1383 void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
1384 Handle<HeapType> type,
1377 Register receiver, 1385 Register receiver,
1378 Handle<JSFunction> getter) { 1386 Handle<JSFunction> getter) {
1379 { 1387 {
1380 FrameScope scope(masm, StackFrame::INTERNAL); 1388 FrameScope scope(masm, StackFrame::INTERNAL);
1381 1389
1382 if (!getter.is_null()) { 1390 if (!getter.is_null()) {
1383 // Call the JavaScript getter with the receiver on the stack. 1391 // Call the JavaScript getter with the receiver on the stack.
1392 if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
1393 // Swap in the global receiver.
1394 __ Ldr(receiver,
1395 FieldMemOperand(
1396 receiver, JSGlobalObject::kGlobalReceiverOffset));
1397 }
1384 __ Push(receiver); 1398 __ Push(receiver);
1385 ParameterCount actual(0); 1399 ParameterCount actual(0);
1386 ParameterCount expected(getter); 1400 ParameterCount expected(getter);
1387 __ InvokeFunction(getter, expected, actual, 1401 __ InvokeFunction(getter, expected, actual,
1388 CALL_FUNCTION, NullCallWrapper()); 1402 CALL_FUNCTION, NullCallWrapper());
1389 } else { 1403 } else {
1390 // If we generate a global code snippet for deoptimization only, remember 1404 // If we generate a global code snippet for deoptimization only, remember
1391 // the place to continue after deoptimization. 1405 // the place to continue after deoptimization.
1392 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset()); 1406 masm->isolate()->heap()->SetGetterStubDeoptPCOffset(masm->pc_offset());
1393 } 1407 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 1532
1519 Handle<Code> StoreStubCompiler::CompileStoreCallback( 1533 Handle<Code> StoreStubCompiler::CompileStoreCallback(
1520 Handle<JSObject> object, 1534 Handle<JSObject> object,
1521 Handle<JSObject> holder, 1535 Handle<JSObject> holder,
1522 Handle<Name> name, 1536 Handle<Name> name,
1523 const CallOptimization& call_optimization) { 1537 const CallOptimization& call_optimization) {
1524 HandlerFrontend(IC::CurrentTypeOf(object, isolate()), 1538 HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
1525 receiver(), holder, name); 1539 receiver(), holder, name);
1526 1540
1527 Register values[] = { value() }; 1541 Register values[] = { value() };
1528 GenerateFastApiCall( 1542 GenerateFastApiCall(masm(), call_optimization, handle(object->map()),
1529 masm(), call_optimization, receiver(), scratch3(), 1, values); 1543 receiver(), scratch3(), 1, values);
1530 1544
1531 // Return the generated code. 1545 // Return the generated code.
1532 return GetCode(kind(), Code::FAST, name); 1546 return GetCode(kind(), Code::FAST, name);
1533 } 1547 }
1534 1548
1535 1549
1536 #undef __ 1550 #undef __
1537 #define __ ACCESS_MASM(masm) 1551 #define __ ACCESS_MASM(masm)
1538 1552
1539 void KeyedLoadStubCompiler::GenerateLoadDictionaryElement( 1553 void KeyedLoadStubCompiler::GenerateLoadDictionaryElement(
(...skipping 21 matching lines...) Expand all
1561 1575
1562 // Miss case, call the runtime. 1576 // Miss case, call the runtime.
1563 __ Bind(&miss); 1577 __ Bind(&miss);
1564 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 1578 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
1565 } 1579 }
1566 1580
1567 1581
1568 } } // namespace v8::internal 1582 } } // namespace v8::internal
1569 1583
1570 #endif // V8_TARGET_ARCH_A64 1584 #endif // V8_TARGET_ARCH_A64
OLDNEW
« no previous file with comments | « src/a64/macro-assembler-a64.cc ('k') | src/accessors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698