| Index: src/objects-inl.h
|
| diff --git a/src/objects-inl.h b/src/objects-inl.h
|
| index 6e2ad06ea7fec2e829eb312740849ad207fbf6a6..ee81c2fcbde610dcddf27d8d3812c3cf20b8ed28 100644
|
| --- a/src/objects-inl.h
|
| +++ b/src/objects-inl.h
|
| @@ -1322,6 +1322,16 @@ void AllocationSite::Initialize() {
|
| }
|
|
|
|
|
| +void AllocationSite::MarkZombie() {
|
| + ASSERT(!IsZombie());
|
| + set_pretenure_decision(Smi::FromInt(kZombie));
|
| + // Clear all non-smi fields
|
| + set_transition_info(Smi::FromInt(0));
|
| + set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()),
|
| + SKIP_WRITE_BARRIER);
|
| +}
|
| +
|
| +
|
| // Heuristic: We only need to create allocation site info if the boilerplate
|
| // elements kind is the initial elements kind.
|
| AllocationSiteMode AllocationSite::GetMode(
|
| @@ -1348,6 +1358,9 @@ AllocationSiteMode AllocationSite::GetMode(ElementsKind from,
|
|
|
|
|
| inline bool AllocationSite::CanTrack(InstanceType type) {
|
| + if (FLAG_allocation_site_pretenuring) {
|
| + return type == JS_ARRAY_TYPE || type == JS_OBJECT_TYPE;
|
| + }
|
| return type == JS_ARRAY_TYPE;
|
| }
|
|
|
| @@ -1367,6 +1380,45 @@ inline DependentCode::DependencyGroup AllocationSite::ToDependencyGroup(
|
| }
|
|
|
|
|
| +inline void AllocationSite::IncrementMementoFoundCount() {
|
| + int value = memento_found_count()->value();
|
| + set_memento_found_count(Smi::FromInt(value + 1));
|
| +}
|
| +
|
| +
|
| +inline void AllocationSite::IncrementMementoCreateCount() {
|
| + ASSERT(FLAG_allocation_site_pretenuring);
|
| + int value = memento_create_count()->value();
|
| + set_memento_create_count(Smi::FromInt(value + 1));
|
| +}
|
| +
|
| +
|
| +inline bool AllocationSite::DigestPretenuringFeedback() {
|
| + bool decision_made = false;
|
| + if (!PretenuringDecisionMade()) {
|
| + int create_count = memento_create_count()->value();
|
| + if (create_count >= kPretenureMinimumCreated) {
|
| + int found_count = memento_found_count()->value();
|
| + double ratio = static_cast<double>(found_count) / create_count;
|
| + if (FLAG_trace_track_allocation_sites) {
|
| + PrintF("AllocationSite: %p (created, found, ratio) (%d, %d, %f)\n",
|
| + static_cast<void*>(this), create_count, found_count, ratio);
|
| + }
|
| + int result = ratio >= kPretenureRatio ? kTenure : kDontTenure;
|
| + set_pretenure_decision(Smi::FromInt(result));
|
| + decision_made = true;
|
| + // TODO(mvstanton): if the decision represents a change, any dependent
|
| + // code registered for pretenuring changes should be deopted.
|
| + }
|
| + }
|
| +
|
| + // Clear feedback calculation fields until the next gc.
|
| + set_memento_found_count(Smi::FromInt(0));
|
| + set_memento_create_count(Smi::FromInt(0));
|
| + return decision_made;
|
| +}
|
| +
|
| +
|
| void JSObject::EnsureCanContainHeapObjectElements(Handle<JSObject> object) {
|
| object->ValidateElements();
|
| ElementsKind elements_kind = object->map()->elements_kind();
|
| @@ -3837,14 +3889,14 @@ InlineCacheState Code::ic_state() {
|
| }
|
|
|
|
|
| -Code::ExtraICState Code::extra_ic_state() {
|
| +ExtraICState Code::extra_ic_state() {
|
| ASSERT((is_inline_cache_stub() && !needs_extended_extra_ic_state(kind()))
|
| || ic_state() == DEBUG_STUB);
|
| return ExtractExtraICStateFromFlags(flags());
|
| }
|
|
|
|
|
| -Code::ExtraICState Code::extended_extra_ic_state() {
|
| +ExtraICState Code::extended_extra_ic_state() {
|
| ASSERT(is_inline_cache_stub() || ic_state() == DEBUG_STUB);
|
| ASSERT(needs_extended_extra_ic_state(kind()));
|
| return ExtractExtendedExtraICStateFromFlags(flags());
|
| @@ -4181,12 +4233,12 @@ InlineCacheState Code::ExtractICStateFromFlags(Flags flags) {
|
| }
|
|
|
|
|
| -Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) {
|
| +ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) {
|
| return ExtraICStateField::decode(flags);
|
| }
|
|
|
|
|
| -Code::ExtraICState Code::ExtractExtendedExtraICStateFromFlags(
|
| +ExtraICState Code::ExtractExtendedExtraICStateFromFlags(
|
| Flags flags) {
|
| return ExtendedExtraICStateField::decode(flags);
|
| }
|
|
|