HParameter::REGISTER_PARAMETER,
Representation::Integer32());
stack_parameter_count->set_type(HType::Smi());
- // it's essential to bind this value to the environment in case of deopt
+ // It's essential to bind this value to the environment in case of deopt.
AddInstruction(stack_parameter_count);
start_environment->Bind(param_count, stack_parameter_count);
arguments_length_ = stack_parameter_count;
HValue* return_value = BuildCodeStub();
// We might have extra expressions to pop from the stack in addition to the
- // arguments above
+ // arguments above.
HInstruction* stack_pop_count = stack_parameter_count;
if (descriptor_->function_mode_ == JS_FUNCTION_STUB_MODE) {
if (!stack_parameter_count->IsConstant() &&
ZoneList<HValue*>* from_values = &from->values_;
for (int i = 0; i < from_values->length(); ++i) {
if (from->HasAssignedIndexAt(i)) {
- AddAssignedValue(from->GetAssignedIndexAt(i),
- from_values->at(i));
+ int index = from->GetAssignedIndexAt(i);
+ if (HasValueForIndex(index)) continue;
+ AddAssignedValue(index, from_values->at(i));
} else {
if (pop_count_ > 0) {
pop_count_--;
if (values_.length() > 0) {
if (pop_count_ > 0) stream->Add(" /");
for (int i = values_.length() - 1; i >= 0; --i) {
- if (i > 0) stream->Add(",");
if (HasAssignedIndexAt(i)) {
stream->Add(" var[%d] = ", GetAssignedIndexAt(i));
} else {
stream->Add(" push ");
}
values_[i]->PrintNameTo(stream);
+ if (i > 0) stream->Add(",");
}
}
}
// use lists are correctly updated.
SetOperandAt(values_.length() - 1, value);
}
+ bool HasValueForIndex(int index) {
+ for (int i = 0; i < assigned_indexes_.length(); ++i) {
+ if (assigned_indexes_[i] == index) return true;
+ }
+ return false;
+ }
BailoutId ast_id_;
int pop_count_;
ZoneList<HValue*> values_;
HSimulate* instr =
new(zone()) HSimulate(ast_id, pop_count, zone(), removable);
// Order of pushed values: newest (top of stack) first. This allows
- // HSimulate::MergeInto() to easily append additional pushed values
+ // HSimulate::MergeWith() to easily append additional pushed values
// that are older (from further down the stack).
for (int i = 0; i < push_count; ++i) {
instr->AddPushedValue(environment->ExpressionStackAt(i));