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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 587 |
588 int len = Smi::cast(array->length())->value(); | 588 int len = Smi::cast(array->length())->value(); |
589 if (len == 0) return heap->undefined_value(); | 589 if (len == 0) return heap->undefined_value(); |
590 | 590 |
591 ElementsAccessor* accessor = array->GetElementsAccessor(); | 591 ElementsAccessor* accessor = array->GetElementsAccessor(); |
592 int new_length = len - 1; | 592 int new_length = len - 1; |
593 MaybeObject* maybe_result; | 593 MaybeObject* maybe_result; |
594 if (accessor->HasElement(array, array, new_length, elms_obj)) { | 594 if (accessor->HasElement(array, array, new_length, elms_obj)) { |
595 maybe_result = accessor->Get(array, array, new_length, elms_obj); | 595 maybe_result = accessor->Get(array, array, new_length, elms_obj); |
596 } else { | 596 } else { |
597 maybe_result = array->GetPrototype()->GetElement(len - 1); | 597 maybe_result = array->GetPrototype()->GetElement(isolate, len - 1); |
598 } | 598 } |
599 if (maybe_result->IsFailure()) return maybe_result; | 599 if (maybe_result->IsFailure()) return maybe_result; |
600 MaybeObject* maybe_failure = | 600 MaybeObject* maybe_failure = |
601 accessor->SetLength(array, Smi::FromInt(new_length)); | 601 accessor->SetLength(array, Smi::FromInt(new_length)); |
602 if (maybe_failure->IsFailure()) return maybe_failure; | 602 if (maybe_failure->IsFailure()) return maybe_failure; |
603 return maybe_result; | 603 return maybe_result; |
604 } | 604 } |
605 | 605 |
606 | 606 |
607 BUILTIN(ArrayShift) { | 607 BUILTIN(ArrayShift) { |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1855 return Handle<Code>(code_address); \ | 1855 return Handle<Code>(code_address); \ |
1856 } | 1856 } |
1857 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1857 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1858 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1858 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1859 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1859 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1860 #undef DEFINE_BUILTIN_ACCESSOR_C | 1860 #undef DEFINE_BUILTIN_ACCESSOR_C |
1861 #undef DEFINE_BUILTIN_ACCESSOR_A | 1861 #undef DEFINE_BUILTIN_ACCESSOR_A |
1862 | 1862 |
1863 | 1863 |
1864 } } // namespace v8::internal | 1864 } } // namespace v8::internal |
OLD | NEW |