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

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

Issue 1214903007: X87: [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, 5 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/x87/instruction-codes-x87.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 // 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/scopes.h" 10 #include "src/scopes.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 Register func = i.InputRegister(0); 378 Register func = i.InputRegister(0);
379 if (FLAG_debug_code) { 379 if (FLAG_debug_code) {
380 // Check the function's context matches the context argument. 380 // Check the function's context matches the context argument.
381 __ cmp(esi, FieldOperand(func, JSFunction::kContextOffset)); 381 __ cmp(esi, FieldOperand(func, JSFunction::kContextOffset));
382 __ Assert(equal, kWrongFunctionContext); 382 __ Assert(equal, kWrongFunctionContext);
383 } 383 }
384 AssembleDeconstructActivationRecord(); 384 AssembleDeconstructActivationRecord();
385 __ jmp(FieldOperand(func, JSFunction::kCodeEntryOffset)); 385 __ jmp(FieldOperand(func, JSFunction::kCodeEntryOffset));
386 break; 386 break;
387 } 387 }
388 case kArchPrepareCallCFunction: {
389 int const num_parameters = MiscField::decode(instr->opcode());
390 __ PrepareCallCFunction(num_parameters, i.TempRegister(0));
391 break;
392 }
393 case kArchCallCFunction: {
394 int const num_parameters = MiscField::decode(instr->opcode());
395 if (HasImmediateInput(instr, 0)) {
396 ExternalReference ref = i.InputExternalReference(0);
397 __ CallCFunction(ref, num_parameters);
398 } else {
399 Register func = i.InputRegister(0);
400 __ CallCFunction(func, num_parameters);
401 }
402 break;
403 }
388 case kArchJmp: 404 case kArchJmp:
389 AssembleArchJump(i.InputRpo(0)); 405 AssembleArchJump(i.InputRpo(0));
390 break; 406 break;
391 case kArchLookupSwitch: 407 case kArchLookupSwitch:
392 AssembleArchLookupSwitch(instr); 408 AssembleArchLookupSwitch(instr);
393 break; 409 break;
394 case kArchTableSwitch: 410 case kArchTableSwitch:
395 AssembleArchTableSwitch(instr); 411 AssembleArchTableSwitch(instr);
396 break; 412 break;
397 case kArchNop: 413 case kArchNop:
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 } 1138 }
1123 break; 1139 break;
1124 } 1140 }
1125 case kX87Push: 1141 case kX87Push:
1126 if (HasImmediateInput(instr, 0)) { 1142 if (HasImmediateInput(instr, 0)) {
1127 __ push(i.InputImmediate(0)); 1143 __ push(i.InputImmediate(0));
1128 } else { 1144 } else {
1129 __ push(i.InputOperand(0)); 1145 __ push(i.InputOperand(0));
1130 } 1146 }
1131 break; 1147 break;
1148 case kX87Poke: {
1149 int const slot = MiscField::decode(instr->opcode());
1150 if (HasImmediateInput(instr, 0)) {
1151 __ mov(Operand(esp, slot * kPointerSize), i.InputImmediate(0));
1152 } else {
1153 __ mov(Operand(esp, slot * kPointerSize), i.InputRegister(0));
1154 }
1155 break;
1156 }
1132 case kX87PushFloat32: 1157 case kX87PushFloat32:
1133 __ lea(esp, Operand(esp, -kFloatSize)); 1158 __ lea(esp, Operand(esp, -kFloatSize));
1134 if (instr->InputAt(0)->IsDoubleStackSlot()) { 1159 if (instr->InputAt(0)->IsDoubleStackSlot()) {
1135 __ fld_s(i.InputOperand(0)); 1160 __ fld_s(i.InputOperand(0));
1136 __ fstp_s(MemOperand(esp, 0)); 1161 __ fstp_s(MemOperand(esp, 0));
1137 } else if (instr->InputAt(0)->IsDoubleRegister()) { 1162 } else if (instr->InputAt(0)->IsDoubleRegister()) {
1138 __ fst_s(MemOperand(esp, 0)); 1163 __ fst_s(MemOperand(esp, 0));
1139 } else { 1164 } else {
1140 UNREACHABLE(); 1165 UNREACHABLE();
1141 } 1166 }
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 __ Nop(padding_size); 1871 __ Nop(padding_size);
1847 } 1872 }
1848 } 1873 }
1849 } 1874 }
1850 1875
1851 #undef __ 1876 #undef __
1852 1877
1853 } // namespace compiler 1878 } // namespace compiler
1854 } // namespace internal 1879 } // namespace internal
1855 } // namespace v8 1880 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/x87/instruction-codes-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698