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

Unified Diff: src/interpreter/interpreter.cc

Issue 2554723004: [Interpreter] Transform StrictEquality with null/undefined to special bytecodes. (Closed)
Patch Set: rebased the patch. 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 b6716b344291a8065044976bacdeb6cd279be570..559d122202e2d6cec82b08f32e5bfdeec701812f 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -1942,7 +1942,7 @@ void Interpreter::DoTestInstanceOf(InterpreterAssembler* assembler) {
// TestUndetectable <src>
//
-// Test if the value in the <src> register equals to Null/Undefined. This is
+// 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);
@@ -1972,6 +1972,53 @@ void Interpreter::DoTestUndetectable(InterpreterAssembler* assembler) {
__ Dispatch();
}
+// TestNull <src>
+//
+// Test if the value in the <src> register is strictly equal to null.
+void Interpreter::DoTestNull(InterpreterAssembler* assembler) {
+ Node* reg_index = __ BytecodeOperandReg(0);
+ Node* object = __ LoadRegister(reg_index);
+ Node* null_value = __ HeapConstant(isolate_->factory()->null_value());
+
+ Label equal(assembler), end(assembler);
+ __ GotoIf(__ WordEqual(object, null_value), &equal);
+ __ SetAccumulator(__ BooleanConstant(false));
+ __ Goto(&end);
+
+ __ Bind(&equal);
+ {
+ __ SetAccumulator(__ BooleanConstant(true));
+ __ Goto(&end);
+ }
+
+ __ Bind(&end);
+ __ Dispatch();
+}
+
+// TestUndefined <src>
+//
+// Test if the value in the <src> register is strictly equal to undefined.
+void Interpreter::DoTestUndefined(InterpreterAssembler* assembler) {
+ Node* reg_index = __ BytecodeOperandReg(0);
+ Node* object = __ LoadRegister(reg_index);
+ Node* undefined_value =
+ __ HeapConstant(isolate_->factory()->undefined_value());
+
+ Label equal(assembler), end(assembler);
+ __ GotoIf(__ WordEqual(object, undefined_value), &equal);
+ __ SetAccumulator(__ BooleanConstant(false));
+ __ Goto(&end);
+
+ __ Bind(&equal);
+ {
+ __ SetAccumulator(__ BooleanConstant(true));
+ __ 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