OLD | NEW |
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 2404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2415 | 2415 |
2416 // Makes sure that this object can contain the specified elements. | 2416 // Makes sure that this object can contain the specified elements. |
2417 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( | 2417 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( |
2418 Object** elements, | 2418 Object** elements, |
2419 uint32_t count, | 2419 uint32_t count, |
2420 EnsureElementsMode mode); | 2420 EnsureElementsMode mode); |
2421 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( | 2421 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( |
2422 FixedArrayBase* elements, | 2422 FixedArrayBase* elements, |
2423 uint32_t length, | 2423 uint32_t length, |
2424 EnsureElementsMode mode); | 2424 EnsureElementsMode mode); |
| 2425 static void EnsureCanContainElements( |
| 2426 Handle<JSObject> object, |
| 2427 Arguments* arguments, |
| 2428 uint32_t first_arg, |
| 2429 uint32_t arg_count, |
| 2430 EnsureElementsMode mode); |
2425 MUST_USE_RESULT MaybeObject* EnsureCanContainElements( | 2431 MUST_USE_RESULT MaybeObject* EnsureCanContainElements( |
2426 Arguments* arguments, | 2432 Arguments* arguments, |
2427 uint32_t first_arg, | 2433 uint32_t first_arg, |
2428 uint32_t arg_count, | 2434 uint32_t arg_count, |
2429 EnsureElementsMode mode); | 2435 EnsureElementsMode mode); |
2430 | 2436 |
2431 // Would we convert a fast elements array to dictionary mode given | 2437 // Would we convert a fast elements array to dictionary mode given |
2432 // an access at key? | 2438 // an access at key? |
2433 bool WouldConvertToSlowElements(Handle<Object> key); | 2439 bool WouldConvertToSlowElements(Handle<Object> key); |
2434 // Do we want to keep the elements in fast case when increasing the | 2440 // Do we want to keep the elements in fast case when increasing the |
(...skipping 7569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10004 static void JSArrayUpdateLengthFromIndex(Handle<JSArray> array, | 10010 static void JSArrayUpdateLengthFromIndex(Handle<JSArray> array, |
10005 uint32_t index, | 10011 uint32_t index, |
10006 Handle<Object> value); | 10012 Handle<Object> value); |
10007 | 10013 |
10008 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index, | 10014 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index, |
10009 Object* value); | 10015 Object* value); |
10010 | 10016 |
10011 // Initialize the array with the given capacity. The function may | 10017 // Initialize the array with the given capacity. The function may |
10012 // fail due to out-of-memory situations, but only if the requested | 10018 // fail due to out-of-memory situations, but only if the requested |
10013 // capacity is non-zero. | 10019 // capacity is non-zero. |
| 10020 static void Initialize(Handle<JSArray> array, int capacity, int length = 0); |
10014 MUST_USE_RESULT MaybeObject* Initialize(int capacity, int length = 0); | 10021 MUST_USE_RESULT MaybeObject* Initialize(int capacity, int length = 0); |
10015 | 10022 |
10016 // Initializes the array to a certain length. | 10023 // Initializes the array to a certain length. |
10017 inline bool AllowsSetElementsLength(); | 10024 inline bool AllowsSetElementsLength(); |
10018 // Can cause GC. | 10025 // Can cause GC. |
| 10026 static Handle<Object> SetElementsLength(Handle<JSArray> array, |
| 10027 Handle<Object> length); |
10019 MUST_USE_RESULT MaybeObject* SetElementsLength(Object* length); | 10028 MUST_USE_RESULT MaybeObject* SetElementsLength(Object* length); |
10020 | 10029 |
10021 // Set the content of the array to the content of storage. | 10030 // Set the content of the array to the content of storage. |
10022 MUST_USE_RESULT inline MaybeObject* SetContent(FixedArrayBase* storage); | 10031 MUST_USE_RESULT inline MaybeObject* SetContent(FixedArrayBase* storage); |
10023 | 10032 |
10024 // Casting. | 10033 // Casting. |
10025 static inline JSArray* cast(Object* obj); | 10034 static inline JSArray* cast(Object* obj); |
10026 | 10035 |
10027 // Uses handles. Ensures that the fixed array backing the JSArray has at | 10036 // Uses handles. Ensures that the fixed array backing the JSArray has at |
10028 // least the stated size. | 10037 // least the stated size. |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10782 } else { | 10791 } else { |
10783 value &= ~(1 << bit_position); | 10792 value &= ~(1 << bit_position); |
10784 } | 10793 } |
10785 return value; | 10794 return value; |
10786 } | 10795 } |
10787 }; | 10796 }; |
10788 | 10797 |
10789 } } // namespace v8::internal | 10798 } } // namespace v8::internal |
10790 | 10799 |
10791 #endif // V8_OBJECTS_H_ | 10800 #endif // V8_OBJECTS_H_ |
OLD | NEW |