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

Side by Side Diff: src/objects.h

Issue 8968028: Ensure large Smi-only arrays don't transition to FAST_DOUBLE_ARRAY (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 8 years, 11 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
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 1637
1638 // Do we want to keep the elements in fast case when increasing the 1638 // Do we want to keep the elements in fast case when increasing the
1639 // capacity? 1639 // capacity?
1640 bool ShouldConvertToSlowElements(int new_capacity); 1640 bool ShouldConvertToSlowElements(int new_capacity);
1641 // Returns true if the backing storage for the slow-case elements of 1641 // Returns true if the backing storage for the slow-case elements of
1642 // this object takes up nearly as much space as a fast-case backing 1642 // this object takes up nearly as much space as a fast-case backing
1643 // storage would. In that case the JSObject should have fast 1643 // storage would. In that case the JSObject should have fast
1644 // elements. 1644 // elements.
1645 bool ShouldConvertToFastElements(); 1645 bool ShouldConvertToFastElements();
1646 // Returns true if the elements of JSObject contains only values that can be 1646 // Returns true if the elements of JSObject contains only values that can be
1647 // represented in a FixedDoubleArray. 1647 // represented in a FixedDoubleArray and has at least one value that can only
1648 bool CanConvertToFastDoubleElements(); 1648 // be represented as a double and not a Smi.
1649 bool ShouldConvertToFastDoubleElements(bool* has_smi_only_elements);
1649 1650
1650 // Tells whether the index'th element is present. 1651 // Tells whether the index'th element is present.
1651 bool HasElementWithReceiver(JSReceiver* receiver, uint32_t index); 1652 bool HasElementWithReceiver(JSReceiver* receiver, uint32_t index);
1652 1653
1653 // Computes the new capacity when expanding the elements of a JSObject. 1654 // Computes the new capacity when expanding the elements of a JSObject.
1654 static int NewElementsCapacity(int old_capacity) { 1655 static int NewElementsCapacity(int old_capacity) {
1655 // (old_capacity + 50%) + 16 1656 // (old_capacity + 50%) + 16
1656 return old_capacity + (old_capacity >> 1) + 16; 1657 return old_capacity + (old_capacity >> 1) + 16;
1657 } 1658 }
1658 1659
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 Object* value, 1702 Object* value,
1702 StrictModeFlag strict_mode, 1703 StrictModeFlag strict_mode,
1703 bool check_prototype); 1704 bool check_prototype);
1704 1705
1705 // Returns the index'th element. 1706 // Returns the index'th element.
1706 // The undefined object if index is out of bounds. 1707 // The undefined object if index is out of bounds.
1707 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); 1708 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index);
1708 1709
1709 enum SetFastElementsCapacityMode { 1710 enum SetFastElementsCapacityMode {
1710 kAllowSmiOnlyElements, 1711 kAllowSmiOnlyElements,
1712 kForceSmiOnlyElements,
1711 kDontAllowSmiOnlyElements 1713 kDontAllowSmiOnlyElements
1712 }; 1714 };
1713 1715
1714 // Replace the elements' backing store with fast elements of the given 1716 // Replace the elements' backing store with fast elements of the given
1715 // capacity. Update the length for JSArrays. Returns the new backing 1717 // capacity. Update the length for JSArrays. Returns the new backing
1716 // store. 1718 // store.
1717 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength( 1719 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(
1718 int capacity, 1720 int capacity,
1719 int length, 1721 int length,
1720 SetFastElementsCapacityMode set_capacity_mode); 1722 SetFastElementsCapacityMode set_capacity_mode);
(...skipping 6280 matching lines...) Expand 10 before | Expand all | Expand 10 after
8001 } else { 8003 } else {
8002 value &= ~(1 << bit_position); 8004 value &= ~(1 << bit_position);
8003 } 8005 }
8004 return value; 8006 return value;
8005 } 8007 }
8006 }; 8008 };
8007 8009
8008 } } // namespace v8::internal 8010 } } // namespace v8::internal
8009 8011
8010 #endif // V8_OBJECTS_H_ 8012 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698