Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: runtime/vm/compiler.cc

Issue 2792033002: [kernel] vm: Fix a few issues in the kernel flow graph builder, update status file for checked-mode (Closed)
Patch Set: addressed comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/kernel/lib/transformations/continuation.dart ('k') | runtime/vm/kernel_to_il.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/block_scheduler.h" 10 #include "vm/block_scheduler.h"
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 // evaluating the initializer value. 1685 // evaluating the initializer value.
1686 ASSERT(field.StaticValue() == Object::transition_sentinel().raw()); 1686 ASSERT(field.StaticValue() == Object::transition_sentinel().raw());
1687 LongJumpScope jump; 1687 LongJumpScope jump;
1688 if (setjmp(*jump.Set()) == 0) { 1688 if (setjmp(*jump.Set()) == 0) {
1689 Thread* const thread = Thread::Current(); 1689 Thread* const thread = Thread::Current();
1690 NoOOBMessageScope no_msg_scope(thread); 1690 NoOOBMessageScope no_msg_scope(thread);
1691 NoReloadScope no_reload_scope(thread->isolate(), thread); 1691 NoReloadScope no_reload_scope(thread->isolate(), thread);
1692 // Under lazy compilation initializer has not yet been created, so create 1692 // Under lazy compilation initializer has not yet been created, so create
1693 // it now, but don't bother remembering it because it won't be used again. 1693 // it now, but don't bother remembering it because it won't be used again.
1694 ASSERT(!field.HasPrecompiledInitializer()); 1694 ASSERT(!field.HasPrecompiledInitializer());
1695 Function& initializer = Function::Handle(thread->zone());
1696 { 1695 {
1697 #if !defined(PRODUCT) 1696 #if !defined(PRODUCT)
1698 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); 1697 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId);
1699 TimelineDurationScope tds(thread, Timeline::GetCompilerStream(), 1698 TimelineDurationScope tds(thread, Timeline::GetCompilerStream(),
1700 "CompileStaticInitializer"); 1699 "CompileStaticInitializer");
1701 if (tds.enabled()) { 1700 if (tds.enabled()) {
1702 tds.SetNumArguments(1); 1701 tds.SetNumArguments(1);
1703 tds.CopyArgument(0, "field", field.ToCString()); 1702 tds.CopyArgument(0, "field", field.ToCString());
1704 } 1703 }
1705 #endif // !defined(PRODUCT) 1704 #endif // !defined(PRODUCT)
1706 1705
1707 StackZone stack_zone(thread); 1706 StackZone stack_zone(thread);
1708 Zone* zone = stack_zone.GetZone(); 1707 Zone* zone = stack_zone.GetZone();
1709 ParsedFunction* parsed_function; 1708 ParsedFunction* parsed_function;
1710 1709
1711 // Create a one-time-use function to evaluate the initializer and invoke 1710 // Create a one-time-use function to evaluate the initializer and invoke
1712 // it immediately. 1711 // it immediately.
1713 if (field.kernel_field() != NULL) { 1712 if (field.kernel_field() != NULL) {
1714 parsed_function = kernel::ParseStaticFieldInitializer(zone, field); 1713 parsed_function = kernel::ParseStaticFieldInitializer(zone, field);
1715 } else { 1714 } else {
1716 parsed_function = Parser::ParseStaticFieldInitializer(field); 1715 parsed_function = Parser::ParseStaticFieldInitializer(field);
1717 parsed_function->AllocateVariables(); 1716 parsed_function->AllocateVariables();
1718 } 1717 }
1719 1718
1720 // Non-optimized code generator. 1719 // Non-optimized code generator.
1721 DartCompilationPipeline pipeline; 1720 DartCompilationPipeline pipeline;
1722 CompileParsedFunctionHelper helper(parsed_function, false, kNoOSRDeoptId); 1721 CompileParsedFunctionHelper helper(parsed_function, false, kNoOSRDeoptId);
1723 helper.Compile(&pipeline); 1722 const Code& code = Code::Handle(helper.Compile(&pipeline));
1724 initializer = parsed_function->function().raw(); 1723 if (!code.IsNull()) {
1725 Code::Handle(initializer.unoptimized_code()) 1724 const Function& initializer = parsed_function->function();
1726 .set_var_descriptors(Object::empty_var_descriptors()); 1725 code.set_var_descriptors(Object::empty_var_descriptors());
1726 // Invoke the function to evaluate the expression.
1727 return DartEntry::InvokeFunction(initializer, Object::empty_array());
1728 }
1727 } 1729 }
1728 // Invoke the function to evaluate the expression.
1729 return DartEntry::InvokeFunction(initializer, Object::empty_array());
1730 } else {
1731 Thread* const thread = Thread::Current();
1732 StackZone zone(thread);
1733 const Error& error = Error::Handle(thread->zone(), thread->sticky_error());
1734 thread->clear_sticky_error();
1735 return error.raw();
1736 } 1730 }
1737 UNREACHABLE(); 1731
1738 return Object::null(); 1732 Thread* const thread = Thread::Current();
1733 StackZone zone(thread);
1734 const Error& error = Error::Handle(thread->zone(), thread->sticky_error());
1735 thread->clear_sticky_error();
1736 return error.raw();
1739 } 1737 }
1740 1738
1741 1739
1742 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { 1740 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) {
1743 #ifdef DART_PRECOMPILER 1741 #ifdef DART_PRECOMPILER
1744 if (FLAG_precompiled_mode) { 1742 if (FLAG_precompiled_mode) {
1745 return Precompiler::ExecuteOnce(fragment); 1743 return Precompiler::ExecuteOnce(fragment);
1746 } 1744 }
1747 #endif 1745 #endif
1748 LongJumpScope jump; 1746 LongJumpScope jump;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 // here. 1789 // here.
1792 ParsedFunction* parsed_function = new ParsedFunction(thread, func); 1790 ParsedFunction* parsed_function = new ParsedFunction(thread, func);
1793 parsed_function->SetNodeSequence(fragment); 1791 parsed_function->SetNodeSequence(fragment);
1794 fragment->scope()->AddVariable(parsed_function->EnsureExpressionTemp()); 1792 fragment->scope()->AddVariable(parsed_function->EnsureExpressionTemp());
1795 fragment->scope()->AddVariable(parsed_function->current_context_var()); 1793 fragment->scope()->AddVariable(parsed_function->current_context_var());
1796 parsed_function->AllocateVariables(); 1794 parsed_function->AllocateVariables();
1797 1795
1798 // Non-optimized code generator. 1796 // Non-optimized code generator.
1799 DartCompilationPipeline pipeline; 1797 DartCompilationPipeline pipeline;
1800 CompileParsedFunctionHelper helper(parsed_function, false, kNoOSRDeoptId); 1798 CompileParsedFunctionHelper helper(parsed_function, false, kNoOSRDeoptId);
1801 helper.Compile(&pipeline); 1799 const Code& code = Code::Handle(helper.Compile(&pipeline));
1802 Code::Handle(func.unoptimized_code()) 1800 if (!code.IsNull()) {
1803 .set_var_descriptors(Object::empty_var_descriptors()); 1801 code.set_var_descriptors(Object::empty_var_descriptors());
1802 const Object& result = PassiveObject::Handle(
1803 DartEntry::InvokeFunction(func, Object::empty_array()));
1804 return result.raw();
1805 }
1806 }
1804 1807
1805 const Object& result = PassiveObject::Handle( 1808 Thread* const thread = Thread::Current();
1806 DartEntry::InvokeFunction(func, Object::empty_array())); 1809 const Object& result = PassiveObject::Handle(thread->sticky_error());
1807 return result.raw(); 1810 thread->clear_sticky_error();
1808 } else { 1811 return result.raw();
1809 Thread* const thread = Thread::Current();
1810 const Object& result = PassiveObject::Handle(thread->sticky_error());
1811 thread->clear_sticky_error();
1812 return result.raw();
1813 }
1814 UNREACHABLE();
1815 return Object::null();
1816 } 1812 }
1817 1813
1818 1814
1819 void Compiler::AbortBackgroundCompilation(intptr_t deopt_id, const char* msg) { 1815 void Compiler::AbortBackgroundCompilation(intptr_t deopt_id, const char* msg) {
1820 if (FLAG_trace_compiler) { 1816 if (FLAG_trace_compiler) {
1821 THR_Print("ABORT background compilation: %s\n", msg); 1817 THR_Print("ABORT background compilation: %s\n", msg);
1822 } 1818 }
1823 #if !defined(PRODUCT) 1819 #if !defined(PRODUCT)
1824 TimelineStream* stream = Timeline::GetCompilerStream(); 1820 TimelineStream* stream = Timeline::GetCompilerStream();
1825 ASSERT(stream != NULL); 1821 ASSERT(stream != NULL);
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 2309
2314 2310
2315 bool BackgroundCompiler::IsDisabled() { 2311 bool BackgroundCompiler::IsDisabled() {
2316 UNREACHABLE(); 2312 UNREACHABLE();
2317 return true; 2313 return true;
2318 } 2314 }
2319 2315
2320 #endif // DART_PRECOMPILED_RUNTIME 2316 #endif // DART_PRECOMPILED_RUNTIME
2321 2317
2322 } // namespace dart 2318 } // namespace dart
OLDNEW
« no previous file with comments | « pkg/kernel/lib/transformations/continuation.dart ('k') | runtime/vm/kernel_to_il.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698