Revert "Revert "Upgrade to 5.0.71.48"" DO NOT MERGE
This reverts commit f2e3994fa5148cc3d9946666f0b0596290192b0e,
and updates the x64 makefile properly so it doesn't break that
build.
FPIIM-449
Change-Id: Ib83e35bfbae6af627451c926a9650ec57c045605
(cherry picked from commit 109988c7ccb6f3fd1a58574fa3dfb88beaef6632)
diff --git a/src/crankshaft/mips/lithium-codegen-mips.cc b/src/crankshaft/mips/lithium-codegen-mips.cc
index 2414f0d..8febb57 100644
--- a/src/crankshaft/mips/lithium-codegen-mips.cc
+++ b/src/crankshaft/mips/lithium-codegen-mips.cc
@@ -83,7 +83,7 @@
void LCodeGen::FinishCode(Handle<Code> code) {
DCHECK(is_done());
- code->set_stack_slots(GetStackSlotCount());
+ code->set_stack_slots(GetTotalFrameSlotCount());
code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
PopulateDeoptimizationData(code);
}
@@ -127,13 +127,6 @@
if (info()->IsOptimizing()) {
ProfileEntryHookStub::MaybeCallEntryHook(masm_);
-#ifdef DEBUG
- if (strlen(FLAG_stop_at) > 0 &&
- info_->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
- __ stop("stop_at");
- }
-#endif
-
// a1: Callee's JS function.
// cp: Callee's context.
// fp: Caller's frame pointer.
@@ -379,7 +372,7 @@
bool LCodeGen::GenerateSafepointTable() {
DCHECK(is_done());
- safepoints_.Emit(masm(), GetStackSlotCount());
+ safepoints_.Emit(masm(), GetTotalFrameSlotCount());
return !is_aborted();
}
@@ -552,7 +545,7 @@
DCHECK(!op->IsDoubleRegister());
DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
if (NeedsEagerFrame()) {
- return MemOperand(fp, StackSlotOffset(op->index()));
+ return MemOperand(fp, FrameSlotToFPOffset(op->index()));
} else {
// Retrieve parameter without eager stack-frame relative to the
// stack-pointer.
@@ -564,7 +557,7 @@
MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const {
DCHECK(op->IsDoubleStackSlot());
if (NeedsEagerFrame()) {
- return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize);
+ return MemOperand(fp, FrameSlotToFPOffset(op->index()) + kPointerSize);
} else {
// Retrieve parameter without eager stack-frame relative to the
// stack-pointer.
@@ -633,9 +626,6 @@
if (op->IsStackSlot()) {
int index = op->index();
- if (index >= 0) {
- index += StandardFrameConstants::kFixedFrameSize / kPointerSize;
- }
if (is_tagged) {
translation->StoreStackSlot(index);
} else if (is_uint32) {
@@ -645,9 +635,6 @@
}
} else if (op->IsDoubleStackSlot()) {
int index = op->index();
- if (index >= 0) {
- index += StandardFrameConstants::kFixedFrameSize / kPointerSize;
- }
translation->StoreDoubleStackSlot(index);
} else if (op->IsRegister()) {
Register reg = ToRegister(op);
@@ -946,26 +933,6 @@
}
-void LCodeGen::DoCallStub(LCallStub* instr) {
- DCHECK(ToRegister(instr->context()).is(cp));
- DCHECK(ToRegister(instr->result()).is(v0));
- switch (instr->hydrogen()->major_key()) {
- case CodeStub::RegExpExec: {
- RegExpExecStub stub(isolate());
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
- break;
- }
- case CodeStub::SubString: {
- SubStringStub stub(isolate());
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
- break;
- }
- default:
- UNREACHABLE();
- }
-}
-
-
void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
GenerateOsrPrologue();
}
@@ -1411,8 +1378,7 @@
if (constant < 0) __ Subu(result, zero_reg, result);
} else if (base::bits::IsPowerOfTwo32(constant_abs - 1)) {
int32_t shift = WhichPowerOf2(constant_abs - 1);
- __ sll(scratch, left, shift);
- __ Addu(result, scratch, left);
+ __ Lsa(result, left, left, shift);
// Correct the sign of the result if the constant is negative.
if (constant < 0) __ Subu(result, zero_reg, result);
} else if (base::bits::IsPowerOfTwo32(constant_abs + 1)) {
@@ -1652,13 +1618,6 @@
}
-void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) {
- Register result = ToRegister(instr->result());
- Register map = ToRegister(instr->value());
- __ EnumLength(result, map);
-}
-
-
MemOperand LCodeGen::BuildSeqStringOperand(Register string,
LOperand* index,
String::Encoding encoding) {
@@ -1804,8 +1763,14 @@
__ BranchF(&return_left, NULL, ne, left_reg, kDoubleRegZero);
// At this point, both left and right are either 0 or -0.
if (operation == HMathMinMax::kMathMin) {
+ // The algorithm is: -((-L) + (-R)), which in case of L and R being
+ // different registers is most efficiently expressed as -((-L) - R).
__ neg_d(left_reg, left_reg);
- __ sub_d(result_reg, left_reg, right_reg);
+ if (left_reg.is(right_reg)) {
+ __ add_d(result_reg, left_reg, right_reg);
+ } else {
+ __ sub_d(result_reg, left_reg, right_reg);
+ }
__ neg_d(result_reg, result_reg);
} else {
__ add_d(result_reg, left_reg, right_reg);
@@ -1877,8 +1842,7 @@
DCHECK(ToRegister(instr->right()).is(a0));
DCHECK(ToRegister(instr->result()).is(v0));
- Handle<Code> code =
- CodeFactory::BinaryOpIC(isolate(), instr->op(), instr->strength()).code();
+ Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), instr->op()).code();
CallCode(code, RelocInfo::CODE_TARGET, instr);
// Other arch use a nop here, to signal that there is no inlined
// patchable code. Mips does not need the nop, since our marker
@@ -2159,8 +2123,9 @@
// We can statically evaluate the comparison.
double left_val = ToDouble(LConstantOperand::cast(left));
double right_val = ToDouble(LConstantOperand::cast(right));
- int next_block = EvalComparison(instr->op(), left_val, right_val) ?
- instr->TrueDestination(chunk_) : instr->FalseDestination(chunk_);
+ int next_block = Token::EvalComparison(instr->op(), left_val, right_val)
+ ? instr->TrueDestination(chunk_)
+ : instr->FalseDestination(chunk_);
EmitGoto(next_block);
} else {
if (instr->is_double()) {
@@ -2235,32 +2200,6 @@
}
-void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
- Representation rep = instr->hydrogen()->value()->representation();
- DCHECK(!rep.IsInteger32());
- Register scratch = ToRegister(instr->temp());
-
- if (rep.IsDouble()) {
- DoubleRegister value = ToDoubleRegister(instr->value());
- EmitFalseBranchF(instr, ne, value, kDoubleRegZero);
- __ FmoveHigh(scratch, value);
- __ li(at, 0x80000000);
- } else {
- Register value = ToRegister(instr->value());
- __ CheckMap(value,
- scratch,
- Heap::kHeapNumberMapRootIndex,
- instr->FalseLabel(chunk()),
- DO_SMI_CHECK);
- __ lw(scratch, FieldMemOperand(value, HeapNumber::kExponentOffset));
- EmitFalseBranch(instr, ne, scratch, Operand(0x80000000));
- __ lw(scratch, FieldMemOperand(value, HeapNumber::kMantissaOffset));
- __ mov(at, zero_reg);
- }
- EmitBranch(instr, eq, scratch, Operand(at));
-}
-
-
Condition LCodeGen::EmitIsString(Register input,
Register temp1,
Label* is_not_string,
@@ -2530,8 +2469,7 @@
DCHECK(ToRegister(instr->context()).is(cp));
Token::Value op = instr->op();
- Handle<Code> ic =
- CodeFactory::CompareIC(isolate(), op, instr->strength()).code();
+ Handle<Code> ic = CodeFactory::CompareIC(isolate(), op).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
// On MIPS there is no need for a "no inlined smi code" marker (nop).
@@ -2577,8 +2515,7 @@
Register reg = ToRegister(instr->parameter_count());
// The argument count parameter is a smi
__ SmiUntag(reg);
- __ sll(at, reg, kPointerSizeLog2);
- __ Addu(sp, sp, at);
+ __ Lsa(sp, sp, reg, kPointerSizeLog2);
}
__ Jump(ra);
@@ -2624,9 +2561,9 @@
__ li(LoadDescriptor::NameRegister(), Operand(instr->name()));
EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr);
- Handle<Code> ic =
- CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(),
- SLOPPY, PREMONOMORPHIC).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(
+ isolate(), instr->typeof_mode(), PREMONOMORPHIC)
+ .code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
@@ -2725,10 +2662,10 @@
// Name is always in a2.
__ li(LoadDescriptor::NameRegister(), Operand(instr->name()));
EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr);
- Handle<Code> ic =
- CodeFactory::LoadICInOptimizedCode(
- isolate(), NOT_INSIDE_TYPEOF, instr->hydrogen()->language_mode(),
- instr->hydrogen()->initialization_state()).code();
+ Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(
+ isolate(), NOT_INSIDE_TYPEOF,
+ instr->hydrogen()->initialization_state())
+ .code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
@@ -2780,8 +2717,7 @@
Register index = ToRegister(instr->index());
__ li(at, Operand(const_length + 1));
__ Subu(result, at, index);
- __ sll(at, result, kPointerSizeLog2);
- __ Addu(at, arguments, at);
+ __ Lsa(at, arguments, result, kPointerSizeLog2);
__ lw(result, MemOperand(at));
}
} else if (instr->index()->IsConstantOperand()) {
@@ -2790,12 +2726,10 @@
int loc = const_index - 1;
if (loc != 0) {
__ Subu(result, length, Operand(loc));
- __ sll(at, result, kPointerSizeLog2);
- __ Addu(at, arguments, at);
+ __ Lsa(at, arguments, result, kPointerSizeLog2);
__ lw(result, MemOperand(at));
} else {
- __ sll(at, length, kPointerSizeLog2);
- __ Addu(at, arguments, at);
+ __ Lsa(at, arguments, length, kPointerSizeLog2);
__ lw(result, MemOperand(at));
}
} else {
@@ -2803,8 +2737,7 @@
Register index = ToRegister(instr->index());
__ Subu(result, length, index);
__ Addu(result, result, 1);
- __ sll(at, result, kPointerSizeLog2);
- __ Addu(at, arguments, at);
+ __ Lsa(at, arguments, result, kPointerSizeLog2);
__ lw(result, MemOperand(at));
}
}
@@ -2883,6 +2816,9 @@
case DICTIONARY_ELEMENTS:
case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
+ case FAST_STRING_WRAPPER_ELEMENTS:
+ case SLOW_STRING_WRAPPER_ELEMENTS:
+ case NO_ELEMENTS:
UNREACHABLE();
break;
}
@@ -2913,8 +2849,7 @@
key = ToRegister(instr->key());
int shift_size = (instr->hydrogen()->key()->representation().IsSmi())
? (element_size_shift - kSmiTagSize) : element_size_shift;
- __ sll(at, key, shift_size);
- __ Addu(scratch, scratch, at);
+ __ Lsa(scratch, scratch, key, shift_size);
}
__ ldc1(result, MemOperand(scratch));
@@ -2945,11 +2880,9 @@
// during bound check elimination with the index argument to the bounds
// check, which can be tagged, so that case must be handled here, too.
if (instr->hydrogen()->key()->representation().IsSmi()) {
- __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize);
- __ addu(scratch, elements, scratch);
+ __ Lsa(scratch, elements, key, kPointerSizeLog2 - kSmiTagSize);
} else {
- __ sll(scratch, key, kPointerSizeLog2);
- __ addu(scratch, elements, scratch);
+ __ Lsa(scratch, elements, key, kPointerSizeLog2);
}
}
__ lw(result, MemOperand(store_base, offset));
@@ -3042,8 +2975,8 @@
}
Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode(
- isolate(), instr->hydrogen()->language_mode(),
- instr->hydrogen()->initialization_state()).code();
+ isolate(), instr->hydrogen()->initialization_state())
+ .code();
CallCode(ic, RelocInfo::CODE_TARGET, instr);
}
@@ -3683,21 +3616,22 @@
void LCodeGen::DoCallFunction(LCallFunction* instr) {
+ HCallFunction* hinstr = instr->hydrogen();
DCHECK(ToRegister(instr->context()).is(cp));
DCHECK(ToRegister(instr->function()).is(a1));
DCHECK(ToRegister(instr->result()).is(v0));
int arity = instr->arity();
- ConvertReceiverMode mode = instr->hydrogen()->convert_mode();
- if (instr->hydrogen()->HasVectorAndSlot()) {
+ ConvertReceiverMode mode = hinstr->convert_mode();
+ if (hinstr->HasVectorAndSlot()) {
Register slot_register = ToRegister(instr->temp_slot());
Register vector_register = ToRegister(instr->temp_vector());
DCHECK(slot_register.is(a3));
DCHECK(vector_register.is(a2));
AllowDeferredHandleDereference vector_structure_check;
- Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector();
- int index = vector->GetIndex(instr->hydrogen()->slot());
+ Handle<TypeFeedbackVector> vector = hinstr->feedback_vector();
+ int index = vector->GetIndex(hinstr->slot());
__ li(vector_register, vector);
__ li(slot_register, Operand(Smi::FromInt(index)));
@@ -3944,8 +3878,7 @@
address = external_pointer;
}
} else {
- __ sll(address, key, shift_size);
- __ Addu(address, external_pointer, address);
+ __ Lsa(address, external_pointer, key, shift_size);
}
if (elements_kind == FLOAT32_ELEMENTS) {
@@ -3985,6 +3918,9 @@
case DICTIONARY_ELEMENTS:
case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS:
+ case FAST_STRING_WRAPPER_ELEMENTS:
+ case SLOW_STRING_WRAPPER_ELEMENTS:
+ case NO_ELEMENTS:
UNREACHABLE();
break;
}
@@ -4062,11 +3998,9 @@
// during bound check elimination with the index argument to the bounds
// check, which can be tagged, so that case must be handled here, too.
if (instr->hydrogen()->key()->representation().IsSmi()) {
- __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize);
- __ addu(scratch, elements, scratch);
+ __ Lsa(scratch, elements, key, kPointerSizeLog2 - kSmiTagSize);
} else {
- __ sll(scratch, key, kPointerSizeLog2);
- __ addu(scratch, elements, scratch);
+ __ Lsa(scratch, elements, key, kPointerSizeLog2);
}
}
__ sw(value, MemOperand(store_base, offset));
@@ -4353,8 +4287,7 @@
__ Branch(deferred->entry(), hi,
char_code, Operand(String::kMaxOneByteCharCode));
__ LoadRoot(result, Heap::kSingleCharacterStringCacheRootIndex);
- __ sll(scratch, char_code, kPointerSizeLog2);
- __ Addu(result, result, scratch);
+ __ Lsa(result, result, char_code, kPointerSizeLog2);
__ lw(result, FieldMemOperand(result, FixedArray::kHeaderSize));
__ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
__ Branch(deferred->entry(), eq, result, Operand(scratch));
@@ -5294,8 +5227,8 @@
final_branch_condition = eq;
} else if (String::Equals(type_name, factory->undefined_string())) {
- __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
- __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input));
+ __ LoadRoot(at, Heap::kNullValueRootIndex);
+ __ Branch(USE_DELAY_SLOT, false_label, eq, at, Operand(input));
// The first instruction of JumpIfSmi is an And - it is safe in the delay
// slot.
__ JumpIfSmi(input, false_label);
@@ -5482,19 +5415,10 @@
void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
Register result = ToRegister(instr->result());
Register object = ToRegister(instr->object());
- __ And(at, object, kSmiTagMask);
- DeoptimizeIf(eq, instr, Deoptimizer::kSmi, at, Operand(zero_reg));
-
- STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
- __ GetObjectType(object, a1, a1);
- DeoptimizeIf(le, instr, Deoptimizer::kNotAJavaScriptObject, a1,
- Operand(JS_PROXY_TYPE));
Label use_cache, call_runtime;
DCHECK(object.is(a0));
- Register null_value = t1;
- __ LoadRoot(null_value, Heap::kNullValueRootIndex);
- __ CheckEnumCache(null_value, &call_runtime);
+ __ CheckEnumCache(&call_runtime);
__ lw(result, FieldMemOperand(object, HeapObject::kMapOffset));
__ Branch(&use_cache);
@@ -5502,12 +5426,7 @@
// Get the set of properties to enumerate.
__ bind(&call_runtime);
__ push(object);
- CallRuntime(Runtime::kGetPropertyNamesFast, instr);
-
- __ lw(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
- DCHECK(result.is(v0));
- __ LoadRoot(at, Heap::kMetaMapRootIndex);
- DeoptimizeIf(ne, instr, Deoptimizer::kWrongMap, a1, Operand(at));
+ CallRuntime(Runtime::kForInEnumerate, instr);
__ bind(&use_cache);
}
@@ -5622,15 +5541,6 @@
}
-void LCodeGen::DoAllocateBlockContext(LAllocateBlockContext* instr) {
- Handle<ScopeInfo> scope_info = instr->scope_info();
- __ li(at, scope_info);
- __ Push(at, ToRegister(instr->function()));
- CallRuntime(Runtime::kPushBlockContext, instr);
- RecordSafepoint(Safepoint::kNoLazyDeopt);
-}
-
-
#undef __
} // namespace internal