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

Unified Diff: src/objects.cc

Issue 11663005: Adapt Danno's Track Allocation Info idea to fast literals. When allocating a literal array, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Always use in ICs, and moved feature behind a flag Created 8 years 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 1d95a5c15271ab3d955e2cbd3f2b6ad1b270cc25..1201c8b0793cec2b1a29b2bae591b36b6eea79e1 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -10637,6 +10637,32 @@ MaybeObject* JSObject::TransitionElementsKind(ElementsKind to_kind) {
if (from_kind == to_kind) return this;
+ // Are we in new space?
+ if (FLAG_use_allocation_site_info && GetHeap()->InNewSpace(this)) {
danno 2012/12/26 10:32:01 The machinery that checks/gets an AllocationSiteIn
mvstanton 2013/01/03 14:40:43 Done.
+ // Are we below the top of the heap?
+ Address ptr_end = (reinterpret_cast<Address>(this) - 1) + Size();
+ if ((ptr_end + AllocationSiteInfo::kSize) <= GetHeap()->NewSpaceTop()) {
+ // There is room for allocation info. Do we have some?
+ Map** possible_allocation_map = reinterpret_cast<Map**>(ptr_end);
+ if (*possible_allocation_map == GetHeap()->allocation_site_info_map()) {
+ AllocationSiteInfo* info = AllocationSiteInfo::cast(
+ reinterpret_cast<Object*>(ptr_end + 1));
+ JSObject* payload = JSObject::cast(info->payload());
+ if (payload->GetElementsKind() != to_kind) {
+ if (IsMoreGeneralElementsKindTransition(
+ payload->GetElementsKind(),
+ to_kind)) {
+ PrintF("Transitioning array to %s\n",
+ ElementsKindToString(to_kind));
+ MaybeObject* maybe_result =
+ payload->TransitionElementsKind(to_kind);
+ if (maybe_result->IsFailure()) return maybe_result;
+ }
+ }
+ }
+ }
+ }
+
Isolate* isolate = GetIsolate();
if (elements() == isolate->heap()->empty_fixed_array() ||
(IsFastSmiOrObjectElementsKind(from_kind) &&

Powered by Google App Engine
This is Rietveld 408576698