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

Side by Side Diff: src/objects-inl.h

Issue 12114054: Supporting AllocationSiteInfo for Nested arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Some updates Created 7 years, 10 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 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 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 MaybeObject* maybe = GetElementsTransitionMap(GetIsolate(), elements_kind); 1454 MaybeObject* maybe = GetElementsTransitionMap(GetIsolate(), elements_kind);
1455 Map* map; 1455 Map* map;
1456 if (!maybe->To(&map)) return maybe; 1456 if (!maybe->To(&map)) return maybe;
1457 set_map(map); 1457 set_map(map);
1458 initialize_elements(); 1458 initialize_elements();
1459 1459
1460 return this; 1460 return this;
1461 } 1461 }
1462 1462
1463 1463
1464 bool JSObject::ShouldTrackAllocationInfo() {
danno 2013/02/11 15:05:21 How abound adding: if (!IsJSArray()) return true;
mvstanton 2013/02/15 07:36:43 Done.
1465 if (map()->CanTrackAllocationSite()) {
1466 return true;
1467 }
1468 return false;
1469 }
1470
1464 MaybeObject* JSObject::AddFastPropertyUsingMap(Map* map) { 1471 MaybeObject* JSObject::AddFastPropertyUsingMap(Map* map) {
1465 ASSERT(this->map()->NumberOfOwnDescriptors() + 1 == 1472 ASSERT(this->map()->NumberOfOwnDescriptors() + 1 ==
1466 map->NumberOfOwnDescriptors()); 1473 map->NumberOfOwnDescriptors());
1467 if (this->map()->unused_property_fields() == 0) { 1474 if (this->map()->unused_property_fields() == 0) {
1468 int new_size = properties()->length() + map->unused_property_fields() + 1; 1475 int new_size = properties()->length() + map->unused_property_fields() + 1;
1469 FixedArray* new_properties; 1476 FixedArray* new_properties;
1470 MaybeObject* maybe_properties = properties()->CopySize(new_size); 1477 MaybeObject* maybe_properties = properties()->CopySize(new_size);
1471 if (!maybe_properties->To(&new_properties)) return maybe_properties; 1478 if (!maybe_properties->To(&new_properties)) return maybe_properties;
1472 set_properties(new_properties); 1479 set_properties(new_properties);
1473 } 1480 }
(...skipping 4144 matching lines...) Expand 10 before | Expand all | Expand 10 after
5618 // It's a performance benefit to keep a frequently used array in new-space. 5625 // It's a performance benefit to keep a frequently used array in new-space.
5619 } else if (!GetHeap()->new_space()->Contains(elts) && 5626 } else if (!GetHeap()->new_space()->Contains(elts) &&
5620 required_size < kArraySizeThatFitsComfortablyInNewSpace) { 5627 required_size < kArraySizeThatFitsComfortablyInNewSpace) {
5621 // Expand will allocate a new backing store in new space even if the size 5628 // Expand will allocate a new backing store in new space even if the size
5622 // we asked for isn't larger than what we had before. 5629 // we asked for isn't larger than what we had before.
5623 Expand(required_size); 5630 Expand(required_size);
5624 } 5631 }
5625 } 5632 }
5626 5633
5627 5634
5635 bool JSArray::ShouldTrackAllocationInfo() {
danno 2013/02/11 15:05:21 I'm a little confused how JSArray::ShouldTrackAllo
mvstanton 2013/02/15 07:36:43 I was thinking in terms of virtual overrides, wher
5636 ASSERT(map()->CanTrackAllocationSite());
5637 AllocationSiteMode mode = AllocationSiteInfo::GetMode(GetElementsKind());
5638 return mode == TRACK_ALLOCATION_SITE;
5639 }
5640
5641
5628 void JSArray::set_length(Smi* length) { 5642 void JSArray::set_length(Smi* length) {
5629 // Don't need a write barrier for a Smi. 5643 // Don't need a write barrier for a Smi.
5630 set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER); 5644 set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER);
5631 } 5645 }
5632 5646
5633 5647
5634 bool JSArray::AllowsSetElementsLength() { 5648 bool JSArray::AllowsSetElementsLength() {
5635 bool result = elements()->IsFixedArray() || elements()->IsFixedDoubleArray(); 5649 bool result = elements()->IsFixedArray() || elements()->IsFixedDoubleArray();
5636 ASSERT(result == !HasExternalArrayElements()); 5650 ASSERT(result == !HasExternalArrayElements());
5637 return result; 5651 return result;
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
5890 #undef WRITE_UINT32_FIELD 5904 #undef WRITE_UINT32_FIELD
5891 #undef READ_SHORT_FIELD 5905 #undef READ_SHORT_FIELD
5892 #undef WRITE_SHORT_FIELD 5906 #undef WRITE_SHORT_FIELD
5893 #undef READ_BYTE_FIELD 5907 #undef READ_BYTE_FIELD
5894 #undef WRITE_BYTE_FIELD 5908 #undef WRITE_BYTE_FIELD
5895 5909
5896 5910
5897 } } // namespace v8::internal 5911 } } // namespace v8::internal
5898 5912
5899 #endif // V8_OBJECTS_INL_H_ 5913 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698