Chromium Code Reviews| Index: runtime/vm/kernel_binary_flowgraph.cc |
| diff --git a/runtime/vm/kernel_binary_flowgraph.cc b/runtime/vm/kernel_binary_flowgraph.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1db13b823c3e968f8cfdbf4625b3d1132d75310e |
| --- /dev/null |
| +++ b/runtime/vm/kernel_binary_flowgraph.cc |
| @@ -0,0 +1,134 @@ |
| +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +#include "vm/kernel_binary_flowgraph.h" |
| + |
| +#if !defined(DART_PRECOMPILED_RUNTIME) |
| + |
| +namespace dart { |
| +namespace kernel { |
| + |
| +Fragment KernelFlowgraphBuilder::BuildAt(int64_t kernel_offset) { |
| + reader_->set_offset(kernel_offset); |
| + |
| + uint8_t payload = 0; |
| + Tag tag = reader_->ReadTag(&payload); |
| + switch (tag) { |
| + // case kInvalidExpression: |
| + // return InvalidExpression::ReadFrom(reader_); |
| + // case kVariableGet: |
| + // return VariableGet::ReadFrom(reader_); |
| + // case kSpecializedVariableGet: |
| + // return VariableGet::ReadFrom(reader_, payload); |
| + // case kVariableSet: |
| + // return VariableSet::ReadFrom(reader_); |
| + // case kSpecializedVariableSet: |
| + // return VariableSet::ReadFrom(reader_, payload); |
| + // case kPropertyGet: |
| + // return PropertyGet::ReadFrom(reader_); |
| + // case kPropertySet: |
| + // return PropertySet::ReadFrom(reader_); |
| + // case kDirectPropertyGet: |
| + // return DirectPropertyGet::ReadFrom(reader_); |
| + // case kDirectPropertySet: |
| + // return DirectPropertySet::ReadFrom(reader_); |
| + // case kStaticGet: |
| + // return StaticGet::ReadFrom(reader_); |
| + // case kStaticSet: |
| + // return StaticSet::ReadFrom(reader_); |
| + // case kMethodInvocation: |
| + // return MethodInvocation::ReadFrom(reader_); |
| + // case kDirectMethodInvocation: |
| + // return DirectMethodInvocation::ReadFrom(reader_); |
| + // case kStaticInvocation: |
| + // return StaticInvocation::ReadFrom(reader_, false); |
| + // case kConstStaticInvocation: |
| + // return StaticInvocation::ReadFrom(reader_, true); |
| + // case kConstructorInvocation: |
| + // return ConstructorInvocation::ReadFrom(reader_, false); |
| + // case kConstConstructorInvocation: |
| + // return ConstructorInvocation::ReadFrom(reader_, true); |
| + // case kNot: |
| + // return Not::ReadFrom(reader_); |
| + // case kLogicalExpression: |
| + // return LogicalExpression::ReadFrom(reader_); |
| + // case kConditionalExpression: |
| + // return ConditionalExpression::ReadFrom(reader_); |
| + // case kStringConcatenation: |
| + // return StringConcatenation::ReadFrom(reader_); |
| + // case kIsExpression: |
| + // return IsExpression::ReadFrom(reader_); |
| + // case kAsExpression: |
| + // return AsExpression::ReadFrom(reader_); |
| + // case kSymbolLiteral: |
| + // return SymbolLiteral::ReadFrom(reader_); |
| + // case kTypeLiteral: |
| + // return TypeLiteral::ReadFrom(reader_); |
| + // case kThisExpression: |
| + // return ThisExpression::ReadFrom(reader_); |
| + case kRethrow: |
| + return buildRethrow(); |
| + // case kThrow: |
| + // return Throw::ReadFrom(reader_); |
| + // case kListLiteral: |
| + // return ListLiteral::ReadFrom(reader_, false); |
| + // case kConstListLiteral: |
| + // return ListLiteral::ReadFrom(reader_, true); |
| + // case kMapLiteral: |
| + // return MapLiteral::ReadFrom(reader_, false); |
| + // case kConstMapLiteral: |
| + // return MapLiteral::ReadFrom(reader_, true); |
| + // case kAwaitExpression: |
| + // return AwaitExpression::ReadFrom(reader_); |
| + // case kFunctionExpression: |
| + // return FunctionExpression::ReadFrom(reader_); |
| + // case kLet: |
| + // return Let::ReadFrom(reader_); |
| + // case kBigIntLiteral: |
| + // return BigintLiteral::ReadFrom(reader_); |
| + // case kStringLiteral: |
| + // return StringLiteral::ReadFrom(reader_); |
| + // case kSpecialIntLiteral: |
| + // return IntLiteral::ReadFrom(reader_, payload); |
| + // case kNegativeIntLiteral: |
| + // return IntLiteral::ReadFrom(reader_, true); |
| + // case kPositiveIntLiteral: |
| + // return IntLiteral::ReadFrom(reader_, false); |
| + // case kDoubleLiteral: |
| + // return DoubleLiteral::ReadFrom(reader_); |
| + // case kTrueLiteral: |
| + // return BoolLiteral::ReadFrom(reader_, true); |
| + // case kFalseLiteral: |
| + // return BoolLiteral::ReadFrom(reader_, false); |
| + // case kNullLiteral: |
| + // return NullLiteral::ReadFrom(reader_); |
| + default: |
| + UNREACHABLE(); |
| + } |
| + |
| + Fragment instructions; |
|
Kevin Millikin (Google)
2017/03/28 12:50:00
return Fragment();
jensj
2017/03/29 09:30:42
Done.
|
| + return instructions; |
| +} |
| + |
| +Fragment KernelFlowgraphBuilder::buildRethrow() { |
| + Fragment instructions; |
| + |
| + TokenPosition position = reader_->ReadPosition(); |
|
Kevin Millikin (Google)
2017/03/28 12:50:00
I would take all these functions (KernelReader::Re
jensj
2017/03/29 09:30:41
Done.
|
| + instructions = flowGraph_builder_->DebugStepCheck(position); |
|
Kevin Millikin (Google)
2017/03/28 12:50:00
Fragment instructions = DebugStepCheck(position);
jensj
2017/03/29 09:30:41
Done.
|
| + instructions += flowGraph_builder_->LoadLocal( |
| + flowGraph_builder_->catch_block_->exception_var()); |
| + instructions += flowGraph_builder_->PushArgument(); |
| + instructions += flowGraph_builder_->LoadLocal( |
| + flowGraph_builder_->catch_block_->stack_trace_var()); |
| + instructions += flowGraph_builder_->PushArgument(); |
| + instructions += flowGraph_builder_->RethrowException( |
| + position, flowGraph_builder_->catch_block_->catch_try_index()); |
| + |
| + return instructions; |
| +} |
| + |
| +} // namespace kernel |
| +} // namespace dart |
| + |
| +#endif // !defined(DART_PRECOMPILED_RUNTIME) |