Commit b890d8c4 authored by rmcilroy's avatar rmcilroy Committed by Commit bot

[Interpreter] Inline test and compare binary ops.

This inlines the test and compare binary operations into Ignition.
With this CL all binary ops are inlined into Ignition's bytecode
handlers.

Some blocks were shuffled around in Equals/NotEquals stubs to avoid
creating frames unecessarily. Some labels were also marked as non-
deferred in both Equals/NotEquals and the AbstractRelationalComparison
stubs for the same reason.

BUG=v8:4280
LOG=N

Review-Url: https://codereview.chromium.org/2013573004
Cr-Commit-Position: refs/heads/master@{#36542}
parent 34c202a0
This diff is collapsed.
...@@ -810,7 +810,7 @@ class InstanceOfStub final : public TurboFanCodeStub { ...@@ -810,7 +810,7 @@ class InstanceOfStub final : public TurboFanCodeStub {
private: private:
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
DEFINE_TURBOFAN_CODE_STUB(InstanceOf, TurboFanCodeStub); DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(InstanceOf, TurboFanCodeStub);
}; };
class LessThanStub final : public TurboFanCodeStub { class LessThanStub final : public TurboFanCodeStub {
...@@ -818,7 +818,7 @@ class LessThanStub final : public TurboFanCodeStub { ...@@ -818,7 +818,7 @@ class LessThanStub final : public TurboFanCodeStub {
explicit LessThanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} explicit LessThanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
DEFINE_TURBOFAN_CODE_STUB(LessThan, TurboFanCodeStub); DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(LessThan, TurboFanCodeStub);
}; };
class LessThanOrEqualStub final : public TurboFanCodeStub { class LessThanOrEqualStub final : public TurboFanCodeStub {
...@@ -826,7 +826,7 @@ class LessThanOrEqualStub final : public TurboFanCodeStub { ...@@ -826,7 +826,7 @@ class LessThanOrEqualStub final : public TurboFanCodeStub {
explicit LessThanOrEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} explicit LessThanOrEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
DEFINE_TURBOFAN_CODE_STUB(LessThanOrEqual, TurboFanCodeStub); DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(LessThanOrEqual, TurboFanCodeStub);
}; };
class GreaterThanStub final : public TurboFanCodeStub { class GreaterThanStub final : public TurboFanCodeStub {
...@@ -834,7 +834,7 @@ class GreaterThanStub final : public TurboFanCodeStub { ...@@ -834,7 +834,7 @@ class GreaterThanStub final : public TurboFanCodeStub {
explicit GreaterThanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} explicit GreaterThanStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
DEFINE_TURBOFAN_CODE_STUB(GreaterThan, TurboFanCodeStub); DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(GreaterThan, TurboFanCodeStub);
}; };
class GreaterThanOrEqualStub final : public TurboFanCodeStub { class GreaterThanOrEqualStub final : public TurboFanCodeStub {
...@@ -843,7 +843,7 @@ class GreaterThanOrEqualStub final : public TurboFanCodeStub { ...@@ -843,7 +843,7 @@ class GreaterThanOrEqualStub final : public TurboFanCodeStub {
: TurboFanCodeStub(isolate) {} : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
DEFINE_TURBOFAN_CODE_STUB(GreaterThanOrEqual, TurboFanCodeStub); DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(GreaterThanOrEqual, TurboFanCodeStub);
}; };
class EqualStub final : public TurboFanCodeStub { class EqualStub final : public TurboFanCodeStub {
...@@ -851,7 +851,7 @@ class EqualStub final : public TurboFanCodeStub { ...@@ -851,7 +851,7 @@ class EqualStub final : public TurboFanCodeStub {
explicit EqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} explicit EqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
DEFINE_TURBOFAN_CODE_STUB(Equal, TurboFanCodeStub); DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(Equal, TurboFanCodeStub);
}; };
class NotEqualStub final : public TurboFanCodeStub { class NotEqualStub final : public TurboFanCodeStub {
...@@ -859,7 +859,7 @@ class NotEqualStub final : public TurboFanCodeStub { ...@@ -859,7 +859,7 @@ class NotEqualStub final : public TurboFanCodeStub {
explicit NotEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} explicit NotEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
DEFINE_TURBOFAN_CODE_STUB(NotEqual, TurboFanCodeStub); DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(NotEqual, TurboFanCodeStub);
}; };
class StrictEqualStub final : public TurboFanCodeStub { class StrictEqualStub final : public TurboFanCodeStub {
...@@ -867,7 +867,7 @@ class StrictEqualStub final : public TurboFanCodeStub { ...@@ -867,7 +867,7 @@ class StrictEqualStub final : public TurboFanCodeStub {
explicit StrictEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} explicit StrictEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
DEFINE_TURBOFAN_CODE_STUB(StrictEqual, TurboFanCodeStub); DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(StrictEqual, TurboFanCodeStub);
}; };
class StrictNotEqualStub final : public TurboFanCodeStub { class StrictNotEqualStub final : public TurboFanCodeStub {
...@@ -875,7 +875,7 @@ class StrictNotEqualStub final : public TurboFanCodeStub { ...@@ -875,7 +875,7 @@ class StrictNotEqualStub final : public TurboFanCodeStub {
explicit StrictNotEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} explicit StrictNotEqualStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare); DEFINE_CALL_INTERFACE_DESCRIPTOR(Compare);
DEFINE_TURBOFAN_CODE_STUB(StrictNotEqual, TurboFanCodeStub); DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(StrictNotEqual, TurboFanCodeStub);
}; };
class StringEqualStub final : public TurboFanCodeStub { class StringEqualStub final : public TurboFanCodeStub {
...@@ -986,7 +986,7 @@ class HasPropertyStub : public TurboFanCodeStub { ...@@ -986,7 +986,7 @@ class HasPropertyStub : public TurboFanCodeStub {
explicit HasPropertyStub(Isolate* isolate) : TurboFanCodeStub(isolate) {} explicit HasPropertyStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(HasProperty); DEFINE_CALL_INTERFACE_DESCRIPTOR(HasProperty);
DEFINE_TURBOFAN_CODE_STUB(HasProperty, TurboFanCodeStub); DEFINE_TURBOFAN_BINARY_OP_CODE_STUB(HasProperty, TurboFanCodeStub);
}; };
enum StringAddFlags { enum StringAddFlags {
......
...@@ -754,20 +754,6 @@ void Interpreter::DoPopContext(InterpreterAssembler* assembler) { ...@@ -754,20 +754,6 @@ void Interpreter::DoPopContext(InterpreterAssembler* assembler) {
__ Dispatch(); __ Dispatch();
} }
void Interpreter::DoBinaryOp(Callable callable,
InterpreterAssembler* assembler) {
// TODO(bmeurer): Collect definition side type feedback for various
// binary operations.
Node* target = __ HeapConstant(callable.code());
Node* reg_index = __ BytecodeOperandReg(0);
Node* lhs = __ LoadRegister(reg_index);
Node* rhs = __ GetAccumulator();
Node* context = __ GetContext();
Node* result = __ CallStub(callable.descriptor(), target, context, lhs, rhs);
__ SetAccumulator(result);
__ Dispatch();
}
template <class Generator> template <class Generator>
void Interpreter::DoBinaryOp(InterpreterAssembler* assembler) { void Interpreter::DoBinaryOp(InterpreterAssembler* assembler) {
Node* reg_index = __ BytecodeOperandReg(0); Node* reg_index = __ BytecodeOperandReg(0);
...@@ -1168,35 +1154,35 @@ void Interpreter::DoNew(InterpreterAssembler* assembler) { ...@@ -1168,35 +1154,35 @@ void Interpreter::DoNew(InterpreterAssembler* assembler) {
// //
// Test if the value in the <src> register equals the accumulator. // Test if the value in the <src> register equals the accumulator.
void Interpreter::DoTestEqual(InterpreterAssembler* assembler) { void Interpreter::DoTestEqual(InterpreterAssembler* assembler) {
DoBinaryOp(CodeFactory::Equal(isolate_), assembler); DoBinaryOp<EqualStub>(assembler);
} }
// TestNotEqual <src> // TestNotEqual <src>
// //
// Test if the value in the <src> register is not equal to the accumulator. // Test if the value in the <src> register is not equal to the accumulator.
void Interpreter::DoTestNotEqual(InterpreterAssembler* assembler) { void Interpreter::DoTestNotEqual(InterpreterAssembler* assembler) {
DoBinaryOp(CodeFactory::NotEqual(isolate_), assembler); DoBinaryOp<NotEqualStub>(assembler);
} }
// TestEqualStrict <src> // TestEqualStrict <src>
// //
// Test if the value in the <src> register is strictly equal to the accumulator. // Test if the value in the <src> register is strictly equal to the accumulator.
void Interpreter::DoTestEqualStrict(InterpreterAssembler* assembler) { void Interpreter::DoTestEqualStrict(InterpreterAssembler* assembler) {
DoBinaryOp(CodeFactory::StrictEqual(isolate_), assembler); DoBinaryOp<StrictEqualStub>(assembler);
} }
// TestLessThan <src> // TestLessThan <src>
// //
// Test if the value in the <src> register is less than the accumulator. // Test if the value in the <src> register is less than the accumulator.
void Interpreter::DoTestLessThan(InterpreterAssembler* assembler) { void Interpreter::DoTestLessThan(InterpreterAssembler* assembler) {
DoBinaryOp(CodeFactory::LessThan(isolate_), assembler); DoBinaryOp<LessThanStub>(assembler);
} }
// TestGreaterThan <src> // TestGreaterThan <src>
// //
// Test if the value in the <src> register is greater than the accumulator. // Test if the value in the <src> register is greater than the accumulator.
void Interpreter::DoTestGreaterThan(InterpreterAssembler* assembler) { void Interpreter::DoTestGreaterThan(InterpreterAssembler* assembler) {
DoBinaryOp(CodeFactory::GreaterThan(isolate_), assembler); DoBinaryOp<GreaterThanStub>(assembler);
} }
// TestLessThanOrEqual <src> // TestLessThanOrEqual <src>
...@@ -1204,7 +1190,7 @@ void Interpreter::DoTestGreaterThan(InterpreterAssembler* assembler) { ...@@ -1204,7 +1190,7 @@ void Interpreter::DoTestGreaterThan(InterpreterAssembler* assembler) {
// Test if the value in the <src> register is less than or equal to the // Test if the value in the <src> register is less than or equal to the
// accumulator. // accumulator.
void Interpreter::DoTestLessThanOrEqual(InterpreterAssembler* assembler) { void Interpreter::DoTestLessThanOrEqual(InterpreterAssembler* assembler) {
DoBinaryOp(CodeFactory::LessThanOrEqual(isolate_), assembler); DoBinaryOp<LessThanOrEqualStub>(assembler);
} }
// TestGreaterThanOrEqual <src> // TestGreaterThanOrEqual <src>
...@@ -1212,7 +1198,7 @@ void Interpreter::DoTestLessThanOrEqual(InterpreterAssembler* assembler) { ...@@ -1212,7 +1198,7 @@ void Interpreter::DoTestLessThanOrEqual(InterpreterAssembler* assembler) {
// Test if the value in the <src> register is greater than or equal to the // Test if the value in the <src> register is greater than or equal to the
// accumulator. // accumulator.
void Interpreter::DoTestGreaterThanOrEqual(InterpreterAssembler* assembler) { void Interpreter::DoTestGreaterThanOrEqual(InterpreterAssembler* assembler) {
DoBinaryOp(CodeFactory::GreaterThanOrEqual(isolate_), assembler); DoBinaryOp<GreaterThanOrEqualStub>(assembler);
} }
// TestIn <src> // TestIn <src>
...@@ -1220,7 +1206,7 @@ void Interpreter::DoTestGreaterThanOrEqual(InterpreterAssembler* assembler) { ...@@ -1220,7 +1206,7 @@ void Interpreter::DoTestGreaterThanOrEqual(InterpreterAssembler* assembler) {
// Test if the object referenced by the register operand is a property of the // Test if the object referenced by the register operand is a property of the
// object referenced by the accumulator. // object referenced by the accumulator.
void Interpreter::DoTestIn(InterpreterAssembler* assembler) { void Interpreter::DoTestIn(InterpreterAssembler* assembler) {
DoBinaryOp(CodeFactory::HasProperty(isolate_), assembler); DoBinaryOp<HasPropertyStub>(assembler);
} }
// TestInstanceOf <src> // TestInstanceOf <src>
...@@ -1228,7 +1214,7 @@ void Interpreter::DoTestIn(InterpreterAssembler* assembler) { ...@@ -1228,7 +1214,7 @@ void Interpreter::DoTestIn(InterpreterAssembler* assembler) {
// Test if the object referenced by the <src> register is an an instance of type // Test if the object referenced by the <src> register is an an instance of type
// referenced by the accumulator. // referenced by the accumulator.
void Interpreter::DoTestInstanceOf(InterpreterAssembler* assembler) { void Interpreter::DoTestInstanceOf(InterpreterAssembler* assembler) {
DoBinaryOp(CodeFactory::InstanceOf(isolate_), assembler); DoBinaryOp<InstanceOfStub>(assembler);
} }
// Jump <imm> // Jump <imm>
......
...@@ -70,9 +70,6 @@ class Interpreter { ...@@ -70,9 +70,6 @@ class Interpreter {
BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR) BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR)
#undef DECLARE_BYTECODE_HANDLER_GENERATOR #undef DECLARE_BYTECODE_HANDLER_GENERATOR
// Generates code to perform the binary operation via |callable|.
void DoBinaryOp(Callable callable, InterpreterAssembler* assembler);
// Generates code to perform the binary operation via |Generator|. // Generates code to perform the binary operation via |Generator|.
template <class Generator> template <class Generator>
void DoBinaryOp(InterpreterAssembler* assembler); void DoBinaryOp(InterpreterAssembler* assembler);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment