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

Unified Diff: src/crankshaft/mips/lithium-codegen-mips.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/mips/lithium-codegen-mips.h ('k') | src/crankshaft/mips/lithium-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/mips/lithium-codegen-mips.cc
diff --git a/src/crankshaft/mips/lithium-codegen-mips.cc b/src/crankshaft/mips/lithium-codegen-mips.cc
index 93801fa070a4a4c0d97d2045968a33e5c44a8f7e..1297aab3439f969309aea4f37d6555168e9bc1d7 100644
--- a/src/crankshaft/mips/lithium-codegen-mips.cc
+++ b/src/crankshaft/mips/lithium-codegen-mips.cc
@@ -61,6 +61,25 @@ 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_->push(ra);
+ codegen_->masm_->CallStub(&stub);
+}
+
+LCodeGen::PushSafepointRegistersScope::~PushSafepointRegistersScope() {
+ DCHECK(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters);
+ RestoreRegistersStateStub stub(codegen_->isolate());
+ codegen_->masm_->push(ra);
+ codegen_->masm_->CallStub(&stub);
+ codegen_->expected_safepoint_kind_ = Safepoint::kSimple;
+}
#define __ masm()->
@@ -1935,43 +1954,42 @@ void LCodeGen::DoBranch(LBranch* instr) {
__ lw(at, FieldMemOperand(reg, String::kLengthOffset));
EmitBranch(instr, ne, at, Operand(zero_reg));
} 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.
__ LoadRoot(at, Heap::kUndefinedValueRootIndex);
__ Branch(instr->FalseLabel(chunk_), eq, reg, Operand(at));
}
- if (expected.Contains(ToBooleanICStub::BOOLEAN)) {
+ if (expected & ToBooleanHint::kBoolean) {
// Boolean -> its value.
__ LoadRoot(at, Heap::kTrueValueRootIndex);
__ Branch(instr->TrueLabel(chunk_), eq, reg, Operand(at));
__ LoadRoot(at, Heap::kFalseValueRootIndex);
__ Branch(instr->FalseLabel(chunk_), eq, reg, Operand(at));
}
- if (expected.Contains(ToBooleanICStub::NULL_TYPE)) {
+ if (expected & ToBooleanHint::kNull) {
// 'null' -> false.
__ LoadRoot(at, Heap::kNullValueRootIndex);
__ Branch(instr->FalseLabel(chunk_), eq, reg, Operand(at));
}
- if (expected.Contains(ToBooleanICStub::SMI)) {
+ if (expected & ToBooleanHint::kSmallInteger) {
// Smis: 0 -> false, all other -> true.
__ Branch(instr->FalseLabel(chunk_), eq, reg, Operand(zero_reg));
__ 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.
__ SmiTst(reg, at);
DeoptimizeIf(eq, instr, DeoptimizeReason::kSmi, at, Operand(zero_reg));
}
const Register map = scratch0();
- if (expected.NeedsMap()) {
+ if (expected & ToBooleanHint::kNeedsMap) {
__ lw(map, FieldMemOperand(reg, HeapObject::kMapOffset));
- if (expected.CanBeUndetectable()) {
+ if (expected & ToBooleanHint::kCanBeUndetectable) {
// Undetectable -> false.
__ lbu(at, FieldMemOperand(map, Map::kBitFieldOffset));
__ And(at, at, Operand(1 << Map::kIsUndetectable));
@@ -1979,14 +1997,14 @@ void LCodeGen::DoBranch(LBranch* instr) {
}
}
- if (expected.Contains(ToBooleanICStub::SPEC_OBJECT)) {
+ if (expected & ToBooleanHint::kReceiver) {
// spec object -> true.
__ lbu(at, FieldMemOperand(map, Map::kInstanceTypeOffset));
__ Branch(instr->TrueLabel(chunk_),
ge, at, Operand(FIRST_JS_RECEIVER_TYPE));
}
- if (expected.Contains(ToBooleanICStub::STRING)) {
+ if (expected & ToBooleanHint::kString) {
// String value -> false iff empty.
Label not_string;
__ lbu(at, FieldMemOperand(map, Map::kInstanceTypeOffset));
@@ -1997,14 +2015,14 @@ void LCodeGen::DoBranch(LBranch* instr) {
__ bind(&not_string);
}
- if (expected.Contains(ToBooleanICStub::SYMBOL)) {
+ if (expected & ToBooleanHint::kSymbol) {
// Symbol value -> true.
const Register scratch = scratch1();
__ lbu(scratch, FieldMemOperand(map, Map::kInstanceTypeOffset));
__ Branch(instr->TrueLabel(chunk_), eq, scratch, Operand(SYMBOL_TYPE));
}
- if (expected.Contains(ToBooleanICStub::SIMD_VALUE)) {
+ if (expected & ToBooleanHint::kSimdValue) {
// SIMD value -> true.
const Register scratch = scratch1();
__ lbu(scratch, FieldMemOperand(map, Map::kInstanceTypeOffset));
@@ -2012,7 +2030,7 @@ void LCodeGen::DoBranch(LBranch* instr) {
Operand(SIMD128_VALUE_TYPE));
}
- if (expected.Contains(ToBooleanICStub::HEAP_NUMBER)) {
+ if (expected & ToBooleanHint::kHeapNumber) {
// heap number -> false iff +0, -0, or NaN.
DoubleRegister dbl_scratch = double_scratch0();
Label not_heap_number;
@@ -2026,7 +2044,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, zero_reg,
« no previous file with comments | « src/crankshaft/mips/lithium-codegen-mips.h ('k') | src/crankshaft/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698