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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 return array_proto->GetPrototype()->IsNull(); | 305 return array_proto->GetPrototype()->IsNull(); |
306 } | 306 } |
307 | 307 |
308 | 308 |
309 MUST_USE_RESULT | 309 MUST_USE_RESULT |
310 static inline MaybeObject* EnsureJSArrayWithWritableFastElements( | 310 static inline MaybeObject* EnsureJSArrayWithWritableFastElements( |
311 Heap* heap, Object* receiver, Arguments* args, int first_added_arg) { | 311 Heap* heap, Object* receiver, Arguments* args, int first_added_arg) { |
312 if (!receiver->IsJSArray()) return NULL; | 312 if (!receiver->IsJSArray()) return NULL; |
313 JSArray* array = JSArray::cast(receiver); | 313 JSArray* array = JSArray::cast(receiver); |
314 if (array->map()->is_observed()) return NULL; | 314 if (array->map()->is_observed()) return NULL; |
| 315 if (!array->map()->is_extensible()) return NULL; |
315 HeapObject* elms = array->elements(); | 316 HeapObject* elms = array->elements(); |
316 Map* map = elms->map(); | 317 Map* map = elms->map(); |
317 if (map == heap->fixed_array_map()) { | 318 if (map == heap->fixed_array_map()) { |
318 if (args == NULL || array->HasFastObjectElements()) return elms; | 319 if (args == NULL || array->HasFastObjectElements()) return elms; |
319 } else if (map == heap->fixed_cow_array_map()) { | 320 } else if (map == heap->fixed_cow_array_map()) { |
320 MaybeObject* maybe_writable_result = array->EnsureWritableFastElements(); | 321 MaybeObject* maybe_writable_result = array->EnsureWritableFastElements(); |
321 if (args == NULL || array->HasFastObjectElements() || | 322 if (args == NULL || array->HasFastObjectElements() || |
322 !maybe_writable_result->To(&elms)) { | 323 !maybe_writable_result->To(&elms)) { |
323 return maybe_writable_result; | 324 return maybe_writable_result; |
324 } | 325 } |
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 } | 1800 } |
1800 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1801 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1801 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1802 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1802 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1803 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
1803 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1804 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1804 #undef DEFINE_BUILTIN_ACCESSOR_C | 1805 #undef DEFINE_BUILTIN_ACCESSOR_C |
1805 #undef DEFINE_BUILTIN_ACCESSOR_A | 1806 #undef DEFINE_BUILTIN_ACCESSOR_A |
1806 | 1807 |
1807 | 1808 |
1808 } } // namespace v8::internal | 1809 } } // namespace v8::internal |
OLD | NEW |