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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 if (array_proto->elements() != heap->empty_fixed_array()) return false; | 304 if (array_proto->elements() != heap->empty_fixed_array()) return false; |
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 HeapObject* elms = array->elements(); | 315 HeapObject* elms = array->elements(); |
315 Map* map = elms->map(); | 316 Map* map = elms->map(); |
316 if (map == heap->fixed_array_map()) { | 317 if (map == heap->fixed_array_map()) { |
317 if (args == NULL || array->HasFastObjectElements()) return elms; | 318 if (args == NULL || array->HasFastObjectElements()) return elms; |
318 } else if (map == heap->fixed_cow_array_map()) { | 319 } else if (map == heap->fixed_cow_array_map()) { |
319 MaybeObject* maybe_writable_result = array->EnsureWritableFastElements(); | 320 MaybeObject* maybe_writable_result = array->EnsureWritableFastElements(); |
320 if (args == NULL || array->HasFastObjectElements() || | 321 if (args == NULL || array->HasFastObjectElements() || |
321 !maybe_writable_result->To(&elms)) { | 322 !maybe_writable_result->To(&elms)) { |
322 return maybe_writable_result; | 323 return maybe_writable_result; |
323 } | 324 } |
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 } | 1823 } |
1823 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1824 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1824 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1825 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1825 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1826 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
1826 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1827 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1827 #undef DEFINE_BUILTIN_ACCESSOR_C | 1828 #undef DEFINE_BUILTIN_ACCESSOR_C |
1828 #undef DEFINE_BUILTIN_ACCESSOR_A | 1829 #undef DEFINE_BUILTIN_ACCESSOR_A |
1829 | 1830 |
1830 | 1831 |
1831 } } // namespace v8::internal | 1832 } } // namespace v8::internal |
OLD | NEW |