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

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

Issue 149643007: Small cleanup: move all library private key code to Library class (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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') | runtime/vm/object.cc » ('J')
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 2570 matching lines...) Expand 10 before | Expand all | Expand 10 after
2581 void set_debuggable(bool value) const { 2581 void set_debuggable(bool value) const {
2582 raw_ptr()->debuggable_ = value; 2582 raw_ptr()->debuggable_ = value;
2583 } 2583 }
2584 2584
2585 bool IsCoreLibrary() const { 2585 bool IsCoreLibrary() const {
2586 return raw() == CoreLibrary(); 2586 return raw() == CoreLibrary();
2587 } 2587 }
2588 2588
2589 static RawLibrary* LookupLibrary(const String& url); 2589 static RawLibrary* LookupLibrary(const String& url);
2590 static RawLibrary* GetLibrary(intptr_t index); 2590 static RawLibrary* GetLibrary(intptr_t index);
2591 static bool IsKeyUsed(intptr_t key);
2592 2591
2593 static void InitCoreLibrary(Isolate* isolate); 2592 static void InitCoreLibrary(Isolate* isolate);
2594 static void InitNativeWrappersLibrary(Isolate* isolate); 2593 static void InitNativeWrappersLibrary(Isolate* isolate);
2595 2594
2596 static RawLibrary* AsyncLibrary(); 2595 static RawLibrary* AsyncLibrary();
2597 static RawLibrary* CoreLibrary(); 2596 static RawLibrary* CoreLibrary();
2598 static RawLibrary* CollectionLibrary(); 2597 static RawLibrary* CollectionLibrary();
2599 static RawLibrary* InternalLibrary(); 2598 static RawLibrary* InternalLibrary();
2600 static RawLibrary* IsolateLibrary(); 2599 static RawLibrary* IsolateLibrary();
2601 static RawLibrary* MathLibrary(); 2600 static RawLibrary* MathLibrary();
(...skipping 14 matching lines...) Expand all
2616 // Lookup class in the core lib which also contains various VM 2615 // Lookup class in the core lib which also contains various VM
2617 // helper methods and classes. Allow look up of private classes. 2616 // helper methods and classes. Allow look up of private classes.
2618 static RawClass* LookupCoreClass(const String& class_name); 2617 static RawClass* LookupCoreClass(const String& class_name);
2619 2618
2620 2619
2621 // Return Function::null() if function does not exist in libs. 2620 // Return Function::null() if function does not exist in libs.
2622 static RawFunction* GetFunction(const GrowableArray<Library*>& libs, 2621 static RawFunction* GetFunction(const GrowableArray<Library*>& libs,
2623 const char* class_name, 2622 const char* class_name,
2624 const char* function_name); 2623 const char* function_name);
2625 2624
2625 // Character used to indicate a private identifier.
2626 static const char kPrivateIdentifierStart = '_';
2627
2628 // Character used to separate private identifiers from
2629 // the library-specific key.
2630 static const char kPrivateKeySeparator = '@';
2631
2626 private: 2632 private:
2627 static const int kInitialImportsCapacity = 4; 2633 static const int kInitialImportsCapacity = 4;
2628 static const int kImportsCapacityIncrement = 8; 2634 static const int kImportsCapacityIncrement = 8;
2629 2635
2630 static RawLibrary* New(); 2636 static RawLibrary* New();
2631 2637
2632 void set_num_imports(intptr_t value) const { 2638 void set_num_imports(intptr_t value) const {
2633 raw_ptr()->num_imports_ = value; 2639 raw_ptr()->num_imports_ = value;
2634 } 2640 }
2635 RawArray* imports() const { return raw_ptr()->imports_; } 2641 RawArray* imports() const { return raw_ptr()->imports_; }
(...skipping 11 matching lines...) Expand all
2647 void AddToResolvedNamesCache(const String& name, const Object& obj) const; 2653 void AddToResolvedNamesCache(const String& name, const Object& obj) const;
2648 void InvalidateResolvedName(const String& name) const; 2654 void InvalidateResolvedName(const String& name) const;
2649 void InvalidateResolvedNamesCache() const; 2655 void InvalidateResolvedNamesCache() const;
2650 2656
2651 void InitImportList() const; 2657 void InitImportList() const;
2652 void GrowDictionary(const Array& dict, intptr_t dict_size) const; 2658 void GrowDictionary(const Array& dict, intptr_t dict_size) const;
2653 static RawLibrary* NewLibraryHelper(const String& url, 2659 static RawLibrary* NewLibraryHelper(const String& url,
2654 bool import_core_lib); 2660 bool import_core_lib);
2655 RawObject* LookupEntry(const String& name, intptr_t *index) const; 2661 RawObject* LookupEntry(const String& name, intptr_t *index) const;
2656 2662
2663 static bool IsKeyUsed(intptr_t key);
2664 void AllocatePrivateKey() const;
2665
2657 RawString* MakeMetadataName(const Object& obj) const; 2666 RawString* MakeMetadataName(const Object& obj) const;
2658 RawField* GetMetadataField(const String& metaname) const; 2667 RawField* GetMetadataField(const String& metaname) const;
2659 void AddMetadata(const Class& cls, 2668 void AddMetadata(const Class& cls,
2660 const String& name, 2669 const String& name,
2661 intptr_t token_pos) const; 2670 intptr_t token_pos) const;
2662 2671
2663 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object); 2672 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object);
2664 2673
2665 friend class Bootstrap; 2674 friend class Bootstrap;
2666 friend class Class; 2675 friend class Class;
(...skipping 3934 matching lines...) Expand 10 before | Expand all | Expand 10 after
6601 6610
6602 6611
6603 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6612 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6604 intptr_t index) { 6613 intptr_t index) {
6605 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6614 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6606 } 6615 }
6607 6616
6608 } // namespace dart 6617 } // namespace dart
6609 6618
6610 #endif // VM_OBJECT_H_ 6619 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698