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

Unified Diff: src/interpreter/interpreter.cc

Issue 1399773002: [Interpreter] Adds logical and, logical or and comma operators to interpreter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added a new bytecode to jump by casting the value to boolean. This reduces code size for logical op… Created 5 years, 2 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
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 85fa74fc87a40c5d41643ea6ae151fefb26910b8..270ff58931fbb70a6cb3fb4bff64edb908d2f09b 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -683,6 +683,37 @@ void Interpreter::DoJumpIfTrueConstant(
}
+// JumpIfToBooleanTrue <imm8>
rmcilroy 2015/10/13 15:43:24 nit - group all ToBoolean versions together below
mythria 2015/10/14 13:33:42 Done.
+//
+// Jump by number of bytes represented by an immediate operand if the object
+// referenced by the accumulator is true when the object is cast to boolean.
+void Interpreter::DoJumpIfToBooleanTrue(
+ compiler::InterpreterAssembler* assembler) {
+ Node* accumulator = __ GetAccumulator();
+ Node* relative_jump = __ BytecodeOperandImm8(0);
+ Node* toBoolean = __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator);
rmcilroy 2015/10/13 15:43:24 /s/toBoolean/to_boolean_value (throughout)
mythria 2015/10/14 13:33:42 Done.
+ Node* true_value = __ BooleanConstant(true);
+ __ JumpIfWordEqual(toBoolean, true_value, relative_jump);
+}
+
+
+// JumpIfToBooleanTrueConstant <idx>
+//
+// Jump by number of bytes in the Smi in the |idx| entry in the constant pool
+// if the object referenced by the accumulator is true when the object is cast
+// to boolean.
+void Interpreter::DoJumpIfToBooleanTrueConstant(
+ compiler::InterpreterAssembler* assembler) {
+ Node* accumulator = __ GetAccumulator();
+ Node* toBoolean = __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator);
+ Node* index = __ BytecodeOperandIdx8(0);
+ Node* constant = __ LoadConstantPoolEntry(index);
+ Node* relative_jump = __ SmiUntag(constant);
+ Node* true_value = __ BooleanConstant(true);
+ __ JumpIfWordEqual(toBoolean, true_value, relative_jump);
+}
+
+
// JumpIfFalse <imm8>
//
// Jump by number of bytes represented by an immediate operand if the
@@ -710,6 +741,37 @@ void Interpreter::DoJumpIfFalseConstant(
}
+// JumpIfToBooleanFalse <imm8>
+//
+// Jump by number of bytes represented by an immediate operand if the object
+// referenced by the accumulator is false when the object is cast to boolean.
+void Interpreter::DoJumpIfToBooleanFalse(
+ compiler::InterpreterAssembler* assembler) {
+ Node* accumulator = __ GetAccumulator();
+ Node* relative_jump = __ BytecodeOperandImm8(0);
+ Node* toBoolean = __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator);
+ Node* false_value = __ BooleanConstant(false);
+ __ JumpIfWordEqual(toBoolean, false_value, relative_jump);
+}
+
+
+// JumpIfToBooleanFalseConstant <idx>
+//
+// Jump by number of bytes in the Smi in the |idx| entry in the constant pool
+// if the object referenced by the accumulator is false when the object is cast
+// to boolean.
+void Interpreter::DoJumpIfToBooleanFalseConstant(
+ compiler::InterpreterAssembler* assembler) {
+ Node* accumulator = __ GetAccumulator();
+ Node* toBoolean = __ CallRuntime(Runtime::kInterpreterToBoolean, accumulator);
+ Node* index = __ BytecodeOperandIdx8(0);
+ Node* constant = __ LoadConstantPoolEntry(index);
+ Node* relative_jump = __ SmiUntag(constant);
+ Node* false_value = __ BooleanConstant(false);
+ __ JumpIfWordEqual(toBoolean, false_value, relative_jump);
+}
+
+
// CreateClosure <tenured>
//
// Creates a new closure for SharedFunctionInfo in the accumulator with the

Powered by Google App Engine
This is Rietveld 408576698