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 <map> | 5 #include <map> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "vm/kernel_to_il.h" | 9 #include "vm/kernel_to_il.h" |
10 | 10 |
(...skipping 5009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5020 if (!type.IsInstantiated()) { | 5020 if (!type.IsInstantiated()) { |
5021 instructions += LoadInstantiatorTypeArguments(); | 5021 instructions += LoadInstantiatorTypeArguments(); |
5022 } else { | 5022 } else { |
5023 instructions += NullConstant(); | 5023 instructions += NullConstant(); |
5024 } | 5024 } |
5025 instructions += PushArgument(); // Type arguments. | 5025 instructions += PushArgument(); // Type arguments. |
5026 | 5026 |
5027 instructions += Constant(type); | 5027 instructions += Constant(type); |
5028 instructions += PushArgument(); // Type. | 5028 instructions += PushArgument(); // Type. |
5029 | 5029 |
5030 instructions += Constant(Bool::False()); | |
5031 instructions += PushArgument(); // Negate?. | |
5032 | |
5033 instructions += | 5030 instructions += |
5034 InstanceCall(node->position(), | 5031 InstanceCall(node->position(), |
5035 dart::Library::PrivateCoreLibName(Symbols::_instanceOf()), | 5032 dart::Library::PrivateCoreLibName(Symbols::_instanceOf()), |
5036 Token::kIS, 4); | 5033 Token::kIS, 3); |
5037 } | 5034 } |
5038 | 5035 |
5039 fragment_ = instructions; | 5036 fragment_ = instructions; |
5040 } | 5037 } |
5041 | 5038 |
5042 | 5039 |
5043 void FlowGraphBuilder::VisitAsExpression(AsExpression* node) { | 5040 void FlowGraphBuilder::VisitAsExpression(AsExpression* node) { |
5044 Fragment instructions = TranslateExpression(node->operand()); | 5041 Fragment instructions = TranslateExpression(node->operand()); |
5045 | 5042 |
5046 // The VM does not like an Object_as call with a dynamic type. We need to | 5043 // The VM does not like an Object_as call with a dynamic type. We need to |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6116 if (type_guard->IsMalformed()) { | 6113 if (type_guard->IsMalformed()) { |
6117 catch_body += ThrowTypeError(); | 6114 catch_body += ThrowTypeError(); |
6118 catch_body += Drop(); | 6115 catch_body += Drop(); |
6119 } else { | 6116 } else { |
6120 catch_body += LoadLocal(CurrentException()); | 6117 catch_body += LoadLocal(CurrentException()); |
6121 catch_body += PushArgument(); // exception | 6118 catch_body += PushArgument(); // exception |
6122 catch_body += NullConstant(); | 6119 catch_body += NullConstant(); |
6123 catch_body += PushArgument(); // type arguments | 6120 catch_body += PushArgument(); // type arguments |
6124 catch_body += Constant(*type_guard); | 6121 catch_body += Constant(*type_guard); |
6125 catch_body += PushArgument(); // guard type | 6122 catch_body += PushArgument(); // guard type |
6126 catch_body += Constant(Object::bool_false()); | |
6127 catch_body += PushArgument(); // negate | |
6128 catch_body += InstanceCall( | 6123 catch_body += InstanceCall( |
6129 TokenPosition::kNoSource, | 6124 TokenPosition::kNoSource, |
6130 dart::Library::PrivateCoreLibName(Symbols::_instanceOf()), | 6125 dart::Library::PrivateCoreLibName(Symbols::_instanceOf()), |
6131 Token::kIS, 4); | 6126 Token::kIS, 3); |
6132 | 6127 |
6133 TargetEntryInstr* catch_entry; | 6128 TargetEntryInstr* catch_entry; |
6134 TargetEntryInstr* next_catch_entry; | 6129 TargetEntryInstr* next_catch_entry; |
6135 catch_body += BranchIfTrue(&catch_entry, &next_catch_entry); | 6130 catch_body += BranchIfTrue(&catch_entry, &next_catch_entry); |
6136 | 6131 |
6137 Fragment(catch_entry) + catch_handler_body; | 6132 Fragment(catch_entry) + catch_handler_body; |
6138 catch_body = Fragment(next_catch_entry); | 6133 catch_body = Fragment(next_catch_entry); |
6139 } | 6134 } |
6140 } else { | 6135 } else { |
6141 catch_body += catch_handler_body; | 6136 catch_body += catch_handler_body; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6444 thread->clear_sticky_error(); | 6439 thread->clear_sticky_error(); |
6445 return error.raw(); | 6440 return error.raw(); |
6446 } | 6441 } |
6447 } | 6442 } |
6448 | 6443 |
6449 | 6444 |
6450 } // namespace kernel | 6445 } // namespace kernel |
6451 } // namespace dart | 6446 } // namespace dart |
6452 | 6447 |
6453 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 6448 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |