| 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
| 10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 | 440 |
| 441 #define ASSEMBLE_CHECKED_LOAD_FLOAT(asm_instr, OutOfLineLoadNaN) \ | 441 #define ASSEMBLE_CHECKED_LOAD_FLOAT(asm_instr, OutOfLineLoadNaN) \ |
| 442 do { \ | 442 do { \ |
| 443 auto result = i.OutputDoubleRegister(); \ | 443 auto result = i.OutputDoubleRegister(); \ |
| 444 auto buffer = i.InputRegister(0); \ | 444 auto buffer = i.InputRegister(0); \ |
| 445 auto index1 = i.InputRegister(1); \ | 445 auto index1 = i.InputRegister(1); \ |
| 446 auto index2 = i.InputUint32(2); \ | 446 auto index2 = i.InputUint32(2); \ |
| 447 OutOfLineCode* ool; \ | 447 OutOfLineCode* ool; \ |
| 448 if (instr->InputAt(3)->IsRegister()) { \ | 448 if (instr->InputAt(3)->IsRegister()) { \ |
| 449 auto length = i.InputRegister(3); \ | 449 auto length = i.InputRegister(3); \ |
| 450 DCHECK_EQ(0, index2); \ | 450 DCHECK_EQ(0u, index2); \ |
| 451 __ cmpl(index1, length); \ | 451 __ cmpl(index1, length); \ |
| 452 ool = new (zone()) OutOfLineLoadNaN(this, result); \ | 452 ool = new (zone()) OutOfLineLoadNaN(this, result); \ |
| 453 } else { \ | 453 } else { \ |
| 454 auto length = i.InputUint32(3); \ | 454 auto length = i.InputUint32(3); \ |
| 455 RelocInfo::Mode rmode = i.ToConstant(instr->InputAt(3)).rmode(); \ | 455 RelocInfo::Mode rmode = i.ToConstant(instr->InputAt(3)).rmode(); \ |
| 456 DCHECK_LE(index2, length); \ | 456 DCHECK_LE(index2, length); \ |
| 457 __ cmpl(index1, Immediate(length - index2, rmode)); \ | 457 __ cmpl(index1, Immediate(length - index2, rmode)); \ |
| 458 class OutOfLineLoadFloat final : public OutOfLineCode { \ | 458 class OutOfLineLoadFloat final : public OutOfLineCode { \ |
| 459 public: \ | 459 public: \ |
| 460 OutOfLineLoadFloat(CodeGenerator* gen, XMMRegister result, \ | 460 OutOfLineLoadFloat(CodeGenerator* gen, XMMRegister result, \ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 | 495 |
| 496 #define ASSEMBLE_CHECKED_LOAD_INTEGER(asm_instr) \ | 496 #define ASSEMBLE_CHECKED_LOAD_INTEGER(asm_instr) \ |
| 497 do { \ | 497 do { \ |
| 498 auto result = i.OutputRegister(); \ | 498 auto result = i.OutputRegister(); \ |
| 499 auto buffer = i.InputRegister(0); \ | 499 auto buffer = i.InputRegister(0); \ |
| 500 auto index1 = i.InputRegister(1); \ | 500 auto index1 = i.InputRegister(1); \ |
| 501 auto index2 = i.InputUint32(2); \ | 501 auto index2 = i.InputUint32(2); \ |
| 502 OutOfLineCode* ool; \ | 502 OutOfLineCode* ool; \ |
| 503 if (instr->InputAt(3)->IsRegister()) { \ | 503 if (instr->InputAt(3)->IsRegister()) { \ |
| 504 auto length = i.InputRegister(3); \ | 504 auto length = i.InputRegister(3); \ |
| 505 DCHECK_EQ(0, index2); \ | 505 DCHECK_EQ(0u, index2); \ |
| 506 __ cmpl(index1, length); \ | 506 __ cmpl(index1, length); \ |
| 507 ool = new (zone()) OutOfLineLoadZero(this, result); \ | 507 ool = new (zone()) OutOfLineLoadZero(this, result); \ |
| 508 } else { \ | 508 } else { \ |
| 509 auto length = i.InputUint32(3); \ | 509 auto length = i.InputUint32(3); \ |
| 510 RelocInfo::Mode rmode = i.ToConstant(instr->InputAt(3)).rmode(); \ | 510 RelocInfo::Mode rmode = i.ToConstant(instr->InputAt(3)).rmode(); \ |
| 511 DCHECK_LE(index2, length); \ | 511 DCHECK_LE(index2, length); \ |
| 512 __ cmpl(index1, Immediate(length - index2, rmode)); \ | 512 __ cmpl(index1, Immediate(length - index2, rmode)); \ |
| 513 class OutOfLineLoadInteger final : public OutOfLineCode { \ | 513 class OutOfLineLoadInteger final : public OutOfLineCode { \ |
| 514 public: \ | 514 public: \ |
| 515 OutOfLineLoadInteger(CodeGenerator* gen, Register result, \ | 515 OutOfLineLoadInteger(CodeGenerator* gen, Register result, \ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 } while (false) | 552 } while (false) |
| 553 | 553 |
| 554 #define ASSEMBLE_CHECKED_STORE_FLOAT(asm_instr) \ | 554 #define ASSEMBLE_CHECKED_STORE_FLOAT(asm_instr) \ |
| 555 do { \ | 555 do { \ |
| 556 auto buffer = i.InputRegister(0); \ | 556 auto buffer = i.InputRegister(0); \ |
| 557 auto index1 = i.InputRegister(1); \ | 557 auto index1 = i.InputRegister(1); \ |
| 558 auto index2 = i.InputUint32(2); \ | 558 auto index2 = i.InputUint32(2); \ |
| 559 auto value = i.InputDoubleRegister(4); \ | 559 auto value = i.InputDoubleRegister(4); \ |
| 560 if (instr->InputAt(3)->IsRegister()) { \ | 560 if (instr->InputAt(3)->IsRegister()) { \ |
| 561 auto length = i.InputRegister(3); \ | 561 auto length = i.InputRegister(3); \ |
| 562 DCHECK_EQ(0, index2); \ | 562 DCHECK_EQ(0u, index2); \ |
| 563 Label done; \ | 563 Label done; \ |
| 564 __ cmpl(index1, length); \ | 564 __ cmpl(index1, length); \ |
| 565 __ j(above_equal, &done, Label::kNear); \ | 565 __ j(above_equal, &done, Label::kNear); \ |
| 566 __ asm_instr(Operand(buffer, index1, times_1, index2), value); \ | 566 __ asm_instr(Operand(buffer, index1, times_1, index2), value); \ |
| 567 __ bind(&done); \ | 567 __ bind(&done); \ |
| 568 } else { \ | 568 } else { \ |
| 569 auto length = i.InputUint32(3); \ | 569 auto length = i.InputUint32(3); \ |
| 570 RelocInfo::Mode rmode = i.ToConstant(instr->InputAt(3)).rmode(); \ | 570 RelocInfo::Mode rmode = i.ToConstant(instr->InputAt(3)).rmode(); \ |
| 571 DCHECK_LE(index2, length); \ | 571 DCHECK_LE(index2, length); \ |
| 572 __ cmpl(index1, Immediate(length - index2, rmode)); \ | 572 __ cmpl(index1, Immediate(length - index2, rmode)); \ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 } \ | 607 } \ |
| 608 } while (false) | 608 } while (false) |
| 609 | 609 |
| 610 #define ASSEMBLE_CHECKED_STORE_INTEGER_IMPL(asm_instr, Value) \ | 610 #define ASSEMBLE_CHECKED_STORE_INTEGER_IMPL(asm_instr, Value) \ |
| 611 do { \ | 611 do { \ |
| 612 auto buffer = i.InputRegister(0); \ | 612 auto buffer = i.InputRegister(0); \ |
| 613 auto index1 = i.InputRegister(1); \ | 613 auto index1 = i.InputRegister(1); \ |
| 614 auto index2 = i.InputUint32(2); \ | 614 auto index2 = i.InputUint32(2); \ |
| 615 if (instr->InputAt(3)->IsRegister()) { \ | 615 if (instr->InputAt(3)->IsRegister()) { \ |
| 616 auto length = i.InputRegister(3); \ | 616 auto length = i.InputRegister(3); \ |
| 617 DCHECK_EQ(0, index2); \ | 617 DCHECK_EQ(0u, index2); \ |
| 618 Label done; \ | 618 Label done; \ |
| 619 __ cmpl(index1, length); \ | 619 __ cmpl(index1, length); \ |
| 620 __ j(above_equal, &done, Label::kNear); \ | 620 __ j(above_equal, &done, Label::kNear); \ |
| 621 __ asm_instr(Operand(buffer, index1, times_1, index2), value); \ | 621 __ asm_instr(Operand(buffer, index1, times_1, index2), value); \ |
| 622 __ bind(&done); \ | 622 __ bind(&done); \ |
| 623 } else { \ | 623 } else { \ |
| 624 auto length = i.InputUint32(3); \ | 624 auto length = i.InputUint32(3); \ |
| 625 RelocInfo::Mode rmode = i.ToConstant(instr->InputAt(3)).rmode(); \ | 625 RelocInfo::Mode rmode = i.ToConstant(instr->InputAt(3)).rmode(); \ |
| 626 DCHECK_LE(index2, length); \ | 626 DCHECK_LE(index2, length); \ |
| 627 __ cmpl(index1, Immediate(length - index2, rmode)); \ | 627 __ cmpl(index1, Immediate(length - index2, rmode)); \ |
| (...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2501 AssembleDeconstructFrame(); | 2501 AssembleDeconstructFrame(); |
| 2502 } | 2502 } |
| 2503 } else { | 2503 } else { |
| 2504 AssembleDeconstructFrame(); | 2504 AssembleDeconstructFrame(); |
| 2505 } | 2505 } |
| 2506 } | 2506 } |
| 2507 | 2507 |
| 2508 if (pop->IsImmediate()) { | 2508 if (pop->IsImmediate()) { |
| 2509 DCHECK_EQ(Constant::kInt32, g.ToConstant(pop).type()); | 2509 DCHECK_EQ(Constant::kInt32, g.ToConstant(pop).type()); |
| 2510 pop_size += g.ToConstant(pop).ToInt32() * kPointerSize; | 2510 pop_size += g.ToConstant(pop).ToInt32() * kPointerSize; |
| 2511 CHECK_LT(pop_size, std::numeric_limits<int>::max()); | 2511 CHECK_LT(pop_size, static_cast<size_t>(std::numeric_limits<int>::max())); |
| 2512 __ Ret(static_cast<int>(pop_size), rcx); | 2512 __ Ret(static_cast<int>(pop_size), rcx); |
| 2513 } else { | 2513 } else { |
| 2514 Register pop_reg = g.ToRegister(pop); | 2514 Register pop_reg = g.ToRegister(pop); |
| 2515 Register scratch_reg = pop_reg.is(rcx) ? rdx : rcx; | 2515 Register scratch_reg = pop_reg.is(rcx) ? rdx : rcx; |
| 2516 __ popq(scratch_reg); | 2516 __ popq(scratch_reg); |
| 2517 __ leaq(rsp, Operand(rsp, pop_reg, times_8, static_cast<int>(pop_size))); | 2517 __ leaq(rsp, Operand(rsp, pop_reg, times_8, static_cast<int>(pop_size))); |
| 2518 __ jmp(scratch_reg); | 2518 __ jmp(scratch_reg); |
| 2519 } | 2519 } |
| 2520 } | 2520 } |
| 2521 | 2521 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2777 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2777 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
| 2778 __ Nop(padding_size); | 2778 __ Nop(padding_size); |
| 2779 } | 2779 } |
| 2780 } | 2780 } |
| 2781 | 2781 |
| 2782 #undef __ | 2782 #undef __ |
| 2783 | 2783 |
| 2784 } // namespace compiler | 2784 } // namespace compiler |
| 2785 } // namespace internal | 2785 } // namespace internal |
| 2786 } // namespace v8 | 2786 } // namespace v8 |
| OLD | NEW |