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

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

Issue 2554723004: [Interpreter] Transform StrictEquality with null/undefined to special bytecodes. (Closed)
Patch Set: "Fixed a DCHECK" 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 dfc40a2c194ec18892d52215c645ea5cda3d38da..4c22a42f30a94a1e35004ae3e4a6bc15fe310d59 100644
--- a/src/interpreter/bytecode-peephole-optimizer.cc
+++ b/src/interpreter/bytecode-peephole-optimizer.cc
@@ -138,12 +138,14 @@ void TransformLdaZeroBinaryOpToBinaryOpWithZero(Bytecode new_bytecode,
}
}
-void TransformEqualityWithNullOrUndefinedToTestUndetectable(
- BytecodeNode* const last, BytecodeNode* const current) {
+void TransformEqualityWithNullOrUndefined(Bytecode new_bytecode,
+ BytecodeNode* const last,
+ BytecodeNode* const current) {
DCHECK((last->bytecode() == Bytecode::kLdaNull) ||
(last->bytecode() == Bytecode::kLdaUndefined));
- DCHECK_EQ(current->bytecode(), Bytecode::kTestEqual);
- current->set_bytecode(Bytecode::kTestUndetectable, current->operand(0));
+ DCHECK((current->bytecode() == Bytecode::kTestEqual) ||
+ (current->bytecode() == Bytecode::kTestEqualStrict));
+ current->set_bytecode(new_bytecode, current->operand(0));
if (last->source_info().is_valid()) {
current->set_source_info(last->source_info());
}
@@ -262,13 +264,12 @@ void BytecodePeepholeOptimizer::
}
}
-void BytecodePeepholeOptimizer::
- TransformEqualityWithNullOrUndefinedToTestUndetectableAction(
- BytecodeNode* const node, const PeepholeActionAndData* action_data) {
+void BytecodePeepholeOptimizer::TransformEqualityWithNullOrUndefinedAction(
+ BytecodeNode* const node, const PeepholeActionAndData* action_data) {
DCHECK(LastIsValid());
DCHECK(!Bytecodes::IsJump(node->bytecode()));
// Fused last and current into current.
- TransformEqualityWithNullOrUndefinedToTestUndetectable(last(), node);
+ TransformEqualityWithNullOrUndefined(action_data->bytecode, last(), node);
SetLast(node);
}

Powered by Google App Engine
This is Rietveld 408576698