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(); |
} |