Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1055)

Side by Side Diff: runtime/vm/flow_graph_builder.cc

Issue 2794373002: VM [KERNEL] Use simpleInstanceOf in kernel. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/kernel_to_il.cc » ('j') | runtime/vm/object.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 Value* value, 1480 Value* value,
1481 const AbstractType& dst_type, 1481 const AbstractType& dst_type,
1482 const String& dst_name) { 1482 const String& dst_name) {
1483 if (CanSkipTypeCheck(token_pos, value, dst_type, dst_name)) { 1483 if (CanSkipTypeCheck(token_pos, value, dst_type, dst_name)) {
1484 return value; 1484 return value;
1485 } 1485 }
1486 return Bind(BuildAssertAssignable(token_pos, value, dst_type, dst_name)); 1486 return Bind(BuildAssertAssignable(token_pos, value, dst_type, dst_name));
1487 } 1487 }
1488 1488
1489 1489
1490 static bool simpleInstanceOfType(const AbstractType& type) {
1491 // Bail if the type is still uninstantiated at compile time.
1492 if (!type.IsInstantiated()) return false;
1493
1494 // Bail if the type is a function or a Dart Function type.
1495 if (type.IsFunctionType() || type.IsDartFunctionType()) return false;
1496
1497 ASSERT(type.HasResolvedTypeClass());
1498 const Class& type_class = Class::Handle(type.type_class());
1499 // Bail if the type has any type parameters.
1500 if (type_class.IsGeneric()) return false;
1501
1502 // Finally a simple class for instance of checking.
1503 return true;
1504 }
1505
1506
1507 void EffectGraphVisitor::BuildTypeTest(ComparisonNode* node) { 1490 void EffectGraphVisitor::BuildTypeTest(ComparisonNode* node) {
1508 ASSERT(Token::IsTypeTestOperator(node->kind())); 1491 ASSERT(Token::IsTypeTestOperator(node->kind()));
1509 const AbstractType& type = node->right()->AsTypeNode()->type(); 1492 const AbstractType& type = node->right()->AsTypeNode()->type();
1510 ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded()); 1493 ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded());
1511 const bool negate_result = (node->kind() == Token::kISNOT); 1494 const bool negate_result = (node->kind() == Token::kISNOT);
1512 // All objects are instances of type T if Object type is a subtype of type T. 1495 // All objects are instances of type T if Object type is a subtype of type T.
1513 const Type& object_type = Type::Handle(Z, Type::ObjectType()); 1496 const Type& object_type = Type::Handle(Z, Type::ObjectType());
1514 if (type.IsInstantiated() && 1497 if (type.IsInstantiated() &&
1515 object_type.IsSubtypeOf(type, NULL, NULL, Heap::kOld)) { 1498 object_type.IsSubtypeOf(type, NULL, NULL, Heap::kOld)) {
1516 // Must evaluate left side. 1499 // Must evaluate left side.
(...skipping 2838 matching lines...) Expand 10 before | Expand all | Expand 10 after
4355 graph_entry_->PruneUnreachable(graph_entry_, NULL, osr_id_, block_marks); 4338 graph_entry_->PruneUnreachable(graph_entry_, NULL, osr_id_, block_marks);
4356 ASSERT(found); 4339 ASSERT(found);
4357 } 4340 }
4358 4341
4359 4342
4360 void FlowGraphBuilder::Bailout(const char* reason) const { 4343 void FlowGraphBuilder::Bailout(const char* reason) const {
4361 parsed_function_.Bailout("FlowGraphBuilder", reason); 4344 parsed_function_.Bailout("FlowGraphBuilder", reason);
4362 } 4345 }
4363 4346
4364 } // namespace dart 4347 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/kernel_to_il.cc » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698