OLD | NEW |
---|---|
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 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1629 UNREACHABLE(); | 1629 UNREACHABLE(); |
1630 return Object::null(); | 1630 return Object::null(); |
1631 } | 1631 } |
1632 | 1632 |
1633 | 1633 |
1634 | 1634 |
1635 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { | 1635 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { |
1636 LongJumpScope jump; | 1636 LongJumpScope jump; |
1637 if (setjmp(*jump.Set()) == 0) { | 1637 if (setjmp(*jump.Set()) == 0) { |
1638 Thread* const thread = Thread::Current(); | 1638 Thread* const thread = Thread::Current(); |
1639 Isolate* const isolate = thread->isolate(); | |
1640 | |
1641 // Don't allow message interrupts while executing constant | |
1642 // expressions. They can cause bogus recursive compilation. | |
1643 isolate->DeferMessageInterrupts(); | |
Cutch
2016/02/09 17:05:51
DBC: Consider adding a scope object helper class.
| |
1639 if (FLAG_trace_compiler) { | 1644 if (FLAG_trace_compiler) { |
1640 THR_Print("compiling expression: "); | 1645 THR_Print("compiling expression: "); |
1641 AstPrinter::PrintNode(fragment); | 1646 AstPrinter::PrintNode(fragment); |
1642 } | 1647 } |
1643 | 1648 |
1644 // Create a dummy function object for the code generator. | 1649 // Create a dummy function object for the code generator. |
1645 // The function needs to be associated with a named Class: the interface | 1650 // The function needs to be associated with a named Class: the interface |
1646 // Function fits the bill. | 1651 // Function fits the bill. |
1647 const char* kEvalConst = "eval_const"; | 1652 const char* kEvalConst = "eval_const"; |
1648 const Function& func = Function::ZoneHandle(Function::New( | 1653 const Function& func = Function::ZoneHandle(Function::New( |
(...skipping 26 matching lines...) Expand all Loading... | |
1675 | 1680 |
1676 // Non-optimized code generator. | 1681 // Non-optimized code generator. |
1677 DartCompilationPipeline pipeline; | 1682 DartCompilationPipeline pipeline; |
1678 CompileParsedFunctionHelper helper(parsed_function, false, kNoOSRDeoptId); | 1683 CompileParsedFunctionHelper helper(parsed_function, false, kNoOSRDeoptId); |
1679 helper.Compile(&pipeline); | 1684 helper.Compile(&pipeline); |
1680 Code::Handle(func.unoptimized_code()).set_var_descriptors( | 1685 Code::Handle(func.unoptimized_code()).set_var_descriptors( |
1681 Object::empty_var_descriptors()); | 1686 Object::empty_var_descriptors()); |
1682 | 1687 |
1683 const Object& result = PassiveObject::Handle( | 1688 const Object& result = PassiveObject::Handle( |
1684 DartEntry::InvokeFunction(func, Object::empty_array())); | 1689 DartEntry::InvokeFunction(func, Object::empty_array())); |
1690 isolate->RestoreMessageInterrupts(); | |
1685 return result.raw(); | 1691 return result.raw(); |
1686 } else { | 1692 } else { |
1687 Thread* const thread = Thread::Current(); | 1693 Thread* const thread = Thread::Current(); |
1688 Isolate* const isolate = thread->isolate(); | 1694 Isolate* const isolate = thread->isolate(); |
1689 const Object& result = | 1695 const Object& result = |
1690 PassiveObject::Handle(isolate->object_store()->sticky_error()); | 1696 PassiveObject::Handle(isolate->object_store()->sticky_error()); |
1691 isolate->object_store()->clear_sticky_error(); | 1697 isolate->object_store()->clear_sticky_error(); |
1698 isolate->RestoreMessageInterrupts(); | |
1692 return result.raw(); | 1699 return result.raw(); |
1693 } | 1700 } |
1694 UNREACHABLE(); | 1701 UNREACHABLE(); |
1695 return Object::null(); | 1702 return Object::null(); |
1696 } | 1703 } |
1697 | 1704 |
1698 | 1705 |
1699 // C-heap allocated background compilation queue element. | 1706 // C-heap allocated background compilation queue element. |
1700 class QueueElement { | 1707 class QueueElement { |
1701 public: | 1708 public: |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2042 } | 2049 } |
2043 | 2050 |
2044 | 2051 |
2045 void BackgroundCompiler::EnsureInit(Thread* thread) { | 2052 void BackgroundCompiler::EnsureInit(Thread* thread) { |
2046 UNREACHABLE(); | 2053 UNREACHABLE(); |
2047 } | 2054 } |
2048 | 2055 |
2049 #endif // DART_PRECOMPILED_RUNTIME | 2056 #endif // DART_PRECOMPILED_RUNTIME |
2050 | 2057 |
2051 } // namespace dart | 2058 } // namespace dart |
OLD | NEW |