| Index: src/compiler/x64/code-generator-x64.cc
|
| diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc
|
| index 84b88f249efa3f47ec68b87ce7922bc5e37e3ff1..40f3247fd44309bde975221f804a4249d0fd63db 100644
|
| --- a/src/compiler/x64/code-generator-x64.cc
|
| +++ b/src/compiler/x64/code-generator-x64.cc
|
| @@ -272,9 +272,62 @@ class OutOfLineTruncateDoubleToI FINAL : public OutOfLineCode {
|
| } while (0)
|
|
|
|
|
| -#define ASSEMBLE_CHECKED_LOAD_FLOAT(asm_instr) \
|
| +#define ASSEMBLE_CHECKED_LOAD_FLOAT(asm_instr) \
|
| + do { \
|
| + auto result = i.OutputDoubleRegister(); \
|
| + auto buffer = i.InputRegister(0); \
|
| + auto index1 = i.InputRegister(1); \
|
| + auto index2 = i.InputInt32(2); \
|
| + OutOfLineCode* ool; \
|
| + if (instr->InputAt(3)->IsRegister()) { \
|
| + auto length = i.InputRegister(3); \
|
| + DCHECK_EQ(0, index2); \
|
| + __ cmpl(index1, length); \
|
| + ool = new (zone()) OutOfLineLoadNaN(this, result); \
|
| + } else { \
|
| + auto length = i.InputInt32(3); \
|
| + DCHECK_LE(index2, length); \
|
| + __ cmpq(index1, Immediate(length - index2)); \
|
| + class OutOfLineLoadFloat FINAL : public OutOfLineCode { \
|
| + public: \
|
| + OutOfLineLoadFloat(CodeGenerator* gen, XMMRegister result, \
|
| + Register buffer, Register index1, int32_t index2, \
|
| + int32_t length) \
|
| + : OutOfLineCode(gen), \
|
| + result_(result), \
|
| + buffer_(buffer), \
|
| + index1_(index1), \
|
| + index2_(index2), \
|
| + length_(length) {} \
|
| + \
|
| + void Generate() FINAL { \
|
| + __ leal(kScratchRegister, Operand(index1_, index2_)); \
|
| + __ pcmpeqd(result_, result_); \
|
| + __ cmpl(kScratchRegister, Immediate(length_)); \
|
| + __ j(above_equal, exit()); \
|
| + __ asm_instr(result_, \
|
| + Operand(buffer_, kScratchRegister, times_1, 0)); \
|
| + } \
|
| + \
|
| + private: \
|
| + XMMRegister const result_; \
|
| + Register const buffer_; \
|
| + Register const index1_; \
|
| + int32_t const index2_; \
|
| + int32_t const length_; \
|
| + }; \
|
| + ool = new (zone()) \
|
| + OutOfLineLoadFloat(this, result, buffer, index1, index2, length); \
|
| + } \
|
| + __ j(above_equal, ool->entry()); \
|
| + __ asm_instr(result, Operand(buffer, index1, times_1, index2)); \
|
| + __ bind(ool->exit()); \
|
| + } while (false)
|
| +
|
| +
|
| +#define ASSEMBLE_CHECKED_LOAD_INTEGER(asm_instr) \
|
| do { \
|
| - auto result = i.OutputDoubleRegister(); \
|
| + auto result = i.OutputRegister(); \
|
| auto buffer = i.InputRegister(0); \
|
| auto index1 = i.InputRegister(1); \
|
| auto index2 = i.InputInt32(2); \
|
| @@ -283,46 +336,41 @@ class OutOfLineTruncateDoubleToI FINAL : public OutOfLineCode {
|
| auto length = i.InputRegister(3); \
|
| DCHECK_EQ(0, index2); \
|
| __ cmpl(index1, length); \
|
| - ool = new (zone()) OutOfLineLoadNaN(this, result); \
|
| + ool = new (zone()) OutOfLineLoadZero(this, result); \
|
| } else { \
|
| auto length = i.InputInt32(3); \
|
| DCHECK_LE(index2, length); \
|
| - __ cmpl(index1, Immediate(length - index2)); \
|
| - if (index2 == 0) { \
|
| - ool = new (zone()) OutOfLineLoadNaN(this, result); \
|
| - } else { \
|
| - class OutOfLineLoadFloat FINAL : public OutOfLineCode { \
|
| - public: \
|
| - OutOfLineLoadFloat(CodeGenerator* gen, XMMRegister result, \
|
| + __ cmpq(index1, Immediate(length - index2)); \
|
| + class OutOfLineLoadInteger FINAL : public OutOfLineCode { \
|
| + public: \
|
| + OutOfLineLoadInteger(CodeGenerator* gen, Register result, \
|
| Register buffer, Register index1, int32_t index2, \
|
| int32_t length) \
|
| - : OutOfLineCode(gen), \
|
| - result_(result), \
|
| - buffer_(buffer), \
|
| - index1_(index1), \
|
| - index2_(index2), \
|
| - length_(length) {} \
|
| + : OutOfLineCode(gen), \
|
| + result_(result), \
|
| + buffer_(buffer), \
|
| + index1_(index1), \
|
| + index2_(index2), \
|
| + length_(length) {} \
|
| \
|
| - void Generate() FINAL { \
|
| - DCHECK_NE(0, index2_); \
|
| - __ leal(kScratchRegister, Operand(index1_, index2_)); \
|
| - __ pcmpeqd(result_, result_); \
|
| - __ cmpl(kScratchRegister, Immediate(length_)); \
|
| - __ j(above_equal, exit()); \
|
| - __ asm_instr(result_, \
|
| - Operand(buffer_, kScratchRegister, times_1, 0)); \
|
| - } \
|
| + void Generate() FINAL { \
|
| + __ leal(kScratchRegister, Operand(index1_, index2_)); \
|
| + __ xorl(result_, result_); \
|
| + __ cmpl(kScratchRegister, Immediate(length_)); \
|
| + __ j(above_equal, exit()); \
|
| + __ asm_instr(result_, \
|
| + Operand(buffer_, kScratchRegister, times_1, 0)); \
|
| + } \
|
| \
|
| - private: \
|
| - XMMRegister const result_; \
|
| - Register const buffer_; \
|
| - Register const index1_; \
|
| - int32_t const index2_; \
|
| - int32_t const length_; \
|
| - }; \
|
| - ool = new (zone()) \
|
| - OutOfLineLoadFloat(this, result, buffer, index1, index2, length); \
|
| - } \
|
| + private: \
|
| + Register const result_; \
|
| + Register const buffer_; \
|
| + Register const index1_; \
|
| + int32_t const index2_; \
|
| + int32_t const length_; \
|
| + }; \
|
| + ool = new (zone()) \
|
| + OutOfLineLoadInteger(this, result, buffer, index1, index2, length); \
|
| } \
|
| __ j(above_equal, ool->entry()); \
|
| __ asm_instr(result, Operand(buffer, index1, times_1, index2)); \
|
| @@ -330,70 +378,65 @@ class OutOfLineTruncateDoubleToI FINAL : public OutOfLineCode {
|
| } while (false)
|
|
|
|
|
| -#define ASSEMBLE_CHECKED_LOAD_INTEGER(asm_instr) \
|
| - do { \
|
| - auto result = i.OutputRegister(); \
|
| - auto buffer = i.InputRegister(0); \
|
| - auto index1 = i.InputRegister(1); \
|
| - auto index2 = i.InputInt32(2); \
|
| - OutOfLineCode* ool; \
|
| - if (instr->InputAt(3)->IsRegister()) { \
|
| - auto length = i.InputRegister(3); \
|
| - DCHECK_EQ(0, index2); \
|
| - __ cmpl(index1, length); \
|
| - ool = new (zone()) OutOfLineLoadZero(this, result); \
|
| - } else { \
|
| - auto length = i.InputInt32(3); \
|
| - DCHECK_LE(index2, length); \
|
| - __ cmpl(index1, Immediate(length - index2)); \
|
| - if (index2 == 0) { \
|
| - ool = new (zone()) OutOfLineLoadZero(this, result); \
|
| - } else { \
|
| - class OutOfLineLoadInteger FINAL : public OutOfLineCode { \
|
| - public: \
|
| - OutOfLineLoadInteger(CodeGenerator* gen, Register result, \
|
| - Register buffer, Register index1, \
|
| - int32_t index2, int32_t length) \
|
| - : OutOfLineCode(gen), \
|
| - result_(result), \
|
| - buffer_(buffer), \
|
| - index1_(index1), \
|
| - index2_(index2), \
|
| - length_(length) {} \
|
| - \
|
| - void Generate() FINAL { \
|
| - DCHECK_NE(0, index2_); \
|
| - __ leal(kScratchRegister, Operand(index1_, index2_)); \
|
| - __ xorl(result_, result_); \
|
| - __ cmpl(kScratchRegister, Immediate(length_)); \
|
| - __ j(above_equal, exit()); \
|
| - __ asm_instr(result_, \
|
| - Operand(buffer_, kScratchRegister, times_1, 0)); \
|
| - } \
|
| - \
|
| - private: \
|
| - Register const result_; \
|
| - Register const buffer_; \
|
| - Register const index1_; \
|
| - int32_t const index2_; \
|
| - int32_t const length_; \
|
| - }; \
|
| - ool = new (zone()) OutOfLineLoadInteger(this, result, buffer, index1, \
|
| - index2, length); \
|
| - } \
|
| - } \
|
| - __ j(above_equal, ool->entry()); \
|
| - __ asm_instr(result, Operand(buffer, index1, times_1, index2)); \
|
| - __ bind(ool->exit()); \
|
| +#define ASSEMBLE_CHECKED_STORE_FLOAT(asm_instr) \
|
| + do { \
|
| + auto buffer = i.InputRegister(0); \
|
| + auto index1 = i.InputRegister(1); \
|
| + auto index2 = i.InputInt32(2); \
|
| + auto value = i.InputDoubleRegister(4); \
|
| + if (instr->InputAt(3)->IsRegister()) { \
|
| + auto length = i.InputRegister(3); \
|
| + DCHECK_EQ(0, index2); \
|
| + Label done; \
|
| + __ cmpl(index1, length); \
|
| + __ j(above_equal, &done, Label::kNear); \
|
| + __ asm_instr(Operand(buffer, index1, times_1, index2), value); \
|
| + __ bind(&done); \
|
| + } else { \
|
| + auto length = i.InputInt32(3); \
|
| + DCHECK_LE(index2, length); \
|
| + __ cmpq(index1, Immediate(length - index2)); \
|
| + class OutOfLineStoreFloat FINAL : public OutOfLineCode { \
|
| + public: \
|
| + OutOfLineStoreFloat(CodeGenerator* gen, Register buffer, \
|
| + Register index1, int32_t index2, int32_t length, \
|
| + XMMRegister value) \
|
| + : OutOfLineCode(gen), \
|
| + buffer_(buffer), \
|
| + index1_(index1), \
|
| + index2_(index2), \
|
| + length_(length), \
|
| + value_(value) {} \
|
| + \
|
| + void Generate() FINAL { \
|
| + __ leal(kScratchRegister, Operand(index1_, index2_)); \
|
| + __ cmpl(kScratchRegister, Immediate(length_)); \
|
| + __ j(above_equal, exit()); \
|
| + __ asm_instr(Operand(buffer_, kScratchRegister, times_1, 0), \
|
| + value_); \
|
| + } \
|
| + \
|
| + private: \
|
| + Register const buffer_; \
|
| + Register const index1_; \
|
| + int32_t const index2_; \
|
| + int32_t const length_; \
|
| + XMMRegister const value_; \
|
| + }; \
|
| + auto ool = new (zone()) \
|
| + OutOfLineStoreFloat(this, buffer, index1, index2, length, value); \
|
| + __ j(above_equal, ool->entry()); \
|
| + __ asm_instr(Operand(buffer, index1, times_1, index2), value); \
|
| + __ bind(ool->exit()); \
|
| + } \
|
| } while (false)
|
|
|
|
|
| -#define ASSEMBLE_CHECKED_STORE_FLOAT(asm_instr) \
|
| +#define ASSEMBLE_CHECKED_STORE_INTEGER_IMPL(asm_instr, Value) \
|
| do { \
|
| auto buffer = i.InputRegister(0); \
|
| auto index1 = i.InputRegister(1); \
|
| auto index2 = i.InputInt32(2); \
|
| - auto value = i.InputDoubleRegister(4); \
|
| if (instr->InputAt(3)->IsRegister()) { \
|
| auto length = i.InputRegister(3); \
|
| DCHECK_EQ(0, index2); \
|
| @@ -405,112 +448,43 @@ class OutOfLineTruncateDoubleToI FINAL : public OutOfLineCode {
|
| } else { \
|
| auto length = i.InputInt32(3); \
|
| DCHECK_LE(index2, length); \
|
| - __ cmpl(index1, Immediate(length - index2)); \
|
| - if (index2 == 0) { \
|
| - Label done; \
|
| - __ j(above_equal, &done, Label::kNear); \
|
| - __ asm_instr(Operand(buffer, index1, times_1, index2), value); \
|
| - __ bind(&done); \
|
| - } else { \
|
| - class OutOfLineStoreFloat FINAL : public OutOfLineCode { \
|
| - public: \
|
| - OutOfLineStoreFloat(CodeGenerator* gen, Register buffer, \
|
| + __ cmpq(index1, Immediate(length - index2)); \
|
| + class OutOfLineStoreInteger FINAL : public OutOfLineCode { \
|
| + public: \
|
| + OutOfLineStoreInteger(CodeGenerator* gen, Register buffer, \
|
| Register index1, int32_t index2, int32_t length, \
|
| - XMMRegister value) \
|
| - : OutOfLineCode(gen), \
|
| - buffer_(buffer), \
|
| - index1_(index1), \
|
| - index2_(index2), \
|
| - length_(length), \
|
| - value_(value) {} \
|
| + Value value) \
|
| + : OutOfLineCode(gen), \
|
| + buffer_(buffer), \
|
| + index1_(index1), \
|
| + index2_(index2), \
|
| + length_(length), \
|
| + value_(value) {} \
|
| \
|
| - void Generate() FINAL { \
|
| - DCHECK_NE(0, index2_); \
|
| - __ leal(kScratchRegister, Operand(index1_, index2_)); \
|
| - __ cmpl(kScratchRegister, Immediate(length_)); \
|
| - __ j(above_equal, exit()); \
|
| - __ asm_instr(Operand(buffer_, kScratchRegister, times_1, 0), \
|
| - value_); \
|
| - } \
|
| + void Generate() FINAL { \
|
| + __ leal(kScratchRegister, Operand(index1_, index2_)); \
|
| + __ cmpl(kScratchRegister, Immediate(length_)); \
|
| + __ j(above_equal, exit()); \
|
| + __ asm_instr(Operand(buffer_, kScratchRegister, times_1, 0), \
|
| + value_); \
|
| + } \
|
| \
|
| - private: \
|
| - Register const buffer_; \
|
| - Register const index1_; \
|
| - int32_t const index2_; \
|
| - int32_t const length_; \
|
| - XMMRegister const value_; \
|
| - }; \
|
| - auto ool = new (zone()) \
|
| - OutOfLineStoreFloat(this, buffer, index1, index2, length, value); \
|
| - __ j(above_equal, ool->entry()); \
|
| - __ asm_instr(Operand(buffer, index1, times_1, index2), value); \
|
| - __ bind(ool->exit()); \
|
| - } \
|
| + private: \
|
| + Register const buffer_; \
|
| + Register const index1_; \
|
| + int32_t const index2_; \
|
| + int32_t const length_; \
|
| + Value const value_; \
|
| + }; \
|
| + auto ool = new (zone()) \
|
| + OutOfLineStoreInteger(this, buffer, index1, index2, length, value); \
|
| + __ j(above_equal, ool->entry()); \
|
| + __ asm_instr(Operand(buffer, index1, times_1, index2), value); \
|
| + __ bind(ool->exit()); \
|
| } \
|
| } while (false)
|
|
|
|
|
| -#define ASSEMBLE_CHECKED_STORE_INTEGER_IMPL(asm_instr, Value) \
|
| - do { \
|
| - auto buffer = i.InputRegister(0); \
|
| - auto index1 = i.InputRegister(1); \
|
| - auto index2 = i.InputInt32(2); \
|
| - if (instr->InputAt(3)->IsRegister()) { \
|
| - auto length = i.InputRegister(3); \
|
| - DCHECK_EQ(0, index2); \
|
| - Label done; \
|
| - __ cmpl(index1, length); \
|
| - __ j(above_equal, &done, Label::kNear); \
|
| - __ asm_instr(Operand(buffer, index1, times_1, index2), value); \
|
| - __ bind(&done); \
|
| - } else { \
|
| - auto length = i.InputInt32(3); \
|
| - DCHECK_LE(index2, length); \
|
| - __ cmpl(index1, Immediate(length - index2)); \
|
| - if (index2 == 0) { \
|
| - Label done; \
|
| - __ j(above_equal, &done, Label::kNear); \
|
| - __ asm_instr(Operand(buffer, index1, times_1, index2), value); \
|
| - __ bind(&done); \
|
| - } else { \
|
| - class OutOfLineStoreInteger FINAL : public OutOfLineCode { \
|
| - public: \
|
| - OutOfLineStoreInteger(CodeGenerator* gen, Register buffer, \
|
| - Register index1, int32_t index2, \
|
| - int32_t length, Value value) \
|
| - : OutOfLineCode(gen), \
|
| - buffer_(buffer), \
|
| - index1_(index1), \
|
| - index2_(index2), \
|
| - length_(length), \
|
| - value_(value) {} \
|
| - \
|
| - void Generate() FINAL { \
|
| - DCHECK_NE(0, index2_); \
|
| - __ leal(kScratchRegister, Operand(index1_, index2_)); \
|
| - __ cmpl(kScratchRegister, Immediate(length_)); \
|
| - __ j(above_equal, exit()); \
|
| - __ asm_instr(Operand(buffer_, kScratchRegister, times_1, 0), \
|
| - value_); \
|
| - } \
|
| - \
|
| - private: \
|
| - Register const buffer_; \
|
| - Register const index1_; \
|
| - int32_t const index2_; \
|
| - int32_t const length_; \
|
| - Value const value_; \
|
| - }; \
|
| - auto ool = new (zone()) OutOfLineStoreInteger(this, buffer, index1, \
|
| - index2, length, value); \
|
| - __ j(above_equal, ool->entry()); \
|
| - __ asm_instr(Operand(buffer, index1, times_1, index2), value); \
|
| - __ bind(ool->exit()); \
|
| - } \
|
| - } \
|
| - } while (false)
|
| -
|
| -
|
| #define ASSEMBLE_CHECKED_STORE_INTEGER(asm_instr) \
|
| do { \
|
| if (instr->InputAt(4)->IsRegister()) { \
|
|
|