| Index: src/code-stubs-hydrogen.cc
|
| diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
|
| index dfa5ecd8cf840a75086eb5b0d5bac86b839aceb3..5ad4c9d300ca82b56b3dafc8c23ccab82574fe0e 100644
|
| --- a/src/code-stubs-hydrogen.cc
|
| +++ b/src/code-stubs-hydrogen.cc
|
| @@ -1191,6 +1191,24 @@ void CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap(
|
| loop_builder.Break();
|
| }
|
| done_check.Else();
|
| + {
|
| + // The optimization count should be tied to the context, e.g. as
|
| + // entry in optimized code map. But for simplicity's sake we just
|
| + // reset the opt count if the optimized code map lookup fails,
|
| + // because no optimized code exists for the current context.
|
| + HObjectAccess field = HObjectAccess::ForOptCountAndBailoutReason().
|
| + WithRepresentation(Representation::Integer32());
|
| + HValue* opt_count_and_bailout_reason =
|
| + Add<HLoadNamedField>(shared_info, field);
|
| + static const int pseudo_smi_shift = 1;
|
| + int32_t opt_count_mask =
|
| + static_cast<int32_t>(~SharedFunctionInfo::OptCountBits::kMask)
|
| + << pseudo_smi_shift;
|
| + HValue* mask = Add<HConstant>(opt_count_mask);
|
| + HValue* result = Add<HBitwise>(
|
| + Token::BIT_AND, opt_count_and_bailout_reason, mask);
|
| + Add<HStoreNamedField>(shared_info, field, result);
|
| + }
|
| done_check.End();
|
| }
|
| restore_check.End();
|
| @@ -1241,8 +1259,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
|
|
|