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

Unified Diff: src/interpreter/interpreter.cc

Issue 2547043002: [Interpreter] Optimize equality check with null/undefined with a check on the map. (Closed)
Patch Set: Address comments from Ross. 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
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/interpreter/mkpeephole.cc » ('j') | 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 bb731b455bf4afa740027200449273555cdb45bf..99433aeb8a60f60027a958bf1fd78ee47eee229a 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -1937,6 +1937,38 @@ void Interpreter::DoTestInstanceOf(InterpreterAssembler* assembler) {
DoCompareOp(Token::INSTANCEOF, assembler);
}
+// TestUndetectable <src>
+//
+// Test if the value in the <src> register equals to Null/Undefined. This is
+// done by checking undetectable bit on the map of the object.
+void Interpreter::DoTestUndetectable(InterpreterAssembler* assembler) {
+ Node* reg_index = __ BytecodeOperandReg(0);
+ Node* object = __ LoadRegister(reg_index);
+
+ Label not_equal(assembler), end(assembler);
+ // If the object is an Smi then return false.
+ __ GotoIf(__ TaggedIsSmi(object), &not_equal);
+
+ // If it is a HeapObject, load the map and check for undetectable bit.
+ Node* map = __ LoadMap(object);
+ Node* map_bitfield = __ LoadMapBitField(map);
+ Node* map_undetectable =
+ __ Word32And(map_bitfield, __ Int32Constant(1 << Map::kIsUndetectable));
+ __ GotoIf(__ Word32Equal(map_undetectable, __ Int32Constant(0)), &not_equal);
+
+ __ SetAccumulator(__ BooleanConstant(true));
+ __ Goto(&end);
+
+ __ Bind(&not_equal);
+ {
+ __ SetAccumulator(__ BooleanConstant(false));
+ __ Goto(&end);
+ }
+
+ __ Bind(&end);
+ __ Dispatch();
+}
+
// Jump <imm>
//
// Jump by number of bytes represented by the immediate operand |imm|.
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/interpreter/mkpeephole.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698