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

Side by Side Diff: src/compiler/ppc/code-generator-ppc.cc

Issue 1206343002: PPC: [turbofan] Add basic support for calling to (a subset of) C functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | src/compiler/ppc/instruction-codes-ppc.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/ppc/macro-assembler-ppc.h" 10 #include "src/ppc/macro-assembler-ppc.h"
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 FieldMemOperand(func, JSFunction::kContextOffset)); 650 FieldMemOperand(func, JSFunction::kContextOffset));
651 __ cmp(cp, kScratchReg); 651 __ cmp(cp, kScratchReg);
652 __ Assert(eq, kWrongFunctionContext); 652 __ Assert(eq, kWrongFunctionContext);
653 } 653 }
654 AssembleDeconstructActivationRecord(); 654 AssembleDeconstructActivationRecord();
655 __ LoadP(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); 655 __ LoadP(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
656 __ Jump(ip); 656 __ Jump(ip);
657 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 657 DCHECK_EQ(LeaveRC, i.OutputRCBit());
658 break; 658 break;
659 } 659 }
660 case kArchPrepareCallCFunction: {
661 int const num_parameters = MiscField::decode(instr->opcode());
662 __ PrepareCallCFunction(num_parameters, kScratchReg);
663 break;
664 }
665 case kArchCallCFunction: {
666 int const num_parameters = MiscField::decode(instr->opcode());
667 if (instr->InputAt(0)->IsImmediate()) {
668 ExternalReference ref = i.InputExternalReference(0);
669 __ CallCFunction(ref, num_parameters);
670 } else {
671 Register func = i.InputRegister(0);
672 __ CallCFunction(func, num_parameters);
673 }
674 break;
675 }
660 case kArchJmp: 676 case kArchJmp:
661 AssembleArchJump(i.InputRpo(0)); 677 AssembleArchJump(i.InputRpo(0));
662 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 678 DCHECK_EQ(LeaveRC, i.OutputRCBit());
663 break; 679 break;
664 case kArchLookupSwitch: 680 case kArchLookupSwitch:
665 AssembleArchLookupSwitch(instr); 681 AssembleArchLookupSwitch(instr);
666 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 682 DCHECK_EQ(LeaveRC, i.OutputRCBit());
667 break; 683 break;
668 case kArchTableSwitch: 684 case kArchTableSwitch:
669 AssembleArchTableSwitch(instr); 685 AssembleArchTableSwitch(instr);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 } else { 971 } else {
956 __ andi(r0, i.InputRegister(0), i.InputImmediate(1)); 972 __ andi(r0, i.InputRegister(0), i.InputImmediate(1));
957 } 973 }
958 DCHECK_EQ(SetRC, i.OutputRCBit()); 974 DCHECK_EQ(SetRC, i.OutputRCBit());
959 break; 975 break;
960 #endif 976 #endif
961 case kPPC_Push: 977 case kPPC_Push:
962 __ Push(i.InputRegister(0)); 978 __ Push(i.InputRegister(0));
963 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 979 DCHECK_EQ(LeaveRC, i.OutputRCBit());
964 break; 980 break;
981 case kPPC_PushFrame: {
982 int num_slots = i.InputInt32(1);
983 __ StorePU(i.InputRegister(0), MemOperand(sp, -num_slots * kPointerSize));
984 break;
985 }
986 case kPPC_StoreToStackSlot: {
987 int slot = i.InputInt32(1);
988 __ StoreP(i.InputRegister(0), MemOperand(sp, slot * kPointerSize));
989 break;
990 }
965 case kPPC_ExtendSignWord8: 991 case kPPC_ExtendSignWord8:
966 __ extsb(i.OutputRegister(), i.InputRegister(0)); 992 __ extsb(i.OutputRegister(), i.InputRegister(0));
967 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 993 DCHECK_EQ(LeaveRC, i.OutputRCBit());
968 break; 994 break;
969 case kPPC_ExtendSignWord16: 995 case kPPC_ExtendSignWord16:
970 __ extsh(i.OutputRegister(), i.InputRegister(0)); 996 __ extsh(i.OutputRegister(), i.InputRegister(0));
971 DCHECK_EQ(LeaveRC, i.OutputRCBit()); 997 DCHECK_EQ(LeaveRC, i.OutputRCBit());
972 break; 998 break;
973 #if V8_TARGET_ARCH_PPC64 999 #if V8_TARGET_ARCH_PPC64
974 case kPPC_ExtendSignWord32: 1000 case kPPC_ExtendSignWord32:
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 } 1581 }
1556 } 1582 }
1557 } 1583 }
1558 } 1584 }
1559 1585
1560 #undef __ 1586 #undef __
1561 1587
1562 } // namespace compiler 1588 } // namespace compiler
1563 } // namespace internal 1589 } // namespace internal
1564 } // namespace v8 1590 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/ppc/instruction-codes-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698