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

Unified Diff: src/interpreter/interpreter.cc

Issue 2372113004: [turbofan] JSGenericLowering mostly uses builtins instead of code stubs now (Closed)
Patch Set: fixed another bug: switched arguments in Interpreter::DoTestIn Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« src/builtins/builtins-string.cc ('K') | « src/interpreter/interpreter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 410030247fc78bd770381fa1e2d1259cd72f0a1b..c5d41f2d531848515e945a4211774e2974a9af3c 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -931,7 +931,8 @@ void Interpreter::DoBinaryOpWithFeedback(InterpreterAssembler* assembler) {
}
template <class Generator>
-void Interpreter::DoCompareOpWithFeedback(InterpreterAssembler* assembler) {
+void Interpreter::DoCompareOpWithFeedback(InterpreterAssembler* assembler,
+ Generator generator) {
Node* reg_index = __ BytecodeOperandReg(0);
Node* lhs = __ LoadRegister(reg_index);
Node* rhs = __ GetAccumulator();
@@ -999,7 +1000,7 @@ void Interpreter::DoCompareOpWithFeedback(InterpreterAssembler* assembler) {
__ Goto(&skip_feedback_update);
__ Bind(&skip_feedback_update);
- Node* result = Generator::Generate(assembler, lhs, rhs, context);
+ Node* result = generator(assembler, lhs, rhs, context);
__ SetAccumulator(result);
__ Dispatch();
}
@@ -1520,7 +1521,13 @@ void Interpreter::DoLogicalNot(InterpreterAssembler* assembler) {
// Load the accumulator with the string representating type of the
// object in the accumulator.
void Interpreter::DoTypeOf(InterpreterAssembler* assembler) {
- DoUnaryOp<TypeofStub>(assembler);
+ struct Generator {
+ static Node* Generate(InterpreterAssembler* assembler, Node* value,
+ Node* context) {
+ return assembler->Typeof(value, context);
+ }
+ };
+ DoUnaryOp<Generator>(assembler);
}
void Interpreter::DoDelete(Runtime::FunctionId function_id,
@@ -1698,35 +1705,55 @@ void Interpreter::DoNew(InterpreterAssembler* assembler) {
//
// Test if the value in the <src> register equals the accumulator.
void Interpreter::DoTestEqual(InterpreterAssembler* assembler) {
- DoCompareOpWithFeedback<EqualStub>(assembler);
+ DoCompareOpWithFeedback(assembler, [](CodeStubAssembler* assembler, Node* lhs,
+ Node* rhs, Node* context) {
+ return assembler->Equal(CodeStubAssembler::kDontNegateResult, lhs, rhs,
+ context);
rmcilroy 2016/10/05 17:20:52 I'm not keen on this approach of building a genera
+ });
}
// TestNotEqual <src>
//
// Test if the value in the <src> register is not equal to the accumulator.
void Interpreter::DoTestNotEqual(InterpreterAssembler* assembler) {
- DoCompareOpWithFeedback<NotEqualStub>(assembler);
+ DoCompareOpWithFeedback(assembler, [](CodeStubAssembler* assembler, Node* lhs,
+ Node* rhs, Node* context) {
+ return assembler->Equal(CodeStubAssembler::kNegateResult, lhs, rhs,
+ context);
+ });
}
// TestEqualStrict <src>
//
// Test if the value in the <src> register is strictly equal to the accumulator.
void Interpreter::DoTestEqualStrict(InterpreterAssembler* assembler) {
- DoCompareOpWithFeedback<StrictEqualStub>(assembler);
+ DoCompareOpWithFeedback(assembler, [](CodeStubAssembler* assembler, Node* lhs,
+ Node* rhs, Node* context) {
+ return assembler->StrictEqual(CodeStubAssembler::kDontNegateResult, lhs,
+ rhs, context);
+ });
}
// TestLessThan <src>
//
// Test if the value in the <src> register is less than the accumulator.
void Interpreter::DoTestLessThan(InterpreterAssembler* assembler) {
- DoCompareOpWithFeedback<LessThanStub>(assembler);
+ DoCompareOpWithFeedback(assembler, [](CodeStubAssembler* assembler, Node* lhs,
+ Node* rhs, Node* context) {
+ return assembler->RelationalComparison(CodeStubAssembler::kLessThan, lhs,
+ rhs, context);
+ });
}
// TestGreaterThan <src>
//
// Test if the value in the <src> register is greater than the accumulator.
void Interpreter::DoTestGreaterThan(InterpreterAssembler* assembler) {
- DoCompareOpWithFeedback<GreaterThanStub>(assembler);
+ DoCompareOpWithFeedback(assembler, [](CodeStubAssembler* assembler, Node* lhs,
+ Node* rhs, Node* context) {
+ return assembler->RelationalComparison(CodeStubAssembler::kGreaterThan, lhs,
+ rhs, context);
+ });
}
// TestLessThanOrEqual <src>
@@ -1734,7 +1761,11 @@ void Interpreter::DoTestGreaterThan(InterpreterAssembler* assembler) {
// Test if the value in the <src> register is less than or equal to the
// accumulator.
void Interpreter::DoTestLessThanOrEqual(InterpreterAssembler* assembler) {
- DoCompareOpWithFeedback<LessThanOrEqualStub>(assembler);
+ DoCompareOpWithFeedback(assembler, [](CodeStubAssembler* assembler, Node* lhs,
+ Node* rhs, Node* context) {
+ return assembler->RelationalComparison(CodeStubAssembler::kLessThanOrEqual,
+ lhs, rhs, context);
+ });
}
// TestGreaterThanOrEqual <src>
@@ -1742,7 +1773,11 @@ void Interpreter::DoTestLessThanOrEqual(InterpreterAssembler* assembler) {
// Test if the value in the <src> register is greater than or equal to the
// accumulator.
void Interpreter::DoTestGreaterThanOrEqual(InterpreterAssembler* assembler) {
- DoCompareOpWithFeedback<GreaterThanOrEqualStub>(assembler);
+ DoCompareOpWithFeedback(assembler, [](CodeStubAssembler* assembler, Node* lhs,
+ Node* rhs, Node* context) {
+ return assembler->RelationalComparison(
+ CodeStubAssembler::kGreaterThanOrEqual, lhs, rhs, context);
+ });
}
// TestIn <src>
@@ -1750,7 +1785,14 @@ void Interpreter::DoTestGreaterThanOrEqual(InterpreterAssembler* assembler) {
// Test if the object referenced by the register operand is a property of the
// object referenced by the accumulator.
void Interpreter::DoTestIn(InterpreterAssembler* assembler) {
- DoBinaryOp<HasPropertyStub>(assembler);
+ struct Generator {
+ static Node* Generate(InterpreterAssembler* assembler, compiler::Node* key,
+ compiler::Node* object, compiler::Node* context) {
+ return assembler->HasProperty(object, key, context,
+ Runtime::kHasProperty);
+ }
+ };
+ DoBinaryOp<Generator>(assembler);
rmcilroy 2016/10/05 17:20:52 Ditto for DoBinaryOp (maybe these should be callin
}
// TestInstanceOf <src>
@@ -1758,7 +1800,14 @@ void Interpreter::DoTestIn(InterpreterAssembler* assembler) {
// Test if the object referenced by the <src> register is an an instance of type
// referenced by the accumulator.
void Interpreter::DoTestInstanceOf(InterpreterAssembler* assembler) {
- DoBinaryOp<InstanceOfStub>(assembler);
+ struct Generator {
+ static Node* Generate(InterpreterAssembler* assembler,
+ compiler::Node* object, compiler::Node* callable,
+ compiler::Node* context) {
+ return assembler->InstanceOf(object, callable, context);
+ }
+ };
+ DoBinaryOp<Generator>(assembler);
}
// Jump <imm>
« src/builtins/builtins-string.cc ('K') | « src/interpreter/interpreter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698