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

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

Issue 1706763002: [turbofan] Emit memory operands for cmp and test on ia32 and x64 when it makes sense. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update. Created 4 years, 10 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 | « src/compiler/instruction-selector.cc ('k') | src/compiler/x64/instruction-selector-x64.cc » ('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/ast/scopes.h" 7 #include "src/ast/scopes.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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } \ 254 } \
255 } else { \ 255 } else { \
256 if (instr->InputAt(1)->IsRegister()) { \ 256 if (instr->InputAt(1)->IsRegister()) { \
257 __ asm_instr(i.InputRegister(0), i.InputRegister(1)); \ 257 __ asm_instr(i.InputRegister(0), i.InputRegister(1)); \
258 } else { \ 258 } else { \
259 __ asm_instr(i.InputRegister(0), i.InputOperand(1)); \ 259 __ asm_instr(i.InputRegister(0), i.InputOperand(1)); \
260 } \ 260 } \
261 } \ 261 } \
262 } while (0) 262 } while (0)
263 263
264 #define ASSEMBLE_COMPARE(asm_instr) \
265 do { \
266 if (AddressingModeField::decode(instr->opcode()) != kMode_None) { \
267 size_t index = 0; \
268 Operand left = i.MemoryOperand(&index); \
269 if (HasImmediateInput(instr, index)) { \
270 __ asm_instr(left, i.InputImmediate(index)); \
271 } else { \
272 __ asm_instr(left, i.InputRegister(index)); \
273 } \
274 } else { \
275 if (HasImmediateInput(instr, 1)) { \
276 if (instr->InputAt(0)->IsRegister()) { \
277 __ asm_instr(i.InputRegister(0), i.InputImmediate(1)); \
278 } else { \
279 __ asm_instr(i.InputOperand(0), i.InputImmediate(1)); \
280 } \
281 } else { \
282 if (instr->InputAt(1)->IsRegister()) { \
283 __ asm_instr(i.InputRegister(0), i.InputRegister(1)); \
284 } else { \
285 __ asm_instr(i.InputRegister(0), i.InputOperand(1)); \
286 } \
287 } \
288 } \
289 } while (0)
264 290
265 #define ASSEMBLE_MULT(asm_instr) \ 291 #define ASSEMBLE_MULT(asm_instr) \
266 do { \ 292 do { \
267 if (HasImmediateInput(instr, 1)) { \ 293 if (HasImmediateInput(instr, 1)) { \
268 if (instr->InputAt(0)->IsRegister()) { \ 294 if (instr->InputAt(0)->IsRegister()) { \
269 __ asm_instr(i.OutputRegister(), i.InputRegister(0), \ 295 __ asm_instr(i.OutputRegister(), i.InputRegister(0), \
270 i.InputImmediate(1)); \ 296 i.InputImmediate(1)); \
271 } else { \ 297 } else { \
272 __ asm_instr(i.OutputRegister(), i.InputOperand(0), \ 298 __ asm_instr(i.OutputRegister(), i.InputOperand(0), \
273 i.InputImmediate(1)); \ 299 i.InputImmediate(1)); \
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 case kX64Sub: 792 case kX64Sub:
767 ASSEMBLE_BINOP(subq); 793 ASSEMBLE_BINOP(subq);
768 break; 794 break;
769 case kX64And32: 795 case kX64And32:
770 ASSEMBLE_BINOP(andl); 796 ASSEMBLE_BINOP(andl);
771 break; 797 break;
772 case kX64And: 798 case kX64And:
773 ASSEMBLE_BINOP(andq); 799 ASSEMBLE_BINOP(andq);
774 break; 800 break;
775 case kX64Cmp32: 801 case kX64Cmp32:
776 ASSEMBLE_BINOP(cmpl); 802 ASSEMBLE_COMPARE(cmpl);
777 break; 803 break;
778 case kX64Cmp: 804 case kX64Cmp:
779 ASSEMBLE_BINOP(cmpq); 805 ASSEMBLE_COMPARE(cmpq);
780 break; 806 break;
781 case kX64Test32: 807 case kX64Test32:
782 ASSEMBLE_BINOP(testl); 808 ASSEMBLE_COMPARE(testl);
783 break; 809 break;
784 case kX64Test: 810 case kX64Test:
785 ASSEMBLE_BINOP(testq); 811 ASSEMBLE_COMPARE(testq);
786 break; 812 break;
787 case kX64Imul32: 813 case kX64Imul32:
788 ASSEMBLE_MULT(imull); 814 ASSEMBLE_MULT(imull);
789 break; 815 break;
790 case kX64Imul: 816 case kX64Imul:
791 ASSEMBLE_MULT(imulq); 817 ASSEMBLE_MULT(imulq);
792 break; 818 break;
793 case kX64ImulHigh32: 819 case kX64ImulHigh32:
794 if (instr->InputAt(1)->IsRegister()) { 820 if (instr->InputAt(1)->IsRegister()) {
795 __ imull(i.InputRegister(1)); 821 __ imull(i.InputRegister(1));
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 2190 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
2165 __ Nop(padding_size); 2191 __ Nop(padding_size);
2166 } 2192 }
2167 } 2193 }
2168 2194
2169 #undef __ 2195 #undef __
2170 2196
2171 } // namespace compiler 2197 } // namespace compiler
2172 } // namespace internal 2198 } // namespace internal
2173 } // namespace v8 2199 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698