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

Side by Side Diff: src/objects.h

Issue 8820014: Support Smi->Double->HeapObject transitions in constructed Arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 9 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
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | 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 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 static const int kExponentBias = 1023; 1315 static const int kExponentBias = 1023;
1316 static const int kExponentShift = 20; 1316 static const int kExponentShift = 20;
1317 static const int kMantissaBitsInTopWord = 20; 1317 static const int kMantissaBitsInTopWord = 20;
1318 static const int kNonMantissaBitsInTopWord = 12; 1318 static const int kNonMantissaBitsInTopWord = 12;
1319 1319
1320 private: 1320 private:
1321 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); 1321 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber);
1322 }; 1322 };
1323 1323
1324 1324
1325 enum EnsureElementsMode {
1326 DONT_ALLOW_DOUBLE_ELEMENTS,
1327 ALLOW_COPIED_DOUBLE_ELEMENTS,
1328 ALLOW_CONVERTED_DOUBLE_ELEMENTS
1329 };
1330
1331
1325 // JSReceiver includes types on which properties can be defined, i.e., 1332 // JSReceiver includes types on which properties can be defined, i.e.,
1326 // JSObject and JSProxy. 1333 // JSObject and JSProxy.
1327 class JSReceiver: public HeapObject { 1334 class JSReceiver: public HeapObject {
1328 public: 1335 public:
1329 enum DeleteMode { 1336 enum DeleteMode {
1330 NORMAL_DELETION, 1337 NORMAL_DELETION,
1331 STRICT_DELETION, 1338 STRICT_DELETION,
1332 FORCE_DELETION 1339 FORCE_DELETION
1333 }; 1340 };
1334 1341
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 bool HasHiddenProperties(); 1615 bool HasHiddenProperties();
1609 1616
1610 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); 1617 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag);
1611 MUST_USE_RESULT MaybeObject* SetIdentityHash(Object* hash, CreationFlag flag); 1618 MUST_USE_RESULT MaybeObject* SetIdentityHash(Object* hash, CreationFlag flag);
1612 1619
1613 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); 1620 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode);
1614 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); 1621 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode);
1615 1622
1616 inline void ValidateSmiOnlyElements(); 1623 inline void ValidateSmiOnlyElements();
1617 1624
1618 // Makes sure that this object can contain non-smi Object as elements. 1625 // Makes sure that this object can contain HeapObject as elements.
1619 inline MaybeObject* EnsureCanContainNonSmiElements(); 1626 inline MaybeObject* EnsureCanContainHeapObjectElements();
1620 1627
1621 // Makes sure that this object can contain the specified elements. 1628 // Makes sure that this object can contain the specified elements.
1622 inline MaybeObject* EnsureCanContainElements(Object** elements, 1629 inline MaybeObject* EnsureCanContainElements(Object** elements,
1623 uint32_t count); 1630 uint32_t count,
1624 inline MaybeObject* EnsureCanContainElements(FixedArray* elements); 1631 EnsureElementsMode mode);
1632 inline MaybeObject* EnsureCanContainElements(FixedArrayBase* elements,
1633 EnsureElementsMode mode);
1625 MaybeObject* EnsureCanContainElements(Arguments* arguments, 1634 MaybeObject* EnsureCanContainElements(Arguments* arguments,
1626 uint32_t first_arg, 1635 uint32_t first_arg,
1627 uint32_t arg_count); 1636 uint32_t arg_count,
1637 EnsureElementsMode mode);
1628 1638
1629 // Do we want to keep the elements in fast case when increasing the 1639 // Do we want to keep the elements in fast case when increasing the
1630 // capacity? 1640 // capacity?
1631 bool ShouldConvertToSlowElements(int new_capacity); 1641 bool ShouldConvertToSlowElements(int new_capacity);
1632 // Returns true if the backing storage for the slow-case elements of 1642 // Returns true if the backing storage for the slow-case elements of
1633 // this object takes up nearly as much space as a fast-case backing 1643 // this object takes up nearly as much space as a fast-case backing
1634 // storage would. In that case the JSObject should have fast 1644 // storage would. In that case the JSObject should have fast
1635 // elements. 1645 // elements.
1636 bool ShouldConvertToFastElements(); 1646 bool ShouldConvertToFastElements();
1637 // Returns true if the elements of JSObject contains only values that can be 1647 // Returns true if the elements of JSObject contains only values that can be
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 2127
2118 // Setters with less debug checks for the GC to use. 2128 // Setters with less debug checks for the GC to use.
2119 inline void set_unchecked(int index, Smi* value); 2129 inline void set_unchecked(int index, Smi* value);
2120 inline void set_null_unchecked(Heap* heap, int index); 2130 inline void set_null_unchecked(Heap* heap, int index);
2121 inline void set_unchecked(Heap* heap, int index, Object* value, 2131 inline void set_unchecked(Heap* heap, int index, Object* value,
2122 WriteBarrierMode mode); 2132 WriteBarrierMode mode);
2123 2133
2124 // Gives access to raw memory which stores the array's data. 2134 // Gives access to raw memory which stores the array's data.
2125 inline Object** data_start(); 2135 inline Object** data_start();
2126 2136
2137 inline Object** GetFirstElementAddress();
2138 inline bool ContainsOnlySmisOrHoles();
2139
2127 // Copy operations. 2140 // Copy operations.
2128 MUST_USE_RESULT inline MaybeObject* Copy(); 2141 MUST_USE_RESULT inline MaybeObject* Copy();
2129 MUST_USE_RESULT MaybeObject* CopySize(int new_length); 2142 MUST_USE_RESULT MaybeObject* CopySize(int new_length);
2130 2143
2131 // Add the elements of a JSArray to this FixedArray. 2144 // Add the elements of a JSArray to this FixedArray.
2132 MUST_USE_RESULT MaybeObject* AddKeysFromJSArray(JSArray* array); 2145 MUST_USE_RESULT MaybeObject* AddKeysFromJSArray(JSArray* array);
2133 2146
2134 // Compute the union of this and other. 2147 // Compute the union of this and other.
2135 MUST_USE_RESULT MaybeObject* UnionOfKeys(FixedArray* other); 2148 MUST_USE_RESULT MaybeObject* UnionOfKeys(FixedArray* other);
2136 2149
(...skipping 5247 matching lines...) Expand 10 before | Expand all | Expand 10 after
7384 7397
7385 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index, 7398 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index,
7386 Object* value); 7399 Object* value);
7387 7400
7388 // Initialize the array with the given capacity. The function may 7401 // Initialize the array with the given capacity. The function may
7389 // fail due to out-of-memory situations, but only if the requested 7402 // fail due to out-of-memory situations, but only if the requested
7390 // capacity is non-zero. 7403 // capacity is non-zero.
7391 MUST_USE_RESULT MaybeObject* Initialize(int capacity); 7404 MUST_USE_RESULT MaybeObject* Initialize(int capacity);
7392 7405
7393 // Set the content of the array to the content of storage. 7406 // Set the content of the array to the content of storage.
7394 inline MaybeObject* SetContent(FixedArray* storage); 7407 inline MaybeObject* SetContent(FixedArrayBase* storage);
7395 7408
7396 // Casting. 7409 // Casting.
7397 static inline JSArray* cast(Object* obj); 7410 static inline JSArray* cast(Object* obj);
7398 7411
7399 // Uses handles. Ensures that the fixed array backing the JSArray has at 7412 // Uses handles. Ensures that the fixed array backing the JSArray has at
7400 // least the stated size. 7413 // least the stated size.
7401 inline void EnsureSize(int minimum_size_of_backing_fixed_array); 7414 inline void EnsureSize(int minimum_size_of_backing_fixed_array);
7402 7415
7403 // Dispatched behavior. 7416 // Dispatched behavior.
7404 #ifdef OBJECT_PRINT 7417 #ifdef OBJECT_PRINT
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
7993 } else { 8006 } else {
7994 value &= ~(1 << bit_position); 8007 value &= ~(1 << bit_position);
7995 } 8008 }
7996 return value; 8009 return value;
7997 } 8010 }
7998 }; 8011 };
7999 8012
8000 } } // namespace v8::internal 8013 } } // namespace v8::internal
8001 8014
8002 #endif // V8_OBJECTS_H_ 8015 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698