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

Side by Side Diff: vm/object.h

Issue 10917222: Move all the closure related fields in RawFunction into a new class (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
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 | « no previous file | 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 static RawClass* void_class() { return void_class_; } 251 static RawClass* void_class() { return void_class_; }
252 static RawClass* unresolved_class_class() { return unresolved_class_class_; } 252 static RawClass* unresolved_class_class() { return unresolved_class_class_; }
253 static RawClass* type_class() { return type_class_; } 253 static RawClass* type_class() { return type_class_; }
254 static RawClass* type_parameter_class() { return type_parameter_class_; } 254 static RawClass* type_parameter_class() { return type_parameter_class_; }
255 static RawClass* type_arguments_class() { return type_arguments_class_; } 255 static RawClass* type_arguments_class() { return type_arguments_class_; }
256 static RawClass* instantiated_type_arguments_class() { 256 static RawClass* instantiated_type_arguments_class() {
257 return instantiated_type_arguments_class_; 257 return instantiated_type_arguments_class_;
258 } 258 }
259 static RawClass* patch_class_class() { return patch_class_class_; } 259 static RawClass* patch_class_class() { return patch_class_class_; }
260 static RawClass* function_class() { return function_class_; } 260 static RawClass* function_class() { return function_class_; }
261 static RawClass* closure_data_class() { return closure_data_class_; }
261 static RawClass* field_class() { return field_class_; } 262 static RawClass* field_class() { return field_class_; }
262 static RawClass* literal_token_class() { return literal_token_class_; } 263 static RawClass* literal_token_class() { return literal_token_class_; }
263 static RawClass* token_stream_class() { return token_stream_class_; } 264 static RawClass* token_stream_class() { return token_stream_class_; }
264 static RawClass* script_class() { return script_class_; } 265 static RawClass* script_class() { return script_class_; }
265 static RawClass* library_class() { return library_class_; } 266 static RawClass* library_class() { return library_class_; }
266 static RawClass* library_prefix_class() { return library_prefix_class_; } 267 static RawClass* library_prefix_class() { return library_prefix_class_; }
267 static RawClass* code_class() { return code_class_; } 268 static RawClass* code_class() { return code_class_; }
268 static RawClass* instructions_class() { return instructions_class_; } 269 static RawClass* instructions_class() { return instructions_class_; }
269 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } 270 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; }
270 static RawClass* stackmap_class() { return stackmap_class_; } 271 static RawClass* stackmap_class() { return stackmap_class_; }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 static RawClass* dynamic_class_; // Class of the 'Dynamic' type. 382 static RawClass* dynamic_class_; // Class of the 'Dynamic' type.
382 static RawClass* void_class_; // Class of the 'void' type. 383 static RawClass* void_class_; // Class of the 'void' type.
383 static RawClass* unresolved_class_class_; // Class of UnresolvedClass. 384 static RawClass* unresolved_class_class_; // Class of UnresolvedClass.
384 static RawClass* type_class_; // Class of Type. 385 static RawClass* type_class_; // Class of Type.
385 static RawClass* type_parameter_class_; // Class of TypeParameter vm object. 386 static RawClass* type_parameter_class_; // Class of TypeParameter vm object.
386 // Class of the TypeArguments vm object. 387 // Class of the TypeArguments vm object.
387 static RawClass* type_arguments_class_; 388 static RawClass* type_arguments_class_;
388 static RawClass* instantiated_type_arguments_class_; // Class of Inst..ments. 389 static RawClass* instantiated_type_arguments_class_; // Class of Inst..ments.
389 static RawClass* patch_class_class_; // Class of the PatchClass vm object. 390 static RawClass* patch_class_class_; // Class of the PatchClass vm object.
390 static RawClass* function_class_; // Class of the Function vm object. 391 static RawClass* function_class_; // Class of the Function vm object.
392 static RawClass* closure_data_class_; // Class of ClosureData vm obj.
391 static RawClass* field_class_; // Class of the Field vm object. 393 static RawClass* field_class_; // Class of the Field vm object.
392 static RawClass* literal_token_class_; // Class of LiteralToken vm object. 394 static RawClass* literal_token_class_; // Class of LiteralToken vm object.
393 static RawClass* token_stream_class_; // Class of the TokenStream vm object. 395 static RawClass* token_stream_class_; // Class of the TokenStream vm object.
394 static RawClass* script_class_; // Class of the Script vm object. 396 static RawClass* script_class_; // Class of the Script vm object.
395 static RawClass* library_class_; // Class of the Library vm object. 397 static RawClass* library_class_; // Class of the Library vm object.
396 static RawClass* library_prefix_class_; // Class of Library prefix vm object. 398 static RawClass* library_prefix_class_; // Class of Library prefix vm object.
397 static RawClass* code_class_; // Class of the Code vm object. 399 static RawClass* code_class_; // Class of the Code vm object.
398 static RawClass* instructions_class_; // Class of the Instructions vm object. 400 static RawClass* instructions_class_; // Class of the Instructions vm object.
399 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. 401 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object.
400 static RawClass* stackmap_class_; // Class of Stackmap vm object. 402 static RawClass* stackmap_class_; // Class of Stackmap vm object.
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 1384
1383 // Return the most recently compiled and installed code for this function. 1385 // Return the most recently compiled and installed code for this function.
1384 // It is not the only Code object that points to this function. 1386 // It is not the only Code object that points to this function.
1385 RawCode* CurrentCode() const { return raw_ptr()->code_; } 1387 RawCode* CurrentCode() const { return raw_ptr()->code_; }
1386 1388
1387 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } 1389 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; }
1388 void set_unoptimized_code(const Code& value) const; 1390 void set_unoptimized_code(const Code& value) const;
1389 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); } 1391 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); }
1390 inline bool HasCode() const; 1392 inline bool HasCode() const;
1391 1393
1392 RawContextScope* context_scope() const { return raw_ptr()->context_scope_; } 1394 RawContextScope* context_scope() const;
1393 void set_context_scope(const ContextScope& value) const; 1395 void set_context_scope(const ContextScope& value) const;
1394 1396
1395 // Enclosing function of this local function. 1397 // Enclosing function of this local function.
1396 RawFunction* parent_function() const { return raw_ptr()->parent_function_; } 1398 RawFunction* parent_function() const;
1397 1399
1398 // Signature class of this closure function or signature function. 1400 // Signature class of this closure function or signature function.
1399 RawClass* signature_class() const { return raw_ptr()->signature_class_; } 1401 RawClass* signature_class() const;
1400 void set_signature_class(const Class& value) const; 1402 void set_signature_class(const Class& value) const;
1401 1403
1402 RawCode* closure_allocation_stub() const { 1404 RawCode* closure_allocation_stub() const;
1403 return raw_ptr()->closure_allocation_stub_;
1404 }
1405 void set_closure_allocation_stub(const Code& value) const; 1405 void set_closure_allocation_stub(const Code& value) const;
1406 1406
1407 // Return the closure function implicitly created for this function. 1407 // Return the closure function implicitly created for this function.
1408 // If none exists yet, create one and remember it. 1408 // If none exists yet, create one and remember it.
1409 RawFunction* ImplicitClosureFunction() const; 1409 RawFunction* ImplicitClosureFunction() const;
1410 1410
1411 RawFunction::Kind kind() const { 1411 RawFunction::Kind kind() const {
1412 return KindBits::decode(raw_ptr()->kind_tag_); 1412 return KindBits::decode(raw_ptr()->kind_tag_);
1413 } 1413 }
1414 1414
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 public BitField<RawFunction::Kind, kKindTagBit, kKindTagSize> {}; // NOLINT 1672 public BitField<RawFunction::Kind, kKindTagBit, kKindTagSize> {}; // NOLINT
1673 1673
1674 void set_name(const String& value) const; 1674 void set_name(const String& value) const;
1675 void set_kind(RawFunction::Kind value) const; 1675 void set_kind(RawFunction::Kind value) const;
1676 void set_is_static(bool value) const; 1676 void set_is_static(bool value) const;
1677 void set_is_const(bool value) const; 1677 void set_is_const(bool value) const;
1678 void set_is_external(bool value) const; 1678 void set_is_external(bool value) const;
1679 void set_parent_function(const Function& value) const; 1679 void set_parent_function(const Function& value) const;
1680 void set_owner(const Object& value) const; 1680 void set_owner(const Object& value) const;
1681 void set_token_pos(intptr_t value) const; 1681 void set_token_pos(intptr_t value) const;
1682 RawFunction* implicit_closure_function() const;
1682 void set_implicit_closure_function(const Function& value) const; 1683 void set_implicit_closure_function(const Function& value) const;
1683 void set_kind_tag(intptr_t value) const; 1684 void set_kind_tag(intptr_t value) const;
1685 void set_data(const Object& value) const;
1684 static RawFunction* New(); 1686 static RawFunction* New();
1685 1687
1686 RawString* BuildSignature(bool instantiate, 1688 RawString* BuildSignature(bool instantiate,
1687 NameVisibility name_visibility, 1689 NameVisibility name_visibility,
1688 const AbstractTypeArguments& instantiator) const; 1690 const AbstractTypeArguments& instantiator) const;
1689 1691
1690 // Check the subtype or 'more specific' relationship. 1692 // Check the subtype or 'more specific' relationship.
1691 bool TypeTest(TypeTestKind test_kind, 1693 bool TypeTest(TypeTestKind test_kind,
1692 const AbstractTypeArguments& type_arguments, 1694 const AbstractTypeArguments& type_arguments,
1693 const Function& other, 1695 const Function& other,
1694 const AbstractTypeArguments& other_type_arguments, 1696 const AbstractTypeArguments& other_type_arguments,
1695 Error* malformed_error) const; 1697 Error* malformed_error) const;
1696 1698
1697 // Checks the type of the formal parameter at the given position for 1699 // Checks the type of the formal parameter at the given position for
1698 // subtyping or 'more specific' relationship between the type of this function 1700 // subtyping or 'more specific' relationship between the type of this function
1699 // and the type of the other function. 1701 // and the type of the other function.
1700 bool TestParameterType(TypeTestKind test_kind, 1702 bool TestParameterType(TypeTestKind test_kind,
1701 intptr_t parameter_position, 1703 intptr_t parameter_position,
1702 intptr_t other_parameter_position, 1704 intptr_t other_parameter_position,
1703 const AbstractTypeArguments& type_arguments, 1705 const AbstractTypeArguments& type_arguments,
1704 const Function& other, 1706 const Function& other,
1705 const AbstractTypeArguments& other_type_arguments, 1707 const AbstractTypeArguments& other_type_arguments,
1706 Error* malformed_error) const; 1708 Error* malformed_error) const;
1707 1709
1708 HEAP_OBJECT_IMPLEMENTATION(Function, Object); 1710 HEAP_OBJECT_IMPLEMENTATION(Function, Object);
1709 friend class Class; 1711 friend class Class;
1710 }; 1712 };
1711 1713
1712 1714
1715 class ClosureData: public Object {
1716 public:
1717 static intptr_t InstanceSize() {
1718 return RoundedAllocationSize(sizeof(RawClosureData));
1719 }
1720
1721 private:
1722 RawContextScope* context_scope() const { return raw_ptr()->context_scope_; }
1723 void set_context_scope(const ContextScope& value) const;
1724
1725 // Enclosing function of this local function.
1726 RawFunction* parent_function() const { return raw_ptr()->parent_function_; }
1727 void set_parent_function(const Function& value) const;
1728
1729 // Signature class of this closure function or signature function.
1730 RawClass* signature_class() const { return raw_ptr()->signature_class_; }
1731 void set_signature_class(const Class& value) const;
1732
1733 RawCode* closure_allocation_stub() const {
1734 return raw_ptr()->closure_allocation_stub_;
1735 }
1736 void set_closure_allocation_stub(const Code& value) const;
1737
1738 static RawClosureData* New();
1739
1740 HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object);
1741 friend class Class;
1742 friend class Function;
1743 friend class HeapProfiler;
1744 };
1745
1746
1713 class Field : public Object { 1747 class Field : public Object {
1714 public: 1748 public:
1715 RawString* name() const { return raw_ptr()->name_; } 1749 RawString* name() const { return raw_ptr()->name_; }
1716 RawString* UserVisibleName() const; 1750 RawString* UserVisibleName() const;
1717 1751
1718 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_bits_); } 1752 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_bits_); }
1719 bool is_final() const { return FinalBit::decode(raw_ptr()->kind_bits_); } 1753 bool is_final() const { return FinalBit::decode(raw_ptr()->kind_bits_); }
1720 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_bits_); } 1754 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_bits_); }
1721 1755
1722 inline intptr_t Offset() const; 1756 inline intptr_t Offset() const;
(...skipping 3852 matching lines...) Expand 10 before | Expand all | Expand 10 after
5575 if (this->CharAt(i) != str.CharAt(begin_index + i)) { 5609 if (this->CharAt(i) != str.CharAt(begin_index + i)) {
5576 return false; 5610 return false;
5577 } 5611 }
5578 } 5612 }
5579 return true; 5613 return true;
5580 } 5614 }
5581 5615
5582 } // namespace dart 5616 } // namespace dart
5583 5617
5584 #endif // VM_OBJECT_H_ 5618 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698