Index: runtime/vm/dart_api_impl_test.cc |
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc |
index 7ccf6a0bda4eafc31c76e30dce7ff954b084e87b..c9aa7feeb1683f503c7eef8792b4f49d6409acb0 100644 |
--- a/runtime/vm/dart_api_impl_test.cc |
+++ b/runtime/vm/dart_api_impl_test.cc |
@@ -23,6 +23,7 @@ namespace dart { |
DECLARE_FLAG(bool, verify_acquired_data); |
DECLARE_FLAG(bool, ignore_patch_signature_mismatch); |
+DECLARE_FLAG(bool, support_externalizable_strings); |
#ifndef PRODUCT |
@@ -5575,6 +5576,9 @@ static Dart_NativeFunction native_args_lookup(Dart_Handle name, |
TEST_CASE(GetNativeArguments) { |
+ const bool saved_flag = FLAG_support_externalizable_strings; |
+ FLAG_support_externalizable_strings = true; |
+ |
const char* kScriptChars = |
"import 'dart:nativewrappers';" |
"class MyObject extends NativeFieldWrapperClass2 {" |
@@ -5621,6 +5625,8 @@ TEST_CASE(GetNativeArguments) { |
Dart_Handle result = Dart_Invoke(lib, NewString("testMain"), 1, args); |
EXPECT_VALID(result); |
EXPECT(Dart_IsInteger(result)); |
+ |
+ FLAG_support_externalizable_strings = saved_flag; |
} |
@@ -8497,6 +8503,9 @@ static void MakeExternalCback(void* peer) { |
TEST_CASE(MakeExternalString) { |
+ const bool saved_flag = FLAG_support_externalizable_strings; |
+ FLAG_support_externalizable_strings = true; |
+ |
static int peer8 = 40; |
static int peer16 = 41; |
static int canonical_str_peer = 42; |
@@ -8700,10 +8709,15 @@ TEST_CASE(MakeExternalString) { |
EXPECT_EQ(80, peer8); |
EXPECT_EQ(82, peer16); |
EXPECT_EQ(42, canonical_str_peer); // "*" Symbol is not removed on GC. |
+ |
+ FLAG_support_externalizable_strings = saved_flag; |
} |
TEST_CASE(ExternalizeConstantStrings) { |
+ const bool saved_flag = FLAG_support_externalizable_strings; |
+ FLAG_support_externalizable_strings = true; |
+ |
const char* kScriptChars = |
"String testMain() {\n" |
" return 'constant string';\n" |
@@ -8727,6 +8741,8 @@ TEST_CASE(ExternalizeConstantStrings) { |
for (intptr_t i = 0; i < kExpectedLen; i++) { |
EXPECT_EQ(expected_str[i], ext_str[i]); |
} |
+ |
+ FLAG_support_externalizable_strings = saved_flag; |
} |
@@ -8816,6 +8832,9 @@ static Dart_NativeFunction ExternalStringDeoptimize_native_lookup( |
// Do not use guarding mechanism on externalizable classes, since their class |
// can change on the fly, |
TEST_CASE(GuardExternalizedString) { |
+ const bool saved_flag = FLAG_support_externalizable_strings; |
+ FLAG_support_externalizable_strings = true; |
+ |
const char* kScriptChars = |
"main() {\n" |
" var a = new A('hello');\n" |
@@ -8851,10 +8870,15 @@ TEST_CASE(GuardExternalizedString) { |
result = Dart_IntegerToInt64(result, &value); |
EXPECT_VALID(result); |
EXPECT_EQ(10640000, value); |
+ |
+ FLAG_support_externalizable_strings = saved_flag; |
} |
TEST_CASE(ExternalStringDeoptimize) { |
+ const bool saved_flag = FLAG_support_externalizable_strings; |
+ FLAG_support_externalizable_strings = true; |
+ |
const char* kScriptChars = |
"String str = 'A';\n" |
"class A {\n" |
@@ -8886,10 +8910,15 @@ TEST_CASE(ExternalStringDeoptimize) { |
result = Dart_IntegerToInt64(result, &value); |
EXPECT_VALID(result); |
EXPECT_EQ(260, value); |
+ |
+ FLAG_support_externalizable_strings = saved_flag; |
} |
TEST_CASE(ExternalStringPolymorphicDeoptimize) { |
+ const bool saved_flag = FLAG_support_externalizable_strings; |
+ FLAG_support_externalizable_strings = true; |
+ |
const char* kScriptChars = |
"const strA = 'AAAA';\n" |
"class A {\n" |
@@ -8922,10 +8951,15 @@ TEST_CASE(ExternalStringPolymorphicDeoptimize) { |
result = Dart_BooleanValue(result, &value); |
EXPECT_VALID(result); |
EXPECT(value); |
+ |
+ FLAG_support_externalizable_strings = saved_flag; |
} |
TEST_CASE(ExternalStringGuardFieldDeoptimize) { |
+ const bool saved_flag = FLAG_support_externalizable_strings; |
+ FLAG_support_externalizable_strings = true; |
+ |
const char* kScriptChars = |
"const strA = 'AAAA';\n" |
"class A {\n" |
@@ -8963,10 +8997,15 @@ TEST_CASE(ExternalStringGuardFieldDeoptimize) { |
result = Dart_BooleanValue(result, &value); |
EXPECT_VALID(result); |
EXPECT(value); |
+ |
+ FLAG_support_externalizable_strings = saved_flag; |
} |
TEST_CASE(ExternalStringStaticFieldDeoptimize) { |
+ const bool saved_flag = FLAG_support_externalizable_strings; |
+ FLAG_support_externalizable_strings = true; |
+ |
const char* kScriptChars = |
"const strA = 'AAAA';\n" |
"class A {\n" |
@@ -8999,10 +9038,15 @@ TEST_CASE(ExternalStringStaticFieldDeoptimize) { |
result = Dart_BooleanValue(result, &value); |
EXPECT_VALID(result); |
EXPECT(value); |
+ |
+ FLAG_support_externalizable_strings = saved_flag; |
} |
TEST_CASE(ExternalStringTrimDoubleParse) { |
+ const bool saved_flag = FLAG_support_externalizable_strings; |
+ FLAG_support_externalizable_strings = true; |
+ |
const char* kScriptChars = |
"String str = 'A';\n" |
"class A {\n" |
@@ -9028,10 +9072,15 @@ TEST_CASE(ExternalStringTrimDoubleParse) { |
result = Dart_IntegerToInt64(result, &value); |
EXPECT_VALID(result); |
EXPECT_EQ(8, value); |
+ |
+ FLAG_support_externalizable_strings = saved_flag; |
} |
TEST_CASE(ExternalStringDoubleParse) { |
+ const bool saved_flag = FLAG_support_externalizable_strings; |
+ FLAG_support_externalizable_strings = true; |
+ |
const char* kScriptChars = |
"String str = 'A';\n" |
"class A {\n" |
@@ -9057,11 +9106,13 @@ TEST_CASE(ExternalStringDoubleParse) { |
result = Dart_IntegerToInt64(result, &value); |
EXPECT_VALID(result); |
EXPECT_EQ(8, value); |
+ |
+ FLAG_support_externalizable_strings = saved_flag; |
} |
TEST_CASE(ExternalStringIndexOf) { |
- const char* kScriptChars = |
+ const char* kScriptChars = |
"main(String pattern) {\n" |
" var str = 'Hello World';\n" |
" return str.indexOf(pattern);\n" |