Index: src/code-stubs-hydrogen.cc |
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc |
index 68c9cd5d5992b3550460d402c1e18d28c9bc4071..342e3176e53adf90ef99eca849e614284227a82e 100644 |
--- a/src/code-stubs-hydrogen.cc |
+++ b/src/code-stubs-hydrogen.cc |
@@ -150,9 +150,9 @@ bool CodeStubGraphBuilderBase::BuildGraph() { |
bool runtime_stack_params = descriptor_->stack_parameter_count_.is_valid(); |
HInstruction* stack_parameter_count = NULL; |
for (int i = 0; i < param_count; ++i) { |
- Representation r = descriptor_->IsParameterCountRegister(i) |
- ? Representation::Integer32() |
- : Representation::Tagged(); |
+ Representation r = descriptor_->register_param_representations_ == NULL |
+ ? Representation::Tagged() |
+ : descriptor_->register_param_representations_[i]; |
HParameter* param = Add<HParameter>(i, HParameter::REGISTER_PARAMETER, r); |
start_environment->Bind(i, param); |
parameters_[i] = param; |
@@ -353,8 +353,6 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { |
Factory* factory = isolate()->factory(); |
HValue* undefined = graph()->GetConstantUndefined(); |
AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); |
- FastCloneShallowArrayStub::Mode mode = casted_stub()->mode(); |
- int length = casted_stub()->length(); |
HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0), |
GetParameter(1), |
@@ -369,46 +367,40 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { |
AllocationSite::kTransitionInfoOffset); |
HInstruction* boilerplate = Add<HLoadNamedField>( |
allocation_site, static_cast<HValue*>(NULL), access); |
- HValue* push_value; |
- if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { |
- HValue* elements = AddLoadElements(boilerplate); |
- |
- IfBuilder if_fixed_cow(this); |
- if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map()); |
- if_fixed_cow.Then(); |
- push_value = BuildCloneShallowArray(boilerplate, |
- allocation_site, |
- alloc_site_mode, |
- FAST_ELEMENTS, |
- 0/*copy-on-write*/); |
- environment()->Push(push_value); |
- if_fixed_cow.Else(); |
- |
- IfBuilder if_fixed(this); |
- if_fixed.If<HCompareMap>(elements, factory->fixed_array_map()); |
- if_fixed.Then(); |
- push_value = BuildCloneShallowArray(boilerplate, |
- allocation_site, |
- alloc_site_mode, |
- FAST_ELEMENTS, |
- length); |
- environment()->Push(push_value); |
- if_fixed.Else(); |
- push_value = BuildCloneShallowArray(boilerplate, |
- allocation_site, |
- alloc_site_mode, |
- FAST_DOUBLE_ELEMENTS, |
- length); |
- environment()->Push(push_value); |
- } else { |
- ElementsKind elements_kind = casted_stub()->ComputeElementsKind(); |
- push_value = BuildCloneShallowArray(boilerplate, |
- allocation_site, |
- alloc_site_mode, |
- elements_kind, |
- length); |
- environment()->Push(push_value); |
- } |
+ HValue* elements = AddLoadElements(boilerplate); |
+ HValue* capacity = AddLoadFixedArrayLength(elements); |
+ IfBuilder zero_capacity(this); |
+ zero_capacity.If<HCompareNumericAndBranch>(capacity, graph()->GetConstant0(), |
+ Token::EQ); |
+ zero_capacity.Then(); |
+ Push(BuildCloneShallowArrayEmpty(boilerplate, |
+ allocation_site, |
+ alloc_site_mode)); |
+ zero_capacity.Else(); |
+ IfBuilder if_fixed_cow(this); |
+ if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map()); |
+ if_fixed_cow.Then(); |
+ Push(BuildCloneShallowArrayCow(boilerplate, |
+ allocation_site, |
+ alloc_site_mode, |
+ FAST_ELEMENTS)); |
+ if_fixed_cow.Else(); |
+ IfBuilder if_fixed(this); |
+ if_fixed.If<HCompareMap>(elements, factory->fixed_array_map()); |
+ if_fixed.Then(); |
+ Push(BuildCloneShallowArrayNonEmpty(boilerplate, |
+ allocation_site, |
+ alloc_site_mode, |
+ FAST_ELEMENTS)); |
+ |
+ if_fixed.Else(); |
+ Push(BuildCloneShallowArrayNonEmpty(boilerplate, |
+ allocation_site, |
+ alloc_site_mode, |
+ FAST_DOUBLE_ELEMENTS)); |
+ if_fixed.End(); |
+ if_fixed_cow.End(); |
+ zero_capacity.End(); |
checker.ElseDeopt("Uninitialized boilerplate literals"); |
checker.End(); |