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

Unified Diff: src/interpreter/interpreter.cc

Issue 1985033002: [Interpreter] Change LogicalNot to ToBooleanLogicalNot and add non-ToBoolean version. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 7 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/interpreter/interpreter.h ('k') | src/interpreter/interpreter-assembler.h » ('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 323e9bec6b810652f79bf9d88d2e2d6234f86363..6eee48a045574c1a336cf6297105a348df164c95 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -862,22 +862,11 @@ void Interpreter::DoDec(InterpreterAssembler* assembler) {
DoCountOp(CodeFactory::Dec(isolate_), assembler);
}
-
-// LogicalNot
-//
-// Perform logical-not on the accumulator, first casting the
-// accumulator to a boolean value if required.
-void Interpreter::DoLogicalNot(InterpreterAssembler* assembler) {
- Callable callable = CodeFactory::ToBoolean(isolate_);
- Node* target = __ HeapConstant(callable.code());
- Node* accumulator = __ GetAccumulator();
- Node* context = __ GetContext();
- Node* to_boolean_value =
- __ CallStub(callable.descriptor(), target, context, accumulator);
+void Interpreter::DoLogicalNotOp(Node* value, InterpreterAssembler* assembler) {
Label if_true(assembler), if_false(assembler), end(assembler);
Node* true_value = __ BooleanConstant(true);
Node* false_value = __ BooleanConstant(false);
- __ BranchIfWordEqual(to_boolean_value, true_value, &if_true, &if_false);
+ __ BranchIfWordEqual(value, true_value, &if_true, &if_false);
__ Bind(&if_true);
{
__ SetAccumulator(false_value);
@@ -885,10 +874,38 @@ void Interpreter::DoLogicalNot(InterpreterAssembler* assembler) {
}
__ Bind(&if_false);
{
+ if (FLAG_debug_code) {
+ __ AbortIfWordNotEqual(value, false_value,
+ BailoutReason::kExpectedBooleanValue);
+ }
__ SetAccumulator(true_value);
__ Goto(&end);
}
__ Bind(&end);
+}
+
+// ToBooleanLogicalNot
+//
+// Perform logical-not on the accumulator, first casting the
+// accumulator to a boolean value if required.
+void Interpreter::DoToBooleanLogicalNot(InterpreterAssembler* assembler) {
+ Callable callable = CodeFactory::ToBoolean(isolate_);
+ Node* target = __ HeapConstant(callable.code());
+ Node* accumulator = __ GetAccumulator();
+ Node* context = __ GetContext();
+ Node* to_boolean_value =
+ __ CallStub(callable.descriptor(), target, context, accumulator);
+ DoLogicalNotOp(to_boolean_value, assembler);
+ __ Dispatch();
+}
+
+// LogicalNot
+//
+// Perform logical-not on the accumulator, which must already be a boolean
+// value.
+void Interpreter::DoLogicalNot(InterpreterAssembler* assembler) {
+ Node* value = __ GetAccumulator();
+ DoLogicalNotOp(value, assembler);
__ Dispatch();
}
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/interpreter/interpreter-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698