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

Unified Diff: src/interpreter/bytecode-peephole-optimizer.cc

Issue 2547043002: [Interpreter] Optimize equality check with null/undefined with a check on the map. (Closed)
Patch Set: A couple of fixes: 1. TestUndetectable writes boolean to accumulator 2. New optimization to load un… Created 4 years 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
Index: src/interpreter/bytecode-peephole-optimizer.cc
diff --git a/src/interpreter/bytecode-peephole-optimizer.cc b/src/interpreter/bytecode-peephole-optimizer.cc
index 40552943f75dcb3b07d196b910f00cfd321d2946..4c7512155bcc394b7d9620cd68ffbfe5fb1fae80 100644
--- a/src/interpreter/bytecode-peephole-optimizer.cc
+++ b/src/interpreter/bytecode-peephole-optimizer.cc
@@ -138,6 +138,16 @@ void TransformLdaZeroBinaryOpToBinaryOpWithZero(Bytecode new_bytecode,
}
}
+void TransformEqualityWithNullOrUndefinedToTestUndetectable(
+ BytecodeNode* const last, BytecodeNode* const current) {
+ DCHECK((last->bytecode() == Bytecode::kLdaNull) ||
+ (last->bytecode() == Bytecode::kLdaUndefined));
rmcilroy 2016/12/05 19:08:09 Do you want to DCHECK that this current bytecode i
mythria 2016/12/06 10:13:27 Done.
+ current->set_bytecode(Bytecode::kTestUndetectable, current->operand(0));
+ if (last->source_info().is_valid()) {
+ current->set_source_info(last->source_info());
+ }
+}
+
} // namespace
void BytecodePeepholeOptimizer::DefaultAction(
@@ -251,6 +261,16 @@ void BytecodePeepholeOptimizer::
}
}
+void BytecodePeepholeOptimizer::
+ TransformEqualityWithNullOrUndefinedToTestUndetectableAction(
+ BytecodeNode* const node, const PeepholeActionAndData* action_data) {
+ DCHECK(LastIsValid());
+ DCHECK(!Bytecodes::IsJump(node->bytecode()));
+ // Fused last and current into current.
+ TransformEqualityWithNullOrUndefinedToTestUndetectable(last(), node);
+ SetLast(node);
+}
+
void BytecodePeepholeOptimizer::DefaultJumpAction(
BytecodeNode* const node, const PeepholeActionAndData* action_data) {
DCHECK(LastIsValid());

Powered by Google App Engine
This is Rietveld 408576698