Merge "LiteralBuffer::ExpandBuffer always grows" into oc-mr1-dev am: 49b6d94dd7
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/v8/+/13120353
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I8ef9fef9c5368964ae6b8a416d97ffebb2804966
diff --git a/Android.libv8.mk b/Android.libv8.mk
index 465b8b4..1d96e6b 100644
--- a/Android.libv8.mk
+++ b/Android.libv8.mk
@@ -8,6 +8,8 @@
LOCAL_MODULE := libv8
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_CFLAGS := -Wall -Werror
+
LOCAL_WHOLE_STATIC_LIBRARIES := libv8base libv8platform libv8sampler libv8src libv8gen v8peephole
LOCAL_EXPORT_C_INCLUDE_DIRS := \
diff --git a/Android.v8common.mk b/Android.v8common.mk
index f0718a1..11ada3e 100644
--- a/Android.v8common.mk
+++ b/Android.v8common.mk
@@ -3,10 +3,13 @@
LOCAL_CPP_EXTENSION := cc
LOCAL_CFLAGS += \
+ -Wall \
+ -Werror \
-Wno-endif-labels \
-Wno-import \
-Wno-format \
-Wno-unused-parameter \
+ -Wno-unused-private-field \
-Wno-sign-compare \
-Wno-missing-field-initializers \
-Wno-ignored-qualifiers \
diff --git a/src/runtime/runtime-regexp.cc b/src/runtime/runtime-regexp.cc
index 5f6a0c6..7c56889 100644
--- a/src/runtime/runtime-regexp.cc
+++ b/src/runtime/runtime-regexp.cc
@@ -1080,7 +1080,7 @@
MUST_USE_RESULT MaybeHandle<String> StringReplaceNonGlobalRegExpWithFunction(
Isolate* isolate, Handle<String> subject, Handle<JSRegExp> regexp,
- Handle<Object> replace_obj) {
+ Handle<String> replace_obj) {
Factory* factory = isolate->factory();
Handle<RegExpMatchInfo> last_match_info = isolate->regexp_last_match_info();
@@ -1169,14 +1169,17 @@
MUST_USE_RESULT MaybeHandle<String> RegExpReplace(Isolate* isolate,
Handle<JSRegExp> regexp,
Handle<String> string,
- Handle<String> replace) {
+ Handle<String> replace_obj) {
Factory* factory = isolate->factory();
const int flags = regexp->GetFlags();
const bool global = (flags & JSRegExp::kGlobal) != 0;
const bool sticky = (flags & JSRegExp::kSticky) != 0;
- replace = String::Flatten(replace);
+ // Functional fast-paths are dispatched directly by replace builtin.
+ DCHECK(!replace_obj->IsCallable());
+
+ replace_obj = String::Flatten(replace_obj);
Handle<RegExpMatchInfo> last_match_info = isolate->regexp_last_match_info();
@@ -1214,11 +1217,11 @@
IncrementalStringBuilder builder(isolate);
builder.AppendString(factory->NewSubString(string, 0, start_index));
- if (replace->length() > 0) {
+ if (replace_obj->length() > 0) {
MatchInfoBackedMatch m(isolate, string, match_indices);
Handle<String> replacement;
ASSIGN_RETURN_ON_EXCEPTION(isolate, replacement,
- String::GetSubstitution(isolate, &m, replace),
+ String::GetSubstitution(isolate, &m, replace_obj),
String);
builder.AppendString(replacement);
}
@@ -1232,7 +1235,7 @@
RETURN_ON_EXCEPTION(isolate, RegExpUtils::SetLastIndex(isolate, regexp, 0),
String);
- if (replace->length() == 0) {
+ if (replace_obj->length() == 0) {
if (string->HasOnlyOneByteChars()) {
Object* result =
StringReplaceGlobalRegExpWithEmptyString<SeqOneByteString>(
@@ -1247,7 +1250,7 @@
}
Object* result = StringReplaceGlobalRegExpWithString(
- isolate, string, regexp, replace, last_match_info);
+ isolate, string, regexp, replace_obj, last_match_info);
if (result->IsString()) {
return handle(String::cast(result), isolate);
} else {
@@ -1295,7 +1298,7 @@
CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, replace, 2);
+ CONVERT_ARG_HANDLE_CHECKED(String, replace, 2);
DCHECK(RegExpUtils::IsUnmodifiedRegExp(isolate, regexp));