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/parser.h" | 5 #include "vm/parser.h" |
6 #include "vm/flags.h" | 6 #include "vm/flags.h" |
7 | 7 |
8 #ifndef DART_PRECOMPILED_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME |
9 | 9 |
10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
11 #include "platform/utils.h" | 11 #include "platform/utils.h" |
12 #include "vm/ast_transformer.h" | 12 #include "vm/ast_transformer.h" |
13 #include "vm/bootstrap.h" | 13 #include "vm/bootstrap.h" |
14 #include "vm/class_finalizer.h" | 14 #include "vm/class_finalizer.h" |
15 #include "vm/compiler.h" | 15 #include "vm/compiler.h" |
16 #include "vm/compiler_stats.h" | 16 #include "vm/compiler_stats.h" |
17 #include "vm/dart_api_impl.h" | 17 #include "vm/dart_api_impl.h" |
18 #include "vm/dart_entry.h" | 18 #include "vm/dart_entry.h" |
| 19 #include "vm/kernel_to_il.h" |
19 #include "vm/growable_array.h" | 20 #include "vm/growable_array.h" |
20 #include "vm/handles.h" | 21 #include "vm/handles.h" |
21 #include "vm/hash_table.h" | 22 #include "vm/hash_table.h" |
22 #include "vm/heap.h" | 23 #include "vm/heap.h" |
23 #include "vm/isolate.h" | 24 #include "vm/isolate.h" |
24 #include "vm/longjump.h" | 25 #include "vm/longjump.h" |
25 #include "vm/native_arguments.h" | 26 #include "vm/native_arguments.h" |
26 #include "vm/native_entry.h" | 27 #include "vm/native_entry.h" |
27 #include "vm/object.h" | 28 #include "vm/object.h" |
28 #include "vm/object_store.h" | 29 #include "vm/object_store.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 function_.token_pos(), | 219 function_.token_pos(), |
219 Report::AtLocation, | 220 Report::AtLocation, |
220 "%s Bailout in %s: %s", | 221 "%s Bailout in %s: %s", |
221 origin, | 222 origin, |
222 String::Handle(function_.name()).ToCString(), | 223 String::Handle(function_.name()).ToCString(), |
223 reason); | 224 reason); |
224 UNREACHABLE(); | 225 UNREACHABLE(); |
225 } | 226 } |
226 | 227 |
227 | 228 |
| 229 kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() { |
| 230 if (kernel_scopes_ == NULL) { |
| 231 kernel::TreeNode* node = NULL; |
| 232 if (function().kernel_function() != NULL) { |
| 233 node = static_cast<kernel::TreeNode*>(function().kernel_function()); |
| 234 } |
| 235 kernel::ScopeBuilder builder(this, node); |
| 236 kernel_scopes_ = builder.BuildScopes(); |
| 237 } |
| 238 return kernel_scopes_; |
| 239 } |
| 240 |
| 241 |
228 LocalVariable* ParsedFunction::EnsureExpressionTemp() { | 242 LocalVariable* ParsedFunction::EnsureExpressionTemp() { |
229 if (!has_expression_temp_var()) { | 243 if (!has_expression_temp_var()) { |
230 LocalVariable* temp = | 244 LocalVariable* temp = |
231 new (Z) LocalVariable(function_.token_pos(), | 245 new (Z) LocalVariable(function_.token_pos(), |
232 Symbols::ExprTemp(), | 246 Symbols::ExprTemp(), |
233 Object::dynamic_type()); | 247 Object::dynamic_type()); |
234 ASSERT(temp != NULL); | 248 ASSERT(temp != NULL); |
235 set_expression_temp_var(temp); | 249 set_expression_temp_var(temp); |
236 } | 250 } |
237 ASSERT(has_expression_temp_var()); | 251 ASSERT(has_expression_temp_var()); |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 | 1599 |
1586 const Function& parent = Function::Handle(func.parent_function()); | 1600 const Function& parent = Function::Handle(func.parent_function()); |
1587 if (parent.IsImplicitSetterFunction()) { | 1601 if (parent.IsImplicitSetterFunction()) { |
1588 const TokenPosition ident_pos = func.token_pos(); | 1602 const TokenPosition ident_pos = func.token_pos(); |
1589 ASSERT(IsIdentifier()); | 1603 ASSERT(IsIdentifier()); |
1590 params.AddFinalParameter(ident_pos, | 1604 params.AddFinalParameter(ident_pos, |
1591 &Symbols::Value(), | 1605 &Symbols::Value(), |
1592 &Object::dynamic_type()); | 1606 &Object::dynamic_type()); |
1593 ASSERT(func.num_fixed_parameters() == 2); // closure, value. | 1607 ASSERT(func.num_fixed_parameters() == 2); // closure, value. |
1594 } else if (!parent.IsGetterFunction() && !parent.IsImplicitGetterFunction()) { | 1608 } else if (!parent.IsGetterFunction() && !parent.IsImplicitGetterFunction()) { |
1595 const bool allow_explicit_default_values = true; | 1609 // NOTE: For the `kernel -> flowgraph` we don't use the parser. |
1596 SkipFunctionPreamble(); | 1610 if (parent.kernel_function() == NULL) { |
1597 ParseFormalParameterList(allow_explicit_default_values, false, ¶ms); | 1611 const bool allow_explicit_default_values = true; |
1598 SetupDefaultsForOptionalParams(params); | 1612 SkipFunctionPreamble(); |
| 1613 ParseFormalParameterList(allow_explicit_default_values, false, ¶ms); |
| 1614 SetupDefaultsForOptionalParams(params); |
| 1615 } |
1599 } | 1616 } |
1600 | 1617 |
1601 // Populate function scope with the formal parameters. | 1618 // Populate function scope with the formal parameters. |
1602 LocalScope* scope = current_block_->scope; | 1619 LocalScope* scope = current_block_->scope; |
1603 AddFormalParamsToScope(¶ms, scope); | 1620 AddFormalParamsToScope(¶ms, scope); |
1604 | 1621 |
1605 ArgumentListNode* func_args = new ArgumentListNode(token_pos); | 1622 ArgumentListNode* func_args = new ArgumentListNode(token_pos); |
1606 if (!func.is_static()) { | 1623 if (!func.is_static()) { |
1607 func_args->Add(LoadReceiver(token_pos)); | 1624 func_args->Add(LoadReceiver(token_pos)); |
1608 } | 1625 } |
(...skipping 13399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15008 #else // DART_PRECOMPILED_RUNTIME | 15025 #else // DART_PRECOMPILED_RUNTIME |
15009 | 15026 |
15010 | 15027 |
15011 namespace dart { | 15028 namespace dart { |
15012 | 15029 |
15013 void ParsedFunction::AddToGuardedFields(const Field* field) const { | 15030 void ParsedFunction::AddToGuardedFields(const Field* field) const { |
15014 UNREACHABLE(); | 15031 UNREACHABLE(); |
15015 } | 15032 } |
15016 | 15033 |
15017 | 15034 |
| 15035 kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() { |
| 15036 UNREACHABLE(); |
| 15037 return NULL; |
| 15038 } |
| 15039 |
| 15040 |
15018 LocalVariable* ParsedFunction::EnsureExpressionTemp() { | 15041 LocalVariable* ParsedFunction::EnsureExpressionTemp() { |
15019 UNREACHABLE(); | 15042 UNREACHABLE(); |
15020 return NULL; | 15043 return NULL; |
15021 } | 15044 } |
15022 | 15045 |
15023 | 15046 |
15024 void ParsedFunction::SetNodeSequence(SequenceNode* node_sequence) { | 15047 void ParsedFunction::SetNodeSequence(SequenceNode* node_sequence) { |
15025 UNREACHABLE(); | 15048 UNREACHABLE(); |
15026 } | 15049 } |
15027 | 15050 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15094 const ArgumentListNode& function_args, | 15117 const ArgumentListNode& function_args, |
15095 const LocalVariable* temp_for_last_arg, | 15118 const LocalVariable* temp_for_last_arg, |
15096 bool is_super_invocation) { | 15119 bool is_super_invocation) { |
15097 UNREACHABLE(); | 15120 UNREACHABLE(); |
15098 return NULL; | 15121 return NULL; |
15099 } | 15122 } |
15100 | 15123 |
15101 } // namespace dart | 15124 } // namespace dart |
15102 | 15125 |
15103 #endif // DART_PRECOMPILED_RUNTIME | 15126 #endif // DART_PRECOMPILED_RUNTIME |
OLD | NEW |