| Index: runtime/vm/compiler.cc
|
| diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
|
| index 96d2fa8b48190da1869f9b760c93134c93365eb0..bc465b30bf484e1163d644dc051f57c2286723f2 100644
|
| --- a/runtime/vm/compiler.cc
|
| +++ b/runtime/vm/compiler.cc
|
| @@ -108,10 +108,8 @@ DEFINE_FLAG(bool,
|
| DECLARE_FLAG(bool, huge_method_cutoff_in_code_size);
|
| DECLARE_FLAG(bool, trace_failed_optimization_attempts);
|
|
|
| -
|
| #ifndef DART_PRECOMPILED_RUNTIME
|
|
|
| -
|
| bool UseKernelFrontEndFor(ParsedFunction* parsed_function) {
|
| const Function& function = parsed_function->function();
|
| return (function.kernel_offset() > 0) ||
|
| @@ -119,7 +117,6 @@ bool UseKernelFrontEndFor(ParsedFunction* parsed_function) {
|
| (function.kind() == RawFunction::kInvokeFieldDispatcher);
|
| }
|
|
|
| -
|
| void DartCompilationPipeline::ParseFunction(ParsedFunction* parsed_function) {
|
| if (!UseKernelFrontEndFor(parsed_function)) {
|
| Parser::ParseFunction(parsed_function);
|
| @@ -127,7 +124,6 @@ void DartCompilationPipeline::ParseFunction(ParsedFunction* parsed_function) {
|
| }
|
| }
|
|
|
| -
|
| FlowGraph* DartCompilationPipeline::BuildFlowGraph(
|
| Zone* zone,
|
| ParsedFunction* parsed_function,
|
| @@ -150,10 +146,8 @@ FlowGraph* DartCompilationPipeline::BuildFlowGraph(
|
| return builder.BuildGraph();
|
| }
|
|
|
| -
|
| void DartCompilationPipeline::FinalizeCompilation(FlowGraph* flow_graph) {}
|
|
|
| -
|
| void IrregexpCompilationPipeline::ParseFunction(
|
| ParsedFunction* parsed_function) {
|
| VMTagScope tagScope(parsed_function->thread(),
|
| @@ -182,7 +176,6 @@ void IrregexpCompilationPipeline::ParseFunction(
|
| // Variables are allocated after compilation.
|
| }
|
|
|
| -
|
| FlowGraph* IrregexpCompilationPipeline::BuildFlowGraph(
|
| Zone* zone,
|
| ParsedFunction* parsed_function,
|
| @@ -209,12 +202,10 @@ FlowGraph* IrregexpCompilationPipeline::BuildFlowGraph(
|
| FlowGraph(*parsed_function, result.graph_entry, result.num_blocks);
|
| }
|
|
|
| -
|
| void IrregexpCompilationPipeline::FinalizeCompilation(FlowGraph* flow_graph) {
|
| backtrack_goto_->ComputeOffsetTable();
|
| }
|
|
|
| -
|
| CompilationPipeline* CompilationPipeline::New(Zone* zone,
|
| const Function& function) {
|
| if (function.IsIrregexpFunction()) {
|
| @@ -224,7 +215,6 @@ CompilationPipeline* CompilationPipeline::New(Zone* zone,
|
| }
|
| }
|
|
|
| -
|
| // Compile a function. Should call only if the function has not been compiled.
|
| // Arg0: function object.
|
| DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
|
| @@ -241,7 +231,6 @@ DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
|
| }
|
| }
|
|
|
| -
|
| bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) {
|
| if (FLAG_support_debugger) {
|
| Isolate* isolate = thread->isolate();
|
| @@ -304,13 +293,11 @@ bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) {
|
| return true;
|
| }
|
|
|
| -
|
| bool Compiler::IsBackgroundCompilation() {
|
| // For now: compilation in non mutator thread is the background compoilation.
|
| return !Thread::Current()->IsMutatorThread();
|
| }
|
|
|
| -
|
| RawError* Compiler::Compile(const Library& library, const Script& script) {
|
| LongJumpScope jump;
|
| if (setjmp(*jump.Set()) == 0) {
|
| @@ -337,7 +324,6 @@ RawError* Compiler::Compile(const Library& library, const Script& script) {
|
| return Error::null();
|
| }
|
|
|
| -
|
| static void AddRelatedClassesToList(
|
| const Class& cls,
|
| GrowableHandlePtrArray<const Class>* parse_list,
|
| @@ -384,7 +370,6 @@ static void AddRelatedClassesToList(
|
| }
|
| }
|
|
|
| -
|
| RawError* Compiler::CompileClass(const Class& cls) {
|
| ASSERT(Thread::Current()->IsMutatorThread());
|
| // If class is a top level class it is already parsed.
|
| @@ -510,7 +495,6 @@ RawError* Compiler::CompileClass(const Class& cls) {
|
| return Error::null();
|
| }
|
|
|
| -
|
| class CompileParsedFunctionHelper : public ValueObject {
|
| public:
|
| CompileParsedFunctionHelper(ParsedFunction* parsed_function,
|
| @@ -548,7 +532,6 @@ class CompileParsedFunctionHelper : public ValueObject {
|
| DISALLOW_COPY_AND_ASSIGN(CompileParsedFunctionHelper);
|
| };
|
|
|
| -
|
| RawCode* CompileParsedFunctionHelper::FinalizeCompilation(
|
| Assembler* assembler,
|
| FlowGraphCompiler* graph_compiler,
|
| @@ -714,7 +697,6 @@ RawCode* CompileParsedFunctionHelper::FinalizeCompilation(
|
| return code.raw();
|
| }
|
|
|
| -
|
| void CompileParsedFunctionHelper::CheckIfBackgroundCompilerIsBeingStopped() {
|
| ASSERT(Compiler::IsBackgroundCompilation());
|
| if (!isolate()->background_compiler()->is_running()) {
|
| @@ -724,7 +706,6 @@ void CompileParsedFunctionHelper::CheckIfBackgroundCompilerIsBeingStopped() {
|
| }
|
| }
|
|
|
| -
|
| // Return null if bailed out.
|
| // If optimized_result_code is not NULL then it is caller's responsibility
|
| // to install code.
|
| @@ -1240,7 +1221,6 @@ RawCode* CompileParsedFunctionHelper::Compile(CompilationPipeline* pipeline) {
|
| return result->raw();
|
| }
|
|
|
| -
|
| static RawObject* CompileFunctionHelper(CompilationPipeline* pipeline,
|
| const Function& function,
|
| bool optimized,
|
| @@ -1406,7 +1386,6 @@ static RawObject* CompileFunctionHelper(CompilationPipeline* pipeline,
|
| return Object::null();
|
| }
|
|
|
| -
|
| static RawError* ParseFunctionHelper(CompilationPipeline* pipeline,
|
| const Function& function,
|
| bool optimized,
|
| @@ -1463,7 +1442,6 @@ static RawError* ParseFunctionHelper(CompilationPipeline* pipeline,
|
| return Error::null();
|
| }
|
|
|
| -
|
| RawObject* Compiler::CompileFunction(Thread* thread, const Function& function) {
|
| #ifdef DART_PRECOMPILER
|
| if (FLAG_precompiled_mode) {
|
| @@ -1493,7 +1471,6 @@ RawObject* Compiler::CompileFunction(Thread* thread, const Function& function) {
|
| /* optimized = */ false, kNoOSRDeoptId);
|
| }
|
|
|
| -
|
| RawError* Compiler::ParseFunction(Thread* thread, const Function& function) {
|
| Isolate* isolate = thread->isolate();
|
| #if !defined(PRODUCT)
|
| @@ -1515,7 +1492,6 @@ RawError* Compiler::ParseFunction(Thread* thread, const Function& function) {
|
| /* optimized = */ false, kNoOSRDeoptId);
|
| }
|
|
|
| -
|
| RawError* Compiler::EnsureUnoptimizedCode(Thread* thread,
|
| const Function& function) {
|
| if (function.unoptimized_code() != Object::null()) {
|
| @@ -1547,7 +1523,6 @@ RawError* Compiler::EnsureUnoptimizedCode(Thread* thread,
|
| return Error::null();
|
| }
|
|
|
| -
|
| RawObject* Compiler::CompileOptimizedFunction(Thread* thread,
|
| const Function& function,
|
| intptr_t osr_id) {
|
| @@ -1575,7 +1550,6 @@ RawObject* Compiler::CompileOptimizedFunction(Thread* thread,
|
| osr_id);
|
| }
|
|
|
| -
|
| // This is only used from unit tests.
|
| RawError* Compiler::CompileParsedFunction(ParsedFunction* parsed_function) {
|
| LongJumpScope jump;
|
| @@ -1601,7 +1575,6 @@ RawError* Compiler::CompileParsedFunction(ParsedFunction* parsed_function) {
|
| return Error::null();
|
| }
|
|
|
| -
|
| void Compiler::ComputeLocalVarDescriptors(const Code& code) {
|
| ASSERT(!code.is_optimized());
|
| const Function& function = Function::Handle(code.function());
|
| @@ -1649,7 +1622,6 @@ void Compiler::ComputeLocalVarDescriptors(const Code& code) {
|
| Thread::Current()->set_deopt_id(prev_deopt_id);
|
| }
|
|
|
| -
|
| RawError* Compiler::CompileAllFunctions(const Class& cls) {
|
| Thread* thread = Thread::Current();
|
| Zone* zone = thread->zone();
|
| @@ -1685,7 +1657,6 @@ RawError* Compiler::CompileAllFunctions(const Class& cls) {
|
| return Error::null();
|
| }
|
|
|
| -
|
| RawError* Compiler::ParseAllFunctions(const Class& cls) {
|
| Thread* thread = Thread::Current();
|
| Zone* zone = thread->zone();
|
| @@ -1719,7 +1690,6 @@ RawError* Compiler::ParseAllFunctions(const Class& cls) {
|
| return error.raw();
|
| }
|
|
|
| -
|
| RawObject* Compiler::EvaluateStaticInitializer(const Field& field) {
|
| #ifdef DART_PRECOMPILER
|
| if (FLAG_precompiled_mode) {
|
| @@ -1782,7 +1752,6 @@ RawObject* Compiler::EvaluateStaticInitializer(const Field& field) {
|
| return error.raw();
|
| }
|
|
|
| -
|
| RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) {
|
| #ifdef DART_PRECOMPILER
|
| if (FLAG_precompiled_mode) {
|
| @@ -1857,7 +1826,6 @@ RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) {
|
| return result.raw();
|
| }
|
|
|
| -
|
| void Compiler::AbortBackgroundCompilation(intptr_t deopt_id, const char* msg) {
|
| if (FLAG_trace_compiler) {
|
| THR_Print("ABORT background compilation: %s\n", msg);
|
| @@ -1878,7 +1846,6 @@ void Compiler::AbortBackgroundCompilation(intptr_t deopt_id, const char* msg) {
|
| deopt_id, Object::background_compilation_error());
|
| }
|
|
|
| -
|
| // C-heap allocated background compilation queue element.
|
| class QueueElement {
|
| public:
|
| @@ -1892,7 +1859,6 @@ class QueueElement {
|
|
|
| RawFunction* Function() const { return function_; }
|
|
|
| -
|
| void set_next(QueueElement* elem) { next_ = elem; }
|
| QueueElement* next() const { return next_; }
|
|
|
| @@ -1908,7 +1874,6 @@ class QueueElement {
|
| DISALLOW_COPY_AND_ASSIGN(QueueElement);
|
| };
|
|
|
| -
|
| // Allocated in C-heap. Handles both input and output of background compilation.
|
| // It implements a FIFO queue, using Peek, Add, Remove operations.
|
| class BackgroundCompilationQueue {
|
| @@ -1988,7 +1953,6 @@ class BackgroundCompilationQueue {
|
| DISALLOW_COPY_AND_ASSIGN(BackgroundCompilationQueue);
|
| };
|
|
|
| -
|
| BackgroundCompiler::BackgroundCompiler(Isolate* isolate)
|
| : isolate_(isolate),
|
| running_(true),
|
| @@ -1999,7 +1963,6 @@ BackgroundCompiler::BackgroundCompiler(Isolate* isolate)
|
| *done_ = false;
|
| }
|
|
|
| -
|
| // Fields all deleted in ::Stop; here clear them.
|
| BackgroundCompiler::~BackgroundCompiler() {
|
| isolate_ = NULL;
|
| @@ -2010,7 +1973,6 @@ BackgroundCompiler::~BackgroundCompiler() {
|
| function_queue_ = NULL;
|
| }
|
|
|
| -
|
| void BackgroundCompiler::Run() {
|
| while (running_) {
|
| // Maybe something is already in the queue, check first before waiting
|
| @@ -2081,7 +2043,6 @@ void BackgroundCompiler::Run() {
|
| }
|
| }
|
|
|
| -
|
| void BackgroundCompiler::CompileOptimized(const Function& function) {
|
| ASSERT(Thread::Current()->IsMutatorThread());
|
| // TODO(srdjan): Checking different strategy for collecting garbage
|
| @@ -2101,12 +2062,10 @@ void BackgroundCompiler::CompileOptimized(const Function& function) {
|
| }
|
| }
|
|
|
| -
|
| void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) {
|
| function_queue_->VisitObjectPointers(visitor);
|
| }
|
|
|
| -
|
| void BackgroundCompiler::Stop(Isolate* isolate) {
|
| BackgroundCompiler* task = isolate->background_compiler();
|
| if (task == NULL) {
|
| @@ -2141,7 +2100,6 @@ void BackgroundCompiler::Stop(Isolate* isolate) {
|
| isolate->set_background_compiler(NULL);
|
| }
|
|
|
| -
|
| void BackgroundCompiler::Disable() {
|
| Thread* thread = Thread::Current();
|
| ASSERT(thread != NULL);
|
| @@ -2158,7 +2116,6 @@ void BackgroundCompiler::Disable() {
|
| isolate->disable_background_compiler();
|
| }
|
|
|
| -
|
| bool BackgroundCompiler::IsDisabled() {
|
| Thread* thread = Thread::Current();
|
| ASSERT(thread != NULL);
|
| @@ -2167,7 +2124,6 @@ bool BackgroundCompiler::IsDisabled() {
|
| return isolate->is_background_compiler_disabled();
|
| }
|
|
|
| -
|
| void BackgroundCompiler::Enable() {
|
| Thread* thread = Thread::Current();
|
| ASSERT(thread != NULL);
|
| @@ -2176,7 +2132,6 @@ void BackgroundCompiler::Enable() {
|
| isolate->enable_background_compiler();
|
| }
|
|
|
| -
|
| void BackgroundCompiler::EnsureInit(Thread* thread) {
|
| ASSERT(thread->IsMutatorThread());
|
| // Finalize NoSuchMethodError, _Mint; occasionally needed in optimized
|
| @@ -2206,23 +2161,19 @@ void BackgroundCompiler::EnsureInit(Thread* thread) {
|
| }
|
| }
|
|
|
| -
|
| #else // DART_PRECOMPILED_RUNTIME
|
|
|
| -
|
| bool UseKernelFrontEndFor(ParsedFunction* parsed_function) {
|
| UNREACHABLE();
|
| return false;
|
| }
|
|
|
| -
|
| CompilationPipeline* CompilationPipeline::New(Zone* zone,
|
| const Function& function) {
|
| UNREACHABLE();
|
| return NULL;
|
| }
|
|
|
| -
|
| DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
|
| const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
|
| FATAL3("Precompilation missed function %s (%" Pd ", %s)\n",
|
| @@ -2231,49 +2182,41 @@ DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
|
| Function::KindToCString(function.kind()));
|
| }
|
|
|
| -
|
| bool Compiler::IsBackgroundCompilation() {
|
| return false;
|
| }
|
|
|
| -
|
| bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) {
|
| UNREACHABLE();
|
| return false;
|
| }
|
|
|
| -
|
| RawError* Compiler::Compile(const Library& library, const Script& script) {
|
| FATAL1("Attempt to compile script %s", script.ToCString());
|
| return Error::null();
|
| }
|
|
|
| -
|
| RawError* Compiler::CompileClass(const Class& cls) {
|
| FATAL1("Attempt to compile class %s", cls.ToCString());
|
| return Error::null();
|
| }
|
|
|
| -
|
| RawObject* Compiler::CompileFunction(Thread* thread, const Function& function) {
|
| FATAL1("Attempt to compile function %s", function.ToCString());
|
| return Error::null();
|
| }
|
|
|
| -
|
| RawError* Compiler::ParseFunction(Thread* thread, const Function& function) {
|
| FATAL1("Attempt to parse function %s", function.ToCString());
|
| return Error::null();
|
| }
|
|
|
| -
|
| RawError* Compiler::EnsureUnoptimizedCode(Thread* thread,
|
| const Function& function) {
|
| FATAL1("Attempt to compile function %s", function.ToCString());
|
| return Error::null();
|
| }
|
|
|
| -
|
| RawObject* Compiler::CompileOptimizedFunction(Thread* thread,
|
| const Function& function,
|
| intptr_t osr_id) {
|
| @@ -2281,31 +2224,26 @@ RawObject* Compiler::CompileOptimizedFunction(Thread* thread,
|
| return Error::null();
|
| }
|
|
|
| -
|
| RawError* Compiler::CompileParsedFunction(ParsedFunction* parsed_function) {
|
| FATAL1("Attempt to compile function %s",
|
| parsed_function->function().ToCString());
|
| return Error::null();
|
| }
|
|
|
| -
|
| void Compiler::ComputeLocalVarDescriptors(const Code& code) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| RawError* Compiler::CompileAllFunctions(const Class& cls) {
|
| FATAL1("Attempt to compile class %s", cls.ToCString());
|
| return Error::null();
|
| }
|
|
|
| -
|
| RawError* Compiler::ParseAllFunctions(const Class& cls) {
|
| FATAL1("Attempt to parse class %s", cls.ToCString());
|
| return Error::null();
|
| }
|
|
|
| -
|
| RawObject* Compiler::EvaluateStaticInitializer(const Field& field) {
|
| ASSERT(field.HasPrecompiledInitializer());
|
| const Function& initializer =
|
| @@ -2313,48 +2251,39 @@ RawObject* Compiler::EvaluateStaticInitializer(const Field& field) {
|
| return DartEntry::InvokeFunction(initializer, Object::empty_array());
|
| }
|
|
|
| -
|
| RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) {
|
| UNREACHABLE();
|
| return Object::null();
|
| }
|
|
|
| -
|
| void Compiler::AbortBackgroundCompilation(intptr_t deopt_id, const char* msg) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void BackgroundCompiler::CompileOptimized(const Function& function) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void BackgroundCompiler::VisitPointers(ObjectPointerVisitor* visitor) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void BackgroundCompiler::Stop(Isolate* isolate) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void BackgroundCompiler::EnsureInit(Thread* thread) {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void BackgroundCompiler::Disable() {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void BackgroundCompiler::Enable() {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| bool BackgroundCompiler::IsDisabled() {
|
| UNREACHABLE();
|
| return true;
|
|
|