OLD | NEW |
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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 } else { \ | 203 } else { \ |
204 if (instr->InputAt(1)->IsRegister()) { \ | 204 if (instr->InputAt(1)->IsRegister()) { \ |
205 __ asm_instr(i.InputRegister(0), i.InputRegister(1)); \ | 205 __ asm_instr(i.InputRegister(0), i.InputRegister(1)); \ |
206 } else { \ | 206 } else { \ |
207 __ asm_instr(i.InputRegister(0), i.InputOperand(1)); \ | 207 __ asm_instr(i.InputRegister(0), i.InputOperand(1)); \ |
208 } \ | 208 } \ |
209 } \ | 209 } \ |
210 } while (0) | 210 } while (0) |
211 | 211 |
212 | 212 |
213 #define ASSEMBLE_CMP(cmp_instr, test_instr) \ | |
214 do { \ | |
215 if (HasImmediateInput(instr, 1)) { \ | |
216 if (instr->InputAt(0)->IsRegister()) { \ | |
217 if (i.InputInt32(1) == 0) { \ | |
218 __ test_instr(i.InputRegister(0), i.InputRegister(0)); \ | |
219 } else { \ | |
220 __ cmp_instr(i.InputRegister(0), i.InputImmediate(1)); \ | |
221 } \ | |
222 } else { \ | |
223 __ cmp_instr(i.InputOperand(0), i.InputImmediate(1)); \ | |
224 } \ | |
225 } else { \ | |
226 if (instr->InputAt(1)->IsRegister()) { \ | |
227 __ cmp_instr(i.InputRegister(0), i.InputRegister(1)); \ | |
228 } else { \ | |
229 __ cmp_instr(i.InputRegister(0), i.InputOperand(1)); \ | |
230 } \ | |
231 } \ | |
232 } while (0) | |
233 | |
234 #define ASSEMBLE_MULT(asm_instr) \ | 213 #define ASSEMBLE_MULT(asm_instr) \ |
235 do { \ | 214 do { \ |
236 if (HasImmediateInput(instr, 1)) { \ | 215 if (HasImmediateInput(instr, 1)) { \ |
237 if (instr->InputAt(0)->IsRegister()) { \ | 216 if (instr->InputAt(0)->IsRegister()) { \ |
238 __ asm_instr(i.OutputRegister(), i.InputRegister(0), \ | 217 __ asm_instr(i.OutputRegister(), i.InputRegister(0), \ |
239 i.InputImmediate(1)); \ | 218 i.InputImmediate(1)); \ |
240 } else { \ | 219 } else { \ |
241 __ asm_instr(i.OutputRegister(), i.InputOperand(0), \ | 220 __ asm_instr(i.OutputRegister(), i.InputOperand(0), \ |
242 i.InputImmediate(1)); \ | 221 i.InputImmediate(1)); \ |
243 } \ | 222 } \ |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 case kX64Sub: | 581 case kX64Sub: |
603 ASSEMBLE_BINOP(subq); | 582 ASSEMBLE_BINOP(subq); |
604 break; | 583 break; |
605 case kX64And32: | 584 case kX64And32: |
606 ASSEMBLE_BINOP(andl); | 585 ASSEMBLE_BINOP(andl); |
607 break; | 586 break; |
608 case kX64And: | 587 case kX64And: |
609 ASSEMBLE_BINOP(andq); | 588 ASSEMBLE_BINOP(andq); |
610 break; | 589 break; |
611 case kX64Cmp32: | 590 case kX64Cmp32: |
612 ASSEMBLE_CMP(cmpl, testl); | 591 ASSEMBLE_BINOP(cmpl); |
613 break; | 592 break; |
614 case kX64Cmp: | 593 case kX64Cmp: |
615 ASSEMBLE_CMP(cmpq, testq); | 594 ASSEMBLE_BINOP(cmpq); |
616 break; | 595 break; |
617 case kX64Test32: | 596 case kX64Test32: |
618 ASSEMBLE_BINOP(testl); | 597 ASSEMBLE_BINOP(testl); |
619 break; | 598 break; |
620 case kX64Test: | 599 case kX64Test: |
621 ASSEMBLE_BINOP(testq); | 600 ASSEMBLE_BINOP(testq); |
622 break; | 601 break; |
623 case kX64Imul32: | 602 case kX64Imul32: |
624 ASSEMBLE_MULT(imull); | 603 ASSEMBLE_MULT(imull); |
625 break; | 604 break; |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 } | 1433 } |
1455 } | 1434 } |
1456 MarkLazyDeoptSite(); | 1435 MarkLazyDeoptSite(); |
1457 } | 1436 } |
1458 | 1437 |
1459 #undef __ | 1438 #undef __ |
1460 | 1439 |
1461 } // namespace internal | 1440 } // namespace internal |
1462 } // namespace compiler | 1441 } // namespace compiler |
1463 } // namespace v8 | 1442 } // namespace v8 |
OLD | NEW |