Reviewers: adamk,

Description:
Version 4.5.103.3 (cherry-pick)

Merged a415f594585cb16cd1b4067cab905ddab61c6e5b

Guard @@isConcatSpreadable behind a flag

BUG=chromium:507553
LOG=N
[email protected]

Please review this at https://codereview.chromium.org/1236443004/

Base URL: https://chromium.googlesource.com/v8/[email protected]

Affected files (+36, -16 lines):
  M BUILD.gn
  M include/v8-version.h
  M src/bootstrapper.cc
  M src/flag-definitions.h
  M src/harmony-array.js
  A src/harmony-concat-spreadable.js
  M src/runtime/runtime-array.cc
  M test/mjsunit/harmony/array-concat.js
  M tools/gyp/v8.gyp


Index: BUILD.gn
diff --git a/BUILD.gn b/BUILD.gn
index e75ffb7656c5b1ef8412a96cd364151596369c24..059ee07086248da5ef965c679041e0e0a356e0af 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -273,6 +273,7 @@ action("js2c_experimental") {
     "src/generator.js",
     "src/harmony-atomics.js",
     "src/harmony-array-includes.js",
+    "src/harmony-concat-spreadable.js",
     "src/harmony-tostring.js",
     "src/harmony-regexp.js",
     "src/harmony-reflect.js",
Index: include/v8-version.h
diff --git a/include/v8-version.h b/include/v8-version.h
index 379f688c9517c7767575e3560bdda3af190eddb9..708166a926164fba0b7569d05820f163b242cc84 100644
--- a/include/v8-version.h
+++ b/include/v8-version.h
@@ -11,7 +11,7 @@
 #define V8_MAJOR_VERSION 4
 #define V8_MINOR_VERSION 5
 #define V8_BUILD_NUMBER 103
-#define V8_PATCH_LEVEL 2
+#define V8_PATCH_LEVEL 3

 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 983da4787fe5a3064b3369e7e8f550544c8beeea..43fc0eb8355a7ad0d1be7ccb0fe4bd233ac81dd9 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1819,6 +1819,7 @@ EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spread_arrays)
 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sharedarraybuffer)
 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_atomics)
 EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_new_target)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_concat_spreadable)


 void Genesis::InstallNativeFunctions_harmony_proxies() {
@@ -1850,6 +1851,7 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object)
 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_spread_arrays)
 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_atomics)
 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_new_target)
+EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_concat_spreadable)

 void Genesis::InitializeGlobal_harmony_regexps() {
   Handle<JSObject> builtins(native_context()->builtins());
@@ -2500,6 +2502,8 @@ bool Genesis::InstallExperimentalNatives() {
static const char* harmony_atomics_natives[] = {"native harmony-atomics.js",
                                                   nullptr};
   static const char* harmony_new_target_natives[] = {nullptr};
+  static const char* harmony_concat_spreadable_natives[] = {
+      "native harmony-concat-spreadable.js", nullptr};

   for (int i = ExperimentalNatives::GetDebuggerCount();
        i < ExperimentalNatives::GetBuiltinsCount(); i++) {
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 033d0b3e8fab230f08bef9dbc2ff3fcb2813687a..2771671c315a7f0f4da1baf791842491639342ba 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -199,8 +199,9 @@ DEFINE_BOOL(legacy_const, true, "legacy semantics for const in sloppy mode")
   V(harmony_new_target, "harmony new.target")

 // Features that are complete (but still behind --harmony/es-staging flag).
-#define HARMONY_STAGED(V)                 \
-  V(harmony_tostring, "harmony toString") \
+#define HARMONY_STAGED(V)                                       \
+  V(harmony_tostring, "harmony toString")                       \
+  V(harmony_concat_spreadable, "harmony isConcatSpreadable")    \
   V(harmony_rest_parameters, "harmony rest parameters")

// Features that are shipping (turned on by default, but internal flag remains).
Index: src/harmony-array.js
diff --git a/src/harmony-array.js b/src/harmony-array.js
index 637dd6ed857639f8b743f617a744aea9460a4e85..e94134b81aa851a9539ceb86d38e72971279fa78 100644
--- a/src/harmony-array.js
+++ b/src/harmony-array.js
@@ -287,11 +287,6 @@ function ArrayOf() {

 // -------------------------------------------------------------------

-utils.InstallConstants(GlobalSymbol, [
-  // TODO(dslomov, caitp): Move to symbol.js when shipping
-  "isConcatSpreadable", symbolIsConcatSpreadable
-]);
-
 %FunctionSetLength(ArrayCopyWithin, 2);
 %FunctionSetLength(ArrayFrom, 1);
 %FunctionSetLength(ArrayFill, 1);
Index: src/harmony-concat-spreadable.js
diff --git a/src/harmony-concat-spreadable.js b/src/harmony-concat-spreadable.js
new file mode 100644
index 0000000000000000000000000000000000000000..362701c12304d8f66d7b9dc1515369e0bf868fc5
--- /dev/null
+++ b/src/harmony-concat-spreadable.js
@@ -0,0 +1,16 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function(global, utils) {
+
+'use strict';
+
+%CheckIsBootstrapping();
+
+utils.InstallConstants(global.Symbol, [
+  // TODO(littledan): Move to symbol.js when shipping
+  "isConcatSpreadable", symbolIsConcatSpreadable
+]);
+
+})
Index: src/runtime/runtime-array.cc
diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc
index b2865dcbdf323b6829fec9e02d2f262036fcd0c1..d00df71576bf27edcee2131a8c0cd5656e314d8c 100644
--- a/src/runtime/runtime-array.cc
+++ b/src/runtime/runtime-array.cc
@@ -729,13 +729,15 @@ static bool IterateElements(Isolate* isolate, Handle<JSObject> receiver,
 static bool IsConcatSpreadable(Isolate* isolate, Handle<Object> obj) {
   HandleScope handle_scope(isolate);
   if (!obj->IsSpecObject()) return false;
-  Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol());
-  Handle<Object> value;
-  MaybeHandle<Object> maybeValue =
-      i::Runtime::GetObjectProperty(isolate, obj, key);
-  if (maybeValue.ToHandle(&value)) {
-    if (!value->IsUndefined()) {
-      return value->BooleanValue();
+  if (FLAG_harmony_concat_spreadable) {
+    Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol());
+    Handle<Object> value;
+    MaybeHandle<Object> maybeValue =
+        i::Runtime::GetObjectProperty(isolate, obj, key);
+    if (maybeValue.ToHandle(&value)) {
+      if (!value->IsUndefined()) {
+        return value->BooleanValue();
+      }
     }
   }
   return obj->IsJSArray();
Index: test/mjsunit/harmony/array-concat.js
diff --git a/test/mjsunit/harmony/array-concat.js b/test/mjsunit/harmony/array-concat.js index 89a884143dd3a898ea7bad72de54bc7df3c2f375..71b6790bc7b13e238930ed824d165d76ec903c2c 100644
--- a/test/mjsunit/harmony/array-concat.js
+++ b/test/mjsunit/harmony/array-concat.js
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

-// Flags: --harmony-arrays
+// Flags: --harmony-concat-spreadable

 (function testArrayConcatArity() {
   "use strict";
Index: tools/gyp/v8.gyp
diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp
index 6ef9b3818e35b42b14cc5c97fd176708dc9c1e31..a77acfa1091ed9fb392895c28ca62e572b8249a1 100644
--- a/tools/gyp/v8.gyp
+++ b/tools/gyp/v8.gyp
@@ -1786,6 +1786,7 @@
           '../../src/generator.js',
           '../../src/harmony-atomics.js',
           '../../src/harmony-array-includes.js',
+          '../../src/harmony-concat-spreadable.js',
           '../../src/harmony-tostring.js',
           '../../src/harmony-regexp.js',
           '../../src/harmony-reflect.js',


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to