OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 7821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7832 { MaybeObject* maybe_obj = key.AsObject(GetHeap()); | 7832 { MaybeObject* maybe_obj = key.AsObject(GetHeap()); |
7833 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 7833 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
7834 } | 7834 } |
7835 cache->set(EntryToIndex(entry), obj); | 7835 cache->set(EntryToIndex(entry), obj); |
7836 cache->set(EntryToIndex(entry) + 1, code); | 7836 cache->set(EntryToIndex(entry) + 1, code); |
7837 cache->ElementAdded(); | 7837 cache->ElementAdded(); |
7838 return cache; | 7838 return cache; |
7839 } | 7839 } |
7840 | 7840 |
7841 | 7841 |
| 7842 void FixedArray::Shrink(int new_length) { |
| 7843 ASSERT(new_length <= length()); |
| 7844 if (new_length < length()) { |
| 7845 RightTrimFixedArray<FROM_MUTATOR>(GetHeap(), this, length() - new_length); |
| 7846 } |
| 7847 } |
| 7848 |
| 7849 |
7842 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) { | 7850 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) { |
7843 ElementsAccessor* accessor = array->GetElementsAccessor(); | 7851 ElementsAccessor* accessor = array->GetElementsAccessor(); |
7844 MaybeObject* maybe_result = | 7852 MaybeObject* maybe_result = |
7845 accessor->AddElementsToFixedArray(array, array, this); | 7853 accessor->AddElementsToFixedArray(array, array, this); |
7846 FixedArray* result; | 7854 FixedArray* result; |
7847 if (!maybe_result->To<FixedArray>(&result)) return maybe_result; | 7855 if (!maybe_result->To<FixedArray>(&result)) return maybe_result; |
7848 #ifdef ENABLE_SLOW_ASSERTS | 7856 #ifdef ENABLE_SLOW_ASSERTS |
7849 if (FLAG_enable_slow_asserts) { | 7857 if (FLAG_enable_slow_asserts) { |
7850 for (int i = 0; i < result->length(); i++) { | 7858 for (int i = 0; i < result->length(); i++) { |
7851 Object* current = result->get(i); | 7859 Object* current = result->get(i); |
(...skipping 8810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16662 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16670 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16663 static const char* error_messages_[] = { | 16671 static const char* error_messages_[] = { |
16664 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16672 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16665 }; | 16673 }; |
16666 #undef ERROR_MESSAGES_TEXTS | 16674 #undef ERROR_MESSAGES_TEXTS |
16667 return error_messages_[reason]; | 16675 return error_messages_[reason]; |
16668 } | 16676 } |
16669 | 16677 |
16670 | 16678 |
16671 } } // namespace v8::internal | 16679 } } // namespace v8::internal |
OLD | NEW |