| Index: src/code-stubs-hydrogen.cc
|
| diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
|
| index 11cd307451cc0017429d0ea84be0bbdc410982a5..1282a04cfce12c5721fa3187992ce653a35a5e00 100644
|
| --- a/src/code-stubs-hydrogen.cc
|
| +++ b/src/code-stubs-hydrogen.cc
|
| @@ -599,7 +599,7 @@ HValue* CodeStubGraphBuilderBase::BuildArraySingleArgumentConstructor(
|
| HConstant* initial_capacity_node = new(zone()) HConstant(initial_capacity);
|
| AddInstruction(initial_capacity_node);
|
|
|
| - HBoundsCheck* checked_arg = AddBoundsCheck(argument, max_alloc_length);
|
| + HBoundsCheck* checked_arg = Add<HBoundsCheck>(argument, max_alloc_length);
|
| IfBuilder if_builder(this);
|
| if_builder.IfCompare(checked_arg, constant_zero, Token::EQ);
|
| if_builder.Then();
|
| @@ -762,7 +762,7 @@ HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() {
|
| IfBuilder if_true(this);
|
| if_true.If<HBranch>(GetParameter(0), stub->GetTypes());
|
| if_true.Then();
|
| - if_true.Return(graph()->GetConstant1());
|
| + if_true.Return(graph()->GetConstant1());
|
| if_true.Else();
|
| if_true.End();
|
| return graph()->GetConstant0();
|
| @@ -774,4 +774,51 @@ Handle<Code> ToBooleanStub::GenerateCode() {
|
| }
|
|
|
|
|
| +template <>
|
| +HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() {
|
| + StoreGlobalStub* stub = casted_stub();
|
| + Handle<Object> hole = Handle<Object>(isolate()->heap()->the_hole_value(),
|
| + isolate());
|
| + Handle<Object> placeholer_value(Smi::FromInt(0), isolate());
|
| + Handle<PropertyCell> placeholder_cell =
|
| + isolate()->factory()->NewPropertyCell(placeholer_value);
|
| +
|
| + HParameter* receiver = GetParameter(0);
|
| + HParameter* value = GetParameter(2);
|
| +
|
| + if (stub->is_constant()) {
|
| + // Assume every store to a constant value changes it.
|
| + current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll);
|
| + set_current_block(NULL);
|
| + } else {
|
| + HValue* cell = Add<HConstant>(placeholder_cell, Representation::Tagged());
|
| +
|
| + // Check that the map of the global has not changed.
|
| + AddInstruction(HCheckMaps::New(receiver,
|
| + Handle<Map>(isolate()->heap()->meta_map()),
|
| + zone()));
|
| +
|
| + // Load the payload of the global parameter cell. A hole indicates that the
|
| + // property has been deleted and that the store must be handled by the
|
| + // runtime.
|
| + HObjectAccess access(HObjectAccess::ForCellPayload(isolate()));
|
| + HValue* cell_contents = Add<HLoadNamedField>(cell, access);
|
| + IfBuilder builder(this);
|
| + HValue* hole_value = Add<HConstant>(hole, Representation::Tagged());
|
| + builder.If<HCompareObjectEqAndBranch>(cell_contents, hole_value);
|
| + builder.Then();
|
| + builder.Deopt();
|
| + builder.Else();
|
| + Add<HStoreNamedField>(cell, access, value);
|
| + builder.End();
|
| + }
|
| + return value;
|
| +}
|
| +
|
| +
|
| +Handle<Code> StoreGlobalStub::GenerateCode() {
|
| + return DoGenerateCode(this);
|
| +}
|
| +
|
| +
|
| } } // namespace v8::internal
|
|
|