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

Unified Diff: src/runtime/runtime-strings.cc

Issue 799803003: Fix ArrayConcat for JSValues/JSFunctions/JSRegExps with @@isConcatSpreadable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: src/runtime/runtime-strings.cc
diff --git a/src/runtime/runtime-strings.cc b/src/runtime/runtime-strings.cc
index df2210c635198410a939c26529a01948a3e5f6aa..8bba9d966b34479c67f87d2a5d23036f9d2b16d4 100644
--- a/src/runtime/runtime-strings.cc
+++ b/src/runtime/runtime-strings.cc
@@ -801,14 +801,8 @@ static int CopyCachedOneByteCharsToArray(Heap* heap, const uint8_t* chars,
}
-// Converts a String to JSArray.
-// For example, "foo" => ["f", "o", "o"].
-RUNTIME_FUNCTION(Runtime_StringToArray) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
- CONVERT_NUMBER_CHECKED(uint32_t, limit, Uint32, args[1]);
-
+Handle<JSArray> Runtime::StringToArray(Isolate* isolate, Handle<String> s,
+ uint32_t limit) {
s = String::Flatten(s);
const int length = static_cast<int>(Min<uint32_t>(s->length(), limit));
@@ -845,7 +839,19 @@ RUNTIME_FUNCTION(Runtime_StringToArray) {
}
#endif
- return *isolate->factory()->NewJSArrayWithElements(elements);
+ return isolate->factory()->NewJSArrayWithElements(elements);
+}
+
+
+// Converts a String to JSArray.
+// For example, "foo" => ["f", "o", "o"].
+RUNTIME_FUNCTION(Runtime_StringToArray) {
+ HandleScope scope(isolate);
+ DCHECK(args.length() == 2);
+ CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
+ CONVERT_NUMBER_CHECKED(uint32_t, limit, Uint32, args[1]);
+
+ return *Runtime::StringToArray(isolate, s, limit);
}

Powered by Google App Engine
This is Rietveld 408576698