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

Unified Diff: src/crankshaft/ia32/lithium-codegen-ia32.cc

Issue 2498563002: [cleanup] Replace ToBooleanICStub::Types with ToBooleanHints (Closed)
Patch Set: Created 4 years, 1 month 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/crankshaft/hydrogen-osr.cc ('k') | src/crankshaft/ia32/lithium-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/ia32/lithium-codegen-ia32.cc
diff --git a/src/crankshaft/ia32/lithium-codegen-ia32.cc b/src/crankshaft/ia32/lithium-codegen-ia32.cc
index ec885682ff4dc1f23796060e7c16f95fdf270a75..985a5a49de1109080a9f5f912a0110aced75778a 100644
--- a/src/crankshaft/ia32/lithium-codegen-ia32.cc
+++ b/src/crankshaft/ia32/lithium-codegen-ia32.cc
@@ -1854,16 +1854,15 @@ void LCodeGen::DoBranch(LBranch* instr) {
__ cmp(FieldOperand(reg, String::kLengthOffset), Immediate(0));
EmitBranch(instr, not_equal);
} else {
- ToBooleanICStub::Types expected =
- instr->hydrogen()->expected_input_types();
- if (expected.IsEmpty()) expected = ToBooleanICStub::Types::Generic();
+ ToBooleanHints expected = instr->hydrogen()->expected_input_types();
+ if (expected == ToBooleanHint::kNone) expected = ToBooleanHint::kAny;
- if (expected.Contains(ToBooleanICStub::UNDEFINED)) {
+ if (expected & ToBooleanHint::kUndefined) {
// undefined -> false.
__ cmp(reg, factory()->undefined_value());
__ j(equal, instr->FalseLabel(chunk_));
}
- if (expected.Contains(ToBooleanICStub::BOOLEAN)) {
+ if (expected & ToBooleanHint::kBoolean) {
// true -> true.
__ cmp(reg, factory()->true_value());
__ j(equal, instr->TrueLabel(chunk_));
@@ -1871,30 +1870,30 @@ void LCodeGen::DoBranch(LBranch* instr) {
__ cmp(reg, factory()->false_value());
__ j(equal, instr->FalseLabel(chunk_));
}
- if (expected.Contains(ToBooleanICStub::NULL_TYPE)) {
+ if (expected & ToBooleanHint::kNull) {
// 'null' -> false.
__ cmp(reg, factory()->null_value());
__ j(equal, instr->FalseLabel(chunk_));
}
- if (expected.Contains(ToBooleanICStub::SMI)) {
+ if (expected & ToBooleanHint::kSmallInteger) {
// Smis: 0 -> false, all other -> true.
__ test(reg, Operand(reg));
__ j(equal, instr->FalseLabel(chunk_));
__ JumpIfSmi(reg, instr->TrueLabel(chunk_));
- } else if (expected.NeedsMap()) {
+ } else if (expected & ToBooleanHint::kNeedsMap) {
// If we need a map later and have a Smi -> deopt.
__ test(reg, Immediate(kSmiTagMask));
DeoptimizeIf(zero, instr, DeoptimizeReason::kSmi);
}
Register map = no_reg; // Keep the compiler happy.
- if (expected.NeedsMap()) {
+ if (expected & ToBooleanHint::kNeedsMap) {
map = ToRegister(instr->temp());
DCHECK(!map.is(reg));
__ mov(map, FieldOperand(reg, HeapObject::kMapOffset));
- if (expected.CanBeUndetectable()) {
+ if (expected & ToBooleanHint::kCanBeUndetectable) {
// Undetectable -> false.
__ test_b(FieldOperand(map, Map::kBitFieldOffset),
Immediate(1 << Map::kIsUndetectable));
@@ -1902,13 +1901,13 @@ void LCodeGen::DoBranch(LBranch* instr) {
}
}
- if (expected.Contains(ToBooleanICStub::SPEC_OBJECT)) {
+ if (expected & ToBooleanHint::kReceiver) {
// spec object -> true.
__ CmpInstanceType(map, FIRST_JS_RECEIVER_TYPE);
__ j(above_equal, instr->TrueLabel(chunk_));
}
- if (expected.Contains(ToBooleanICStub::STRING)) {
+ if (expected & ToBooleanHint::kString) {
// String value -> false iff empty.
Label not_string;
__ CmpInstanceType(map, FIRST_NONSTRING_TYPE);
@@ -1919,19 +1918,19 @@ void LCodeGen::DoBranch(LBranch* instr) {
__ bind(&not_string);
}
- if (expected.Contains(ToBooleanICStub::SYMBOL)) {
+ if (expected & ToBooleanHint::kSymbol) {
// Symbol value -> true.
__ CmpInstanceType(map, SYMBOL_TYPE);
__ j(equal, instr->TrueLabel(chunk_));
}
- if (expected.Contains(ToBooleanICStub::SIMD_VALUE)) {
+ if (expected & ToBooleanHint::kSimdValue) {
// SIMD value -> true.
__ CmpInstanceType(map, SIMD128_VALUE_TYPE);
__ j(equal, instr->TrueLabel(chunk_));
}
- if (expected.Contains(ToBooleanICStub::HEAP_NUMBER)) {
+ if (expected & ToBooleanHint::kHeapNumber) {
// heap number -> false iff +0, -0, or NaN.
Label not_heap_number;
__ cmp(FieldOperand(reg, HeapObject::kMapOffset),
@@ -1945,7 +1944,7 @@ void LCodeGen::DoBranch(LBranch* instr) {
__ bind(&not_heap_number);
}
- if (!expected.IsGeneric()) {
+ if (expected != ToBooleanHint::kAny) {
// We've seen something for the first time -> deopt.
// This can only happen if we are not generic already.
DeoptimizeIf(no_condition, instr, DeoptimizeReason::kUnexpectedObject);
« no previous file with comments | « src/crankshaft/hydrogen-osr.cc ('k') | src/crankshaft/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698