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

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

Issue 10928160: Limit the maximum number of formal parameters (32K fixed and 32K optional) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « runtime/vm/flow_graph_compiler_x64.cc ('k') | 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 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 void set_end_token_pos(intptr_t value) const { 1469 void set_end_token_pos(intptr_t value) const {
1470 raw_ptr()->end_token_pos_ = value; 1470 raw_ptr()->end_token_pos_ = value;
1471 } 1471 }
1472 1472
1473 intptr_t num_fixed_parameters() const { 1473 intptr_t num_fixed_parameters() const {
1474 return raw_ptr()->num_fixed_parameters_; 1474 return raw_ptr()->num_fixed_parameters_;
1475 } 1475 }
1476 void set_num_fixed_parameters(intptr_t value) const; 1476 void set_num_fixed_parameters(intptr_t value) const;
1477 1477
1478 bool HasOptionalParameters() const { 1478 bool HasOptionalParameters() const {
1479 return (num_optional_positional_parameters() + 1479 return raw_ptr()->num_optional_parameters_ != 0;
1480 num_optional_named_parameters()) > 0; 1480 }
1481 bool HasOptionalPositionalParameters() const {
1482 return raw_ptr()->num_optional_parameters_ > 0;
1483 }
1484 bool HasOptionalNamedParameters() const {
1485 return raw_ptr()->num_optional_parameters_ < 0;
1486 }
1487 intptr_t NumOptionalParameters() const {
1488 const intptr_t num_opt_params = raw_ptr()->num_optional_parameters_;
1489 return (num_opt_params >= 0) ? num_opt_params : -num_opt_params;
1490 }
1491 void SetNumOptionalParameters(intptr_t num_optional_parameters,
1492 bool are_optional_positional) const;
1493
1494 intptr_t NumOptionalPositionalParameters() const {
1495 const intptr_t num_opt_params = raw_ptr()->num_optional_parameters_;
1496 return (num_opt_params > 0) ? num_opt_params : 0;
1497 }
1498 intptr_t NumOptionalNamedParameters() const {
1499 const intptr_t num_opt_params = raw_ptr()->num_optional_parameters_;
1500 return (num_opt_params < 0) ? -num_opt_params : 0;
1481 } 1501 }
1482 1502
1483 intptr_t num_optional_positional_parameters() const { 1503 intptr_t NumParameters() const;
1484 return raw_ptr()->num_optional_positional_parameters_;
1485 }
1486 void set_num_optional_positional_parameters(intptr_t value) const;
1487 1504
1488 intptr_t num_optional_named_parameters() const { 1505 intptr_t NumImplicitParameters() const;
1489 return raw_ptr()->num_optional_named_parameters_;
1490 }
1491 void set_num_optional_named_parameters(intptr_t value) const;
1492 1506
1493 static intptr_t usage_counter_offset() { 1507 static intptr_t usage_counter_offset() {
1494 return OFFSET_OF(RawFunction, usage_counter_); 1508 return OFFSET_OF(RawFunction, usage_counter_);
1495 } 1509 }
1496 intptr_t usage_counter() const { 1510 intptr_t usage_counter() const {
1497 return raw_ptr()->usage_counter_; 1511 return raw_ptr()->usage_counter_;
1498 } 1512 }
1499 void set_usage_counter(intptr_t value) const { 1513 void set_usage_counter(intptr_t value) const {
1500 raw_ptr()->usage_counter_ = value; 1514 raw_ptr()->usage_counter_ = value;
1501 } 1515 }
(...skipping 14 matching lines...) Expand all
1516 void set_has_finally(bool value) const; 1530 void set_has_finally(bool value) const;
1517 1531
1518 bool is_native() const { return NativeBit::decode(raw_ptr()->kind_tag_); } 1532 bool is_native() const { return NativeBit::decode(raw_ptr()->kind_tag_); }
1519 void set_is_native(bool value) const; 1533 void set_is_native(bool value) const;
1520 1534
1521 bool is_abstract() const { return AbstractBit::decode(raw_ptr()->kind_tag_); } 1535 bool is_abstract() const { return AbstractBit::decode(raw_ptr()->kind_tag_); }
1522 void set_is_abstract(bool value) const; 1536 void set_is_abstract(bool value) const;
1523 1537
1524 bool HasOptimizedCode() const; 1538 bool HasOptimizedCode() const;
1525 1539
1526 intptr_t NumberOfParameters() const;
1527 intptr_t NumberOfImplicitParameters() const;
1528 void SetNumberOfParameters(intptr_t num_fixed_parameters,
1529 intptr_t num_optional_parameters,
1530 bool are_optional_positional) const;
1531
1532 // Returns true if the argument counts are valid for calling this function. 1540 // Returns true if the argument counts are valid for calling this function.
1533 // Otherwise, it returns false and the reason (if error_message is not NULL). 1541 // Otherwise, it returns false and the reason (if error_message is not NULL).
1534 bool AreValidArgumentCounts(int num_arguments, 1542 bool AreValidArgumentCounts(int num_arguments,
1535 int num_named_arguments, 1543 int num_named_arguments,
1536 String* error_message) const; 1544 String* error_message) const;
1537 1545
1538 // Returns true if the total argument count and the names of optional 1546 // Returns true if the total argument count and the names of optional
1539 // arguments are valid for calling this function. 1547 // arguments are valid for calling this function.
1540 // Otherwise, it returns false and the reason (if error_message is not NULL). 1548 // Otherwise, it returns false and the reason (if error_message is not NULL).
1541 bool AreValidArguments(int num_arguments, 1549 bool AreValidArguments(int num_arguments,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 1681
1674 void set_name(const String& value) const; 1682 void set_name(const String& value) const;
1675 void set_kind(RawFunction::Kind value) const; 1683 void set_kind(RawFunction::Kind value) const;
1676 void set_is_static(bool value) const; 1684 void set_is_static(bool value) const;
1677 void set_is_const(bool value) const; 1685 void set_is_const(bool value) const;
1678 void set_is_external(bool value) const; 1686 void set_is_external(bool value) const;
1679 void set_parent_function(const Function& value) const; 1687 void set_parent_function(const Function& value) const;
1680 void set_owner(const Object& value) const; 1688 void set_owner(const Object& value) const;
1681 void set_token_pos(intptr_t value) const; 1689 void set_token_pos(intptr_t value) const;
1682 void set_implicit_closure_function(const Function& value) const; 1690 void set_implicit_closure_function(const Function& value) const;
1691 void set_num_optional_parameters(intptr_t value) const; // Encoded value.
1683 void set_kind_tag(intptr_t value) const; 1692 void set_kind_tag(intptr_t value) const;
1684 static RawFunction* New(); 1693 static RawFunction* New();
1685 1694
1686 RawString* BuildSignature(bool instantiate, 1695 RawString* BuildSignature(bool instantiate,
1687 NameVisibility name_visibility, 1696 NameVisibility name_visibility,
1688 const AbstractTypeArguments& instantiator) const; 1697 const AbstractTypeArguments& instantiator) const;
1689 1698
1690 // Check the subtype or 'more specific' relationship. 1699 // Check the subtype or 'more specific' relationship.
1691 bool TypeTest(TypeTestKind test_kind, 1700 bool TypeTest(TypeTestKind test_kind,
1692 const AbstractTypeArguments& type_arguments, 1701 const AbstractTypeArguments& type_arguments,
(...skipping 3882 matching lines...) Expand 10 before | Expand all | Expand 10 after
5575 if (this->CharAt(i) != str.CharAt(begin_index + i)) { 5584 if (this->CharAt(i) != str.CharAt(begin_index + i)) {
5576 return false; 5585 return false;
5577 } 5586 }
5578 } 5587 }
5579 return true; 5588 return true;
5580 } 5589 }
5581 5590
5582 } // namespace dart 5591 } // namespace dart
5583 5592
5584 #endif // VM_OBJECT_H_ 5593 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698