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

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

Issue 1205023002: [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: Fix argument slots. 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
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/arm/macro-assembler-arm.h" 7 #include "src/arm/macro-assembler-arm.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 __ ldr(kScratchReg, FieldMemOperand(func, JSFunction::kContextOffset)); 366 __ ldr(kScratchReg, FieldMemOperand(func, JSFunction::kContextOffset));
367 __ cmp(cp, kScratchReg); 367 __ cmp(cp, kScratchReg);
368 __ Assert(eq, kWrongFunctionContext); 368 __ Assert(eq, kWrongFunctionContext);
369 } 369 }
370 AssembleDeconstructActivationRecord(); 370 AssembleDeconstructActivationRecord();
371 __ ldr(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); 371 __ ldr(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
372 __ Jump(ip); 372 __ Jump(ip);
373 DCHECK_EQ(LeaveCC, i.OutputSBit()); 373 DCHECK_EQ(LeaveCC, i.OutputSBit());
374 break; 374 break;
375 } 375 }
376 case kArchPrepareCallCFunction: {
377 int const num_parameters = MiscField::decode(instr->opcode());
378 __ PrepareCallCFunction(num_parameters, kScratchReg);
379 break;
380 }
381 case kArchCallCFunction: {
382 int const num_parameters = MiscField::decode(instr->opcode());
383 if (instr->InputAt(0)->IsImmediate()) {
384 ExternalReference ref = i.InputExternalReference(0);
385 __ CallCFunction(ref, num_parameters);
386 } else {
387 Register func = i.InputRegister(0);
388 __ CallCFunction(func, num_parameters);
389 }
390 break;
391 }
376 case kArchJmp: 392 case kArchJmp:
377 AssembleArchJump(i.InputRpo(0)); 393 AssembleArchJump(i.InputRpo(0));
378 DCHECK_EQ(LeaveCC, i.OutputSBit()); 394 DCHECK_EQ(LeaveCC, i.OutputSBit());
379 break; 395 break;
380 case kArchLookupSwitch: 396 case kArchLookupSwitch:
381 AssembleArchLookupSwitch(instr); 397 AssembleArchLookupSwitch(instr);
382 DCHECK_EQ(LeaveCC, i.OutputSBit()); 398 DCHECK_EQ(LeaveCC, i.OutputSBit());
383 break; 399 break;
384 case kArchTableSwitch: 400 case kArchTableSwitch:
385 AssembleArchTableSwitch(instr); 401 AssembleArchTableSwitch(instr);
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 size_t index = 0; 815 size_t index = 0;
800 MemOperand operand = i.InputOffset(&index); 816 MemOperand operand = i.InputOffset(&index);
801 __ vstr(i.InputFloat64Register(index), operand); 817 __ vstr(i.InputFloat64Register(index), operand);
802 DCHECK_EQ(LeaveCC, i.OutputSBit()); 818 DCHECK_EQ(LeaveCC, i.OutputSBit());
803 break; 819 break;
804 } 820 }
805 case kArmPush: 821 case kArmPush:
806 __ Push(i.InputRegister(0)); 822 __ Push(i.InputRegister(0));
807 DCHECK_EQ(LeaveCC, i.OutputSBit()); 823 DCHECK_EQ(LeaveCC, i.OutputSBit());
808 break; 824 break;
825 case kArmPoke: {
826 int const slot = MiscField::decode(instr->opcode());
827 __ str(i.InputRegister(0), MemOperand(sp, slot * kPointerSize));
828 DCHECK_EQ(LeaveCC, i.OutputSBit());
829 break;
830 }
809 case kArmStoreWriteBarrier: { 831 case kArmStoreWriteBarrier: {
810 Register object = i.InputRegister(0); 832 Register object = i.InputRegister(0);
811 Register index = i.InputRegister(1); 833 Register index = i.InputRegister(1);
812 Register value = i.InputRegister(2); 834 Register value = i.InputRegister(2);
813 __ add(index, object, index); 835 __ add(index, object, index);
814 __ str(value, MemOperand(index)); 836 __ str(value, MemOperand(index));
815 SaveFPRegsMode mode = 837 SaveFPRegsMode mode =
816 frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; 838 frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs;
817 LinkRegisterStatus lr_status = kLRHasNotBeenSaved; 839 LinkRegisterStatus lr_status = kLRHasNotBeenSaved;
818 __ RecordWrite(object, index, value, lr_status, mode); 840 __ RecordWrite(object, index, value, lr_status, mode);
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 } 1239 }
1218 } 1240 }
1219 } 1241 }
1220 } 1242 }
1221 1243
1222 #undef __ 1244 #undef __
1223 1245
1224 } // namespace compiler 1246 } // namespace compiler
1225 } // namespace internal 1247 } // namespace internal
1226 } // namespace v8 1248 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/arm/instruction-codes-arm.h » ('j') | test/cctest/compiler/test-run-machops.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698