OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/kernel_binary_flowgraph.h" | 5 #include "vm/kernel_binary_flowgraph.h" |
6 | 6 |
7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
8 #include "vm/longjump.h" | 8 #include "vm/longjump.h" |
9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
10 | 10 |
(...skipping 3269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3280 SkipVariableDeclaration(); // read ith variable. | 3280 SkipVariableDeclaration(); // read ith variable. |
3281 } | 3281 } |
3282 } else { | 3282 } else { |
3283 // Still skip past the parameters. | 3283 // Still skip past the parameters. |
3284 SkipListOfVariableDeclarations(); // read list of positionals. | 3284 SkipListOfVariableDeclarations(); // read list of positionals. |
3285 SkipListOfVariableDeclarations(); // read list of named. | 3285 SkipListOfVariableDeclarations(); // read list of named. |
3286 } | 3286 } |
3287 | 3287 |
3288 SkipDartType(); // read return type. | 3288 SkipDartType(); // read return type. |
3289 | 3289 |
| 3290 if (FLAG_causal_async_stacks && |
| 3291 (dart_function.IsAsyncFunction() || dart_function.IsAsyncGenerator())) { |
| 3292 LocalScope* scope = parsed_function()->node_sequence()->scope(); |
| 3293 // :async_stack_trace = _asyncStackTraceHelper(:async_op); |
| 3294 const dart::Library& async_lib = |
| 3295 dart::Library::Handle(dart::Library::AsyncLibrary()); |
| 3296 const Function& target = Function::ZoneHandle( |
| 3297 Z, |
| 3298 async_lib.LookupFunctionAllowPrivate(Symbols::AsyncStackTraceHelper())); |
| 3299 ASSERT(!target.IsNull()); |
| 3300 |
| 3301 // TODO(johnmccutchan): Why does this have the null value? |
| 3302 LocalVariable* async_op = |
| 3303 scope->child()->LookupVariable(Symbols::AsyncOperation(), false); |
| 3304 ASSERT(async_op != NULL); |
| 3305 ASSERT(async_op->is_captured()); |
| 3306 body += LoadLocal(async_op); |
| 3307 body += PushArgument(); |
| 3308 body += StaticCall(TokenPosition::kNoSource, target, 1); |
| 3309 LocalVariable* async_stack_trace_var = |
| 3310 scope->LookupVariable(Symbols::AsyncStackTraceVar(), false); |
| 3311 ASSERT(async_stack_trace_var != NULL); |
| 3312 body += StoreLocal(TokenPosition::kNoSource, async_stack_trace_var); |
| 3313 body += Drop(); |
| 3314 } |
| 3315 |
3290 bool has_body = ReadTag() == kSomething; // read first part of body. | 3316 bool has_body = ReadTag() == kSomething; // read first part of body. |
3291 | 3317 |
3292 if (dart_function.is_native()) { | 3318 if (dart_function.is_native()) { |
3293 body += flow_graph_builder_->NativeFunctionBody(first_parameter_offset, | 3319 body += flow_graph_builder_->NativeFunctionBody(first_parameter_offset, |
3294 dart_function); | 3320 dart_function); |
3295 } else if (has_body) { | 3321 } else if (has_body) { |
3296 if (is_in_builtin_library_toplevel && | 3322 if (is_in_builtin_library_toplevel && |
3297 IsGetMainClosure(dart::String::Handle(Z, dart_function.name()))) { | 3323 IsGetMainClosure(dart::String::Handle(Z, dart_function.name()))) { |
3298 body += BuildGetMainClosure(); | 3324 body += BuildGetMainClosure(); |
3299 } else { | 3325 } else { |
(...skipping 3810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7110 metadata_values.SetAt(i, value); | 7136 metadata_values.SetAt(i, value); |
7111 } | 7137 } |
7112 | 7138 |
7113 return metadata_values.raw(); | 7139 return metadata_values.raw(); |
7114 } | 7140 } |
7115 | 7141 |
7116 } // namespace kernel | 7142 } // namespace kernel |
7117 } // namespace dart | 7143 } // namespace dart |
7118 | 7144 |
7119 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 7145 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |