OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/elements.h" | 8 #include "src/elements.h" |
9 #include "src/messages.h" | 9 #include "src/messages.h" |
10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 } | 719 } |
720 } | 720 } |
721 visitor->increase_index_offset(length); | 721 visitor->increase_index_offset(length); |
722 return true; | 722 return true; |
723 } | 723 } |
724 | 724 |
725 | 725 |
726 static bool IsConcatSpreadable(Isolate* isolate, Handle<Object> obj) { | 726 static bool IsConcatSpreadable(Isolate* isolate, Handle<Object> obj) { |
727 HandleScope handle_scope(isolate); | 727 HandleScope handle_scope(isolate); |
728 if (!obj->IsSpecObject()) return false; | 728 if (!obj->IsSpecObject()) return false; |
729 if (FLAG_harmony_arrays) { | 729 Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol()); |
730 Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol()); | 730 Handle<Object> value; |
731 Handle<Object> value; | 731 MaybeHandle<Object> maybeValue = |
732 MaybeHandle<Object> maybeValue = | 732 i::Runtime::GetObjectProperty(isolate, obj, key); |
733 i::Runtime::GetObjectProperty(isolate, obj, key); | 733 if (maybeValue.ToHandle(&value)) { |
734 if (maybeValue.ToHandle(&value)) { | 734 if (!value->IsUndefined()) { |
735 if (!value->IsUndefined()) { | 735 return value->BooleanValue(); |
736 return value->BooleanValue(); | |
737 } | |
738 } | 736 } |
739 } | 737 } |
740 return obj->IsJSArray(); | 738 return obj->IsJSArray(); |
741 } | 739 } |
742 | 740 |
743 | 741 |
744 /** | 742 /** |
745 * Array::concat implementation. | 743 * Array::concat implementation. |
746 * See ECMAScript 262, 15.4.4.4. | 744 * See ECMAScript 262, 15.4.4.4. |
747 * TODO(581): Fix non-compliance for very large concatenations and update to | 745 * TODO(581): Fix non-compliance for very large concatenations and update to |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 | 1315 |
1318 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { | 1316 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { |
1319 SealHandleScope shs(isolate); | 1317 SealHandleScope shs(isolate); |
1320 DCHECK(args.length() == 2); | 1318 DCHECK(args.length() == 2); |
1321 // Returning undefined means that this fast path fails and one has to resort | 1319 // Returning undefined means that this fast path fails and one has to resort |
1322 // to a slow path. | 1320 // to a slow path. |
1323 return isolate->heap()->undefined_value(); | 1321 return isolate->heap()->undefined_value(); |
1324 } | 1322 } |
1325 } // namespace internal | 1323 } // namespace internal |
1326 } // namespace v8 | 1324 } // namespace v8 |
OLD | NEW |