diff options
Diffstat (limited to 'deps/v8/src/ia32/lithium-ia32.cc')
-rw-r--r-- | deps/v8/src/ia32/lithium-ia32.cc | 122 |
1 files changed, 67 insertions, 55 deletions
diff --git a/deps/v8/src/ia32/lithium-ia32.cc b/deps/v8/src/ia32/lithium-ia32.cc index 52f39d4244..b3158685fc 100644 --- a/deps/v8/src/ia32/lithium-ia32.cc +++ b/deps/v8/src/ia32/lithium-ia32.cc @@ -645,8 +645,10 @@ LInstruction* LChunkBuilder::DefineFixedDouble( LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { HEnvironment* hydrogen_env = current_block_->last_environment(); int argument_index_accumulator = 0; + ZoneList<HValue*> objects_to_materialize(0, zone()); instr->set_environment(CreateEnvironment(hydrogen_env, - &argument_index_accumulator)); + &argument_index_accumulator, + &objects_to_materialize)); return instr; } @@ -868,7 +870,7 @@ void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { HEnvironment* last_environment = pred->last_environment(); for (int i = 0; i < block->phis()->length(); ++i) { HPhi* phi = block->phis()->at(i); - if (phi->merged_index() < last_environment->length()) { + if (phi->HasMergedIndex()) { last_environment->SetValueAt(phi->merged_index(), phi); } } @@ -938,6 +940,7 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) { } #endif + instr->set_position(position_); if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { instr = AssignPointerMap(instr); } @@ -953,11 +956,13 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) { LEnvironment* LChunkBuilder::CreateEnvironment( HEnvironment* hydrogen_env, - int* argument_index_accumulator) { + int* argument_index_accumulator, + ZoneList<HValue*>* objects_to_materialize) { if (hydrogen_env == NULL) return NULL; - LEnvironment* outer = - CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator); + LEnvironment* outer = CreateEnvironment(hydrogen_env->outer(), + argument_index_accumulator, + objects_to_materialize); BailoutId ast_id = hydrogen_env->ast_id(); ASSERT(!ast_id.IsNone() || hydrogen_env->frame_type() != JS_FUNCTION); @@ -972,16 +977,16 @@ LEnvironment* LChunkBuilder::CreateEnvironment( outer, hydrogen_env->entry(), zone()); - bool needs_arguments_object_materialization = false; int argument_index = *argument_index_accumulator; + int object_index = objects_to_materialize->length(); for (int i = 0; i < hydrogen_env->length(); ++i) { if (hydrogen_env->is_special_index(i)) continue; + LOperand* op; HValue* value = hydrogen_env->values()->at(i); - LOperand* op = NULL; - if (value->IsArgumentsObject()) { - needs_arguments_object_materialization = true; - op = NULL; + if (value->IsArgumentsObject() || value->IsCapturedObject()) { + objects_to_materialize->Add(value, zone()); + op = LEnvironment::materialization_marker(); } else if (value->IsPushArgument()) { op = new(zone()) LArgument(argument_index++); } else { @@ -992,15 +997,33 @@ LEnvironment* LChunkBuilder::CreateEnvironment( value->CheckFlag(HInstruction::kUint32)); } - if (needs_arguments_object_materialization) { - HArgumentsObject* arguments = hydrogen_env->entry() == NULL - ? graph()->GetArgumentsObject() - : hydrogen_env->entry()->arguments_object(); - ASSERT(arguments->IsLinked()); - for (int i = 1; i < arguments->arguments_count(); ++i) { - HValue* value = arguments->arguments_values()->at(i); - ASSERT(!value->IsArgumentsObject() && !value->IsPushArgument()); - LOperand* op = UseAny(value); + for (int i = object_index; i < objects_to_materialize->length(); ++i) { + HValue* object_to_materialize = objects_to_materialize->at(i); + int previously_materialized_object = -1; + for (int prev = 0; prev < i; ++prev) { + if (objects_to_materialize->at(prev) == objects_to_materialize->at(i)) { + previously_materialized_object = prev; + break; + } + } + int length = object_to_materialize->OperandCount(); + bool is_arguments = object_to_materialize->IsArgumentsObject(); + if (previously_materialized_object >= 0) { + result->AddDuplicateObject(previously_materialized_object); + continue; + } else { + result->AddNewObject(is_arguments ? length - 1 : length, is_arguments); + } + for (int i = is_arguments ? 1 : 0; i < length; ++i) { + LOperand* op; + HValue* value = object_to_materialize->OperandAt(i); + if (value->IsArgumentsObject() || value->IsCapturedObject()) { + objects_to_materialize->Add(value, zone()); + op = LEnvironment::materialization_marker(); + } else { + ASSERT(!value->IsPushArgument()); + op = UseAny(value); + } result->AddValue(op, value->representation(), value->CheckFlag(HInstruction::kUint32)); @@ -1392,9 +1415,8 @@ LInstruction* LChunkBuilder::DoShl(HShl* instr) { LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { if (instr->representation().IsSmiOrInteger32()) { - ASSERT(instr->left()->representation().IsSmiOrInteger32()); - ASSERT(instr->right()->representation().Equals( - instr->left()->representation())); + ASSERT(instr->left()->representation().Equals(instr->representation())); + ASSERT(instr->right()->representation().Equals(instr->representation())); LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); @@ -1502,8 +1524,8 @@ LInstruction* LChunkBuilder::DoMod(HMod* instr) { HValue* left = instr->left(); HValue* right = instr->right(); if (instr->representation().IsSmiOrInteger32()) { - ASSERT(left->representation().IsSmiOrInteger32()); - ASSERT(right->representation().Equals(left->representation())); + ASSERT(instr->left()->representation().Equals(instr->representation())); + ASSERT(instr->right()->representation().Equals(instr->representation())); if (instr->HasPowerOf2Divisor()) { ASSERT(!right->CanBeZero()); @@ -1579,9 +1601,8 @@ LInstruction* LChunkBuilder::DoMul(HMul* instr) { LInstruction* LChunkBuilder::DoSub(HSub* instr) { if (instr->representation().IsSmiOrInteger32()) { - ASSERT(instr->left()->representation().IsSmiOrInteger32()); - ASSERT(instr->right()->representation().Equals( - instr->left()->representation())); + ASSERT(instr->left()->representation().Equals(instr->representation())); + ASSERT(instr->right()->representation().Equals(instr->representation())); LOperand* left = UseRegisterAtStart(instr->left()); LOperand* right = UseOrConstantAtStart(instr->right()); LSubI* sub = new(zone()) LSubI(left, right); @@ -1601,9 +1622,8 @@ LInstruction* LChunkBuilder::DoSub(HSub* instr) { LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { if (instr->representation().IsSmiOrInteger32()) { - ASSERT(instr->left()->representation().IsSmiOrInteger32()); - ASSERT(instr->right()->representation().Equals( - instr->left()->representation())); + ASSERT(instr->left()->representation().Equals(instr->representation())); + ASSERT(instr->right()->representation().Equals(instr->representation())); // Check to see if it would be advantageous to use an lea instruction rather // than an add. This is the case when no overflow check is needed and there // are multiple uses of the add's inputs, so using a 3-register add will @@ -1636,9 +1656,8 @@ LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { LOperand* left = NULL; LOperand* right = NULL; if (instr->representation().IsSmiOrInteger32()) { - ASSERT(instr->left()->representation().IsSmiOrInteger32()); - ASSERT(instr->right()->representation().Equals( - instr->left()->representation())); + ASSERT(instr->left()->representation().Equals(instr->representation())); + ASSERT(instr->right()->representation().Equals(instr->representation())); left = UseRegisterAtStart(instr->BetterLeftOperand()); right = UseOrConstantAtStart(instr->BetterRightOperand()); } else { @@ -1693,9 +1712,8 @@ LInstruction* LChunkBuilder::DoCompareNumericAndBranch( HCompareNumericAndBranch* instr) { Representation r = instr->representation(); if (r.IsSmiOrInteger32()) { - ASSERT(instr->left()->representation().IsSmiOrInteger32()); - ASSERT(instr->left()->representation().Equals( - instr->right()->representation())); + ASSERT(instr->left()->representation().Equals(r)); + ASSERT(instr->right()->representation().Equals(r)); LOperand* left = UseRegisterOrConstantAtStart(instr->left()); LOperand* right = UseOrConstantAtStart(instr->right()); return new(zone()) LCompareNumericAndBranch(left, right); @@ -1725,6 +1743,13 @@ LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( } +LInstruction* LChunkBuilder::DoCompareHoleAndBranch( + HCompareHoleAndBranch* instr) { + LOperand* object = UseRegisterAtStart(instr->object()); + return new(zone()) LCmpHoleAndBranch(object); +} + + LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { ASSERT(instr->value()->representation().IsSmiOrTagged()); LOperand* temp = TempRegister(); @@ -2182,25 +2207,6 @@ LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { } -LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( - HLoadNamedFieldPolymorphic* instr) { - ASSERT(instr->representation().IsTagged()); - if (instr->need_generic()) { - LOperand* context = UseFixed(instr->context(), esi); - LOperand* obj = UseFixed(instr->object(), edx); - LLoadNamedFieldPolymorphic* result = - new(zone()) LLoadNamedFieldPolymorphic(context, obj); - return MarkAsCall(DefineFixed(result, eax), instr); - } else { - LOperand* context = UseAny(instr->context()); // Not actually used. - LOperand* obj = UseRegisterAtStart(instr->object()); - LLoadNamedFieldPolymorphic* result = - new(zone()) LLoadNamedFieldPolymorphic(context, obj); - return AssignEnvironment(DefineAsRegister(result)); - } -} - - LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { LOperand* context = UseFixed(instr->context(), esi); LOperand* object = UseFixed(instr->object(), edx); @@ -2567,6 +2573,12 @@ LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { } +LInstruction* LChunkBuilder::DoCapturedObject(HCapturedObject* instr) { + // There are no real uses of a captured object. + return NULL; +} + + LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { info()->MarkAsRequiresFrame(); LOperand* args = UseRegister(instr->arguments()); |