X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fv8%2Fsrc%2Flithium-allocator.cc;h=fd8f847e0f4e8ad8b7f30aaaebc6fdf2ae3ac92c;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=29c31942e44387903929e80e83241003a84ba8c2;hpb=172ee7c03df346ff158858709f7f6494e695e0e4;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/v8/src/lithium-allocator.cc b/src/v8/src/lithium-allocator.cc index 29c3194..fd8f847 100644 --- a/src/v8/src/lithium-allocator.cc +++ b/src/v8/src/lithium-allocator.cc @@ -238,6 +238,12 @@ LOperand* LiveRange::CreateAssignedOperand(Zone* zone) { case DOUBLE_REGISTERS: op = LDoubleRegister::Create(assigned_register(), zone); break; + case FLOAT32x4_REGISTERS: + op = LFloat32x4Register::Create(assigned_register(), zone); + break; + case INT32x4_REGISTERS: + op = LInt32x4Register::Create(assigned_register(), zone); + break; default: UNREACHABLE(); } @@ -488,7 +494,7 @@ void LiveRange::ConvertOperands(Zone* zone) { if (use_pos->HasOperand()) { ASSERT(op->IsRegister() || op->IsDoubleRegister() || - !use_pos->RequiresRegister()); + op->IsSIMD128Register() || !use_pos->RequiresRegister()); use_pos->operand()->ConvertTo(op->kind(), op->index()); } use_pos = use_pos->next(); @@ -554,6 +560,7 @@ LAllocator::LAllocator(int num_values, HGraph* graph) active_live_ranges_(8, zone()), inactive_live_ranges_(8, zone()), reusable_slots_(8, zone()), + reusable_simd128_slots_(8, zone()), next_virtual_register_(num_values), first_artificial_register_(num_values), mode_(UNALLOCATED_REGISTERS), @@ -873,6 +880,16 @@ void LAllocator::MeetConstraintsBetween(LInstruction* first, double_artificial_registers_.Add( cur_input->virtual_register() - first_artificial_register_, zone()); + } else if (RequiredRegisterKind(input_copy->virtual_register()) == + FLOAT32x4_REGISTERS) { + float32x4_artificial_registers_.Add( + cur_input->virtual_register() - first_artificial_register_, + zone()); + } else if (RequiredRegisterKind(input_copy->virtual_register()) == + INT32x4_REGISTERS) { + int32x4_artificial_registers_.Add( + cur_input->virtual_register() - first_artificial_register_, + zone()); } AddConstraintsGapMove(gap_index, input_copy, cur_input); @@ -1185,8 +1202,10 @@ void LAllocator::ResolveControlFlow(LiveRange* range, if (branch->HasPointerMap()) { if (HasTaggedValue(range->id())) { branch->pointer_map()->RecordPointer(cur_op, chunk()->zone()); - } else if (!cur_op->IsDoubleStackSlot() && - !cur_op->IsDoubleRegister()) { + } else if (!cur_op->IsDoubleStackSlot() && + !cur_op->IsDoubleRegister() && + !cur_op->IsSIMD128StackSlot() && + !cur_op->IsSIMD128Register()) { branch->pointer_map()->RemovePointer(cur_op); } } @@ -1369,7 +1388,7 @@ void LAllocator::BuildLiveRanges() { ASSERT(chunk_->info()->IsOptimizing()); AllowHandleDereference allow_deref; PrintF("Function: %s\n", - *chunk_->info()->function()->debug_name()->ToCString()); + chunk_->info()->function()->debug_name()->ToCString().get()); } PrintF("Value %d used before first definition!\n", operand_index); LiveRange* range = LiveRangeFor(operand_index); @@ -1512,6 +1531,9 @@ void LAllocator::AllocateRegisters() { if (live_ranges_[i] != NULL) { if (live_ranges_[i]->Kind() == mode_) { AddToUnhandledUnsorted(live_ranges_[i]); + } else if (mode_ == DOUBLE_REGISTERS && + IsSIMD128RegisterKind(live_ranges_[i]->Kind())) { + AddToUnhandledUnsorted(live_ranges_[i]); } } } @@ -1519,6 +1541,7 @@ void LAllocator::AllocateRegisters() { ASSERT(UnhandledIsSorted()); ASSERT(reusable_slots_.is_empty()); + ASSERT(reusable_simd128_slots_.is_empty()); ASSERT(active_live_ranges_.is_empty()); ASSERT(inactive_live_ranges_.is_empty()); @@ -1610,6 +1633,7 @@ void LAllocator::AllocateRegisters() { } reusable_slots_.Rewind(0); + reusable_simd128_slots_.Rewind(0); active_live_ranges_.Rewind(0); inactive_live_ranges_.Rewind(0); } @@ -1646,10 +1670,20 @@ RegisterKind LAllocator::RequiredRegisterKind(int virtual_register) const { HValue* value = graph_->LookupValue(virtual_register); if (value != NULL && value->representation().IsDouble()) { return DOUBLE_REGISTERS; + } else if (value != NULL && (value->representation().IsFloat32x4())) { + return FLOAT32x4_REGISTERS; + } else if (value != NULL && (value->representation().IsInt32x4())) { + return INT32x4_REGISTERS; } } else if (double_artificial_registers_.Contains( virtual_register - first_artificial_register_)) { return DOUBLE_REGISTERS; + } else if (float32x4_artificial_registers_.Contains( + virtual_register - first_artificial_register_)) { + return FLOAT32x4_REGISTERS; + } else if (int32x4_artificial_registers_.Contains( + virtual_register - first_artificial_register_)) { + return INT32x4_REGISTERS; } return GENERAL_REGISTERS; @@ -1732,19 +1766,26 @@ void LAllocator::FreeSpillSlot(LiveRange* range) { int index = range->TopLevel()->GetSpillOperand()->index(); if (index >= 0) { - reusable_slots_.Add(range, zone()); + if (IsSIMD128RegisterKind(range->Kind())) { + reusable_simd128_slots_.Add(range, zone()); + } else { + reusable_slots_.Add(range, zone()); + } } } LOperand* LAllocator::TryReuseSpillSlot(LiveRange* range) { - if (reusable_slots_.is_empty()) return NULL; - if (reusable_slots_.first()->End().Value() > + ZoneList* reusable_slots = IsSIMD128RegisterKind(range->Kind()) + ? &reusable_simd128_slots_ + : &reusable_slots_; + if (reusable_slots->is_empty()) return NULL; + if (reusable_slots->first()->End().Value() > range->TopLevel()->Start().Value()) { return NULL; } - LOperand* result = reusable_slots_.first()->TopLevel()->GetSpillOperand(); - reusable_slots_.Remove(0); + LOperand* result = reusable_slots->first()->TopLevel()->GetSpillOperand(); + reusable_slots->Remove(0); return result; } @@ -1811,7 +1852,8 @@ bool LAllocator::TryAllocateFreeReg(LiveRange* current) { } LOperand* hint = current->FirstHint(); - if (hint != NULL && (hint->IsRegister() || hint->IsDoubleRegister())) { + if (hint != NULL && (hint->IsRegister() || hint->IsDoubleRegister() || + hint->IsSIMD128Register())) { int register_index = hint->index(); TraceAlloc( "Found reg hint %s (free until [%d) for live range %d (end %d[).\n", @@ -2162,7 +2204,17 @@ void LAllocator::Spill(LiveRange* range) { if (!first->HasAllocatedSpillOperand()) { LOperand* op = TryReuseSpillSlot(range); - if (op == NULL) op = chunk_->GetNextSpillSlot(range->Kind()); + if (op == NULL) { + op = chunk_->GetNextSpillSlot(range->Kind()); + } else if (range->Kind() == FLOAT32x4_REGISTERS && + op->kind() != LOperand::FLOAT32x4_STACK_SLOT) { + // Convert to Float32x4StackSlot. + op = LFloat32x4StackSlot::Create(op->index(), zone()); + } else if (range->Kind() == INT32x4_REGISTERS && + op->kind() != LOperand::INT32x4_STACK_SLOT) { + // Convert to Int32x4StackSlot. + op = LInt32x4StackSlot::Create(op->index(), zone()); + } first->SetSpillOperand(op); } range->MakeSpilled(chunk()->zone());