| Index: src/crankshaft/mips64/lithium-codegen-mips64.cc
|
| diff --git a/src/crankshaft/mips64/lithium-codegen-mips64.cc b/src/crankshaft/mips64/lithium-codegen-mips64.cc
|
| index 5c0f41e460830d9de2177f0659d7f94bb2f6a017..3c4eb541c00fd50d4534d2a6fbcb880111b2d05f 100644
|
| --- a/src/crankshaft/mips64/lithium-codegen-mips64.cc
|
| +++ b/src/crankshaft/mips64/lithium-codegen-mips64.cc
|
| @@ -37,6 +37,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()->
|
|
|
| @@ -2057,43 +2076,42 @@ void LCodeGen::DoBranch(LBranch* instr) {
|
| __ ld(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) {
|
| __ ld(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));
|
| @@ -2101,14 +2119,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));
|
| @@ -2119,14 +2137,14 @@ void LCodeGen::DoBranch(LBranch* instr) {
|
| __ bind(¬_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));
|
| @@ -2134,7 +2152,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;
|
| @@ -2148,7 +2166,7 @@ void LCodeGen::DoBranch(LBranch* instr) {
|
| __ bind(¬_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,
|
|
|