Chromium Code Reviews| 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 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1561 ASSERT(field.is_static()); | 1561 ASSERT(field.is_static()); |
| 1562 // The VM sets the field's value to transiton_sentinel prior to | 1562 // The VM sets the field's value to transiton_sentinel prior to |
| 1563 // evaluating the initializer value. | 1563 // evaluating the initializer value. |
| 1564 ASSERT(field.StaticValue() == Object::transition_sentinel().raw()); | 1564 ASSERT(field.StaticValue() == Object::transition_sentinel().raw()); |
| 1565 LongJumpScope jump; | 1565 LongJumpScope jump; |
| 1566 if (setjmp(*jump.Set()) == 0) { | 1566 if (setjmp(*jump.Set()) == 0) { |
| 1567 // Under lazy compilation initializer has not yet been created, so create | 1567 // Under lazy compilation initializer has not yet been created, so create |
| 1568 // it now, but don't bother remembering it because it won't be used again. | 1568 // it now, but don't bother remembering it because it won't be used again. |
| 1569 ASSERT(!field.HasPrecompiledInitializer()); | 1569 ASSERT(!field.HasPrecompiledInitializer()); |
| 1570 Thread* const thread = Thread::Current(); | 1570 Thread* const thread = Thread::Current(); |
| 1571 StackZone zone(thread); | 1571 Function& initializer = Function::Handle(thread->zone()); |
| 1572 ParsedFunction* parsed_function = | 1572 { |
| 1573 Parser::ParseStaticFieldInitializer(field); | 1573 #ifndef PRODUCT |
|
Cutch
2016/05/13 20:23:27
could use NOT_IN_PRODUCT()
rmacnak
2016/05/16 16:28:49
Done.
| |
| 1574 VMTagScope tagScope(thread, VMTag::kCompileUnoptimizedTagId); | |
| 1575 TimelineDurationScope tds(thread, Timeline::GetCompilerStream(), | |
| 1576 "CompileStaticInitializer"); | |
| 1577 if (tds.enabled()) { | |
| 1578 tds.SetNumArguments(1); | |
| 1579 tds.CopyArgument(0, "field", field.ToCString()); | |
| 1580 } | |
| 1581 #endif // !PRODUCT | |
| 1574 | 1582 |
| 1575 parsed_function->AllocateVariables(); | 1583 StackZone zone(thread); |
| 1576 // Non-optimized code generator. | 1584 ParsedFunction* parsed_function = |
| 1577 DartCompilationPipeline pipeline; | 1585 Parser::ParseStaticFieldInitializer(field); |
| 1578 CompileParsedFunctionHelper helper(parsed_function, false, kNoOSRDeoptId); | 1586 |
| 1579 helper.Compile(&pipeline); | 1587 parsed_function->AllocateVariables(); |
| 1580 const Function& initializer = | 1588 // Non-optimized code generator. |
| 1581 Function::Handle(parsed_function->function().raw()); | 1589 DartCompilationPipeline pipeline; |
| 1582 Code::Handle(initializer.unoptimized_code()).set_var_descriptors( | 1590 CompileParsedFunctionHelper helper(parsed_function, false, kNoOSRDeoptId); |
| 1583 Object::empty_var_descriptors()); | 1591 helper.Compile(&pipeline); |
| 1592 initializer = parsed_function->function().raw(); | |
| 1593 Code::Handle(initializer.unoptimized_code()).set_var_descriptors( | |
| 1594 Object::empty_var_descriptors()); | |
| 1595 } | |
| 1584 // Invoke the function to evaluate the expression. | 1596 // Invoke the function to evaluate the expression. |
| 1585 return DartEntry::InvokeFunction(initializer, Object::empty_array()); | 1597 return DartEntry::InvokeFunction(initializer, Object::empty_array()); |
| 1586 } else { | 1598 } else { |
| 1587 Thread* const thread = Thread::Current(); | 1599 Thread* const thread = Thread::Current(); |
| 1588 StackZone zone(thread); | 1600 StackZone zone(thread); |
| 1589 const Error& error = Error::Handle(thread->zone(), thread->sticky_error()); | 1601 const Error& error = Error::Handle(thread->zone(), thread->sticky_error()); |
| 1590 thread->clear_sticky_error(); | 1602 thread->clear_sticky_error(); |
| 1591 return error.raw(); | 1603 return error.raw(); |
| 1592 } | 1604 } |
| 1593 UNREACHABLE(); | 1605 UNREACHABLE(); |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2110 } | 2122 } |
| 2111 | 2123 |
| 2112 | 2124 |
| 2113 void BackgroundCompiler::EnsureInit(Thread* thread) { | 2125 void BackgroundCompiler::EnsureInit(Thread* thread) { |
| 2114 UNREACHABLE(); | 2126 UNREACHABLE(); |
| 2115 } | 2127 } |
| 2116 | 2128 |
| 2117 #endif // DART_PRECOMPILED_RUNTIME | 2129 #endif // DART_PRECOMPILED_RUNTIME |
| 2118 | 2130 |
| 2119 } // namespace dart | 2131 } // namespace dart |
| OLD | NEW |