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

Side by Side Diff: runtime/vm/object.h

Issue 10579033: Fix type test elimination of function types using static type propagation in (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »
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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 // Returns true if this function has parameters that are compatible with the 1461 // Returns true if this function has parameters that are compatible with the
1462 // parameters of the other function in order for this function to override the 1462 // parameters of the other function in order for this function to override the
1463 // other function. Parameter types are ignored. 1463 // other function. Parameter types are ignored.
1464 bool HasCompatibleParametersWith(const Function& other) const; 1464 bool HasCompatibleParametersWith(const Function& other) const;
1465 1465
1466 // Returns true if the type of this function is a subtype of the type of 1466 // Returns true if the type of this function is a subtype of the type of
1467 // the other function. 1467 // the other function.
1468 bool IsSubtypeOf(const AbstractTypeArguments& type_arguments, 1468 bool IsSubtypeOf(const AbstractTypeArguments& type_arguments,
1469 const Function& other, 1469 const Function& other,
1470 const AbstractTypeArguments& other_type_arguments, 1470 const AbstractTypeArguments& other_type_arguments,
1471 Error* malformed_error) const; 1471 Error* malformed_error) const {
1472 return TypeTest(kIsSubtypeOf,
1473 type_arguments,
1474 other,
1475 other_type_arguments,
1476 malformed_error);
1477 }
1478
1479 // Returns true if the type of this function is more specific than the type of
1480 // the other function.
1481 bool IsMoreSpecificThan(const AbstractTypeArguments& type_arguments,
1482 const Function& other,
1483 const AbstractTypeArguments& other_type_arguments,
1484 Error* malformed_error) const {
1485 return TypeTest(kIsMoreSpecificThan,
1486 type_arguments,
1487 other,
1488 other_type_arguments,
1489 malformed_error);
1490 }
1472 1491
1473 // Returns true if this function represents a (possibly implicit) closure 1492 // Returns true if this function represents a (possibly implicit) closure
1474 // function. 1493 // function.
1475 bool IsClosureFunction() const { 1494 bool IsClosureFunction() const {
1476 return kind() == RawFunction::kClosureFunction; 1495 return kind() == RawFunction::kClosureFunction;
1477 } 1496 }
1478 1497
1479 // Returns true if this function represents an implicit closure function. 1498 // Returns true if this function represents an implicit closure function.
1480 bool IsImplicitClosureFunction() const; 1499 bool IsImplicitClosureFunction() const;
1481 1500
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 void set_is_static(bool is_static) const; 1554 void set_is_static(bool is_static) const;
1536 void set_is_const(bool is_const) const; 1555 void set_is_const(bool is_const) const;
1537 void set_parent_function(const Function& value) const; 1556 void set_parent_function(const Function& value) const;
1538 void set_token_index(intptr_t value) const; 1557 void set_token_index(intptr_t value) const;
1539 void set_implicit_closure_function(const Function& value) const; 1558 void set_implicit_closure_function(const Function& value) const;
1540 static RawFunction* New(); 1559 static RawFunction* New();
1541 1560
1542 RawString* BuildSignature(bool instantiate, 1561 RawString* BuildSignature(bool instantiate,
1543 const AbstractTypeArguments& instantiator) const; 1562 const AbstractTypeArguments& instantiator) const;
1544 1563
1564 // Check the subtype or 'more specific' relationship.
1565 bool TypeTest(TypeTestKind test_kind,
1566 const AbstractTypeArguments& type_arguments,
1567 const Function& other,
1568 const AbstractTypeArguments& other_type_arguments,
1569 Error* malformed_error) const;
1570
1545 // Checks the type of the formal parameter at the given position for 1571 // Checks the type of the formal parameter at the given position for
1546 // assignability relationship between the type of this function and the type 1572 // subtyping or 'more specific' relationship between the type of this function
1547 // of the other function. 1573 // and the type of the other function.
1548 bool TestParameterType( 1574 bool TestParameterType(TypeTestKind test_kind,
1549 intptr_t parameter_position, 1575 intptr_t parameter_position,
1550 const AbstractTypeArguments& type_arguments, 1576 const AbstractTypeArguments& type_arguments,
1551 const Function& other, 1577 const Function& other,
1552 const AbstractTypeArguments& other_type_arguments, 1578 const AbstractTypeArguments& other_type_arguments,
1553 Error* malformed_error) const; 1579 Error* malformed_error) const;
1554 1580
1555 HEAP_OBJECT_IMPLEMENTATION(Function, Object); 1581 HEAP_OBJECT_IMPLEMENTATION(Function, Object);
1556 friend class Class; 1582 friend class Class;
1557 }; 1583 };
1558 1584
1559 1585
1560 class Field : public Object { 1586 class Field : public Object {
1561 public: 1587 public:
1562 RawString* name() const { return raw_ptr()->name_; } 1588 RawString* name() const { return raw_ptr()->name_; }
1563 bool is_static() const { return raw_ptr()->is_static_; } 1589 bool is_static() const { return raw_ptr()->is_static_; }
(...skipping 3482 matching lines...) Expand 10 before | Expand all | Expand 10 after
5046 } 5072 }
5047 5073
5048 5074
5049 intptr_t Stackmap::SizeInBits() const { 5075 intptr_t Stackmap::SizeInBits() const {
5050 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); 5076 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte);
5051 } 5077 }
5052 5078
5053 } // namespace dart 5079 } // namespace dart
5054 5080
5055 #endif // VM_OBJECT_H_ 5081 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698