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 4c5da677aee888be5f682ffb22f93fed330bf597..8993a6d60d9da2b95969a2b3264708efefcc6a48 100644 |
--- a/src/compiler/x64/code-generator-x64.cc |
+++ b/src/compiler/x64/code-generator-x64.cc |
@@ -269,13 +269,12 @@ class OutOfLineRecordWrite final : public OutOfLineCode { |
class WasmOutOfLineTrap final : public OutOfLineCode { |
public: |
WasmOutOfLineTrap(CodeGenerator* gen, int pc, bool frame_elided, |
- int32_t position, Instruction* instr) |
+ int32_t position) |
: OutOfLineCode(gen), |
gen_(gen), |
pc_(pc), |
frame_elided_(frame_elided), |
- position_(position), |
- instr_(instr) {} |
+ position_(position) {} |
// TODO(eholk): Refactor this method to take the code generator as a |
// parameter. |
@@ -290,13 +289,13 @@ class WasmOutOfLineTrap final : public OutOfLineCode { |
int trap_reason = wasm::WasmOpcodes::TrapReasonToMessageId(trap_id); |
__ Push(Smi::FromInt(trap_reason)); |
__ Push(Smi::FromInt(position_)); |
ahaas
2017/02/20 09:27:24
I think it would be better to pass in the instruct
Eric Holk
2017/02/23 02:16:55
I added a TODO. It looks like we can and should re
|
- __ Move(rsi, gen_->isolate()->native_context()); |
+ __ Move(rsi, Smi::kZero); |
__ CallRuntime(Runtime::kThrowWasmError); |
- if (instr_->reference_map() != nullptr) { |
- gen_->RecordSafepoint(instr_->reference_map(), Safepoint::kSimple, 0, |
- Safepoint::kNoLazyDeopt); |
- } |
+ ReferenceMap* reference_map = |
titzer
2017/02/20 09:50:08
I don't think we always want to generate a referen
Eric Holk
2017/02/23 02:16:55
Is there a way to call RecordSafepoint without a r
|
+ new (gen_->code()->zone()) ReferenceMap(gen_->code()->zone()); |
+ gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, |
+ Safepoint::kNoLazyDeopt); |
} |
private: |
@@ -304,18 +303,17 @@ class WasmOutOfLineTrap final : public OutOfLineCode { |
int pc_; |
bool frame_elided_; |
int32_t position_; |
- Instruction* instr_; |
}; |
void EmitOOLTrapIfNeeded(Zone* zone, CodeGenerator* codegen, |
InstructionCode opcode, size_t input_count, |
- X64OperandConverter& i, int pc, Instruction* instr) { |
+ X64OperandConverter& i, int pc) { |
const X64MemoryProtection protection = |
static_cast<X64MemoryProtection>(MiscField::decode(opcode)); |
if (protection == X64MemoryProtection::kProtected) { |
const bool frame_elided = !codegen->frame_access_state()->has_frame(); |
const int32_t position = i.InputInt32(input_count - 1); |
- new (zone) WasmOutOfLineTrap(codegen, pc, frame_elided, position, instr); |
+ new (zone) WasmOutOfLineTrap(codegen, pc, frame_elided, position); |
} |
} |
} // namespace |
@@ -1853,30 +1851,30 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
break; |
case kX64Movsxbl: |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
ASSEMBLE_MOVX(movsxbl); |
__ AssertZeroExtended(i.OutputRegister()); |
break; |
case kX64Movzxbl: |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
ASSEMBLE_MOVX(movzxbl); |
__ AssertZeroExtended(i.OutputRegister()); |
break; |
case kX64Movsxbq: |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
ASSEMBLE_MOVX(movsxbq); |
break; |
case kX64Movzxbq: |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
ASSEMBLE_MOVX(movzxbq); |
__ AssertZeroExtended(i.OutputRegister()); |
break; |
case kX64Movb: { |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
size_t index = 0; |
Operand operand = i.MemoryOperand(&index); |
if (HasImmediateInput(instr, index)) { |
@@ -1888,30 +1886,30 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
} |
case kX64Movsxwl: |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
ASSEMBLE_MOVX(movsxwl); |
__ AssertZeroExtended(i.OutputRegister()); |
break; |
case kX64Movzxwl: |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
ASSEMBLE_MOVX(movzxwl); |
__ AssertZeroExtended(i.OutputRegister()); |
break; |
case kX64Movsxwq: |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
ASSEMBLE_MOVX(movsxwq); |
break; |
case kX64Movzxwq: |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
ASSEMBLE_MOVX(movzxwq); |
__ AssertZeroExtended(i.OutputRegister()); |
break; |
case kX64Movw: { |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
size_t index = 0; |
Operand operand = i.MemoryOperand(&index); |
if (HasImmediateInput(instr, index)) { |
@@ -1923,7 +1921,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
} |
case kX64Movl: |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
if (instr->HasOutput()) { |
if (instr->addressing_mode() == kMode_None) { |
if (instr->InputAt(0)->IsRegister()) { |
@@ -1947,12 +1945,12 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
break; |
case kX64Movsxlq: |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
ASSEMBLE_MOVX(movsxlq); |
break; |
case kX64Movq: |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
if (instr->HasOutput()) { |
__ movq(i.OutputRegister(), i.MemoryOperand()); |
} else { |
@@ -1967,7 +1965,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
break; |
case kX64Movss: |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
if (instr->HasOutput()) { |
__ movss(i.OutputDoubleRegister(), i.MemoryOperand()); |
} else { |
@@ -1978,7 +1976,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
break; |
case kX64Movsd: |
EmitOOLTrapIfNeeded(zone(), this, opcode, instr->InputCount(), i, |
- __ pc_offset(), instr); |
+ __ pc_offset()); |
if (instr->HasOutput()) { |
__ Movsd(i.OutputDoubleRegister(), i.MemoryOperand()); |
} else { |