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

Unified Diff: src/compiler/bytecode-graph-builder.cc

Issue 2793923002: [Interpreter] Optimize code of the form 'if (x === undefined)'. (Closed)
Patch Set: Rebase Created 3 years, 9 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
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/interpreter/bytecode-array-builder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/bytecode-graph-builder.cc
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc
index 90e654addb55f94d4aa723a7ab5a21a874db89b1..9e8e2b53dbdd22447f3997554248d62e7b9ee079 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -1943,23 +1943,20 @@ void BytecodeGraphBuilder::VisitTestInstanceOf() {
}
void BytecodeGraphBuilder::VisitTestUndetectable() {
- Node* object =
- environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
+ Node* object = environment()->LookupAccumulator();
Node* node = NewNode(jsgraph()->simplified()->ObjectIsUndetectable(), object);
environment()->BindAccumulator(node);
}
void BytecodeGraphBuilder::VisitTestNull() {
- Node* object =
- environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
+ Node* object = environment()->LookupAccumulator();
Node* result = NewNode(simplified()->ReferenceEqual(), object,
jsgraph()->NullConstant());
environment()->BindAccumulator(result);
}
void BytecodeGraphBuilder::VisitTestUndefined() {
- Node* object =
- environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
+ Node* object = environment()->LookupAccumulator();
Node* result = NewNode(simplified()->ReferenceEqual(), object,
jsgraph()->UndefinedConstant());
environment()->BindAccumulator(result);
@@ -2082,6 +2079,14 @@ void BytecodeGraphBuilder::VisitJumpIfNullConstant() {
BuildJumpIfEqual(jsgraph()->NullConstant());
}
+void BytecodeGraphBuilder::VisitJumpIfNotNull() {
+ BuildJumpIfNotEqual(jsgraph()->NullConstant());
+}
+
+void BytecodeGraphBuilder::VisitJumpIfNotNullConstant() {
+ BuildJumpIfNotEqual(jsgraph()->NullConstant());
+}
+
void BytecodeGraphBuilder::VisitJumpIfUndefined() {
BuildJumpIfEqual(jsgraph()->UndefinedConstant());
}
@@ -2090,6 +2095,14 @@ void BytecodeGraphBuilder::VisitJumpIfUndefinedConstant() {
BuildJumpIfEqual(jsgraph()->UndefinedConstant());
}
+void BytecodeGraphBuilder::VisitJumpIfNotUndefined() {
+ BuildJumpIfNotEqual(jsgraph()->UndefinedConstant());
+}
+
+void BytecodeGraphBuilder::VisitJumpIfNotUndefinedConstant() {
+ BuildJumpIfNotEqual(jsgraph()->UndefinedConstant());
+}
+
void BytecodeGraphBuilder::VisitJumpLoop() { BuildJump(); }
void BytecodeGraphBuilder::VisitStackCheck() {
@@ -2365,6 +2378,13 @@ void BytecodeGraphBuilder::BuildJumpIfEqual(Node* comperand) {
BuildJumpIf(condition);
}
+void BytecodeGraphBuilder::BuildJumpIfNotEqual(Node* comperand) {
+ Node* accumulator = environment()->LookupAccumulator();
+ Node* condition =
+ NewNode(simplified()->ReferenceEqual(), accumulator, comperand);
+ BuildJumpIfNot(condition);
+}
+
void BytecodeGraphBuilder::BuildJumpIfFalse() {
NewBranch(environment()->LookupAccumulator());
Environment* if_true_environment = environment()->Copy();
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/interpreter/bytecode-array-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698