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 5035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5046 if (type.IsInstantiated() && | 5046 if (type.IsInstantiated() && |
5047 object_type.IsSubtypeOf(type, NULL, NULL, Heap::kOld)) { | 5047 object_type.IsSubtypeOf(type, NULL, NULL, Heap::kOld)) { |
5048 // Evaluate the expression on the left but ignore it's result. | 5048 // Evaluate the expression on the left but ignore it's result. |
5049 instructions += Drop(); | 5049 instructions += Drop(); |
5050 | 5050 |
5051 // Let condition be always true. | 5051 // Let condition be always true. |
5052 instructions += Constant(Bool::True()); | 5052 instructions += Constant(Bool::True()); |
5053 } else { | 5053 } else { |
5054 instructions += PushArgument(); | 5054 instructions += PushArgument(); |
5055 | 5055 |
| 5056 // See if simple instanceOf is applicable. |
| 5057 if (simpleInstanceOfType(type)) { |
| 5058 instructions += Constant(type); |
| 5059 instructions += PushArgument(); // Type. |
| 5060 instructions += InstanceCall( |
| 5061 node->position(), |
| 5062 dart::Library::PrivateCoreLibName(Symbols::_simpleInstanceOf()), |
| 5063 Token::kIS, 2, 2); // 2 checked arguments. |
| 5064 fragment_ = instructions; |
| 5065 return; |
| 5066 } |
| 5067 |
5056 if (!type.IsInstantiated()) { | 5068 if (!type.IsInstantiated()) { |
5057 instructions += LoadInstantiatorTypeArguments(); | 5069 instructions += LoadInstantiatorTypeArguments(); |
5058 } else { | 5070 } else { |
5059 instructions += NullConstant(); | 5071 instructions += NullConstant(); |
5060 } | 5072 } |
5061 instructions += PushArgument(); // Type arguments. | 5073 instructions += PushArgument(); // Type arguments. |
5062 | 5074 |
5063 instructions += Constant(type); | 5075 instructions += Constant(type); |
5064 instructions += PushArgument(); // Type. | 5076 instructions += PushArgument(); // Type. |
5065 | 5077 |
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6475 thread->clear_sticky_error(); | 6487 thread->clear_sticky_error(); |
6476 return error.raw(); | 6488 return error.raw(); |
6477 } | 6489 } |
6478 } | 6490 } |
6479 | 6491 |
6480 | 6492 |
6481 } // namespace kernel | 6493 } // namespace kernel |
6482 } // namespace dart | 6494 } // namespace dart |
6483 | 6495 |
6484 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 6496 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |