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

Unified Diff: src/crankshaft/s390/lithium-codegen-s390.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/s390/lithium-codegen-s390.h ('k') | src/crankshaft/s390/lithium-s390.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/s390/lithium-codegen-s390.cc
diff --git a/src/crankshaft/s390/lithium-codegen-s390.cc b/src/crankshaft/s390/lithium-codegen-s390.cc
index 8cfdc566ccac9982b0c86fd67f50fe561500832b..63b016162b686f9714888a2213c8008a40c177ff 100644
--- a/src/crankshaft/s390/lithium-codegen-s390.cc
+++ b/src/crankshaft/s390/lithium-codegen-s390.cc
@@ -35,6 +35,23 @@ class SafepointGenerator final : public CallWrapper {
Safepoint::DeoptMode deopt_mode_;
};
+LCodeGen::PushSafepointRegistersScope::PushSafepointRegistersScope(
+ LCodeGen* codegen)
+ : codegen_(codegen) {
+ DCHECK(codegen_->info()->is_calling());
+ DCHECK(codegen_->expected_safepoint_kind_ == Safepoint::kSimple);
+ codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters;
+ StoreRegistersStateStub stub(codegen_->isolate());
+ codegen_->masm_->CallStub(&stub);
+}
+
+LCodeGen::PushSafepointRegistersScope::~PushSafepointRegistersScope() {
+ DCHECK(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters);
+ RestoreRegistersStateStub stub(codegen_->isolate());
+ codegen_->masm_->CallStub(&stub);
+ codegen_->expected_safepoint_kind_ = Safepoint::kSimple;
+}
+
#define __ masm()->
bool LCodeGen::GenerateCode() {
@@ -2101,45 +2118,44 @@ void LCodeGen::DoBranch(LBranch* instr) {
__ CmpP(ip, Operand::Zero());
EmitBranch(instr, ne);
} else {
- ToBooleanICStub::Types expected =
- instr->hydrogen()->expected_input_types();
+ ToBooleanHints expected = instr->hydrogen()->expected_input_types();
// Avoid deopts in the case where we've never executed this path before.
- if (expected.IsEmpty()) expected = ToBooleanICStub::Types::Generic();
+ if (expected == ToBooleanHint::kNone) expected = ToBooleanHint::kAny;
- if (expected.Contains(ToBooleanICStub::UNDEFINED)) {
+ if (expected & ToBooleanHint::kUndefined) {
// undefined -> false.
__ CompareRoot(reg, Heap::kUndefinedValueRootIndex);
__ beq(instr->FalseLabel(chunk_));
}
- if (expected.Contains(ToBooleanICStub::BOOLEAN)) {
+ if (expected & ToBooleanHint::kBoolean) {
// Boolean -> its value.
__ CompareRoot(reg, Heap::kTrueValueRootIndex);
__ beq(instr->TrueLabel(chunk_));
__ CompareRoot(reg, Heap::kFalseValueRootIndex);
__ beq(instr->FalseLabel(chunk_));
}
- if (expected.Contains(ToBooleanICStub::NULL_TYPE)) {
+ if (expected & ToBooleanHint::kNull) {
// 'null' -> false.
__ CompareRoot(reg, Heap::kNullValueRootIndex);
__ beq(instr->FalseLabel(chunk_));
}
- if (expected.Contains(ToBooleanICStub::SMI)) {
+ if (expected & ToBooleanHint::kSmallInteger) {
// Smis: 0 -> false, all other -> true.
__ CmpP(reg, Operand::Zero());
__ beq(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.
__ TestIfSmi(reg);
DeoptimizeIf(eq, instr, DeoptimizeReason::kSmi, cr0);
}
const Register map = scratch0();
- if (expected.NeedsMap()) {
+ if (expected & ToBooleanHint::kNeedsMap) {
__ LoadP(map, FieldMemOperand(reg, HeapObject::kMapOffset));
- if (expected.CanBeUndetectable()) {
+ if (expected & ToBooleanHint::kCanBeUndetectable) {
// Undetectable -> false.
__ tm(FieldMemOperand(map, Map::kBitFieldOffset),
Operand(1 << Map::kIsUndetectable));
@@ -2147,13 +2163,13 @@ void LCodeGen::DoBranch(LBranch* instr) {
}
}
- if (expected.Contains(ToBooleanICStub::SPEC_OBJECT)) {
+ if (expected & ToBooleanHint::kReceiver) {
// spec object -> true.
__ CompareInstanceType(map, ip, FIRST_JS_RECEIVER_TYPE);
__ bge(instr->TrueLabel(chunk_));
}
- if (expected.Contains(ToBooleanICStub::STRING)) {
+ if (expected & ToBooleanHint::kString) {
// String value -> false iff empty.
Label not_string;
__ CompareInstanceType(map, ip, FIRST_NONSTRING_TYPE);
@@ -2165,20 +2181,20 @@ void LCodeGen::DoBranch(LBranch* instr) {
__ bind(&not_string);
}
- if (expected.Contains(ToBooleanICStub::SYMBOL)) {
+ if (expected & ToBooleanHint::kSymbol) {
// Symbol value -> true.
__ CompareInstanceType(map, ip, SYMBOL_TYPE);
__ beq(instr->TrueLabel(chunk_));
}
- if (expected.Contains(ToBooleanICStub::SIMD_VALUE)) {
+ if (expected & ToBooleanHint::kSimdValue) {
// SIMD value -> true.
Label not_simd;
__ CompareInstanceType(map, ip, SIMD128_VALUE_TYPE);
__ beq(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;
__ CompareRoot(map, Heap::kHeapNumberMapRootIndex);
@@ -2193,7 +2209,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(al, instr, DeoptimizeReason::kUnexpectedObject);
« no previous file with comments | « src/crankshaft/s390/lithium-codegen-s390.h ('k') | src/crankshaft/s390/lithium-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698