summaryrefslogtreecommitdiff
path: root/deps/v8/src/crankshaft/ia32/lithium-codegen-ia32.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/crankshaft/ia32/lithium-codegen-ia32.cc')
-rw-r--r--deps/v8/src/crankshaft/ia32/lithium-codegen-ia32.cc145
1 files changed, 32 insertions, 113 deletions
diff --git a/deps/v8/src/crankshaft/ia32/lithium-codegen-ia32.cc b/deps/v8/src/crankshaft/ia32/lithium-codegen-ia32.cc
index 4ec33ab146..a535153e18 100644
--- a/deps/v8/src/crankshaft/ia32/lithium-codegen-ia32.cc
+++ b/deps/v8/src/crankshaft/ia32/lithium-codegen-ia32.cc
@@ -74,7 +74,7 @@ bool LCodeGen::GenerateCode() {
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);
if (info()->ShouldEnsureSpaceForLazyDeopt()) {
@@ -131,13 +131,6 @@ bool LCodeGen::GeneratePrologue() {
if (info()->IsOptimizing()) {
ProfileEntryHookStub::MaybeCallEntryHook(masm_);
-#ifdef DEBUG
- if (strlen(FLAG_stop_at) > 0 &&
- info_->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
- __ int3();
- }
-#endif
-
if (support_aligned_spilled_doubles_ && dynamic_frame_alignment_) {
// Move state of dynamic frame alignment into edx.
__ Move(edx, Immediate(kNoAlignmentPadding));
@@ -490,7 +483,7 @@ bool LCodeGen::GenerateSafepointTable() {
masm()->nop();
}
}
- safepoints_.Emit(masm(), GetStackSlotCount());
+ safepoints_.Emit(masm(), GetTotalFrameSlotCount());
return !is_aborted();
}
@@ -578,7 +571,7 @@ Operand LCodeGen::ToOperand(LOperand* op) const {
if (op->IsDoubleRegister()) return Operand(ToDoubleRegister(op));
DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
if (NeedsEagerFrame()) {
- return Operand(ebp, StackSlotOffset(op->index()));
+ return Operand(ebp, FrameSlotToFPOffset(op->index()));
} else {
// Retrieve parameter without eager stack-frame relative to the
// stack-pointer.
@@ -590,7 +583,7 @@ Operand LCodeGen::ToOperand(LOperand* op) const {
Operand LCodeGen::HighOperand(LOperand* op) {
DCHECK(op->IsDoubleStackSlot());
if (NeedsEagerFrame()) {
- return Operand(ebp, StackSlotOffset(op->index()) + kPointerSize);
+ return Operand(ebp, FrameSlotToFPOffset(op->index()) + kPointerSize);
} else {
// Retrieve parameter without eager stack-frame relative to the
// stack-pointer.
@@ -659,9 +652,6 @@ void LCodeGen::AddToTranslation(LEnvironment* environment,
if (op->IsStackSlot()) {
int index = op->index();
- if (index >= 0) {
- index += StandardFrameConstants::kFixedFrameSize / kPointerSize;
- }
if (is_tagged) {
translation->StoreStackSlot(index);
} else if (is_uint32) {
@@ -671,9 +661,6 @@ void LCodeGen::AddToTranslation(LEnvironment* environment,
}
} 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);
@@ -983,26 +970,6 @@ void LCodeGen::DoParameter(LParameter* instr) {
}
-void LCodeGen::DoCallStub(LCallStub* instr) {
- DCHECK(ToRegister(instr->context()).is(esi));
- DCHECK(ToRegister(instr->result()).is(eax));
- 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();
}
@@ -1668,13 +1635,6 @@ void LCodeGen::DoConstantT(LConstantT* instr) {
}
-void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) {
- Register result = ToRegister(instr->result());
- Register map = ToRegister(instr->value());
- __ EnumLength(result, map);
-}
-
-
Operand LCodeGen::BuildSeqStringOperand(Register string,
LOperand* index,
String::Encoding encoding) {
@@ -1923,8 +1883,7 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
DCHECK(ToRegister(instr->right()).is(eax));
DCHECK(ToRegister(instr->result()).is(eax));
- 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);
}
@@ -2167,8 +2126,9 @@ void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) {
// 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()) {
@@ -2230,34 +2190,6 @@ void LCodeGen::DoCmpHoleAndBranch(LCmpHoleAndBranch* instr) {
}
-void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) {
- Representation rep = instr->hydrogen()->value()->representation();
- DCHECK(!rep.IsInteger32());
- Register scratch = ToRegister(instr->temp());
-
- if (rep.IsDouble()) {
- XMMRegister value = ToDoubleRegister(instr->value());
- XMMRegister xmm_scratch = double_scratch0();
- __ xorps(xmm_scratch, xmm_scratch);
- __ ucomisd(xmm_scratch, value);
- EmitFalseBranch(instr, not_equal);
- __ movmskpd(scratch, value);
- __ test(scratch, Immediate(1));
- EmitBranch(instr, not_zero);
- } else {
- Register value = ToRegister(instr->value());
- Handle<Map> map = masm()->isolate()->factory()->heap_number_map();
- __ CheckMap(value, map, instr->FalseLabel(chunk()), DO_SMI_CHECK);
- __ cmp(FieldOperand(value, HeapNumber::kExponentOffset),
- Immediate(0x1));
- EmitFalseBranch(instr, no_overflow);
- __ cmp(FieldOperand(value, HeapNumber::kMantissaOffset),
- Immediate(0x00000000));
- EmitBranch(instr, equal);
- }
-}
-
-
Condition LCodeGen::EmitIsString(Register input,
Register temp1,
Label* is_not_string,
@@ -2516,8 +2448,7 @@ void LCodeGen::DoHasInPrototypeChainAndBranch(
void LCodeGen::DoCmpT(LCmpT* instr) {
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);
Condition condition = ComputeCompareCondition(op);
@@ -2643,9 +2574,9 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {
__ mov(LoadDescriptor::NameRegister(), 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);
}
@@ -2760,10 +2691,10 @@ void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
__ mov(LoadDescriptor::NameRegister(), 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);
}
@@ -2877,6 +2808,9 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
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;
}
@@ -2996,8 +2930,8 @@ void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) {
}
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);
}
@@ -3657,21 +3591,22 @@ void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
void LCodeGen::DoCallFunction(LCallFunction* instr) {
+ HCallFunction* hinstr = instr->hydrogen();
DCHECK(ToRegister(instr->context()).is(esi));
DCHECK(ToRegister(instr->function()).is(edi));
DCHECK(ToRegister(instr->result()).is(eax));
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(edx));
DCHECK(vector_register.is(ebx));
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());
__ mov(vector_register, vector);
__ mov(slot_register, Immediate(Smi::FromInt(index)));
@@ -3947,6 +3882,9 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
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;
}
@@ -5155,8 +5093,8 @@ Condition LCodeGen::EmitTypeofIs(LTypeofIsAndBranch* instr, Register input) {
final_branch_condition = equal;
} else if (String::Equals(type_name, factory()->undefined_string())) {
- __ cmp(input, factory()->undefined_value());
- __ j(equal, true_label, true_distance);
+ __ cmp(input, factory()->null_value());
+ __ j(equal, false_label, false_distance);
__ JumpIfSmi(input, false_label, false_distance);
// Check for undetectable objects => true.
__ mov(input, FieldOperand(input, HeapObject::kMapOffset));
@@ -5328,12 +5266,6 @@ void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
DCHECK(ToRegister(instr->context()).is(esi));
- __ test(eax, Immediate(kSmiTagMask));
- DeoptimizeIf(zero, instr, Deoptimizer::kSmi);
-
- STATIC_ASSERT(JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE);
- __ CmpObjectType(eax, JS_PROXY_TYPE, ecx);
- DeoptimizeIf(below_equal, instr, Deoptimizer::kWrongInstanceType);
Label use_cache, call_runtime;
__ CheckEnumCache(&call_runtime);
@@ -5344,11 +5276,7 @@ void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
// Get the set of properties to enumerate.
__ bind(&call_runtime);
__ push(eax);
- CallRuntime(Runtime::kGetPropertyNamesFast, instr);
-
- __ cmp(FieldOperand(eax, HeapObject::kMapOffset),
- isolate()->factory()->meta_map());
- DeoptimizeIf(not_equal, instr, Deoptimizer::kWrongMap);
+ CallRuntime(Runtime::kForInEnumerate, instr);
__ bind(&use_cache);
}
@@ -5460,15 +5388,6 @@ void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) {
}
-void LCodeGen::DoAllocateBlockContext(LAllocateBlockContext* instr) {
- Handle<ScopeInfo> scope_info = instr->scope_info();
- __ Push(scope_info);
- __ push(ToRegister(instr->function()));
- CallRuntime(Runtime::kPushBlockContext, instr);
- RecordSafepoint(Safepoint::kNoLazyDeopt);
-}
-
-
#undef __
} // namespace internal