Move flags strong/sync-async/reify-generic-functions back to global vm flags (they are not set as isolate specific flags).
Change-Id: I4d5cba4f5ac657a0834e3755312147cff1fbc001 Reviewed-on: https://dart-review.googlesource.com/71426 Commit-Queue: Siva Annamalai <asiva@google.com> Reviewed-by: Zach Anderson <zra@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
3903b5b2d8
commit
cd3ddede99
@@ -661,6 +661,13 @@ gen_snapshot_action("generate_snapshot_bin") {
|
||||
]
|
||||
args = [
|
||||
"--deterministic",
|
||||
|
||||
# TODO(asiva) remove these flags once the core snapshot is switched to
|
||||
# dart 2.
|
||||
"--no-strong",
|
||||
"--no-sync-async",
|
||||
"--reify-generic-functions",
|
||||
|
||||
"--snapshot_kind=" + dart_core_snapshot_kind,
|
||||
"--vm_snapshot_data=" + rebase_path(vm_snapshot_data, root_build_dir),
|
||||
"--vm_snapshot_instructions=" +
|
||||
|
||||
+7
-5
@@ -448,7 +448,7 @@ static Dart_Isolate CreateAndSetupKernelIsolate(const char* script_uri,
|
||||
packages_config = Options::packages_file();
|
||||
}
|
||||
|
||||
Dart_Isolate isolate;
|
||||
Dart_Isolate isolate = NULL;
|
||||
IsolateData* isolate_data = NULL;
|
||||
bool isolate_run_app_snapshot = false;
|
||||
AppSnapshot* app_snapshot = NULL;
|
||||
@@ -470,7 +470,8 @@ static Dart_Isolate CreateAndSetupKernelIsolate(const char* script_uri,
|
||||
DART_KERNEL_ISOLATE_NAME, main, isolate_snapshot_data,
|
||||
isolate_snapshot_instructions, app_isolate_shared_data,
|
||||
app_isolate_shared_instructions, flags, isolate_data, error);
|
||||
} else {
|
||||
}
|
||||
if (isolate == NULL) {
|
||||
const uint8_t* kernel_service_buffer = NULL;
|
||||
intptr_t kernel_service_buffer_size = 0;
|
||||
dfe.LoadKernelService(&kernel_service_buffer, &kernel_service_buffer_size);
|
||||
@@ -890,7 +891,7 @@ bool RunMainIsolate(const char* script_name, CommandLineOptions* dart_options) {
|
||||
}
|
||||
|
||||
Dart_Isolate isolate = NULL;
|
||||
if (flags.strong && Options::gen_snapshot_kind() == kAppAOT) {
|
||||
if (Options::preview_dart_2() && Options::gen_snapshot_kind() == kAppAOT) {
|
||||
isolate = IsolateSetupHelperAotCompilationDart2(
|
||||
script_name, "main", Options::package_root(), Options::packages_file(),
|
||||
&flags, &error, &exit_code);
|
||||
@@ -1261,8 +1262,9 @@ void main(int argc, char** argv) {
|
||||
init_params.entropy_source = DartUtils::EntropySource;
|
||||
init_params.get_service_assets = GetVMServiceAssetsArchiveCallback;
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
init_params.start_kernel_isolate =
|
||||
dfe.UseDartFrontend() && dfe.CanUseDartFrontend();
|
||||
init_params.start_kernel_isolate = Options::preview_dart_2() &&
|
||||
dfe.UseDartFrontend() &&
|
||||
dfe.CanUseDartFrontend();
|
||||
#else
|
||||
init_params.start_kernel_isolate = false;
|
||||
#endif
|
||||
|
||||
@@ -63,12 +63,6 @@ ENUM_OPTIONS_LIST(ENUM_OPTION_DEFINITION)
|
||||
CB_OPTIONS_LIST(CB_OPTION_DEFINITION)
|
||||
#undef CB_OPTION_DEFINITION
|
||||
|
||||
void Options::SetDart2Options(CommandLineOptions* vm_options) {
|
||||
vm_options->AddArgument("--strong");
|
||||
vm_options->AddArgument("--reify-generic-functions");
|
||||
vm_options->AddArgument("--sync-async");
|
||||
}
|
||||
|
||||
void Options::SetDart1Options(CommandLineOptions* vm_options) {
|
||||
vm_options->AddArgument("--no-strong");
|
||||
vm_options->AddArgument("--no-reify-generic-functions");
|
||||
@@ -348,9 +342,6 @@ int Options::ParseArguments(int argc,
|
||||
const char* kPrefix = "--";
|
||||
const intptr_t kPrefixLen = strlen(kPrefix);
|
||||
|
||||
// Set Dart 2 as the default option.
|
||||
Options::SetDart2Options(vm_options);
|
||||
|
||||
// Store the executable name.
|
||||
Platform::SetExecutableName(argv[0]);
|
||||
|
||||
|
||||
@@ -112,7 +112,6 @@ class Options {
|
||||
#undef CB_OPTIONS_DECL
|
||||
|
||||
static bool preview_dart_2() { return !no_preview_dart_2(); }
|
||||
static void SetDart2Options(CommandLineOptions* vm_options);
|
||||
static void SetDart1Options(CommandLineOptions* vm_options);
|
||||
|
||||
static dart::SimpleHashMap* environment() { return environment_; }
|
||||
|
||||
@@ -150,7 +150,8 @@ static Dart_Isolate CreateIsolateAndSetup(const char* script_uri,
|
||||
isolate = Dart_CreateIsolate(
|
||||
DART_KERNEL_ISOLATE_NAME, main, isolate_snapshot_data,
|
||||
isolate_snapshot_instructions, NULL, NULL, flags, isolate_data, error);
|
||||
} else {
|
||||
}
|
||||
if (isolate == NULL) {
|
||||
bin::dfe.Init();
|
||||
bin::dfe.LoadKernelService(&kernel_service_buffer,
|
||||
&kernel_service_buffer_size);
|
||||
@@ -262,13 +263,27 @@ static int Main(int argc, const char** argv) {
|
||||
dart_argc = argc - 2;
|
||||
dart_argv = &argv[1];
|
||||
}
|
||||
const char* error;
|
||||
if (!start_kernel_isolate) {
|
||||
int extra_argc = dart_argc + 3;
|
||||
const char** extra_argv = new const char*[extra_argc];
|
||||
for (intptr_t i = 0; i < dart_argc; i++) {
|
||||
extra_argv[i] = dart_argv[i];
|
||||
}
|
||||
extra_argv[dart_argc] = "--no-strong";
|
||||
extra_argv[dart_argc + 1] = "--no-reify-generic-arguments";
|
||||
extra_argv[dart_argc + 2] = "--no-sync-async";
|
||||
error = Flags::ProcessCommandLineFlags(extra_argc, extra_argv);
|
||||
ASSERT(error == NULL);
|
||||
} else {
|
||||
error = Flags::ProcessCommandLineFlags(dart_argc, dart_argv);
|
||||
ASSERT(error == NULL);
|
||||
}
|
||||
|
||||
bin::Thread::InitOnce();
|
||||
bin::TimerUtils::InitOnce();
|
||||
bin::EventHandler::Start();
|
||||
|
||||
const char* error = Flags::ProcessCommandLineFlags(dart_argc, dart_argv);
|
||||
ASSERT(error == NULL);
|
||||
|
||||
error = Dart::InitOnce(
|
||||
dart::bin::vm_snapshot_data, dart::bin::vm_snapshot_instructions,
|
||||
|
||||
@@ -553,7 +553,7 @@ typedef struct {
|
||||
* for each part.
|
||||
*/
|
||||
|
||||
#define DART_FLAGS_CURRENT_VERSION (0x00000006)
|
||||
#define DART_FLAGS_CURRENT_VERSION (0x00000007)
|
||||
|
||||
typedef struct {
|
||||
int32_t version;
|
||||
@@ -566,10 +566,7 @@ typedef struct {
|
||||
bool use_dart_frontend;
|
||||
bool obfuscate;
|
||||
Dart_QualifiedFunctionName* entry_points;
|
||||
bool reify_generic_functions;
|
||||
bool strong;
|
||||
bool load_vmservice_library;
|
||||
bool sync_async;
|
||||
bool unsafe_trust_strong_mode_types;
|
||||
} Dart_IsolateFlags;
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ DEFINE_NATIVE_ENTRY(Isolate_spawnUri, 12) {
|
||||
Dart_IsolateFlags* flags = state->isolate_flags();
|
||||
flags->enable_asserts = is_checked;
|
||||
// Do not enable type checks in strong mode.
|
||||
flags->enable_type_checks = is_checked && !flags->strong;
|
||||
flags->enable_type_checks = is_checked && !FLAG_strong;
|
||||
}
|
||||
|
||||
ThreadPool::Task* spawn_task = new SpawnIsolateTask(state);
|
||||
|
||||
@@ -380,7 +380,7 @@ DEFINE_NATIVE_ENTRY(Internal_extractTypeArguments, 2) {
|
||||
Class& interface_cls = Class::Handle(zone);
|
||||
intptr_t num_type_args = 0; // Remains 0 when executing Dart 1.0 code.
|
||||
// TODO(regis): Check for strong mode too?
|
||||
if (Isolate::Current()->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
const TypeArguments& function_type_args =
|
||||
TypeArguments::Handle(zone, arguments->NativeTypeArgs());
|
||||
if (function_type_args.Length() == 1) {
|
||||
|
||||
@@ -449,8 +449,7 @@ void ClassFinalizer::ResolveRedirectingFactoryTarget(
|
||||
return;
|
||||
}
|
||||
|
||||
Isolate* isolate = Isolate::Current();
|
||||
if (isolate->error_on_bad_override() && !isolate->strong()) {
|
||||
if (!FLAG_strong && Isolate::Current()->error_on_bad_override()) {
|
||||
// Verify that the target is compatible with the redirecting factory.
|
||||
Error& error = Error::Handle();
|
||||
if (!target.HasCompatibleParametersWith(factory, &error)) {
|
||||
@@ -564,7 +563,7 @@ void ClassFinalizer::ResolveTypeClass(const Class& cls, const Type& type) {
|
||||
(type.signature() != Function::null()));
|
||||
|
||||
// In non-strong mode, replace FutureOr<T> type of async library with dynamic.
|
||||
if (type_class.IsFutureOrClass() && !Isolate::Current()->strong()) {
|
||||
if (type_class.IsFutureOrClass() && !FLAG_strong) {
|
||||
Type::Cast(type).set_type_class(Class::Handle(Object::dynamic_class()));
|
||||
type.set_arguments(Object::null_type_arguments());
|
||||
}
|
||||
@@ -1226,7 +1225,7 @@ RawAbstractType* ClassFinalizer::FinalizeType(const Class& cls,
|
||||
// malformed.
|
||||
if ((finalization >= kCanonicalize) && !type.IsMalformed() &&
|
||||
!type.IsCanonical() && type.IsType()) {
|
||||
if (!Isolate::Current()->strong()) {
|
||||
if (!FLAG_strong) {
|
||||
CheckTypeBounds(cls, type);
|
||||
}
|
||||
return type.Canonicalize();
|
||||
@@ -1370,7 +1369,7 @@ RawAbstractType* ClassFinalizer::FinalizeType(const Class& cls,
|
||||
|
||||
// If we are done finalizing a graph of mutually recursive types, check their
|
||||
// bounds.
|
||||
if (is_root_type && !Isolate::Current()->strong()) {
|
||||
if (is_root_type && !FLAG_strong) {
|
||||
for (intptr_t i = pending_types->length() - 1; i >= 0; i--) {
|
||||
const AbstractType& type = pending_types->At(i);
|
||||
if (!type.IsMalformed() && !type.IsCanonical()) {
|
||||
@@ -1634,7 +1633,7 @@ void ClassFinalizer::ResolveAndFinalizeMemberTypes(const Class& cls) {
|
||||
String& other_name = String::Handle(zone);
|
||||
Class& super_class = Class::Handle(zone);
|
||||
const intptr_t num_fields = array.Length();
|
||||
const bool track_exactness = isolate->strong() && isolate->use_field_guards();
|
||||
const bool track_exactness = FLAG_strong && isolate->use_field_guards();
|
||||
for (intptr_t i = 0; i < num_fields; i++) {
|
||||
field ^= array.At(i);
|
||||
type = field.type();
|
||||
@@ -1743,7 +1742,7 @@ void ClassFinalizer::ResolveAndFinalizeMemberTypes(const Class& cls) {
|
||||
// If we check for bad overrides, collect interfaces, super interfaces, and
|
||||
// super classes of this class.
|
||||
GrowableArray<const Class*> interfaces(zone, 4);
|
||||
if (isolate->error_on_bad_override() && !isolate->strong()) {
|
||||
if (isolate->error_on_bad_override() && !FLAG_strong) {
|
||||
CollectInterfaces(cls, &interfaces);
|
||||
// Include superclasses in list of interfaces and super interfaces.
|
||||
super_class = cls.SuperClass();
|
||||
@@ -1765,7 +1764,7 @@ void ClassFinalizer::ResolveAndFinalizeMemberTypes(const Class& cls) {
|
||||
FinalizeSignature(cls, function);
|
||||
name = function.name();
|
||||
// Report signature conflicts only.
|
||||
if (isolate->error_on_bad_override() && !isolate->strong() &&
|
||||
if (isolate->error_on_bad_override() && !FLAG_strong &&
|
||||
!function.is_static() && !function.IsGenerativeConstructor()) {
|
||||
// A constructor cannot override anything.
|
||||
for (intptr_t i = 0; i < interfaces.length(); i++) {
|
||||
@@ -2787,7 +2786,7 @@ void ClassFinalizer::FinalizeClass(const Class& cls) {
|
||||
}
|
||||
// Ensure interfaces are finalized in case we check for bad overrides.
|
||||
Isolate* isolate = Isolate::Current();
|
||||
if (isolate->error_on_bad_override() && !isolate->strong()) {
|
||||
if (isolate->error_on_bad_override() && !FLAG_strong) {
|
||||
GrowableArray<const Class*> interfaces(4);
|
||||
CollectInterfaces(cls, &interfaces);
|
||||
for (intptr_t i = 0; i < interfaces.length(); i++) {
|
||||
|
||||
@@ -1048,7 +1048,7 @@ void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis,
|
||||
|
||||
// Check if inlining_parameters include a type argument vector parameter.
|
||||
const intptr_t inlined_type_args_param =
|
||||
(isolate()->reify_generic_functions() && (inlining_parameters != NULL) &&
|
||||
(FLAG_reify_generic_functions && (inlining_parameters != NULL) &&
|
||||
function().IsGeneric())
|
||||
? 1
|
||||
: 0;
|
||||
@@ -1091,7 +1091,7 @@ void FlowGraph::Rename(GrowableArray<PhiInstr*>* live_phis,
|
||||
|
||||
if (!IsCompiledForOsr()) {
|
||||
const bool reify_generic_argument =
|
||||
function().IsGeneric() && isolate()->reify_generic_functions();
|
||||
function().IsGeneric() && FLAG_reify_generic_functions;
|
||||
|
||||
// Replace the type arguments slot with a special parameter.
|
||||
if (reify_generic_argument) {
|
||||
|
||||
@@ -1119,7 +1119,7 @@ void FlowGraphCompiler::EmitOptimizedStaticCall(
|
||||
Code::EntryKind entry_kind) {
|
||||
ASSERT(!function.IsClosureFunction());
|
||||
if (function.HasOptionalParameters() ||
|
||||
(isolate()->reify_generic_functions() && function.IsGeneric())) {
|
||||
(FLAG_reify_generic_functions && function.IsGeneric())) {
|
||||
__ LoadObject(R4, arguments_descriptor);
|
||||
} else {
|
||||
__ LoadImmediate(R4, 0); // GC safe smi zero because of stub.
|
||||
|
||||
@@ -1088,7 +1088,7 @@ void FlowGraphCompiler::EmitOptimizedStaticCall(
|
||||
// TODO(sjindel/entrypoints): Support multiple entrypoints on ARM64.
|
||||
ASSERT(!function.IsClosureFunction());
|
||||
if (function.HasOptionalParameters() ||
|
||||
(isolate()->reify_generic_functions() && function.IsGeneric())) {
|
||||
(FLAG_reify_generic_functions && function.IsGeneric())) {
|
||||
__ LoadObject(R4, arguments_descriptor);
|
||||
} else {
|
||||
__ LoadImmediate(R4, 0); // GC safe smi zero because of stub.
|
||||
|
||||
@@ -1001,7 +1001,7 @@ void FlowGraphCompiler::EmitOptimizedStaticCall(
|
||||
Code::EntryKind entry_kind) {
|
||||
// TODO(sjindel/entrypoints): Support multiple entrypoints on IA32.
|
||||
if (function.HasOptionalParameters() ||
|
||||
(isolate()->reify_generic_functions() && function.IsGeneric())) {
|
||||
(FLAG_reify_generic_functions && function.IsGeneric())) {
|
||||
__ LoadObject(EDX, arguments_descriptor);
|
||||
} else {
|
||||
__ xorl(EDX, EDX); // GC safe smi zero because of stub.
|
||||
|
||||
@@ -1096,7 +1096,7 @@ void FlowGraphCompiler::EmitOptimizedStaticCall(
|
||||
Code::EntryKind entry_kind) {
|
||||
ASSERT(!function.IsClosureFunction());
|
||||
if (function.HasOptionalParameters() ||
|
||||
(isolate()->reify_generic_functions() && function.IsGeneric())) {
|
||||
(FLAG_reify_generic_functions && function.IsGeneric())) {
|
||||
__ LoadObject(R10, arguments_descriptor);
|
||||
} else {
|
||||
__ xorl(R10, R10); // GC safe smi zero because of stub.
|
||||
|
||||
@@ -2695,7 +2695,7 @@ Definition* AssertBooleanInstr::Canonicalize(FlowGraph* flow_graph) {
|
||||
|
||||
// In strong mode type is already verified either by static analysis
|
||||
// or runtime checks, so AssertBoolean just ensures that value is not null.
|
||||
if (Isolate::Current()->strong() && !value()->Type()->is_nullable()) {
|
||||
if (FLAG_strong && !value()->Type()->is_nullable()) {
|
||||
return value()->definition();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4251,7 +4251,7 @@ class StoreInstanceFieldInstr : public TemplateDefinition<2, NoThrow> {
|
||||
|
||||
Assembler::CanBeSmi CanValueBeSmi() const {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
if (isolate->type_checks() && !isolate->strong()) {
|
||||
if (isolate->type_checks() && !FLAG_strong) {
|
||||
// Dart 1 sometimes places a store into a context before a parameter
|
||||
// type check.
|
||||
return Assembler::kValueCanBeSmi;
|
||||
@@ -4424,7 +4424,7 @@ class StoreStaticFieldInstr : public TemplateDefinition<1, NoThrow> {
|
||||
private:
|
||||
Assembler::CanBeSmi CanValueBeSmi() const {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
if (isolate->type_checks() && !isolate->strong()) {
|
||||
if (isolate->type_checks() && !FLAG_strong) {
|
||||
// Dart 1 sometimes places a store into a context before a parameter
|
||||
// type check.
|
||||
return Assembler::kValueCanBeSmi;
|
||||
|
||||
@@ -501,7 +501,7 @@ static void EmitAssertBoolean(Register reg,
|
||||
__ CompareObject(reg, Bool::False());
|
||||
__ b(&done, EQ);
|
||||
} else {
|
||||
ASSERT(isolate->asserts() || isolate->strong());
|
||||
ASSERT(isolate->asserts() || FLAG_strong);
|
||||
__ CompareObject(reg, Object::null_instance());
|
||||
__ b(&done, NE);
|
||||
}
|
||||
@@ -937,9 +937,9 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
const Register result = locs()->out(0).reg();
|
||||
|
||||
// All arguments are already @SP due to preceding PushArgument()s.
|
||||
ASSERT(ArgumentCount() == function().NumParameters() +
|
||||
(function().IsGeneric() &&
|
||||
Isolate::Current()->reify_generic_functions())
|
||||
ASSERT(ArgumentCount() ==
|
||||
function().NumParameters() +
|
||||
(function().IsGeneric() && FLAG_reify_generic_functions)
|
||||
? 1
|
||||
: 0);
|
||||
|
||||
|
||||
@@ -497,7 +497,7 @@ static void EmitAssertBoolean(Register reg,
|
||||
__ CompareObject(reg, Bool::False());
|
||||
__ b(&done, EQ);
|
||||
} else {
|
||||
ASSERT(isolate->asserts() || isolate->strong());
|
||||
ASSERT(isolate->asserts() || FLAG_strong);
|
||||
__ CompareObject(reg, Object::null_instance());
|
||||
__ b(&done, NE);
|
||||
}
|
||||
@@ -824,9 +824,9 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
const Register result = locs()->out(0).reg();
|
||||
|
||||
// All arguments are already @SP due to preceding PushArgument()s.
|
||||
ASSERT(ArgumentCount() == function().NumParameters() +
|
||||
(function().IsGeneric() &&
|
||||
Isolate::Current()->reify_generic_functions())
|
||||
ASSERT(ArgumentCount() ==
|
||||
function().NumParameters() +
|
||||
(function().IsGeneric() && FLAG_reify_generic_functions)
|
||||
? 1
|
||||
: 0);
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ static void EmitAssertBoolean(Register reg,
|
||||
__ CompareObject(reg, Bool::False());
|
||||
__ j(EQUAL, &done, Assembler::kNearJump);
|
||||
} else {
|
||||
ASSERT(isolate->asserts() || isolate->strong());
|
||||
ASSERT(isolate->asserts() || FLAG_strong);
|
||||
__ CompareObject(reg, Object::null_instance());
|
||||
__ j(NOT_EQUAL, &done, Assembler::kNearJump);
|
||||
}
|
||||
@@ -821,9 +821,9 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
|
||||
|
||||
// All arguments are already @ESP due to preceding PushArgument()s.
|
||||
ASSERT(ArgumentCount() == function().NumParameters() +
|
||||
(function().IsGeneric() &&
|
||||
Isolate::Current()->reify_generic_functions())
|
||||
ASSERT(ArgumentCount() ==
|
||||
function().NumParameters() +
|
||||
(function().IsGeneric() && FLAG_reify_generic_functions)
|
||||
? 1
|
||||
: 0);
|
||||
|
||||
|
||||
@@ -473,7 +473,7 @@ static void EmitAssertBoolean(Register reg,
|
||||
__ CompareObject(reg, Bool::False());
|
||||
__ j(EQUAL, &done, Assembler::kNearJump);
|
||||
} else {
|
||||
ASSERT(isolate->asserts() || isolate->strong());
|
||||
ASSERT(isolate->asserts() || FLAG_strong);
|
||||
__ CompareObject(reg, Object::null_instance());
|
||||
__ j(NOT_EQUAL, &done, Assembler::kNearJump);
|
||||
}
|
||||
@@ -847,9 +847,9 @@ void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
||||
const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
|
||||
|
||||
// All arguments are already @RSP due to preceding PushArgument()s.
|
||||
ASSERT(ArgumentCount() == function().NumParameters() +
|
||||
(function().IsGeneric() &&
|
||||
Isolate::Current()->reify_generic_functions())
|
||||
ASSERT(ArgumentCount() ==
|
||||
function().NumParameters() +
|
||||
(function().IsGeneric() && FLAG_reify_generic_functions)
|
||||
? 1
|
||||
: 0);
|
||||
|
||||
|
||||
@@ -1011,8 +1011,7 @@ class CallSiteInliner : public ValueObject {
|
||||
// TODO(zerny): Put more information in the stubs, eg, type information.
|
||||
const intptr_t first_actual_param_index = call_data->first_arg_index;
|
||||
const intptr_t inlined_type_args_param =
|
||||
(isolate->reify_generic_functions() && function.IsGeneric()) ? 1
|
||||
: 0;
|
||||
(FLAG_reify_generic_functions && function.IsGeneric()) ? 1 : 0;
|
||||
const intptr_t num_inlined_params =
|
||||
inlined_type_args_param + function.NumParameters();
|
||||
ZoneGrowableArray<Definition*>* param_stubs =
|
||||
|
||||
@@ -753,7 +753,7 @@ const AbstractType* CompileType::ToAbstractType() {
|
||||
Isolate* I = Isolate::Current();
|
||||
const Class& type_class = Class::Handle(I->class_table()->At(cid_));
|
||||
if (type_class.NumTypeArguments() > 0) {
|
||||
if (I->strong()) {
|
||||
if (FLAG_strong) {
|
||||
type_ = &AbstractType::ZoneHandle(type_class.RareType());
|
||||
} else {
|
||||
type_ = &Object::dynamic_type();
|
||||
@@ -1189,7 +1189,7 @@ CompileType StaticCallInstr::ComputeType() const {
|
||||
}
|
||||
|
||||
const Isolate* isolate = Isolate::Current();
|
||||
if ((isolate->can_use_strong_mode_types()) || isolate->type_checks()) {
|
||||
if (isolate->can_use_strong_mode_types() || isolate->type_checks()) {
|
||||
const AbstractType& result_type =
|
||||
AbstractType::ZoneHandle(function().result_type());
|
||||
// TODO(dartbug.com/30480): instantiate generic result_type if possible.
|
||||
|
||||
@@ -1005,7 +1005,7 @@ bool CallSpecializer::TryInlineInstanceSetter(InstanceCallInstr* instr,
|
||||
// Compute if we need to type check the value. Always type check if
|
||||
// not in strong mode or if at a dynamic invocation.
|
||||
bool needs_check = true;
|
||||
if (I->strong() && !instr->interface_target().IsNull() &&
|
||||
if (FLAG_strong && !instr->interface_target().IsNull() &&
|
||||
(field.kernel_offset() >= 0)) {
|
||||
bool is_covariant = false;
|
||||
bool is_generic_covariant = false;
|
||||
|
||||
@@ -830,7 +830,7 @@ const Object& ConstantEvaluator::RunFunction(TokenPosition position,
|
||||
// We use a kernel2kernel constant evaluator in Dart 2.0 AOT compilation, so
|
||||
// we should never end up evaluating constants using the VM's constant
|
||||
// evaluator.
|
||||
if (I->strong() && FLAG_precompiled_mode) {
|
||||
if (FLAG_strong && FLAG_precompiled_mode) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
@@ -912,7 +912,7 @@ RawObject* ConstantEvaluator::EvaluateConstConstructorCall(
|
||||
// We use a kernel2kernel constant evaluator in Dart 2.0 AOT compilation, so
|
||||
// we should never end up evaluating constants using the VM's constant
|
||||
// evaluator.
|
||||
if (I->strong() && FLAG_precompiled_mode) {
|
||||
if (FLAG_strong && FLAG_precompiled_mode) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
|
||||
@@ -941,7 +941,7 @@ BlockEntryInstr* TestGraphVisitor::CreateFalseSuccessor() const {
|
||||
|
||||
void TestGraphVisitor::ReturnValue(Value* value) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
if (isolate->strong() || isolate->type_checks() || isolate->asserts()) {
|
||||
if (FLAG_strong || isolate->type_checks() || isolate->asserts()) {
|
||||
value = Bind(new (Z) AssertBooleanInstr(condition_token_pos(), value,
|
||||
owner()->GetNextDeoptId()));
|
||||
}
|
||||
@@ -1286,7 +1286,7 @@ void EffectGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) {
|
||||
node->left()->Visit(&for_left);
|
||||
EffectGraphVisitor empty(owner());
|
||||
Isolate* isolate = Isolate::Current();
|
||||
if (isolate->strong() || isolate->type_checks() || isolate->asserts()) {
|
||||
if (FLAG_strong || isolate->type_checks() || isolate->asserts()) {
|
||||
ValueGraphVisitor for_right(owner());
|
||||
node->right()->Visit(&for_right);
|
||||
Value* right_value = for_right.value();
|
||||
@@ -1350,7 +1350,7 @@ void ValueGraphVisitor::VisitBinaryOpNode(BinaryOpNode* node) {
|
||||
node->right()->Visit(&for_right);
|
||||
Value* right_value = for_right.value();
|
||||
Isolate* isolate = Isolate::Current();
|
||||
if (isolate->strong() || isolate->type_checks() || isolate->asserts()) {
|
||||
if (FLAG_strong || isolate->type_checks() || isolate->asserts()) {
|
||||
right_value = for_right.Bind(new (Z) AssertBooleanInstr(
|
||||
node->right()->token_pos(), right_value, owner()->GetNextDeoptId()));
|
||||
}
|
||||
@@ -1622,7 +1622,7 @@ void EffectGraphVisitor::VisitComparisonNode(ComparisonNode* node) {
|
||||
owner()->ic_data_array(), owner()->GetNextDeoptId());
|
||||
if (node->kind() == Token::kNE) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
if (isolate->strong() || isolate->type_checks() || isolate->asserts()) {
|
||||
if (FLAG_strong || isolate->type_checks() || isolate->asserts()) {
|
||||
Value* value = Bind(result);
|
||||
result = new (Z) AssertBooleanInstr(node->token_pos(), value,
|
||||
owner()->GetNextDeoptId());
|
||||
@@ -1666,7 +1666,7 @@ void EffectGraphVisitor::VisitUnaryOpNode(UnaryOpNode* node) {
|
||||
Append(for_value);
|
||||
Value* value = for_value.value();
|
||||
Isolate* isolate = Isolate::Current();
|
||||
if (isolate->strong() || isolate->type_checks() || isolate->asserts()) {
|
||||
if (FLAG_strong || isolate->type_checks() || isolate->asserts()) {
|
||||
value = Bind(new (Z) AssertBooleanInstr(
|
||||
node->operand()->token_pos(), value, owner()->GetNextDeoptId()));
|
||||
}
|
||||
@@ -2744,7 +2744,7 @@ Value* EffectGraphVisitor::BuildFunctionTypeArguments(TokenPosition token_pos) {
|
||||
LocalVariable* function_type_arguments_var =
|
||||
owner()->parsed_function().function_type_arguments();
|
||||
if (function_type_arguments_var == NULL) {
|
||||
ASSERT(!owner()->isolate()->reify_generic_functions());
|
||||
ASSERT(!FLAG_reify_generic_functions);
|
||||
return BuildNullValue(token_pos);
|
||||
}
|
||||
return Bind(BuildLoadLocal(*function_type_arguments_var, token_pos));
|
||||
@@ -3383,7 +3383,7 @@ void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) {
|
||||
const String& name = String::ZoneHandle(Z, function.native_name());
|
||||
const intptr_t num_params = function.NumParameters();
|
||||
ZoneGrowableArray<PushArgumentInstr*>* args = NULL;
|
||||
if (function.IsGeneric() && owner()->isolate()->reify_generic_functions()) {
|
||||
if (function.IsGeneric() && FLAG_reify_generic_functions) {
|
||||
args = new (Z) ZoneGrowableArray<PushArgumentInstr*>(1 + num_params);
|
||||
LocalVariable* type_args = pf.RawTypeArgumentsVariable();
|
||||
ASSERT(type_args != NULL);
|
||||
@@ -3834,7 +3834,7 @@ void EffectGraphVisitor::VisitSequenceNode(SequenceNode* node) {
|
||||
// Load the passed-in type argument vector from the temporary stack slot,
|
||||
// prepend the function type arguments of the generic parent function, and
|
||||
// store it to the final location, possibly in the context.
|
||||
if (owner()->isolate()->reify_generic_functions() && is_top_level_sequence &&
|
||||
if (FLAG_reify_generic_functions && is_top_level_sequence &&
|
||||
function.IsGeneric()) {
|
||||
const ParsedFunction& parsed_function = owner()->parsed_function();
|
||||
LocalVariable* type_args_var = parsed_function.function_type_arguments();
|
||||
|
||||
@@ -428,7 +428,7 @@ Fragment StreamingFlowGraphBuilder::BuildInitializers(
|
||||
Fragment StreamingFlowGraphBuilder::BuildDefaultTypeHandling(
|
||||
const Function& function,
|
||||
intptr_t type_parameters_offset) {
|
||||
if (function.IsGeneric() && I->reify_generic_functions()) {
|
||||
if (function.IsGeneric() && FLAG_reify_generic_functions) {
|
||||
AlternativeReadingScope alt(&reader_);
|
||||
SetOffset(type_parameters_offset);
|
||||
intptr_t num_type_params = ReadListLength();
|
||||
@@ -544,7 +544,7 @@ FlowGraph* StreamingFlowGraphBuilder::BuildGraphOfImplicitClosureFunction(
|
||||
FunctionNodeHelper::kPositionalParameters);
|
||||
|
||||
intptr_t type_args_len = 0;
|
||||
if (I->reify_generic_functions() && function.IsGeneric()) {
|
||||
if (function.IsGeneric() && FLAG_reify_generic_functions) {
|
||||
type_args_len = function.NumTypeParameters();
|
||||
ASSERT(parsed_function()->function_type_arguments() != NULL);
|
||||
body += LoadLocal(parsed_function()->function_type_arguments());
|
||||
@@ -703,7 +703,7 @@ FlowGraph* StreamingFlowGraphBuilder::BuildGraphOfNoSuchMethodForwarder(
|
||||
body += IntConstant(0);
|
||||
body += StoreLocal(TokenPosition::kNoSource, argument_count_var);
|
||||
body += Drop();
|
||||
if (function.IsGeneric() && Isolate::Current()->reify_generic_functions()) {
|
||||
if (function.IsGeneric() && FLAG_reify_generic_functions) {
|
||||
Fragment then;
|
||||
Fragment otherwise;
|
||||
otherwise += IntConstant(1);
|
||||
@@ -752,7 +752,7 @@ FlowGraph* StreamingFlowGraphBuilder::BuildGraphOfNoSuchMethodForwarder(
|
||||
// arguments[0] = function_type_arguments;
|
||||
// i = 1;
|
||||
// }
|
||||
if (function.IsGeneric() && Isolate::Current()->reify_generic_functions()) {
|
||||
if (function.IsGeneric() && FLAG_reify_generic_functions) {
|
||||
Fragment store;
|
||||
store += LoadLocal(arguments);
|
||||
store += IntConstant(0);
|
||||
@@ -965,7 +965,7 @@ void StreamingFlowGraphBuilder::BuildArgumentTypeChecks(
|
||||
}
|
||||
|
||||
const bool has_reified_type_arguments =
|
||||
I->strong() && I->reify_generic_functions();
|
||||
FLAG_strong && FLAG_reify_generic_functions;
|
||||
|
||||
TypeParameter& forwarding_param = TypeParameter::Handle(Z);
|
||||
Fragment check_bounds;
|
||||
@@ -1094,7 +1094,7 @@ void StreamingFlowGraphBuilder::BuildArgumentTypeChecks(
|
||||
}
|
||||
|
||||
Fragment StreamingFlowGraphBuilder::PushAllArguments(PushedArguments* pushed) {
|
||||
ASSERT(I->strong());
|
||||
ASSERT(FLAG_strong);
|
||||
|
||||
FunctionNodeHelper function_node_helper(this);
|
||||
function_node_helper.SetNext(FunctionNodeHelper::kTypeParameters);
|
||||
@@ -1109,7 +1109,7 @@ Fragment StreamingFlowGraphBuilder::PushAllArguments(PushedArguments* pushed) {
|
||||
helper.Finish();
|
||||
}
|
||||
|
||||
if (I->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
body += LoadLocal(parsed_function()->function_type_arguments());
|
||||
body += PushArgument();
|
||||
pushed->type_args_len = num_type_params;
|
||||
@@ -1318,7 +1318,7 @@ Fragment StreamingFlowGraphBuilder::TypeArgumentsHandling(
|
||||
|
||||
if (dart_function.IsClosureFunction() &&
|
||||
dart_function.NumParentTypeParameters() > 0 &&
|
||||
I->reify_generic_functions()) {
|
||||
FLAG_reify_generic_functions) {
|
||||
LocalVariable* closure =
|
||||
parsed_function()->node_sequence()->scope()->VariableAt(0);
|
||||
|
||||
@@ -2981,7 +2981,7 @@ Fragment StreamingFlowGraphBuilder::BuildPropertyGet(TokenPosition* p) {
|
||||
const Function* interface_target = &Function::null_function();
|
||||
const NameIndex itarget_name =
|
||||
ReadCanonicalNameReference(); // read interface_target_reference.
|
||||
if (I->strong() && !H.IsRoot(itarget_name) &&
|
||||
if (FLAG_strong && !H.IsRoot(itarget_name) &&
|
||||
(H.IsGetter(itarget_name) || H.IsField(itarget_name))) {
|
||||
interface_target = &Function::ZoneHandle(
|
||||
Z,
|
||||
@@ -3061,7 +3061,7 @@ Fragment StreamingFlowGraphBuilder::BuildPropertySet(TokenPosition* p) {
|
||||
const Function* interface_target = &Function::null_function();
|
||||
const NameIndex itarget_name =
|
||||
ReadCanonicalNameReference(); // read interface_target_reference.
|
||||
if (I->strong() && !H.IsRoot(itarget_name)) {
|
||||
if (FLAG_strong && !H.IsRoot(itarget_name)) {
|
||||
interface_target = &Function::ZoneHandle(
|
||||
Z,
|
||||
H.LookupMethodByMember(itarget_name, H.DartSetterName(itarget_name)));
|
||||
@@ -3571,7 +3571,7 @@ Fragment StreamingFlowGraphBuilder::BuildMethodInvocation(TokenPosition* p) {
|
||||
|
||||
intptr_t type_args_len = 0;
|
||||
LocalVariable* type_arguments_temp = NULL;
|
||||
if (I->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
AlternativeReadingScope alt(&reader_);
|
||||
SkipExpression(); // skip receiver
|
||||
SkipName(); // skip method name
|
||||
@@ -3659,7 +3659,7 @@ Fragment StreamingFlowGraphBuilder::BuildMethodInvocation(TokenPosition* p) {
|
||||
const Function* interface_target = &Function::null_function();
|
||||
const NameIndex itarget_name =
|
||||
ReadCanonicalNameReference(); // read interface_target_reference.
|
||||
if (I->strong() && !H.IsRoot(itarget_name) && !H.IsField(itarget_name)) {
|
||||
if (FLAG_strong && !H.IsRoot(itarget_name) && !H.IsField(itarget_name)) {
|
||||
interface_target = &Function::ZoneHandle(
|
||||
Z, H.LookupMethodByMember(itarget_name,
|
||||
H.DartProcedureName(itarget_name)));
|
||||
@@ -3750,7 +3750,7 @@ Fragment StreamingFlowGraphBuilder::BuildDirectMethodInvocation(
|
||||
|
||||
Fragment instructions;
|
||||
intptr_t type_args_len = 0;
|
||||
if (I->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
AlternativeReadingScope alt(&reader_);
|
||||
SkipExpression(); // skip receiver
|
||||
ReadCanonicalNameReference(); // skip target reference
|
||||
@@ -3816,7 +3816,7 @@ Fragment StreamingFlowGraphBuilder::BuildSuperMethodInvocation(
|
||||
inferred_type_metadata_helper_.GetInferredType(offset);
|
||||
|
||||
intptr_t type_args_len = 0;
|
||||
if (I->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
AlternativeReadingScope alt(&reader_);
|
||||
SkipName(); // skip method name
|
||||
ReadUInt(); // read argument count.
|
||||
@@ -3920,7 +3920,7 @@ Fragment StreamingFlowGraphBuilder::BuildSuperMethodInvocation(
|
||||
} else {
|
||||
Fragment instructions;
|
||||
|
||||
if (I->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
AlternativeReadingScope alt(&reader_);
|
||||
ReadUInt(); // read argument count.
|
||||
intptr_t list_length = ReadListLength(); // read types list length.
|
||||
@@ -4019,7 +4019,7 @@ Fragment StreamingFlowGraphBuilder::BuildStaticInvocation(bool is_const,
|
||||
const TypeArguments& type_arguments = PeekArgumentsInstantiatedType(klass);
|
||||
instructions += TranslateInstantiatedTypeArguments(type_arguments);
|
||||
instructions += PushArgument();
|
||||
} else if (!special_case && I->reify_generic_functions()) {
|
||||
} else if (!special_case && FLAG_reify_generic_functions) {
|
||||
AlternativeReadingScope alt(&reader_);
|
||||
ReadUInt(); // read argument count.
|
||||
intptr_t list_length = ReadListLength(); // read types list length.
|
||||
@@ -4224,7 +4224,7 @@ Fragment StreamingFlowGraphBuilder::TranslateLogicalExpressionForValue(
|
||||
const bool is_bool = top->IsStrictCompare() || top->IsBooleanNegate();
|
||||
if (!is_bool) {
|
||||
right_value += CheckBoolean(position);
|
||||
if (!I->strong()) {
|
||||
if (!FLAG_strong) {
|
||||
right_value += Constant(Bool::True());
|
||||
right_value += StrictCompare(Token::kEQ_STRICT);
|
||||
}
|
||||
|
||||
@@ -297,14 +297,14 @@ void KernelFingerprintHelper::CalculateFunctionTypeFingerprint(bool simple) {
|
||||
|
||||
void KernelFingerprintHelper::CalculateGetterNameFingerprint() {
|
||||
const NameIndex name = ReadCanonicalNameReference();
|
||||
if (I->strong() && !H.IsRoot(name) && (H.IsGetter(name) || H.IsField(name))) {
|
||||
if (FLAG_strong && !H.IsRoot(name) && (H.IsGetter(name) || H.IsField(name))) {
|
||||
BuildHash(H.DartGetterName(name).Hash());
|
||||
}
|
||||
}
|
||||
|
||||
void KernelFingerprintHelper::CalculateSetterNameFingerprint() {
|
||||
const NameIndex name = ReadCanonicalNameReference();
|
||||
if (I->strong() && !H.IsRoot(name)) {
|
||||
if (FLAG_strong && !H.IsRoot(name)) {
|
||||
BuildHash(H.DartSetterName(name).Hash());
|
||||
}
|
||||
}
|
||||
@@ -312,7 +312,7 @@ void KernelFingerprintHelper::CalculateSetterNameFingerprint() {
|
||||
void KernelFingerprintHelper::CalculateMethodNameFingerprint() {
|
||||
const NameIndex name =
|
||||
ReadCanonicalNameReference(); // read interface_target_reference.
|
||||
if (I->strong() && !H.IsRoot(name) && !H.IsField(name)) {
|
||||
if (FLAG_strong && !H.IsRoot(name) && !H.IsField(name)) {
|
||||
BuildHash(H.DartProcedureName(name).Hash());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ Fragment FlowGraphBuilder::LoadInstantiatorTypeArguments() {
|
||||
// arguments of the current function.
|
||||
Fragment FlowGraphBuilder::LoadFunctionTypeArguments() {
|
||||
Fragment instructions;
|
||||
if (!Isolate::Current()->reify_generic_functions()) {
|
||||
if (!FLAG_reify_generic_functions) {
|
||||
instructions += NullConstant();
|
||||
return instructions;
|
||||
}
|
||||
@@ -451,9 +451,7 @@ Fragment FlowGraphBuilder::NativeCall(const String* name,
|
||||
InlineBailout("kernel::FlowGraphBuilder::NativeCall");
|
||||
const intptr_t num_args =
|
||||
function->NumParameters() +
|
||||
((function->IsGeneric() && Isolate::Current()->reify_generic_functions())
|
||||
? 1
|
||||
: 0);
|
||||
((function->IsGeneric() && FLAG_reify_generic_functions) ? 1 : 0);
|
||||
ArgumentArray arguments = GetArguments(num_args);
|
||||
NativeCallInstr* call =
|
||||
new (Z) NativeCallInstr(name, function, FLAG_link_natives_lazily,
|
||||
@@ -470,7 +468,7 @@ Fragment FlowGraphBuilder::Return(TokenPosition position,
|
||||
// Emit a type check of the return type in checked mode for all functions
|
||||
// and in strong mode for native functions.
|
||||
if (!omit_result_type_check &&
|
||||
(I->type_checks() || (function.is_native() && I->strong()))) {
|
||||
(I->type_checks() || (function.is_native() && FLAG_strong))) {
|
||||
const AbstractType& return_type =
|
||||
AbstractType::Handle(Z, function.result_type());
|
||||
instructions += CheckAssignable(return_type, Symbols::FunctionResult());
|
||||
@@ -928,8 +926,7 @@ Fragment FlowGraphBuilder::NativeFunctionBody(const Function& function,
|
||||
break;
|
||||
default: {
|
||||
String& name = String::ZoneHandle(Z, function.native_name());
|
||||
if (function.IsGeneric() &&
|
||||
Isolate::Current()->reify_generic_functions()) {
|
||||
if (function.IsGeneric() && FLAG_reify_generic_functions) {
|
||||
body += LoadLocal(parsed_function_->RawTypeArgumentsVariable());
|
||||
body += PushArgument();
|
||||
}
|
||||
@@ -1046,7 +1043,7 @@ Fragment FlowGraphBuilder::EvaluateAssertion() {
|
||||
|
||||
Fragment FlowGraphBuilder::CheckBoolean(TokenPosition position) {
|
||||
Fragment instructions;
|
||||
if (I->strong() || I->type_checks() || I->asserts()) {
|
||||
if (FLAG_strong || I->type_checks() || I->asserts()) {
|
||||
LocalVariable* top_of_stack = MakeTemporary();
|
||||
instructions += LoadLocal(top_of_stack);
|
||||
instructions += AssertBool(position);
|
||||
|
||||
@@ -2865,7 +2865,7 @@ void TypeTranslator::BuildTypeParameterType() {
|
||||
: 0;
|
||||
if (procedure_type_parameter_count > 0) {
|
||||
if (procedure_type_parameter_count > parameter_index) {
|
||||
if (I->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
result_ ^=
|
||||
TypeArguments::Handle(Z, active_class_->member->type_parameters())
|
||||
.TypeAt(parameter_index);
|
||||
@@ -2884,7 +2884,7 @@ void TypeTranslator::BuildTypeParameterType() {
|
||||
|
||||
if (active_class_->local_type_parameters != NULL) {
|
||||
if (parameter_index < active_class_->local_type_parameters->Length()) {
|
||||
if (I->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
result_ ^=
|
||||
active_class_->local_type_parameters->TypeAt(parameter_index);
|
||||
} else {
|
||||
|
||||
@@ -34,8 +34,7 @@ bool PrologueBuilder::HasEmptyPrologue(const Function& function) {
|
||||
|
||||
BlockEntryInstr* PrologueBuilder::BuildPrologue(BlockEntryInstr* entry,
|
||||
PrologueInfo* prologue_info) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
const bool strong = isolate->strong();
|
||||
const bool strong = FLAG_strong;
|
||||
|
||||
// We always have to build the graph, but we only link it sometimes.
|
||||
const bool link = !is_inlining_ && !compiling_for_osr_;
|
||||
@@ -44,7 +43,7 @@ BlockEntryInstr* PrologueBuilder::BuildPrologue(BlockEntryInstr* entry,
|
||||
|
||||
const bool load_optional_arguments = function_.HasOptionalParameters();
|
||||
const bool expect_type_args =
|
||||
function_.IsGeneric() && isolate->reify_generic_functions();
|
||||
function_.IsGeneric() && FLAG_reify_generic_functions;
|
||||
const bool check_arguments = function_.IsClosureFunction();
|
||||
|
||||
Fragment prologue = Fragment(entry);
|
||||
|
||||
@@ -116,7 +116,7 @@ ScopeBuildingResult* ScopeBuilder::BuildScopes() {
|
||||
scope_->set_end_token_pos(function.end_token_pos());
|
||||
|
||||
// Add function type arguments variable before current context variable.
|
||||
if (I->reify_generic_functions() &&
|
||||
if (FLAG_reify_generic_functions &&
|
||||
(function.IsGeneric() || function.HasGenericParent())) {
|
||||
LocalVariable* type_args_var = MakeVariable(
|
||||
TokenPosition::kNoSource, TokenPosition::kNoSource,
|
||||
|
||||
+8
-4
@@ -694,7 +694,7 @@ const char* Dart::FeaturesString(Isolate* isolate,
|
||||
// isolate is always initialized from a vm_snapshot generated in non strong
|
||||
// mode.
|
||||
if (!is_vm_isolate) {
|
||||
ADD_FLAG(strong, strong, FLAG_strong);
|
||||
buffer.AddString(FLAG_strong ? " strong" : " no-strong");
|
||||
}
|
||||
|
||||
if (Snapshot::IncludesCode(kind)) {
|
||||
@@ -706,9 +706,10 @@ const char* Dart::FeaturesString(Isolate* isolate,
|
||||
ADD_FLAG(error_on_bad_override, enable_error_on_bad_override,
|
||||
FLAG_error_on_bad_override);
|
||||
// sync-async and reify_generic_functions also affect deopt_ids.
|
||||
ADD_FLAG(sync_async, sync_async, FLAG_sync_async);
|
||||
ADD_FLAG(reify_generic_functions, reify_generic_functions,
|
||||
FLAG_reify_generic_functions);
|
||||
buffer.AddString(FLAG_sync_async ? " sync_async" : " no-sync_async");
|
||||
buffer.AddString(FLAG_reify_generic_functions
|
||||
? " reify_generic_functions"
|
||||
: " no-reify_generic_functions");
|
||||
if (kind == Snapshot::kFullJIT) {
|
||||
ADD_FLAG(use_field_guards, use_field_guards, FLAG_use_field_guards);
|
||||
ADD_FLAG(use_osr, use_osr, FLAG_use_osr);
|
||||
@@ -780,6 +781,9 @@ void Dart::ShutdownIsolate(Isolate* isolate) {
|
||||
void Dart::ShutdownIsolate() {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
isolate->Shutdown();
|
||||
if (KernelIsolate::IsKernelIsolate(isolate)) {
|
||||
KernelIsolate::SetKernelIsolate(NULL);
|
||||
}
|
||||
delete isolate;
|
||||
}
|
||||
|
||||
|
||||
@@ -1487,7 +1487,7 @@ Dart_CreateScriptSnapshot(uint8_t** script_snapshot_buffer,
|
||||
Isolate* I = T->isolate();
|
||||
CHECK_NULL(script_snapshot_buffer);
|
||||
CHECK_NULL(script_snapshot_size);
|
||||
if (I->strong()) {
|
||||
if (I->use_dart_frontend()) {
|
||||
return Api::NewError("Script snapshots are not supported in Dart 2");
|
||||
}
|
||||
// Finalize all classes if needed.
|
||||
@@ -5078,7 +5078,7 @@ DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer,
|
||||
if (buffer == NULL) {
|
||||
RETURN_NULL_ERROR(buffer);
|
||||
}
|
||||
if (I->strong()) {
|
||||
if (I->use_dart_frontend()) {
|
||||
return Api::NewError("Script snapshots are not supported in Dart 2");
|
||||
}
|
||||
NoHeapGrowthControlScope no_growth_control;
|
||||
|
||||
@@ -116,7 +116,7 @@ RawObject* DartEntry::InvokeFunction(const Function& function,
|
||||
// and never start the VM service isolate. So we should never end up invoking
|
||||
// any dart code in the Dart 2.0 AOT compiler.
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
if (Isolate::Current()->strong() && FLAG_precompiled_mode) {
|
||||
if (FLAG_strong && FLAG_precompiled_mode) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
#endif // !defined(DART_PRECOMPILED_RUNTIME)
|
||||
|
||||
@@ -156,13 +156,13 @@ constexpr bool kDartPrecompiledRuntime = false;
|
||||
R(profiler, false, bool, false, "Enable the profiler.") \
|
||||
R(profiler_native_memory, false, bool, false, \
|
||||
"Enable native memory statistic collection.") \
|
||||
P(reify_generic_functions, bool, false, \
|
||||
P(reify_generic_functions, bool, true, \
|
||||
"Enable reification of generic functions (not yet supported).") \
|
||||
P(reorder_basic_blocks, bool, true, "Reorder basic blocks") \
|
||||
C(stress_async_stacks, false, false, bool, false, \
|
||||
"Stress test async stack traces") \
|
||||
P(strong, bool, false, "Enable strong mode.") \
|
||||
P(sync_async, bool, false, "Start `async` functions synchronously.") \
|
||||
P(strong, bool, true, "Enable strong mode.") \
|
||||
P(sync_async, bool, true, "Start `async` functions synchronously.") \
|
||||
R(support_ast_printer, false, bool, true, "Support the AST printer.") \
|
||||
R(support_compiler_stats, false, bool, true, "Support compiler stats.") \
|
||||
R(support_disassembler, false, bool, true, "Support the disassembler.") \
|
||||
|
||||
@@ -1083,6 +1083,12 @@ Isolate* Isolate::Init(const char* name_prefix,
|
||||
if (!Thread::EnterIsolate(result)) {
|
||||
// We failed to enter the isolate, it is possible the VM is shutting down,
|
||||
// return back a NULL so that CreateIsolate reports back an error.
|
||||
if (KernelIsolate::IsKernelIsolate(result)) {
|
||||
KernelIsolate::SetKernelIsolate(NULL);
|
||||
}
|
||||
if (ServiceIsolate::IsServiceIsolate(result)) {
|
||||
ServiceIsolate::SetServiceIsolate(NULL);
|
||||
}
|
||||
delete result;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -141,10 +141,6 @@ typedef FixedCache<intptr_t, CatchEntryState, 16> CatchEntryStateCache;
|
||||
V(NONPRODUCT, type_checks, EnableTypeChecks, enable_type_checks, \
|
||||
FLAG_enable_type_checks) \
|
||||
V(NONPRODUCT, asserts, EnableAsserts, enable_asserts, FLAG_enable_asserts) \
|
||||
V(PRODUCT, reify_generic_functions, ReifyGenericFunctions, \
|
||||
reify_generic_functions, FLAG_reify_generic_functions) \
|
||||
V(PRODUCT, sync_async, SyncAsync, sync_async, FLAG_sync_async) \
|
||||
V(PRODUCT, strong, Strong, strong, FLAG_strong) \
|
||||
V(NONPRODUCT, error_on_bad_type, ErrorOnBadType, enable_error_on_bad_type, \
|
||||
FLAG_error_on_bad_type) \
|
||||
V(NONPRODUCT, error_on_bad_override, ErrorOnBadOverride, \
|
||||
@@ -705,7 +701,7 @@ class Isolate : public BaseIsolate {
|
||||
}
|
||||
|
||||
bool can_use_strong_mode_types() const {
|
||||
return strong() && FLAG_use_strong_mode_types &&
|
||||
return FLAG_strong && FLAG_use_strong_mode_types &&
|
||||
!unsafe_trust_strong_mode_types();
|
||||
}
|
||||
|
||||
@@ -769,7 +765,7 @@ class Isolate : public BaseIsolate {
|
||||
}
|
||||
|
||||
bool should_emit_strong_mode_checks() const {
|
||||
return strong() && !unsafe_trust_strong_mode_types();
|
||||
return FLAG_strong && !unsafe_trust_strong_mode_types();
|
||||
}
|
||||
|
||||
static void KillAllIsolates(LibMsgId msg_id);
|
||||
@@ -884,9 +880,6 @@ class Isolate : public BaseIsolate {
|
||||
V(EnableAsserts) \
|
||||
V(ErrorOnBadType) \
|
||||
V(ErrorOnBadOverride) \
|
||||
V(ReifyGenericFunctions) \
|
||||
V(SyncAsync) \
|
||||
V(Strong) \
|
||||
V(UseFieldGuards) \
|
||||
V(UseOsr) \
|
||||
V(Obfuscate) \
|
||||
|
||||
@@ -593,7 +593,7 @@ RawObject* BuildParameterDescriptor(const Function& function) {
|
||||
}
|
||||
|
||||
bool NeedsDynamicInvocationForwarder(const Function& function) {
|
||||
ASSERT(Isolate::Current()->strong());
|
||||
ASSERT(FLAG_strong);
|
||||
|
||||
Thread* thread = Thread::Current();
|
||||
Zone* zone = thread->zone();
|
||||
|
||||
@@ -93,10 +93,7 @@ class RunKernelTask : public ThreadPool::Task {
|
||||
api_flags.enable_error_on_bad_type = false;
|
||||
api_flags.enable_error_on_bad_override = false;
|
||||
api_flags.use_dart_frontend = true;
|
||||
api_flags.reify_generic_functions = true;
|
||||
api_flags.strong = true;
|
||||
api_flags.unsafe_trust_strong_mode_types = false;
|
||||
api_flags.sync_async = true;
|
||||
#if !defined(DART_PRECOMPILER) && !defined(TARGET_ARCH_DBC)
|
||||
api_flags.use_field_guards = true;
|
||||
#endif
|
||||
@@ -177,9 +174,6 @@ class RunKernelTask : public ThreadPool::Task {
|
||||
if (FLAG_trace_kernel) {
|
||||
OS::PrintErr(DART_KERNEL_ISOLATE_NAME ": Shutdown.\n");
|
||||
}
|
||||
// This should be the last line so the check
|
||||
// IsKernelIsolate works during the shutdown process.
|
||||
KernelIsolate::SetKernelIsolate(NULL);
|
||||
}
|
||||
|
||||
bool RunMain(Isolate* I) {
|
||||
@@ -451,7 +445,7 @@ class KernelCompilationRequest : public ValueObject {
|
||||
|
||||
Dart_CObject dart_sync_async;
|
||||
dart_sync_async.type = Dart_CObject_kBool;
|
||||
dart_sync_async.value.as_bool = isolate->sync_async();
|
||||
dart_sync_async.value.as_bool = FLAG_sync_async;
|
||||
|
||||
Dart_CObject* message_arr[] = {&tag,
|
||||
&send_port,
|
||||
@@ -571,7 +565,7 @@ class KernelCompilationRequest : public ValueObject {
|
||||
|
||||
Dart_CObject dart_sync_async;
|
||||
dart_sync_async.type = Dart_CObject_kBool;
|
||||
dart_sync_async.value.as_bool = isolate->sync_async();
|
||||
dart_sync_async.value.as_bool = FLAG_sync_async;
|
||||
|
||||
Dart_CObject package_config_uri;
|
||||
if (package_config != NULL) {
|
||||
|
||||
@@ -84,11 +84,10 @@ TEST_CASE(Mixin_PrivateSuperResolutionCrossLibraryShouldFail) {
|
||||
}};
|
||||
// clang-format on
|
||||
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
|
||||
sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
|
||||
/* resolver= */ NULL, /* finalize= */ true, /* incrementally= */ true);
|
||||
if (isolate->strong()) {
|
||||
if (FLAG_strong) {
|
||||
EXPECT_ERROR(lib, "Error: Superclass has no method named '_bar'.");
|
||||
} else {
|
||||
EXPECT_VALID(lib);
|
||||
|
||||
@@ -182,7 +182,7 @@ class NativeArguments {
|
||||
if (function.IsClosureFunction()) {
|
||||
function_bits |= kClosureFunctionBit;
|
||||
}
|
||||
if (function.IsGeneric() && Isolate::Current()->reify_generic_functions()) {
|
||||
if (function.IsGeneric() && FLAG_reify_generic_functions) {
|
||||
function_bits |= kGenericFunctionBit;
|
||||
argc++;
|
||||
}
|
||||
|
||||
+27
-33
@@ -4335,7 +4335,6 @@ bool Class::TypeTestNonRecursive(const Class& cls,
|
||||
// instead of recursing, reset it to the super class and loop.
|
||||
Thread* thread = Thread::Current();
|
||||
Zone* zone = thread->zone();
|
||||
Isolate* isolate = thread->isolate();
|
||||
Class& this_class = Class::Handle(zone, cls.raw());
|
||||
while (true) {
|
||||
// Each occurrence of DynamicType in type T is interpreted as the dynamic
|
||||
@@ -4351,13 +4350,12 @@ bool Class::TypeTestNonRecursive(const Class& cls,
|
||||
}
|
||||
// Class FutureOr is mapped to dynamic in non-strong mode.
|
||||
// Detect snapshots compiled in strong mode and run in non-strong mode.
|
||||
ASSERT(isolate->strong() || !other.IsFutureOrClass());
|
||||
ASSERT(FLAG_strong || !other.IsFutureOrClass());
|
||||
// In strong mode, check if 'other' is 'FutureOr'.
|
||||
// If so, apply additional subtyping rules.
|
||||
if (isolate->strong() &&
|
||||
this_class.FutureOrTypeTest(zone, type_arguments, other,
|
||||
other_type_arguments, bound_error,
|
||||
bound_trail, space)) {
|
||||
if (FLAG_strong && this_class.FutureOrTypeTest(
|
||||
zone, type_arguments, other, other_type_arguments,
|
||||
bound_error, bound_trail, space)) {
|
||||
return true;
|
||||
}
|
||||
// In the case of a subtype test, each occurrence of DynamicType in type S
|
||||
@@ -4365,7 +4363,7 @@ bool Class::TypeTestNonRecursive(const Class& cls,
|
||||
// strong mode.
|
||||
// However, DynamicType is not more specific than any type.
|
||||
if (this_class.IsDynamicClass()) {
|
||||
return !isolate->strong() && (test_kind == Class::kIsSubtypeOf);
|
||||
return !FLAG_strong && (test_kind == Class::kIsSubtypeOf);
|
||||
}
|
||||
// If other is neither Object, dynamic or void, then ObjectType/VoidType
|
||||
// can't be a subtype of other.
|
||||
@@ -4392,14 +4390,14 @@ bool Class::TypeTestNonRecursive(const Class& cls,
|
||||
// Other type can't be more specific than this one because for that
|
||||
// it would have to have all dynamic type arguments which is checked
|
||||
// above.
|
||||
return !isolate->strong() && (test_kind == Class::kIsSubtypeOf);
|
||||
return !FLAG_strong && (test_kind == Class::kIsSubtypeOf);
|
||||
}
|
||||
return type_arguments.TypeTest(test_kind, other_type_arguments,
|
||||
from_index, num_type_params, bound_error,
|
||||
bound_trail, space);
|
||||
}
|
||||
// In strong mode, subtyping rules of callable instances are restricted.
|
||||
if (!isolate->strong() && other.IsDartFunctionClass()) {
|
||||
if (!FLAG_strong && other.IsDartFunctionClass()) {
|
||||
// Check if type S has a call() method.
|
||||
const Function& call_function =
|
||||
Function::Handle(zone, this_class.LookupCallFunctionForTypeTest());
|
||||
@@ -4459,7 +4457,7 @@ bool Class::TypeTestNonRecursive(const Class& cls,
|
||||
}
|
||||
}
|
||||
// In Dart 2, implementing Function has no meaning.
|
||||
if (isolate->strong() && interface_class.IsDartFunctionClass()) {
|
||||
if (FLAG_strong && interface_class.IsDartFunctionClass()) {
|
||||
continue;
|
||||
}
|
||||
if (interface_class.TypeTest(test_kind, interface_args, other,
|
||||
@@ -4505,7 +4503,7 @@ bool Class::FutureOrTypeTest(Zone* zone,
|
||||
Heap::Space space) const {
|
||||
// In strong mode, there is no difference between 'is subtype of' and
|
||||
// 'is more specific than'.
|
||||
ASSERT(Isolate::Current()->strong());
|
||||
ASSERT(FLAG_strong);
|
||||
if (other.IsFutureOrClass()) {
|
||||
if (other_type_arguments.IsNull()) {
|
||||
return true;
|
||||
@@ -5242,7 +5240,7 @@ RawString* TypeArguments::SubvectorName(intptr_t from_index,
|
||||
name = type.BuildName(name_visibility);
|
||||
} else {
|
||||
// Show dynamic type argument in strong mode.
|
||||
ASSERT(thread->isolate()->strong());
|
||||
ASSERT(FLAG_strong);
|
||||
name = Symbols::Dynamic().raw();
|
||||
}
|
||||
pieces.Add(name);
|
||||
@@ -7060,7 +7058,7 @@ const char* Function::ToQualifiedCString() const {
|
||||
bool Function::HasCompatibleParametersWith(const Function& other,
|
||||
Error* bound_error) const {
|
||||
ASSERT(Isolate::Current()->error_on_bad_override());
|
||||
ASSERT(!Isolate::Current()->strong());
|
||||
ASSERT(!FLAG_strong);
|
||||
ASSERT((bound_error != NULL) && bound_error->IsNull());
|
||||
// Check that this function's signature type is a subtype of the other
|
||||
// function's signature type.
|
||||
@@ -7235,7 +7233,7 @@ bool Function::TestParameterType(TypeTestKind test_kind,
|
||||
Error* bound_error,
|
||||
TrailPtr bound_trail,
|
||||
Heap::Space space) const {
|
||||
if (Isolate::Current()->strong()) {
|
||||
if (FLAG_strong) {
|
||||
const AbstractType& param_type =
|
||||
AbstractType::Handle(ParameterTypeAt(parameter_position));
|
||||
if (param_type.IsTopType()) {
|
||||
@@ -7326,8 +7324,7 @@ bool Function::TypeTest(TypeTestKind test_kind,
|
||||
(num_opt_named_params < other_num_opt_named_params)) {
|
||||
return false;
|
||||
}
|
||||
Isolate* isolate = Isolate::Current();
|
||||
if (isolate->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
// Check the type parameters and bounds of generic functions.
|
||||
if (!HasSameTypeParametersAndBounds(other)) {
|
||||
return false;
|
||||
@@ -7338,7 +7335,7 @@ bool Function::TypeTest(TypeTestKind test_kind,
|
||||
// Check the result type.
|
||||
const AbstractType& other_res_type =
|
||||
AbstractType::Handle(zone, other.result_type());
|
||||
if (isolate->strong()) {
|
||||
if (FLAG_strong) {
|
||||
// In strong mode, 'void Function()' is a subtype of 'Object Function()'.
|
||||
if (!other_res_type.IsTopType()) {
|
||||
const AbstractType& res_type = AbstractType::Handle(zone, result_type());
|
||||
@@ -7710,7 +7707,7 @@ RawFunction* Function::ImplicitClosureFunction() const {
|
||||
// In strong mode, change covariant parameter types to Object in the implicit
|
||||
// closure of a method compiled by kernel.
|
||||
// The VM's parser erases covariant types immediately in strong mode.
|
||||
if (thread->isolate()->strong() && !is_static() && kernel_offset() > 0) {
|
||||
if (FLAG_strong && !is_static() && kernel_offset() > 0) {
|
||||
const Script& function_script = Script::Handle(zone, script());
|
||||
kernel::TranslationHelper translation_helper(thread);
|
||||
translation_helper.InitFromScript(function_script);
|
||||
@@ -7874,7 +7871,7 @@ RawString* Function::BuildSignature(NameVisibility name_visibility) const {
|
||||
Zone* zone = thread->zone();
|
||||
GrowableHandlePtrArray<const String> pieces(zone, 4);
|
||||
String& name = String::Handle(zone);
|
||||
if (Isolate::Current()->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
const TypeArguments& type_params =
|
||||
TypeArguments::Handle(zone, type_parameters());
|
||||
if (!type_params.IsNull()) {
|
||||
@@ -17244,7 +17241,6 @@ bool Instance::IsInstanceOf(
|
||||
}
|
||||
Thread* thread = Thread::Current();
|
||||
Zone* zone = thread->zone();
|
||||
Isolate* isolate = thread->isolate();
|
||||
const Class& cls = Class::Handle(zone, clazz());
|
||||
if (cls.IsClosureClass()) {
|
||||
if (other.IsTopType() || other.IsDartFunctionType() ||
|
||||
@@ -17269,7 +17265,7 @@ bool Instance::IsInstanceOf(
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (isolate->strong() &&
|
||||
if (FLAG_strong &&
|
||||
IsFutureOrInstanceOf(zone, instantiated_other, bound_error)) {
|
||||
return true;
|
||||
}
|
||||
@@ -17319,7 +17315,7 @@ bool Instance::IsInstanceOf(
|
||||
other_type_arguments = instantiated_other.arguments();
|
||||
const bool other_is_dart_function = instantiated_other.IsDartFunctionType();
|
||||
// In strong mode, subtyping rules of callable instances are restricted.
|
||||
if (!isolate->strong() &&
|
||||
if (!FLAG_strong &&
|
||||
(other_is_dart_function || instantiated_other.IsFunctionType())) {
|
||||
// Check if this instance understands a call() method of a compatible type.
|
||||
Function& sig_fun =
|
||||
@@ -17355,7 +17351,7 @@ bool Instance::IsInstanceOf(
|
||||
ASSERT(cls.IsNullClass());
|
||||
// As of Dart 1.5, the null instance and Null type are handled differently.
|
||||
// We already checked other for dynamic and void.
|
||||
if (isolate->strong() &&
|
||||
if (FLAG_strong &&
|
||||
IsFutureOrInstanceOf(zone, instantiated_other, bound_error)) {
|
||||
return true;
|
||||
}
|
||||
@@ -17368,7 +17364,7 @@ bool Instance::IsInstanceOf(
|
||||
bool Instance::IsFutureOrInstanceOf(Zone* zone,
|
||||
const AbstractType& other,
|
||||
Error* bound_error) const {
|
||||
ASSERT(Isolate::Current()->strong());
|
||||
ASSERT(FLAG_strong);
|
||||
if (other.IsType() &&
|
||||
Class::Handle(zone, other.type_class()).IsFutureOrClass()) {
|
||||
if (other.arguments() == TypeArguments::null()) {
|
||||
@@ -17947,7 +17943,7 @@ RawString* AbstractType::BuildName(NameVisibility name_visibility) const {
|
||||
} else {
|
||||
ASSERT(num_args == 0); // Type is raw.
|
||||
// No need to fill up with "dynamic", unless running in strong mode.
|
||||
if (!thread->isolate()->strong()) {
|
||||
if (!FLAG_strong) {
|
||||
num_type_params = 0;
|
||||
}
|
||||
}
|
||||
@@ -17968,8 +17964,7 @@ RawString* AbstractType::BuildName(NameVisibility name_visibility) const {
|
||||
GrowableHandlePtrArray<const String> pieces(zone, 4);
|
||||
pieces.Add(class_name);
|
||||
if ((num_type_params == 0) ||
|
||||
(!thread->isolate()->strong() &&
|
||||
args.IsRaw(first_type_param_index, num_type_params))) {
|
||||
(!FLAG_strong && args.IsRaw(first_type_param_index, num_type_params))) {
|
||||
// Do nothing.
|
||||
} else {
|
||||
const String& args_name = String::Handle(
|
||||
@@ -18132,7 +18127,6 @@ bool AbstractType::TypeTest(TypeTestKind test_kind,
|
||||
}
|
||||
Thread* thread = Thread::Current();
|
||||
Zone* zone = thread->zone();
|
||||
Isolate* isolate = thread->isolate();
|
||||
if (IsBoundedType() || other.IsBoundedType()) {
|
||||
if (Equals(other)) {
|
||||
return true;
|
||||
@@ -18212,7 +18206,7 @@ bool AbstractType::TypeTest(TypeTestKind test_kind,
|
||||
}
|
||||
// In strong mode, check if 'other' is 'FutureOr'.
|
||||
// If so, apply additional subtyping rules.
|
||||
if (isolate->strong() &&
|
||||
if (FLAG_strong &&
|
||||
FutureOrTypeTest(zone, other, bound_error, bound_trail, space)) {
|
||||
return true;
|
||||
}
|
||||
@@ -18239,7 +18233,7 @@ bool AbstractType::TypeTest(TypeTestKind test_kind,
|
||||
space);
|
||||
}
|
||||
// In strong mode, subtyping rules of callable instances are restricted.
|
||||
if (!isolate->strong()) {
|
||||
if (!FLAG_strong) {
|
||||
// Check if type S has a call() method of function type T.
|
||||
const Function& call_function =
|
||||
Function::Handle(zone, type_cls.LookupCallFunctionForTypeTest());
|
||||
@@ -18277,7 +18271,7 @@ bool AbstractType::TypeTest(TypeTestKind test_kind,
|
||||
if (IsFunctionType()) {
|
||||
// In strong mode, check if 'other' is 'FutureOr'.
|
||||
// If so, apply additional subtyping rules.
|
||||
if (isolate->strong() &&
|
||||
if (FLAG_strong &&
|
||||
FutureOrTypeTest(zone, other, bound_error, bound_trail, space)) {
|
||||
return true;
|
||||
}
|
||||
@@ -18296,7 +18290,7 @@ bool AbstractType::FutureOrTypeTest(Zone* zone,
|
||||
Heap::Space space) const {
|
||||
// In strong mode, there is no difference between 'is subtype of' and
|
||||
// 'is more specific than'.
|
||||
ASSERT(Isolate::Current()->strong());
|
||||
ASSERT(FLAG_strong);
|
||||
if (other.IsType() &&
|
||||
Class::Handle(zone, other.type_class()).IsFutureOrClass()) {
|
||||
if (other.arguments() == TypeArguments::null()) {
|
||||
@@ -18777,7 +18771,7 @@ bool Type::IsEquivalent(const Instance& other, TrailPtr trail) const {
|
||||
const Function& other_sig_fun =
|
||||
Function::Handle(zone, other_type.signature());
|
||||
|
||||
if (Isolate::Current()->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
// Compare function type parameters and their bounds.
|
||||
// Check the type parameters and bounds of generic functions.
|
||||
if (!sig_fun.HasSameTypeParametersAndBounds(other_sig_fun)) {
|
||||
|
||||
+1
-1
@@ -2537,7 +2537,7 @@ class Function : public Object {
|
||||
bool IsInFactoryScope() const;
|
||||
|
||||
bool NeedsArgumentTypeChecks(Isolate* I) const {
|
||||
if (I->strong()) {
|
||||
if (FLAG_strong) {
|
||||
if (!I->should_emit_strong_mode_checks()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+15
-16
@@ -197,7 +197,7 @@ ParsedFunction::ParsedFunction(Thread* thread, const Function& function)
|
||||
current_context_var_ = temp;
|
||||
|
||||
const bool reify_generic_argument =
|
||||
function.IsGeneric() && Isolate::Current()->reify_generic_functions();
|
||||
function.IsGeneric() && FLAG_reify_generic_functions;
|
||||
|
||||
const bool load_optional_arguments = function.HasOptionalParameters();
|
||||
|
||||
@@ -1247,7 +1247,7 @@ void Parser::ParseFunction(ParsedFunction* parsed_function) {
|
||||
}
|
||||
}
|
||||
// ParseFunc has recorded the generic function type arguments variable.
|
||||
ASSERT(!Isolate::Current()->reify_generic_functions() ||
|
||||
ASSERT(!FLAG_reify_generic_functions ||
|
||||
!parser.current_function().IsGeneric() ||
|
||||
(parsed_function->function_type_arguments() != NULL));
|
||||
}
|
||||
@@ -1573,7 +1573,7 @@ SequenceNode* Parser::ParseImplicitClosure(const Function& func) {
|
||||
const Function& parent = Function::Handle(func.parent_function());
|
||||
intptr_t type_args_len = 0; // Length of type args vector passed to parent.
|
||||
LocalVariable* type_args_var = NULL;
|
||||
if (Isolate::Current()->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
// The parent function of an implicit closure is the original function, i.e.
|
||||
// non-closurized. It is not an enclosing function in the usual sense of a
|
||||
// parent function. Do not set parent_type_arguments() in parsed_function_.
|
||||
@@ -3545,7 +3545,7 @@ SequenceNode* Parser::ParseFunc(const Function& func, bool check_semicolon) {
|
||||
current_block_->scope->AddVariable(parsed_function_->arg_desc_var());
|
||||
}
|
||||
|
||||
if (Isolate::Current()->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
// Lookup function type arguments variable in parent function scope, if any.
|
||||
if (func.HasGenericParent()) {
|
||||
const String* variable_name = &Symbols::FunctionTypeArgumentsVar();
|
||||
@@ -3802,7 +3802,7 @@ SequenceNode* Parser::ParseFunc(const Function& func, bool check_semicolon) {
|
||||
func.end_token_pos() == end_token_pos);
|
||||
func.set_end_token_pos(end_token_pos);
|
||||
SequenceNode* body = CloseBlock();
|
||||
if (Isolate::Current()->reify_generic_functions() && func.IsGeneric() &&
|
||||
if (FLAG_reify_generic_functions && func.IsGeneric() &&
|
||||
!generated_body_closure.IsNull()) {
|
||||
LocalVariable* existing_var = body->scope()->LookupVariable(
|
||||
Symbols::FunctionTypeArgumentsVar(), false);
|
||||
@@ -7629,7 +7629,7 @@ SequenceNode* Parser::CloseAsyncFunction(const Function& closure,
|
||||
const TokenPosition token_pos = ST(closure_body->token_pos());
|
||||
|
||||
Function& completer_constructor = Function::ZoneHandle(Z);
|
||||
if (I->sync_async()) {
|
||||
if (FLAG_sync_async) {
|
||||
const Class& completer_class = Class::Handle(
|
||||
Z, async_lib.LookupClassAllowPrivate(Symbols::_AsyncAwaitCompleter()));
|
||||
ASSERT(!completer_class.IsNull());
|
||||
@@ -7739,7 +7739,7 @@ SequenceNode* Parser::CloseAsyncFunction(const Function& closure,
|
||||
|
||||
current_block_->statements->Add(store_async_catch_error_callback);
|
||||
|
||||
if (I->sync_async()) {
|
||||
if (FLAG_sync_async) {
|
||||
// Add to AST:
|
||||
// :async_completer.start(:async_op);
|
||||
ArgumentListNode* arguments = new (Z) ArgumentListNode(token_pos);
|
||||
@@ -7823,7 +7823,6 @@ void Parser::FinalizeFormalParameterTypes(const ParamList* params) {
|
||||
// with the formal parameter types and names.
|
||||
void Parser::AddFormalParamsToFunction(const ParamList* params,
|
||||
const Function& func) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
ASSERT((params != NULL) && (params->parameters != NULL));
|
||||
ASSERT((params->num_optional_parameters > 0) ==
|
||||
(params->has_optional_positional_parameters ||
|
||||
@@ -7859,7 +7858,7 @@ void Parser::AddFormalParamsToFunction(const ParamList* params,
|
||||
}
|
||||
// In non-strong mode, the covariant keyword is ignored. In strong mode,
|
||||
// the parameter type is changed to Object.
|
||||
if (isolate->strong()) {
|
||||
if (FLAG_strong) {
|
||||
param_type = Type::ObjectType();
|
||||
}
|
||||
}
|
||||
@@ -7940,7 +7939,7 @@ void Parser::CaptureInstantiator() {
|
||||
void Parser::CaptureFunctionTypeArguments() {
|
||||
ASSERT(InGenericFunctionScope());
|
||||
ASSERT(FunctionLevel() > 0);
|
||||
if (!Isolate::Current()->reify_generic_functions()) {
|
||||
if (!FLAG_reify_generic_functions) {
|
||||
return;
|
||||
}
|
||||
const String* variable_name = &Symbols::FunctionTypeArgumentsVar();
|
||||
@@ -11971,7 +11970,7 @@ AstNode* Parser::LoadTypeParameter(PrimaryNode* primary) {
|
||||
type_parameter ^= CanonicalizeType(type_parameter);
|
||||
} else {
|
||||
ASSERT(type_parameter.IsFunctionTypeParameter());
|
||||
if (!Isolate::Current()->reify_generic_functions()) {
|
||||
if (!FLAG_reify_generic_functions) {
|
||||
Type& type = Type::ZoneHandle(Z, Type::DynamicType());
|
||||
return new (Z) TypeNode(primary_pos, type);
|
||||
}
|
||||
@@ -12016,7 +12015,7 @@ AstNode* Parser::ParseSelectors(AstNode* primary, bool is_cascade) {
|
||||
if (CurrentToken() == Token::kLT) {
|
||||
// Type arguments.
|
||||
func_type_args = ParseTypeArguments(ClassFinalizer::kCanonicalize);
|
||||
if (Isolate::Current()->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
if (!func_type_args.IsNull() && !func_type_args.IsInstantiated() &&
|
||||
(FunctionLevel() > 0)) {
|
||||
// Make sure that the instantiators are captured.
|
||||
@@ -12112,7 +12111,7 @@ AstNode* Parser::ParseSelectors(AstNode* primary, bool is_cascade) {
|
||||
if (CurrentToken() == Token::kLT) {
|
||||
// Type arguments.
|
||||
func_type_args = ParseTypeArguments(ClassFinalizer::kCanonicalize);
|
||||
if (Isolate::Current()->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
if (!func_type_args.IsNull() && !func_type_args.IsInstantiated() &&
|
||||
(FunctionLevel() > 0)) {
|
||||
// Make sure that the instantiators are captured.
|
||||
@@ -12338,7 +12337,7 @@ void Parser::ResolveTypeParameters(AbstractType* type) {
|
||||
String::Handle(Z, type_parameter.name()).ToCString());
|
||||
return;
|
||||
}
|
||||
if (Isolate::Current()->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
ASSERT(!type_parameter.IsMalformed());
|
||||
*type = type_parameter.raw();
|
||||
} else {
|
||||
@@ -12943,7 +12942,7 @@ AstNode* Parser::ResolveIdent(TokenPosition ident_pos,
|
||||
if ((resolved == NULL) || (resolved_func_level < type_param_func_level)) {
|
||||
// The identifier is a function type parameter, possibly shadowing
|
||||
// 'resolved'.
|
||||
if (!Isolate::Current()->reify_generic_functions()) {
|
||||
if (!FLAG_reify_generic_functions) {
|
||||
Type& type = Type::ZoneHandle(Z, Type::DynamicType());
|
||||
return new (Z) TypeNode(ident_pos, type);
|
||||
}
|
||||
@@ -14414,7 +14413,7 @@ AstNode* Parser::ParsePrimary() {
|
||||
if (CurrentToken() == Token::kLT) {
|
||||
// Type arguments.
|
||||
func_type_args = ParseTypeArguments(ClassFinalizer::kCanonicalize);
|
||||
if (Isolate::Current()->reify_generic_functions()) {
|
||||
if (FLAG_reify_generic_functions) {
|
||||
if (!func_type_args.IsNull() && !func_type_args.IsInstantiated() &&
|
||||
(FunctionLevel() > 0)) {
|
||||
// Make sure that the instantiators are captured.
|
||||
|
||||
Reference in New Issue
Block a user