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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 | 406 |
407 MUST_USE_RESULT | 407 MUST_USE_RESULT |
408 static inline MaybeObject* EnsureJSArrayWithWritableFastElements( | 408 static inline MaybeObject* EnsureJSArrayWithWritableFastElements( |
409 Heap* heap, Object* receiver, Arguments* args, int first_added_arg) { | 409 Heap* heap, Object* receiver, Arguments* args, int first_added_arg) { |
410 if (!receiver->IsJSArray()) return NULL; | 410 if (!receiver->IsJSArray()) return NULL; |
411 JSArray* array = JSArray::cast(receiver); | 411 JSArray* array = JSArray::cast(receiver); |
412 HeapObject* elms = array->elements(); | 412 HeapObject* elms = array->elements(); |
413 Map* map = elms->map(); | 413 Map* map = elms->map(); |
414 if (map == heap->fixed_array_map()) { | 414 if (map == heap->fixed_array_map()) { |
415 if (array->HasFastElements()) return elms; | 415 if (array->HasFastElements()) return elms; |
416 if (array->HasFastDoubleElements()) { | |
417 ASSERT(elms == heap->empty_fixed_array()); | |
418 MaybeObject* maybe_transition = | |
419 array->TransitionElementsKind(FAST_ELEMENTS); | |
420 if (maybe_transition->IsFailure()) return maybe_transition; | |
Michael Starzinger
2012/05/15 15:38:13
At this point we know that the array has FAST_ELEM
| |
421 } | |
416 if (args == NULL) { | 422 if (args == NULL) { |
Michael Starzinger
2012/05/15 15:38:13
Can we merge that into line 415 like the following
| |
417 if (array->HasFastDoubleElements()) { | |
418 ASSERT(elms == heap->empty_fixed_array()); | |
419 MaybeObject* maybe_transition = | |
420 array->TransitionElementsKind(FAST_ELEMENTS); | |
421 if (maybe_transition->IsFailure()) return maybe_transition; | |
422 } | |
423 return elms; | 423 return elms; |
424 } | 424 } |
425 } else if (map == heap->fixed_cow_array_map()) { | 425 } else if (map == heap->fixed_cow_array_map()) { |
426 MaybeObject* maybe_writable_result = array->EnsureWritableFastElements(); | 426 MaybeObject* maybe_writable_result = array->EnsureWritableFastElements(); |
427 if (args == NULL || array->HasFastElements() || | 427 if (args == NULL || array->HasFastElements() || |
428 maybe_writable_result->IsFailure()) { | 428 maybe_writable_result->IsFailure()) { |
429 return maybe_writable_result; | 429 return maybe_writable_result; |
430 } | 430 } |
431 } else { | 431 } else { |
432 return NULL; | 432 return NULL; |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1680 return Handle<Code>(code_address); \ | 1680 return Handle<Code>(code_address); \ |
1681 } | 1681 } |
1682 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1682 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1683 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1683 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1684 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1684 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1685 #undef DEFINE_BUILTIN_ACCESSOR_C | 1685 #undef DEFINE_BUILTIN_ACCESSOR_C |
1686 #undef DEFINE_BUILTIN_ACCESSOR_A | 1686 #undef DEFINE_BUILTIN_ACCESSOR_A |
1687 | 1687 |
1688 | 1688 |
1689 } } // namespace v8::internal | 1689 } } // namespace v8::internal |
OLD | NEW |