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/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" | |
| 20 #include "vm/growable_array.h" | 19 #include "vm/growable_array.h" |
| 21 #include "vm/handles.h" | 20 #include "vm/handles.h" |
| 22 #include "vm/hash_table.h" | 21 #include "vm/hash_table.h" |
| 23 #include "vm/heap.h" | 22 #include "vm/heap.h" |
| 24 #include "vm/isolate.h" | 23 #include "vm/isolate.h" |
| 24 #include "vm/kernel_binary_flowgraph.h" | |
| 25 #include "vm/longjump.h" | 25 #include "vm/longjump.h" |
| 26 #include "vm/native_arguments.h" | 26 #include "vm/native_arguments.h" |
| 27 #include "vm/native_entry.h" | 27 #include "vm/native_entry.h" |
| 28 #include "vm/object.h" | 28 #include "vm/object.h" |
| 29 #include "vm/object_store.h" | 29 #include "vm/object_store.h" |
| 30 #include "vm/os.h" | 30 #include "vm/os.h" |
| 31 #include "vm/regexp_assembler.h" | 31 #include "vm/regexp_assembler.h" |
| 32 #include "vm/resolver.h" | 32 #include "vm/resolver.h" |
| 33 #include "vm/safepoint.h" | 33 #include "vm/safepoint.h" |
| 34 #include "vm/scanner.h" | 34 #include "vm/scanner.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 UNREACHABLE(); | 232 UNREACHABLE(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 | 235 |
| 236 kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() { | 236 kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() { |
| 237 if (kernel_scopes_ == NULL) { | 237 if (kernel_scopes_ == NULL) { |
| 238 kernel::TreeNode* node = NULL; | 238 kernel::TreeNode* node = NULL; |
| 239 if (function().kernel_function() != NULL) { | 239 if (function().kernel_function() != NULL) { |
| 240 node = static_cast<kernel::TreeNode*>(function().kernel_function()); | 240 node = static_cast<kernel::TreeNode*>(function().kernel_function()); |
| 241 } | 241 } |
| 242 kernel::ScopeBuilder builder(this, node); | 242 |
| 243 kernel_scopes_ = builder.BuildScopes(); | 243 intptr_t kernel_offset = -1; |
| 244 const uint8_t* kernel_data = NULL; | |
| 245 intptr_t kernel_data_size = 0; | |
| 246 if (node != NULL) { | |
| 247 kernel::TreeNode* library_node = node; | |
| 248 if (node != NULL) { | |
|
Kevin Millikin (Google)
2017/06/12 08:25:14
We know node != NULL. We can also move all this c
| |
| 249 const Function* parent = &function(); | |
| 250 while (true) { | |
|
Kevin Millikin (Google)
2017/06/12 08:25:14
The nested loops make this seem complicated. Isn'
| |
| 251 library_node = | |
| 252 static_cast<kernel::TreeNode*>(parent->kernel_function()); | |
| 253 while (library_node != NULL && !library_node->IsLibrary()) { | |
| 254 if (library_node->IsMember()) { | |
| 255 library_node = kernel::Member::Cast(library_node)->parent(); | |
| 256 } else if (library_node->IsClass()) { | |
| 257 library_node = kernel::Class::Cast(library_node)->parent(); | |
| 258 break; | |
| 259 } else { | |
| 260 library_node = NULL; | |
| 261 break; | |
| 262 } | |
| 263 } | |
| 264 if (library_node != NULL) break; | |
| 265 parent = &Function::Handle(parent->parent_function()); | |
| 266 } | |
| 267 } | |
| 268 if (library_node != NULL && library_node->IsLibrary()) { | |
| 269 kernel::Library* library = kernel::Library::Cast(library_node); | |
| 270 kernel_offset = node->kernel_offset(); | |
| 271 kernel_data = library->kernel_data(); | |
| 272 kernel_data_size = library->kernel_data_size(); | |
| 273 } | |
| 274 } | |
| 275 | |
| 276 kernel::StreamingScopeBuilder builder2(this, kernel_offset, kernel_data, | |
| 277 kernel_data_size); | |
| 278 kernel_scopes_ = builder2.BuildScopes(); | |
| 244 } | 279 } |
| 245 return kernel_scopes_; | 280 return kernel_scopes_; |
| 246 } | 281 } |
| 247 | 282 |
| 248 | 283 |
| 249 LocalVariable* ParsedFunction::EnsureExpressionTemp() { | 284 LocalVariable* ParsedFunction::EnsureExpressionTemp() { |
| 250 if (!has_expression_temp_var()) { | 285 if (!has_expression_temp_var()) { |
| 251 LocalVariable* temp = | 286 LocalVariable* temp = |
| 252 new (Z) LocalVariable(function_.token_pos(), function_.token_pos(), | 287 new (Z) LocalVariable(function_.token_pos(), function_.token_pos(), |
| 253 Symbols::ExprTemp(), Object::dynamic_type()); | 288 Symbols::ExprTemp(), Object::dynamic_type()); |
| (...skipping 14943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15197 const ArgumentListNode& function_args, | 15232 const ArgumentListNode& function_args, |
| 15198 const LocalVariable* temp_for_last_arg, | 15233 const LocalVariable* temp_for_last_arg, |
| 15199 bool is_super_invocation) { | 15234 bool is_super_invocation) { |
| 15200 UNREACHABLE(); | 15235 UNREACHABLE(); |
| 15201 return NULL; | 15236 return NULL; |
| 15202 } | 15237 } |
| 15203 | 15238 |
| 15204 } // namespace dart | 15239 } // namespace dart |
| 15205 | 15240 |
| 15206 #endif // DART_PRECOMPILED_RUNTIME | 15241 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |