Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(829)

Unified Diff: src/objects.cc

Issue 2244983004: [elements, turbofan] Implement simple GrowElements (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 1fc6085deb425dd4c5554e2593d523d7f01882fd..6a1619c00fa0dc8e8362be5bb2cd5a6be88641e1 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -16023,10 +16023,11 @@ bool AllocationSite::IsNestedSite() {
return false;
}
-
-void AllocationSite::DigestTransitionFeedback(Handle<AllocationSite> site,
+template <AllocationSiteUpdateMode update_or_check>
+bool AllocationSite::DigestTransitionFeedback(Handle<AllocationSite> site,
ElementsKind to_kind) {
Isolate* isolate = site->GetIsolate();
+ bool result = false;
if (site->SitePointsToLiteral() && site->transition_info()->IsJSArray()) {
Handle<JSArray> transition_info =
@@ -16042,6 +16043,9 @@ void AllocationSite::DigestTransitionFeedback(Handle<AllocationSite> site,
uint32_t length = 0;
CHECK(transition_info->length()->ToArrayLength(&length));
if (length <= kMaximumArrayBytesToPretransition) {
+ if (update_or_check == AllocationSiteUpdateMode::kCheckOnly) {
+ return true;
+ }
if (FLAG_trace_track_allocation_sites) {
bool is_nested = site->IsNestedSite();
PrintF(
@@ -16054,6 +16058,7 @@ void AllocationSite::DigestTransitionFeedback(Handle<AllocationSite> site,
JSObject::TransitionElementsKind(transition_info, to_kind);
site->dependent_code()->DeoptimizeDependentCodeGroup(
isolate, DependentCode::kAllocationSiteTransitionChangedGroup);
+ result = true;
}
}
} else {
@@ -16063,6 +16068,7 @@ void AllocationSite::DigestTransitionFeedback(Handle<AllocationSite> site,
to_kind = GetHoleyElementsKind(to_kind);
}
if (IsMoreGeneralElementsKindTransition(kind, to_kind)) {
+ if (update_or_check == AllocationSiteUpdateMode::kCheckOnly) return true;
if (FLAG_trace_track_allocation_sites) {
PrintF("AllocationSite: JSArray %p site updated %s->%s\n",
reinterpret_cast<void*>(*site),
@@ -16072,8 +16078,10 @@ void AllocationSite::DigestTransitionFeedback(Handle<AllocationSite> site,
site->SetElementsKind(to_kind);
site->dependent_code()->DeoptimizeDependentCodeGroup(
isolate, DependentCode::kAllocationSiteTransitionChangedGroup);
+ result = true;
}
}
+ return false;
Jakob Kummerow 2016/08/16 15:15:01 Did you mean to "return result" here?
}
@@ -16089,13 +16097,13 @@ const char* AllocationSite::PretenureDecisionName(PretenureDecision decision) {
return NULL;
}
-
-void JSObject::UpdateAllocationSite(Handle<JSObject> object,
+template <AllocationSiteUpdateMode update_or_check>
+bool JSObject::UpdateAllocationSite(Handle<JSObject> object,
ElementsKind to_kind) {
- if (!object->IsJSArray()) return;
+ if (!object->IsJSArray()) return false;
Heap* heap = object->GetHeap();
- if (!heap->InNewSpace(*object)) return;
+ if (!heap->InNewSpace(*object)) return false;
Handle<AllocationSite> site;
{
@@ -16103,14 +16111,18 @@ void JSObject::UpdateAllocationSite(Handle<JSObject> object,
AllocationMemento* memento =
heap->FindAllocationMemento<Heap::kForRuntime>(*object);
- if (memento == NULL) return;
+ if (memento == NULL) return false;
// Walk through to the Allocation Site
site = handle(memento->GetAllocationSite());
}
- AllocationSite::DigestTransitionFeedback(site, to_kind);
+ return AllocationSite::DigestTransitionFeedback<update_or_check>(site,
+ to_kind);
}
+template bool
+JSObject::UpdateAllocationSite<AllocationSiteUpdateMode::kCheckOnly>(
+ Handle<JSObject> object, ElementsKind to_kind);
void JSObject::TransitionElementsKind(Handle<JSObject> object,
ElementsKind to_kind) {
« src/elements.cc ('K') | « src/objects.h ('k') | src/runtime/runtime-array.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698