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

Unified Diff: src/interpreter/bytecode-array-builder.cc

Issue 1507683005: [Interpreter] Removes ToBoolean bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased the patch. Created 5 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/compiler/bytecode-graph-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index 7f0fe60c4453a737df5511b95d620d4f14e81d2c..eb4ef36bae0493609d44fab7a496ffd95af08125 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -593,8 +593,6 @@ bool BytecodeArrayBuilder::NeedToBooleanCast() {
}
PreviousBytecodeHelper previous_bytecode(*this);
switch (previous_bytecode.GetBytecode()) {
- case Bytecode::kToBoolean:
- UNREACHABLE();
// If the previous bytecode puts a boolean in the accumulator return true.
case Bytecode::kLdaTrue:
case Bytecode::kLdaFalse:
@@ -617,38 +615,6 @@ bool BytecodeArrayBuilder::NeedToBooleanCast() {
}
-BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToBoolean() {
- if (!LastBytecodeInSameBlock()) {
- Output(Bytecode::kToBoolean);
- return *this;
- }
- // If the previous bytecode puts a boolean in the accumulator
- // there is no need to emit an instruction.
- if (NeedToBooleanCast()) {
- PreviousBytecodeHelper previous_bytecode(*this);
- switch (previous_bytecode.GetBytecode()) {
- // If the previous bytecode is a constant evaluate it and return false.
- case Bytecode::kLdaZero: {
- LoadFalse();
- break;
- }
- case Bytecode::kLdaSmi8: {
- LoadBooleanConstant(previous_bytecode.GetOperand(0) != 0);
- break;
- }
- case Bytecode::kLdaConstant: {
- Handle<Object> object = previous_bytecode.GetConstantForIndexOperand(0);
- LoadBooleanConstant(object->BooleanValue());
- break;
- }
- default:
- Output(Bytecode::kToBoolean);
- }
- }
- return *this;
-}
-
-
BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToJSObject() {
Output(Bytecode::kToObject);
return *this;
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698