| Index: runtime/vm/precompiler.cc
|
| diff --git a/runtime/vm/precompiler.cc b/runtime/vm/precompiler.cc
|
| index 30b3e047b4e0e4870c80093e1a2547fba9eb07ba..55c56a8ebfaf7fbf5b02af56bc78e66380521f29 100644
|
| --- a/runtime/vm/precompiler.cc
|
| +++ b/runtime/vm/precompiler.cc
|
| @@ -53,7 +53,6 @@ namespace dart {
|
| #define I (isolate())
|
| #define Z (zone())
|
|
|
| -
|
| DEFINE_FLAG(bool, print_unique_targets, false, "Print unique dynamic targets");
|
| DEFINE_FLAG(bool, trace_precompiler, false, "Trace precompiler.");
|
| DEFINE_FLAG(
|
| @@ -87,7 +86,6 @@ DECLARE_FLAG(int, inlining_caller_size_threshold);
|
| DECLARE_FLAG(int, inlining_constant_arguments_max_size_threshold);
|
| DECLARE_FLAG(int, inlining_constant_arguments_min_size_threshold);
|
|
|
| -
|
| #ifdef DART_PRECOMPILER
|
|
|
| class DartPrecompilationPipeline : public DartCompilationPipeline {
|
| @@ -167,7 +165,6 @@ class DartPrecompilationPipeline : public DartCompilationPipeline {
|
| FieldTypeMap* field_map_;
|
| };
|
|
|
| -
|
| class PrecompileParsedFunctionHelper : public ValueObject {
|
| public:
|
| PrecompileParsedFunctionHelper(Precompiler* precompiler,
|
| @@ -198,12 +195,10 @@ class PrecompileParsedFunctionHelper : public ValueObject {
|
| DISALLOW_COPY_AND_ASSIGN(PrecompileParsedFunctionHelper);
|
| };
|
|
|
| -
|
| static void Jump(const Error& error) {
|
| Thread::Current()->long_jump_base()->Jump(1, error);
|
| }
|
|
|
| -
|
| TypeRangeCache::TypeRangeCache(Precompiler* precompiler,
|
| Thread* thread,
|
| intptr_t num_cids)
|
| @@ -219,13 +214,11 @@ TypeRangeCache::TypeRangeCache(Precompiler* precompiler,
|
| precompiler->set_type_range_cache(this);
|
| }
|
|
|
| -
|
| TypeRangeCache::~TypeRangeCache() {
|
| ASSERT(precompiler_->type_range_cache() == this);
|
| precompiler_->set_type_range_cache(NULL);
|
| }
|
|
|
| -
|
| RawError* Precompiler::CompileAll(
|
| Dart_QualifiedFunctionName embedder_entry_points[],
|
| uint8_t* jit_feedback,
|
| @@ -244,7 +237,6 @@ RawError* Precompiler::CompileAll(
|
| }
|
| }
|
|
|
| -
|
| bool TypeRangeCache::InstanceOfHasClassRange(const AbstractType& type,
|
| intptr_t* lower_limit,
|
| intptr_t* upper_limit) {
|
| @@ -261,7 +253,6 @@ bool TypeRangeCache::InstanceOfHasClassRange(const AbstractType& type,
|
| !type_arguments.IsRaw(0, type_arguments.Length()))
|
| return false;
|
|
|
| -
|
| intptr_t type_cid = type.type_class_id();
|
| if (lower_limits_[type_cid] == kNotContiguous) return false;
|
| if (lower_limits_[type_cid] != kNotComputed) {
|
| @@ -270,7 +261,6 @@ bool TypeRangeCache::InstanceOfHasClassRange(const AbstractType& type,
|
| return true;
|
| }
|
|
|
| -
|
| *lower_limit = -1;
|
| *upper_limit = -1;
|
| intptr_t last_matching_cid = -1;
|
| @@ -338,7 +328,6 @@ bool TypeRangeCache::InstanceOfHasClassRange(const AbstractType& type,
|
| return true;
|
| }
|
|
|
| -
|
| Precompiler::Precompiler(Thread* thread)
|
| : thread_(thread),
|
| zone_(NULL),
|
| @@ -371,7 +360,6 @@ Precompiler::Precompiler(Thread* thread)
|
| error_(Error::Handle()),
|
| get_runtime_type_is_unique_(false) {}
|
|
|
| -
|
| void Precompiler::LoadFeedback(uint8_t* buffer, intptr_t length) {
|
| if (buffer == NULL) {
|
| if (FLAG_trace_precompiler) {
|
| @@ -412,7 +400,6 @@ void Precompiler::LoadFeedback(uint8_t* buffer, intptr_t length) {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::DoCompileAll(
|
| Dart_QualifiedFunctionName embedder_entry_points[]) {
|
| ASSERT(I->compilation_allowed());
|
| @@ -533,7 +520,6 @@ void Precompiler::DoCompileAll(
|
| }
|
| }
|
|
|
| -
|
| static void CompileStaticInitializerIgnoreErrors(const Field& field) {
|
| LongJumpScope jump;
|
| if (setjmp(*jump.Set()) == 0) {
|
| @@ -544,7 +530,6 @@ static void CompileStaticInitializerIgnoreErrors(const Field& field) {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::PrecompileStaticInitializers() {
|
| class StaticInitializerVisitor : public ClassVisitor {
|
| public:
|
| @@ -577,7 +562,6 @@ void Precompiler::PrecompileStaticInitializers() {
|
| ProgramVisitor::VisitClasses(&visitor);
|
| }
|
|
|
| -
|
| void Precompiler::PrecompileConstructors() {
|
| class ConstructorVisitor : public FunctionVisitor {
|
| public:
|
| @@ -620,7 +604,6 @@ void Precompiler::PrecompileConstructors() {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]) {
|
| // Note that <rootlibrary>.main is not a root. The appropriate main will be
|
| // discovered through _getMainClosure.
|
| @@ -712,7 +695,6 @@ void Precompiler::AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]) {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::AddEntryPoints(Dart_QualifiedFunctionName entry_points[]) {
|
| Library& lib = Library::Handle(Z);
|
| Class& cls = Class::Handle(Z);
|
| @@ -792,7 +774,6 @@ void Precompiler::AddEntryPoints(Dart_QualifiedFunctionName entry_points[]) {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::Iterate() {
|
| Function& function = Function::Handle(Z);
|
|
|
| @@ -812,7 +793,6 @@ void Precompiler::Iterate() {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::CollectCallbackFields() {
|
| Library& lib = Library::Handle(Z);
|
| Class& cls = Class::Handle(Z);
|
| @@ -874,7 +854,6 @@ void Precompiler::CollectCallbackFields() {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::ProcessFunction(const Function& function) {
|
| if (!function.HasCode()) {
|
| function_count_++;
|
| @@ -910,7 +889,6 @@ void Precompiler::ProcessFunction(const Function& function) {
|
| AddCalleesOf(function);
|
| }
|
|
|
| -
|
| void Precompiler::AddCalleesOf(const Function& function) {
|
| ASSERT(function.HasCode());
|
|
|
| @@ -1002,7 +980,6 @@ void Precompiler::AddCalleesOf(const Function& function) {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::AddTypesOf(const Class& cls) {
|
| if (cls.IsNull()) return;
|
| if (classes_to_retain_.HasKey(&cls)) return;
|
| @@ -1028,7 +1005,6 @@ void Precompiler::AddTypesOf(const Class& cls) {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::AddTypesOf(const Function& function) {
|
| if (function.IsNull()) return;
|
| if (functions_to_retain_.HasKey(&function)) return;
|
| @@ -1078,7 +1054,6 @@ void Precompiler::AddTypesOf(const Function& function) {
|
| AddTypesOf(owner);
|
| }
|
|
|
| -
|
| void Precompiler::AddType(const AbstractType& abstype) {
|
| if (abstype.IsNull()) return;
|
|
|
| @@ -1115,7 +1090,6 @@ void Precompiler::AddType(const AbstractType& abstype) {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::AddTypeArguments(const TypeArguments& args) {
|
| if (args.IsNull()) return;
|
|
|
| @@ -1129,7 +1103,6 @@ void Precompiler::AddTypeArguments(const TypeArguments& args) {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::AddConstObject(const Instance& instance) {
|
| const Class& cls = Class::Handle(Z, instance.clazz());
|
| AddInstantiatedClass(cls);
|
| @@ -1189,7 +1162,6 @@ void Precompiler::AddConstObject(const Instance& instance) {
|
| instance.raw()->VisitPointers(&visitor);
|
| }
|
|
|
| -
|
| void Precompiler::AddClosureCall(const Array& arguments_descriptor) {
|
| const Class& cache_class =
|
| Class::Handle(Z, I->object_store()->closure_class());
|
| @@ -1200,7 +1172,6 @@ void Precompiler::AddClosureCall(const Array& arguments_descriptor) {
|
| AddFunction(dispatcher);
|
| }
|
|
|
| -
|
| void Precompiler::AddField(const Field& field) {
|
| if (fields_to_retain_.HasKey(&field)) return;
|
|
|
| @@ -1232,7 +1203,6 @@ void Precompiler::AddField(const Field& field) {
|
| }
|
| }
|
|
|
| -
|
| RawFunction* Precompiler::CompileStaticInitializer(const Field& field,
|
| bool compute_type) {
|
| ASSERT(field.is_static());
|
| @@ -1249,7 +1219,6 @@ RawFunction* Precompiler::CompileStaticInitializer(const Field& field,
|
| parsed_function->AllocateVariables();
|
| }
|
|
|
| -
|
| DartPrecompilationPipeline pipeline(zone);
|
| PrecompileParsedFunctionHelper helper(/* precompiler = */ NULL,
|
| parsed_function,
|
| @@ -1279,7 +1248,6 @@ RawFunction* Precompiler::CompileStaticInitializer(const Field& field,
|
| return parsed_function->function().raw();
|
| }
|
|
|
| -
|
| RawObject* Precompiler::EvaluateStaticInitializer(const Field& field) {
|
| ASSERT(field.is_static());
|
| // The VM sets the field's value to transiton_sentinel prior to
|
| @@ -1310,7 +1278,6 @@ RawObject* Precompiler::EvaluateStaticInitializer(const Field& field) {
|
| return Object::null();
|
| }
|
|
|
| -
|
| RawObject* Precompiler::ExecuteOnce(SequenceNode* fragment) {
|
| LongJumpScope jump;
|
| if (setjmp(*jump.Set()) == 0) {
|
| @@ -1374,7 +1341,6 @@ RawObject* Precompiler::ExecuteOnce(SequenceNode* fragment) {
|
| return Object::null();
|
| }
|
|
|
| -
|
| void Precompiler::AddFunction(const Function& function) {
|
| if (enqueued_functions_.HasKey(&function)) return;
|
|
|
| @@ -1383,7 +1349,6 @@ void Precompiler::AddFunction(const Function& function) {
|
| changed_ = true;
|
| }
|
|
|
| -
|
| bool Precompiler::IsSent(const String& selector) {
|
| if (selector.IsNull()) {
|
| return false;
|
| @@ -1391,7 +1356,6 @@ bool Precompiler::IsSent(const String& selector) {
|
| return sent_selectors_.HasKey(&selector);
|
| }
|
|
|
| -
|
| void Precompiler::AddSelector(const String& selector) {
|
| ASSERT(!selector.IsNull());
|
|
|
| @@ -1407,7 +1371,6 @@ void Precompiler::AddSelector(const String& selector) {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::AddInstantiatedClass(const Class& cls) {
|
| if (cls.is_allocated()) return;
|
|
|
| @@ -1430,7 +1393,6 @@ void Precompiler::AddInstantiatedClass(const Class& cls) {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::CheckForNewDynamicFunctions() {
|
| Library& lib = Library::Handle(Z);
|
| Class& cls = Class::Handle(Z);
|
| @@ -1532,7 +1494,6 @@ void Precompiler::CheckForNewDynamicFunctions() {
|
| }
|
| }
|
|
|
| -
|
| class NameFunctionsTraits {
|
| public:
|
| static const char* Name() { return "NameFunctionsTraits"; }
|
| @@ -1548,7 +1509,6 @@ class NameFunctionsTraits {
|
|
|
| typedef UnorderedHashMap<NameFunctionsTraits> Table;
|
|
|
| -
|
| static void AddNameToFunctionsTable(Zone* zone,
|
| Table* table,
|
| const String& fname,
|
| @@ -1560,7 +1520,6 @@ static void AddNameToFunctionsTable(Zone* zone,
|
| table->UpdateValue(fname, farray);
|
| }
|
|
|
| -
|
| void Precompiler::CollectDynamicFunctionNames() {
|
| if (!FLAG_collect_dynamic_function_names) {
|
| return;
|
| @@ -1645,7 +1604,6 @@ void Precompiler::CollectDynamicFunctionNames() {
|
| table.Release();
|
| }
|
|
|
| -
|
| void Precompiler::TraceConstFunctions() {
|
| // Compilation of const accessors happens outside of the treeshakers
|
| // queue, so we haven't previously scanned its literal pool.
|
| @@ -1675,7 +1633,6 @@ void Precompiler::TraceConstFunctions() {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::TraceForRetainedFunctions() {
|
| Library& lib = Library::Handle(Z);
|
| Class& cls = Class::Handle(Z);
|
| @@ -1735,7 +1692,6 @@ void Precompiler::TraceForRetainedFunctions() {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::DropFunctions() {
|
| Library& lib = Library::Handle(Z);
|
| Class& cls = Class::Handle(Z);
|
| @@ -1797,7 +1753,6 @@ void Precompiler::DropFunctions() {
|
| isolate()->object_store()->set_closure_functions(retained_functions);
|
| }
|
|
|
| -
|
| void Precompiler::DropFields() {
|
| Library& lib = Library::Handle(Z);
|
| Class& cls = Class::Handle(Z);
|
| @@ -1842,7 +1797,6 @@ void Precompiler::DropFields() {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::DropTypes() {
|
| ObjectStore* object_store = I->object_store();
|
| GrowableObjectArray& retained_types =
|
| @@ -1879,7 +1833,6 @@ void Precompiler::DropTypes() {
|
| object_store->set_canonical_types(types_table.Release());
|
| }
|
|
|
| -
|
| void Precompiler::DropTypeArguments() {
|
| ObjectStore* object_store = I->object_store();
|
| Array& typeargs_array = Array::Handle(Z);
|
| @@ -1918,7 +1871,6 @@ void Precompiler::DropTypeArguments() {
|
| object_store->set_canonical_type_arguments(typeargs_table.Release());
|
| }
|
|
|
| -
|
| void Precompiler::DropScriptData() {
|
| Library& lib = Library::Handle(Z);
|
| Array& scripts = Array::Handle(Z);
|
| @@ -1936,7 +1888,6 @@ void Precompiler::DropScriptData() {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::TraceTypesFromRetainedClasses() {
|
| Library& lib = Library::Handle(Z);
|
| Class& cls = Class::Handle(Z);
|
| @@ -2010,7 +1961,6 @@ void Precompiler::TraceTypesFromRetainedClasses() {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::DropLibraryEntries() {
|
| Library& lib = Library::Handle(Z);
|
| Array& dict = Array::Handle(Z);
|
| @@ -2056,7 +2006,6 @@ void Precompiler::DropLibraryEntries() {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::DropClasses() {
|
| Class& cls = Class::Handle(Z);
|
| Array& constants = Array::Handle(Z);
|
| @@ -2119,7 +2068,6 @@ void Precompiler::DropClasses() {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::DropLibraries() {
|
| const GrowableObjectArray& retained_libraries =
|
| GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
|
| @@ -2178,7 +2126,6 @@ void Precompiler::DropLibraries() {
|
| libraries_ = retained_libraries.raw();
|
| }
|
|
|
| -
|
| void Precompiler::BindStaticCalls() {
|
| class BindStaticCallsVisitor : public FunctionVisitor {
|
| public:
|
| @@ -2235,7 +2182,6 @@ void Precompiler::BindStaticCalls() {
|
| ProgramVisitor::VisitFunctions(&visitor);
|
| }
|
|
|
| -
|
| void Precompiler::SwitchICCalls() {
|
| #if !defined(TARGET_ARCH_DBC)
|
| // Now that all functions have been compiled, we can switch to an instance
|
| @@ -2325,7 +2271,6 @@ void Precompiler::SwitchICCalls() {
|
| #endif
|
| }
|
|
|
| -
|
| void Precompiler::FinalizeAllClasses() {
|
| Library& lib = Library::Handle(Z);
|
| Class& cls = Class::Handle(Z);
|
| @@ -2357,8 +2302,6 @@ void Precompiler::FinalizeAllClasses() {
|
| I->set_all_classes_finalized(true);
|
| }
|
|
|
| -
|
| -
|
| void Precompiler::VerifyJITFeedback() {
|
| if (jit_feedback_ == NULL) return;
|
|
|
| @@ -2489,7 +2432,6 @@ void Precompiler::VerifyJITFeedback() {
|
| ProgramVisitor::VisitFunctions(&visitor);
|
| }
|
|
|
| -
|
| ParsedJSONObject* Precompiler::LookupFeedback(const Function& function) {
|
| const Class& owner = Class::Handle(Z, function.Owner());
|
|
|
| @@ -2502,7 +2444,6 @@ ParsedJSONObject* Precompiler::LookupFeedback(const Function& function) {
|
| return pair->value_;
|
| }
|
|
|
| -
|
| RawScript* Precompiler::LookupScript(const char* uri) {
|
| String& dart_uri = String::Handle(Z, String::New(uri));
|
| Library& lib = Library::Handle(Z);
|
| @@ -2517,7 +2458,6 @@ RawScript* Precompiler::LookupScript(const char* uri) {
|
| return Script::null();
|
| }
|
|
|
| -
|
| intptr_t Precompiler::MapCid(intptr_t feedback_cid) {
|
| if (feedback_cid < kNumPredefinedCids) {
|
| return feedback_cid;
|
| @@ -2527,7 +2467,6 @@ intptr_t Precompiler::MapCid(intptr_t feedback_cid) {
|
| return pair->value_;
|
| }
|
|
|
| -
|
| void Precompiler::PopulateWithICData(const Function& function,
|
| FlowGraph* graph) {
|
| Zone* zone = Thread::Current()->zone();
|
| @@ -2578,7 +2517,6 @@ void Precompiler::PopulateWithICData(const Function& function,
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::TryApplyFeedback(const Function& function, FlowGraph* graph) {
|
| ParsedJSONObject* js_function = LookupFeedback(function);
|
| if (js_function == NULL) {
|
| @@ -2608,7 +2546,6 @@ void Precompiler::TryApplyFeedback(const Function& function, FlowGraph* graph) {
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::TryApplyFeedback(ParsedJSONArray* js_icdatas,
|
| const ICData& ic) {
|
| for (intptr_t j = 0; j < js_icdatas->Length(); j++) {
|
| @@ -2692,7 +2629,6 @@ void Precompiler::TryApplyFeedback(ParsedJSONArray* js_icdatas,
|
| }
|
| }
|
|
|
| -
|
| void Precompiler::ResetPrecompilerState() {
|
| changed_ = false;
|
| function_count_ = 0;
|
| @@ -2727,7 +2663,6 @@ void Precompiler::ResetPrecompilerState() {
|
| }
|
| }
|
|
|
| -
|
| void PrecompileParsedFunctionHelper::FinalizeCompilation(
|
| Assembler* assembler,
|
| FlowGraphCompiler* graph_compiler,
|
| @@ -2776,7 +2711,6 @@ void PrecompileParsedFunctionHelper::FinalizeCompilation(
|
| ASSERT(FLAG_load_deferred_eagerly);
|
| }
|
|
|
| -
|
| // Return false if bailed out.
|
| // If optimized_result_code is not NULL then it is caller's responsibility
|
| // to install code.
|
| @@ -3287,7 +3221,6 @@ bool PrecompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
|
| return is_compiled;
|
| }
|
|
|
| -
|
| static RawError* PrecompileFunctionHelper(Precompiler* precompiler,
|
| CompilationPipeline* pipeline,
|
| const Function& function,
|
| @@ -3376,7 +3309,6 @@ static RawError* PrecompileFunctionHelper(Precompiler* precompiler,
|
| return Error::null();
|
| }
|
|
|
| -
|
| RawError* Precompiler::CompileFunction(Precompiler* precompiler,
|
| Thread* thread,
|
| Zone* zone,
|
|
|