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 visitor->visit(index, element); | 719 visitor->visit(index, element); |
720 } | 720 } |
721 break; | 721 break; |
722 } | 722 } |
723 } | 723 } |
724 visitor->increase_index_offset(length); | 724 visitor->increase_index_offset(length); |
725 return true; | 725 return true; |
726 } | 726 } |
727 | 727 |
728 | 728 |
729 static bool IsConcatSpreadable(Isolate* isolate, Handle<Object> obj) { | |
730 HandleScope handle_scope(isolate); | |
731 if (!obj->IsSpecObject()) return false; | |
732 if (FLAG_harmony_concat_spreadable) { | |
733 Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol()); | |
734 Handle<Object> value; | |
735 MaybeHandle<Object> maybeValue = | |
736 i::Runtime::GetObjectProperty(isolate, obj, key); | |
737 if (maybeValue.ToHandle(&value)) { | |
738 if (!value->IsUndefined()) { | |
739 return value->BooleanValue(); | |
740 } | |
741 } | |
742 } | |
743 return obj->IsJSArray(); | |
744 } | |
745 | |
746 | |
747 /** | 729 /** |
748 * Array::concat implementation. | 730 * Array::concat implementation. |
749 * See ECMAScript 262, 15.4.4.4. | 731 * See ECMAScript 262, 15.4.4.4. |
750 * TODO(581): Fix non-compliance for very large concatenations and update to | 732 * TODO(581): Fix non-compliance for very large concatenations and update to |
751 * following the ECMAScript 5 specification. | 733 * following the ECMAScript 5 specification. |
752 */ | 734 */ |
753 RUNTIME_FUNCTION(Runtime_ArrayConcat) { | 735 RUNTIME_FUNCTION(Runtime_ArrayConcat) { |
754 HandleScope handle_scope(isolate); | 736 HandleScope handle_scope(isolate); |
755 DCHECK(args.length() == 1); | 737 DCHECK(args.length() == 1); |
756 | 738 |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 | 1302 |
1321 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { | 1303 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { |
1322 SealHandleScope shs(isolate); | 1304 SealHandleScope shs(isolate); |
1323 DCHECK(args.length() == 2); | 1305 DCHECK(args.length() == 2); |
1324 // Returning undefined means that this fast path fails and one has to resort | 1306 // Returning undefined means that this fast path fails and one has to resort |
1325 // to a slow path. | 1307 // to a slow path. |
1326 return isolate->heap()->undefined_value(); | 1308 return isolate->heap()->undefined_value(); |
1327 } | 1309 } |
1328 } // namespace internal | 1310 } // namespace internal |
1329 } // namespace v8 | 1311 } // namespace v8 |
OLD | NEW |