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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 10619 matching lines...) Expand 10 before | Expand all | Expand 10 after
10630 MaybeObject* JSObject::TransitionElementsKind(ElementsKind to_kind) { 10630 MaybeObject* JSObject::TransitionElementsKind(ElementsKind to_kind) {
10631 ASSERT(!map()->is_observed()); 10631 ASSERT(!map()->is_observed());
10632 ElementsKind from_kind = map()->elements_kind(); 10632 ElementsKind from_kind = map()->elements_kind();
10633 10633
10634 if (IsFastHoleyElementsKind(from_kind)) { 10634 if (IsFastHoleyElementsKind(from_kind)) {
10635 to_kind = GetHoleyElementsKind(to_kind); 10635 to_kind = GetHoleyElementsKind(to_kind);
10636 } 10636 }
10637 10637
10638 if (from_kind == to_kind) return this; 10638 if (from_kind == to_kind) return this;
10639 10639
10640 // Are we in new space?
10641 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.
10642 // Are we below the top of the heap?
10643 Address ptr_end = (reinterpret_cast<Address>(this) - 1) + Size();
10644 if ((ptr_end + AllocationSiteInfo::kSize) <= GetHeap()->NewSpaceTop()) {
10645 // There is room for allocation info. Do we have some?
10646 Map** possible_allocation_map = reinterpret_cast<Map**>(ptr_end);
10647 if (*possible_allocation_map == GetHeap()->allocation_site_info_map()) {
10648 AllocationSiteInfo* info = AllocationSiteInfo::cast(
10649 reinterpret_cast<Object*>(ptr_end + 1));
10650 JSObject* payload = JSObject::cast(info->payload());
10651 if (payload->GetElementsKind() != to_kind) {
10652 if (IsMoreGeneralElementsKindTransition(
10653 payload->GetElementsKind(),
10654 to_kind)) {
10655 PrintF("Transitioning array to %s\n",
10656 ElementsKindToString(to_kind));
10657 MaybeObject* maybe_result =
10658 payload->TransitionElementsKind(to_kind);
10659 if (maybe_result->IsFailure()) return maybe_result;
10660 }
10661 }
10662 }
10663 }
10664 }
10665
10640 Isolate* isolate = GetIsolate(); 10666 Isolate* isolate = GetIsolate();
10641 if (elements() == isolate->heap()->empty_fixed_array() || 10667 if (elements() == isolate->heap()->empty_fixed_array() ||
10642 (IsFastSmiOrObjectElementsKind(from_kind) && 10668 (IsFastSmiOrObjectElementsKind(from_kind) &&
10643 IsFastSmiOrObjectElementsKind(to_kind)) || 10669 IsFastSmiOrObjectElementsKind(to_kind)) ||
10644 (from_kind == FAST_DOUBLE_ELEMENTS && 10670 (from_kind == FAST_DOUBLE_ELEMENTS &&
10645 to_kind == FAST_HOLEY_DOUBLE_ELEMENTS)) { 10671 to_kind == FAST_HOLEY_DOUBLE_ELEMENTS)) {
10646 ASSERT(from_kind != TERMINAL_FAST_ELEMENTS_KIND); 10672 ASSERT(from_kind != TERMINAL_FAST_ELEMENTS_KIND);
10647 // No change is needed to the elements() buffer, the transition 10673 // No change is needed to the elements() buffer, the transition
10648 // only requires a map change. 10674 // only requires a map change.
10649 MaybeObject* maybe_new_map = GetElementsTransitionMap(isolate, to_kind); 10675 MaybeObject* maybe_new_map = GetElementsTransitionMap(isolate, to_kind);
(...skipping 3377 matching lines...) Expand 10 before | Expand all | Expand 10 after
14027 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 14053 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
14028 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 14054 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
14029 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 14055 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
14030 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 14056 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
14031 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 14057 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
14032 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 14058 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
14033 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 14059 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
14034 } 14060 }
14035 14061
14036 } } // namespace v8::internal 14062 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698