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

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

Issue 10796004: Consolidate a few fields in RawFunction using bitfields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/dart_api_impl.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 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 1393
1394 RawCode* closure_allocation_stub() const { 1394 RawCode* closure_allocation_stub() const {
1395 return raw_ptr()->closure_allocation_stub_; 1395 return raw_ptr()->closure_allocation_stub_;
1396 } 1396 }
1397 void set_closure_allocation_stub(const Code& value) const; 1397 void set_closure_allocation_stub(const Code& value) const;
1398 1398
1399 // Return the closure function implicitly created for this function. 1399 // Return the closure function implicitly created for this function.
1400 // If none exists yet, create one and remember it. 1400 // If none exists yet, create one and remember it.
1401 RawFunction* ImplicitClosureFunction() const; 1401 RawFunction* ImplicitClosureFunction() const;
1402 1402
1403 RawFunction::Kind kind() const { return raw_ptr()->kind_; } 1403 RawFunction::Kind kind() const { return raw()->GetKind(); }
1404 1404
1405 bool is_static() const { return raw_ptr()->is_static_; } 1405 bool is_static() const { return raw()->IsStatic(); }
1406 bool is_const() const { return raw_ptr()->is_const_; } 1406 bool is_const() const { return raw()->IsConst(); }
1407 bool is_external() const { return raw_ptr()->is_external_; } 1407 bool is_external() const { return raw()->IsExternal(); }
1408 bool IsConstructor() const { 1408 bool IsConstructor() const {
1409 return (kind() == RawFunction::kConstructor) && !is_static(); 1409 return (kind() == RawFunction::kConstructor) && !is_static();
1410 } 1410 }
1411 bool IsFactory() const { 1411 bool IsFactory() const {
1412 return (kind() == RawFunction::kConstructor) && is_static(); 1412 return (kind() == RawFunction::kConstructor) && is_static();
1413 } 1413 }
1414 bool IsAbstract() const {
1415 return kind() == RawFunction::kAbstract;
1416 }
1417 bool IsDynamicFunction() const { 1414 bool IsDynamicFunction() const {
1418 if (is_static()) { 1415 if (is_static() || is_abstract()) {
1419 return false; 1416 return false;
1420 } 1417 }
1421 switch (kind()) { 1418 switch (kind()) {
1422 case RawFunction::kRegularFunction: 1419 case RawFunction::kRegularFunction:
1423 case RawFunction::kGetterFunction: 1420 case RawFunction::kGetterFunction:
1424 case RawFunction::kSetterFunction: 1421 case RawFunction::kSetterFunction:
1425 case RawFunction::kImplicitGetter: 1422 case RawFunction::kImplicitGetter:
1426 case RawFunction::kImplicitSetter: 1423 case RawFunction::kImplicitSetter:
1427 return true; 1424 return true;
1428 case RawFunction::kClosureFunction: 1425 case RawFunction::kClosureFunction:
1429 case RawFunction::kConstructor: 1426 case RawFunction::kConstructor:
1430 case RawFunction::kConstImplicitGetter: 1427 case RawFunction::kConstImplicitGetter:
1431 case RawFunction::kAbstract:
1432 return false; 1428 return false;
1433 default: 1429 default:
1434 UNREACHABLE(); 1430 UNREACHABLE();
1435 return false; 1431 return false;
1436 } 1432 }
1437 } 1433 }
1438 bool IsStaticFunction() const { 1434 bool IsStaticFunction() const {
1439 if (!is_static()) { 1435 if (!is_static()) {
1440 return false; 1436 return false;
1441 } 1437 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 raw_ptr()->usage_counter_ = value; 1486 raw_ptr()->usage_counter_ = value;
1491 } 1487 }
1492 1488
1493 intptr_t deoptimization_counter() const { 1489 intptr_t deoptimization_counter() const {
1494 return raw_ptr()->deoptimization_counter_; 1490 return raw_ptr()->deoptimization_counter_;
1495 } 1491 }
1496 void set_deoptimization_counter(intptr_t value) const { 1492 void set_deoptimization_counter(intptr_t value) const {
1497 raw_ptr()->deoptimization_counter_ = value; 1493 raw_ptr()->deoptimization_counter_ = value;
1498 } 1494 }
1499 1495
1500 bool is_optimizable() const { 1496 bool is_optimizable() const { return raw()->IsOptimizable(); }
1501 return raw_ptr()->is_optimizable_;
1502 }
1503 void set_is_optimizable(bool value) const; 1497 void set_is_optimizable(bool value) const;
1504 1498
1505 bool is_native() const { return raw_ptr()->is_native_; } 1499 bool is_native() const { return raw()->IsNative(); }
1506 void set_is_native(bool value) const; 1500 void set_is_native(bool value) const;
1507 1501
1502 bool is_abstract() const { return raw()->IsAbstract(); }
1503 void set_is_abstract(bool value) const;
1504
1508 bool HasOptimizedCode() const; 1505 bool HasOptimizedCode() const;
1509 1506
1510 intptr_t NumberOfParameters() const; 1507 intptr_t NumberOfParameters() const;
1511 intptr_t NumberOfImplicitParameters() const; 1508 intptr_t NumberOfImplicitParameters() const;
1512 1509
1513 // Returns true if the argument counts are valid for calling this function. 1510 // Returns true if the argument counts are valid for calling this function.
1514 // Otherwise, it returns false and the reason (if error_message is not NULL). 1511 // Otherwise, it returns false and the reason (if error_message is not NULL).
1515 bool AreValidArgumentCounts(int num_arguments, 1512 bool AreValidArgumentCounts(int num_arguments,
1516 int num_named_arguments, 1513 int num_named_arguments,
1517 String* error_message) const; 1514 String* error_message) const;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 1593
1597 1594
1598 static intptr_t InstanceSize() { 1595 static intptr_t InstanceSize() {
1599 return RoundedAllocationSize(sizeof(RawFunction)); 1596 return RoundedAllocationSize(sizeof(RawFunction));
1600 } 1597 }
1601 1598
1602 static RawFunction* New(const String& name, 1599 static RawFunction* New(const String& name,
1603 RawFunction::Kind kind, 1600 RawFunction::Kind kind,
1604 bool is_static, 1601 bool is_static,
1605 bool is_const, 1602 bool is_const,
1603 bool is_abstract,
1606 bool is_external, 1604 bool is_external,
1607 intptr_t token_pos); 1605 intptr_t token_pos);
1608 1606
1609 // Allocates a new Function object representing a closure function, as well as 1607 // Allocates a new Function object representing a closure function, as well as
1610 // a new associated Class object representing the signature class of the 1608 // a new associated Class object representing the signature class of the
1611 // function. 1609 // function.
1612 // The function and the class share the same given name. 1610 // The function and the class share the same given name.
1613 static RawFunction* NewClosureFunction(const String& name, 1611 static RawFunction* NewClosureFunction(const String& name,
1614 const Function& parent, 1612 const Function& parent,
1615 intptr_t token_pos); 1613 intptr_t token_pos);
(...skipping 3598 matching lines...) Expand 10 before | Expand all | Expand 10 after
5214 if (this->CharAt(i) != str.CharAt(begin_index + i)) { 5212 if (this->CharAt(i) != str.CharAt(begin_index + i)) {
5215 return false; 5213 return false;
5216 } 5214 }
5217 } 5215 }
5218 return true; 5216 return true;
5219 } 5217 }
5220 5218
5221 } // namespace dart 5219 } // namespace dart
5222 5220
5223 #endif // VM_OBJECT_H_ 5221 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698