| Index: src/code-stubs-hydrogen.cc
|
| diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
|
| index 88af4665b684410fa046ec6dd662ceb0dc2e6fd1..a7901796966b42c23e1a64d1a8bbab01ab4c2261 100644
|
| --- a/src/code-stubs-hydrogen.cc
|
| +++ b/src/code-stubs-hydrogen.cc
|
| @@ -150,26 +150,24 @@ bool CodeStubGraphBuilderBase::BuildGraph() {
|
| next_block->SetJoinId(BailoutId::StubEntry());
|
| set_current_block(next_block);
|
|
|
| + bool runtime_stack_params = descriptor_->stack_parameter_count_.is_valid();
|
| + HInstruction* stack_parameter_count = NULL;
|
| for (int i = 0; i < param_count; ++i) {
|
| - HParameter* param =
|
| - Add<HParameter>(i, HParameter::REGISTER_PARAMETER);
|
| + Representation r = descriptor_->IsParameterCountRegister(i)
|
| + ? Representation::Integer32()
|
| + : Representation::Tagged();
|
| + HParameter* param = Add<HParameter>(i, HParameter::REGISTER_PARAMETER, r);
|
| start_environment->Bind(i, param);
|
| parameters_[i] = param;
|
| + if (descriptor_->IsParameterCountRegister(i)) {
|
| + param->set_type(HType::Smi());
|
| + stack_parameter_count = param;
|
| + arguments_length_ = stack_parameter_count;
|
| + }
|
| }
|
|
|
| - HInstruction* stack_parameter_count;
|
| - if (descriptor_->stack_parameter_count_.is_valid()) {
|
| - ASSERT(descriptor_->environment_length() == (param_count + 1));
|
| - stack_parameter_count = New<HParameter>(param_count,
|
| - 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.
|
| - AddInstruction(stack_parameter_count);
|
| - start_environment->Bind(param_count, stack_parameter_count);
|
| - arguments_length_ = stack_parameter_count;
|
| - } else {
|
| - ASSERT(descriptor_->environment_length() == param_count);
|
| + ASSERT(!runtime_stack_params || arguments_length_ != NULL);
|
| + if (!runtime_stack_params) {
|
| stack_parameter_count = graph()->GetConstantMinus1();
|
| arguments_length_ = graph()->GetConstant0();
|
| }
|
| @@ -189,10 +187,11 @@ bool CodeStubGraphBuilderBase::BuildGraph() {
|
| if (descriptor_->function_mode_ == JS_FUNCTION_STUB_MODE) {
|
| if (!stack_parameter_count->IsConstant() &&
|
| descriptor_->hint_stack_parameter_count_ < 0) {
|
| - HInstruction* amount = graph()->GetConstant1();
|
| - stack_pop_count = Add<HAdd>(stack_parameter_count, amount);
|
| - stack_pop_count->ChangeRepresentation(Representation::Integer32());
|
| + HInstruction* constant_one = graph()->GetConstant1();
|
| + stack_pop_count = Add<HAdd>(stack_parameter_count, constant_one);
|
| stack_pop_count->ClearFlag(HValue::kCanOverflow);
|
| + // TODO(mvstanton): verify that stack_parameter_count+1 really fits in a
|
| + // smi.
|
| } else {
|
| int count = descriptor_->hint_stack_parameter_count_;
|
| stack_pop_count = Add<HConstant>(count);
|
| @@ -371,7 +370,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
|
| undefined);
|
| checker.Then();
|
|
|
| - HObjectAccess access = HObjectAccess::ForAllocationSiteTransitionInfo();
|
| + HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
|
| + AllocationSite::kTransitionInfoOffset);
|
| HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access);
|
| HValue* push_value;
|
| if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) {
|
| @@ -440,7 +440,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
|
| undefined);
|
| checker.And();
|
|
|
| - HObjectAccess access = HObjectAccess::ForAllocationSiteTransitionInfo();
|
| + HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
|
| + AllocationSite::kTransitionInfoOffset);
|
| HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access);
|
|
|
| int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize;
|
| @@ -500,12 +501,14 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
|
| // Store the payload (smi elements kind)
|
| HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind());
|
| Add<HStoreNamedField>(object,
|
| - HObjectAccess::ForAllocationSiteTransitionInfo(),
|
| + HObjectAccess::ForAllocationSiteOffset(
|
| + AllocationSite::kTransitionInfoOffset),
|
| initial_elements_kind);
|
|
|
| // Unlike literals, constructed arrays don't have nested sites
|
| Add<HStoreNamedField>(object,
|
| - HObjectAccess::ForAllocationSiteNestedSite(),
|
| + HObjectAccess::ForAllocationSiteOffset(
|
| + AllocationSite::kNestedSiteOffset),
|
| graph()->GetConstant0());
|
|
|
| // Store an empty fixed array for the code dependency.
|
| @@ -513,7 +516,8 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
|
| Add<HConstant>(isolate()->factory()->empty_fixed_array());
|
| HStoreNamedField* store = Add<HStoreNamedField>(
|
| object,
|
| - HObjectAccess::ForAllocationSiteDependentCode(),
|
| + HObjectAccess::ForAllocationSiteOffset(
|
| + AllocationSite::kDependentCodeOffset),
|
| empty_fixed_array);
|
|
|
| // Link the object to the allocation site list
|
| @@ -522,8 +526,8 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
|
| HValue* site = Add<HLoadNamedField>(site_list,
|
| HObjectAccess::ForAllocationSiteList());
|
| store = Add<HStoreNamedField>(object,
|
| - HObjectAccess::ForAllocationSiteWeakNext(),
|
| - site);
|
| + HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset),
|
| + site);
|
| store->SkipWriteBarrier();
|
| Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(),
|
| object);
|
| @@ -967,6 +971,38 @@ Handle<Code> BinaryOpStub::GenerateCode(Isolate* isolate) {
|
|
|
|
|
| template <>
|
| +HValue* CodeStubGraphBuilder<NewStringAddStub>::BuildCodeInitializedStub() {
|
| + NewStringAddStub* stub = casted_stub();
|
| + StringAddFlags flags = stub->flags();
|
| + PretenureFlag pretenure_flag = stub->pretenure_flag();
|
| +
|
| + HValue* left = GetParameter(NewStringAddStub::kLeft);
|
| + HValue* right = GetParameter(NewStringAddStub::kRight);
|
| +
|
| + // Make sure that both arguments are strings if not known in advance.
|
| + if ((flags & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) {
|
| + IfBuilder if_leftnotstring(this);
|
| + if_leftnotstring.IfNot<HIsStringAndBranch>(left);
|
| + if_leftnotstring.Then();
|
| + if_leftnotstring.Deopt("Expected string for LHS of string addition");
|
| + }
|
| + if ((flags & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) {
|
| + IfBuilder if_rightnotstring(this);
|
| + if_rightnotstring.IfNot<HIsStringAndBranch>(right);
|
| + if_rightnotstring.Then();
|
| + if_rightnotstring.Deopt("Expected string for RHS of string addition");
|
| + }
|
| +
|
| + return BuildStringAdd(left, right, pretenure_flag);
|
| +}
|
| +
|
| +
|
| +Handle<Code> NewStringAddStub::GenerateCode(Isolate* isolate) {
|
| + return DoGenerateCode(isolate, this);
|
| +}
|
| +
|
| +
|
| +template <>
|
| HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() {
|
| ToBooleanStub* stub = casted_stub();
|
|
|
| @@ -1236,8 +1272,6 @@ HValue* CodeStubGraphBuilder<FastNewClosureStub>::BuildCodeStub() {
|
| HObjectAccess::ForSharedFunctionInfoPointer(),
|
| shared_info);
|
| Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(),
|
| - shared_info);
|
| - Add<HStoreNamedField>(js_function, HObjectAccess::ForFunctionContextPointer(),
|
| context());
|
|
|
| // Initialize the code pointer in the function to be the one
|
|
|