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

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

Issue 10964058: Support redirecting factory constructors in the VM (issue 3969). (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
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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 static RawClass* unresolved_class_class() { return unresolved_class_class_; } 259 static RawClass* unresolved_class_class() { return unresolved_class_class_; }
260 static RawClass* type_class() { return type_class_; } 260 static RawClass* type_class() { return type_class_; }
261 static RawClass* type_parameter_class() { return type_parameter_class_; } 261 static RawClass* type_parameter_class() { return type_parameter_class_; }
262 static RawClass* type_arguments_class() { return type_arguments_class_; } 262 static RawClass* type_arguments_class() { return type_arguments_class_; }
263 static RawClass* instantiated_type_arguments_class() { 263 static RawClass* instantiated_type_arguments_class() {
264 return instantiated_type_arguments_class_; 264 return instantiated_type_arguments_class_;
265 } 265 }
266 static RawClass* patch_class_class() { return patch_class_class_; } 266 static RawClass* patch_class_class() { return patch_class_class_; }
267 static RawClass* function_class() { return function_class_; } 267 static RawClass* function_class() { return function_class_; }
268 static RawClass* closure_data_class() { return closure_data_class_; } 268 static RawClass* closure_data_class() { return closure_data_class_; }
269 static RawClass* redirection_data_class() { return redirection_data_class_; }
269 static RawClass* field_class() { return field_class_; } 270 static RawClass* field_class() { return field_class_; }
270 static RawClass* literal_token_class() { return literal_token_class_; } 271 static RawClass* literal_token_class() { return literal_token_class_; }
271 static RawClass* token_stream_class() { return token_stream_class_; } 272 static RawClass* token_stream_class() { return token_stream_class_; }
272 static RawClass* script_class() { return script_class_; } 273 static RawClass* script_class() { return script_class_; }
273 static RawClass* library_class() { return library_class_; } 274 static RawClass* library_class() { return library_class_; }
274 static RawClass* library_prefix_class() { return library_prefix_class_; } 275 static RawClass* library_prefix_class() { return library_prefix_class_; }
275 static RawClass* code_class() { return code_class_; } 276 static RawClass* code_class() { return code_class_; }
276 static RawClass* instructions_class() { return instructions_class_; } 277 static RawClass* instructions_class() { return instructions_class_; }
277 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } 278 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; }
278 static RawClass* stackmap_class() { return stackmap_class_; } 279 static RawClass* stackmap_class() { return stackmap_class_; }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 static RawClass* void_class_; // Class of the 'void' type. 391 static RawClass* void_class_; // Class of the 'void' type.
391 static RawClass* unresolved_class_class_; // Class of UnresolvedClass. 392 static RawClass* unresolved_class_class_; // Class of UnresolvedClass.
392 static RawClass* type_class_; // Class of Type. 393 static RawClass* type_class_; // Class of Type.
393 static RawClass* type_parameter_class_; // Class of TypeParameter vm object. 394 static RawClass* type_parameter_class_; // Class of TypeParameter vm object.
394 // Class of the TypeArguments vm object. 395 // Class of the TypeArguments vm object.
395 static RawClass* type_arguments_class_; 396 static RawClass* type_arguments_class_;
396 static RawClass* instantiated_type_arguments_class_; // Class of Inst..ments. 397 static RawClass* instantiated_type_arguments_class_; // Class of Inst..ments.
397 static RawClass* patch_class_class_; // Class of the PatchClass vm object. 398 static RawClass* patch_class_class_; // Class of the PatchClass vm object.
398 static RawClass* function_class_; // Class of the Function vm object. 399 static RawClass* function_class_; // Class of the Function vm object.
399 static RawClass* closure_data_class_; // Class of ClosureData vm obj. 400 static RawClass* closure_data_class_; // Class of ClosureData vm obj.
401 static RawClass* redirection_data_class_; // Class of RedirectionData vm obj.
400 static RawClass* field_class_; // Class of the Field vm object. 402 static RawClass* field_class_; // Class of the Field vm object.
401 static RawClass* literal_token_class_; // Class of LiteralToken vm object. 403 static RawClass* literal_token_class_; // Class of LiteralToken vm object.
402 static RawClass* token_stream_class_; // Class of the TokenStream vm object. 404 static RawClass* token_stream_class_; // Class of the TokenStream vm object.
403 static RawClass* script_class_; // Class of the Script vm object. 405 static RawClass* script_class_; // Class of the Script vm object.
404 static RawClass* library_class_; // Class of the Library vm object. 406 static RawClass* library_class_; // Class of the Library vm object.
405 static RawClass* library_prefix_class_; // Class of Library prefix vm object. 407 static RawClass* library_prefix_class_; // Class of Library prefix vm object.
406 static RawClass* code_class_; // Class of the Code vm object. 408 static RawClass* code_class_; // Class of the Code vm object.
407 static RawClass* instructions_class_; // Class of the Instructions vm object. 409 static RawClass* instructions_class_; // Class of the Instructions vm object.
408 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. 410 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object.
409 static RawClass* stackmap_class_; // Class of Stackmap vm object. 411 static RawClass* stackmap_class_; // Class of Stackmap vm object.
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 RawClass* signature_class() const; 1412 RawClass* signature_class() const;
1411 void set_signature_class(const Class& value) const; 1413 void set_signature_class(const Class& value) const;
1412 1414
1413 RawCode* closure_allocation_stub() const; 1415 RawCode* closure_allocation_stub() const;
1414 void set_closure_allocation_stub(const Code& value) const; 1416 void set_closure_allocation_stub(const Code& value) const;
1415 1417
1416 // Return the closure function implicitly created for this function. 1418 // Return the closure function implicitly created for this function.
1417 // If none exists yet, create one and remember it. 1419 // If none exists yet, create one and remember it.
1418 RawFunction* ImplicitClosureFunction() const; 1420 RawFunction* ImplicitClosureFunction() const;
1419 1421
1422 // Redirection information for a redirecting factory.
1423 bool IsRedirectingFactory() const;
1424 RawType* RedirectionType() const;
1425 void SetRedirectionType(const Type& type) const;
1426 RawString* RedirectionIdentifier() const;
1427 void SetRedirectionIdentifier(const String& identifier) const;
1428 RawFunction* RedirectionTarget() const;
1429 void SetRedirectionTarget(const Function& target) const;
1430
1420 RawFunction::Kind kind() const { 1431 RawFunction::Kind kind() const {
1421 return KindBits::decode(raw_ptr()->kind_tag_); 1432 return KindBits::decode(raw_ptr()->kind_tag_);
1422 } 1433 }
1423 1434
1424 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_tag_); } 1435 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_tag_); }
1425 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_tag_); } 1436 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_tag_); }
1426 bool is_external() const { return ExternalBit::decode(raw_ptr()->kind_tag_); } 1437 bool is_external() const { return ExternalBit::decode(raw_ptr()->kind_tag_); }
1427 bool IsConstructor() const { 1438 bool IsConstructor() const {
1428 return (kind() == RawFunction::kConstructor) && !is_static(); 1439 return (kind() == RawFunction::kConstructor) && !is_static();
1429 } 1440 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 1766
1756 static RawClosureData* New(); 1767 static RawClosureData* New();
1757 1768
1758 HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object); 1769 HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object);
1759 friend class Class; 1770 friend class Class;
1760 friend class Function; 1771 friend class Function;
1761 friend class HeapProfiler; 1772 friend class HeapProfiler;
1762 }; 1773 };
1763 1774
1764 1775
1776 class RedirectionData: public Object {
1777 public:
1778 static intptr_t InstanceSize() {
1779 return RoundedAllocationSize(sizeof(RawRedirectionData));
1780 }
1781
1782 private:
1783 // The type specifies the class and type arguments of the target constructor.
1784 RawType* type() const { return raw_ptr()->type_; }
1785 void set_type(const Type& value) const;
1786
1787 // The optional identifier specifies a named constructor.
1788 RawString* identifier() const { return raw_ptr()->identifier_; }
1789 void set_identifier(const String& value) const;
1790
1791 // The resolved constructor or factory target of the redirection.
1792 RawFunction* target() const { return raw_ptr()->target_; }
1793 void set_target(const Function& value) const;
1794
1795 static RawRedirectionData* New();
1796
1797 HEAP_OBJECT_IMPLEMENTATION(RedirectionData, Object);
1798 friend class Class;
1799 friend class Function;
1800 friend class HeapProfiler;
1801 };
1802
1803
1765 class Field : public Object { 1804 class Field : public Object {
1766 public: 1805 public:
1767 RawString* name() const { return raw_ptr()->name_; } 1806 RawString* name() const { return raw_ptr()->name_; }
1768 RawString* UserVisibleName() const; 1807 RawString* UserVisibleName() const;
1769 virtual RawString* DictionaryName() const { return name(); } 1808 virtual RawString* DictionaryName() const { return name(); }
1770 1809
1771 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_bits_); } 1810 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_bits_); }
1772 bool is_final() const { return FinalBit::decode(raw_ptr()->kind_bits_); } 1811 bool is_final() const { return FinalBit::decode(raw_ptr()->kind_bits_); }
1773 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_bits_); } 1812 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_bits_); }
1774 1813
(...skipping 3878 matching lines...) Expand 10 before | Expand all | Expand 10 after
5653 if (this->CharAt(i) != str.CharAt(begin_index + i)) { 5692 if (this->CharAt(i) != str.CharAt(begin_index + i)) {
5654 return false; 5693 return false;
5655 } 5694 }
5656 } 5695 }
5657 return true; 5696 return true;
5658 } 5697 }
5659 5698
5660 } // namespace dart 5699 } // namespace dart
5661 5700
5662 #endif // VM_OBJECT_H_ 5701 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698