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