Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: src/runtime/runtime-array.cc

Issue 1226063002: Guard @@isConcatSpreadable behind a flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: stage new option so test262 passes Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/harmony-concat-spreadable.js ('k') | test/mjsunit/harmony/array-concat.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 729 static bool IsConcatSpreadable(Isolate* isolate, Handle<Object> obj) {
730 HandleScope handle_scope(isolate); 730 HandleScope handle_scope(isolate);
731 if (!obj->IsSpecObject()) return false; 731 if (!obj->IsSpecObject()) return false;
732 Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol()); 732 if (FLAG_harmony_concat_spreadable) {
733 Handle<Object> value; 733 Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol());
734 MaybeHandle<Object> maybeValue = 734 Handle<Object> value;
735 i::Runtime::GetObjectProperty(isolate, obj, key); 735 MaybeHandle<Object> maybeValue =
736 if (maybeValue.ToHandle(&value)) { 736 i::Runtime::GetObjectProperty(isolate, obj, key);
737 if (!value->IsUndefined()) { 737 if (maybeValue.ToHandle(&value)) {
738 return value->BooleanValue(); 738 if (!value->IsUndefined()) {
739 return value->BooleanValue();
740 }
739 } 741 }
740 } 742 }
741 return obj->IsJSArray(); 743 return obj->IsJSArray();
742 } 744 }
743 745
744 746
745 /** 747 /**
746 * Array::concat implementation. 748 * Array::concat implementation.
747 * See ECMAScript 262, 15.4.4.4. 749 * See ECMAScript 262, 15.4.4.4.
748 * TODO(581): Fix non-compliance for very large concatenations and update to 750 * TODO(581): Fix non-compliance for very large concatenations and update to
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 1320
1319 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { 1321 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) {
1320 SealHandleScope shs(isolate); 1322 SealHandleScope shs(isolate);
1321 DCHECK(args.length() == 2); 1323 DCHECK(args.length() == 2);
1322 // Returning undefined means that this fast path fails and one has to resort 1324 // Returning undefined means that this fast path fails and one has to resort
1323 // to a slow path. 1325 // to a slow path.
1324 return isolate->heap()->undefined_value(); 1326 return isolate->heap()->undefined_value();
1325 } 1327 }
1326 } // namespace internal 1328 } // namespace internal
1327 } // namespace v8 1329 } // namespace v8
OLDNEW
« no previous file with comments | « src/harmony-concat-spreadable.js ('k') | test/mjsunit/harmony/array-concat.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698