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

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

Issue 1149943009: Shrink some fields and add some bounds checks. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
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 3401 matching lines...) Expand 10 before | Expand all | Expand 10 after
3412 // Character used to separate private identifiers from 3412 // Character used to separate private identifiers from
3413 // the library-specific key. 3413 // the library-specific key.
3414 static const char kPrivateKeySeparator = '@'; 3414 static const char kPrivateKeySeparator = '@';
3415 3415
3416 private: 3416 private:
3417 static const int kInitialImportsCapacity = 4; 3417 static const int kInitialImportsCapacity = 4;
3418 static const int kImportsCapacityIncrement = 8; 3418 static const int kImportsCapacityIncrement = 8;
3419 3419
3420 static RawLibrary* New(); 3420 static RawLibrary* New();
3421 3421
3422 void set_num_imports(intptr_t value) const { 3422 void set_num_imports(intptr_t value) const;
3423 StoreNonPointer(&raw_ptr()->num_imports_, value);
3424 }
3425 bool HasExports() const; 3423 bool HasExports() const;
3426 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } 3424 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; }
3427 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } 3425 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; }
3428 RawArray* dictionary() const { return raw_ptr()->dictionary_; } 3426 RawArray* dictionary() const { return raw_ptr()->dictionary_; }
3429 void InitClassDictionary() const; 3427 void InitClassDictionary() const;
3430 3428
3431 RawArray* resolved_names() const { return raw_ptr()->resolved_names_; } 3429 RawArray* resolved_names() const { return raw_ptr()->resolved_names_; }
3432 void InitResolvedNamesCache(intptr_t size) const; 3430 void InitResolvedNamesCache(intptr_t size) const;
3433 void GrowResolvedNamesCache() const; 3431 void GrowResolvedNamesCache() const;
3434 bool LookupResolvedNamesCache(const String& name, Object* obj) const; 3432 bool LookupResolvedNamesCache(const String& name, Object* obj) const;
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
4721 friend class TypedDataView; 4719 friend class TypedDataView;
4722 }; 4720 };
4723 4721
4724 4722
4725 class LibraryPrefix : public Instance { 4723 class LibraryPrefix : public Instance {
4726 public: 4724 public:
4727 RawString* name() const { return raw_ptr()->name_; } 4725 RawString* name() const { return raw_ptr()->name_; }
4728 virtual RawString* DictionaryName() const { return name(); } 4726 virtual RawString* DictionaryName() const { return name(); }
4729 4727
4730 RawArray* imports() const { return raw_ptr()->imports_; } 4728 RawArray* imports() const { return raw_ptr()->imports_; }
4731 int32_t num_imports() const { return raw_ptr()->num_imports_; } 4729 intptr_t num_imports() const { return raw_ptr()->num_imports_; }
4732 RawLibrary* importer() const { return raw_ptr()->importer_; } 4730 RawLibrary* importer() const { return raw_ptr()->importer_; }
4733 4731
4734 RawInstance* LoadError() const; 4732 RawInstance* LoadError() const;
4735 4733
4736 bool ContainsLibrary(const Library& library) const; 4734 bool ContainsLibrary(const Library& library) const;
4737 RawLibrary* GetLibrary(int index) const; 4735 RawLibrary* GetLibrary(int index) const;
4738 void AddImport(const Namespace& import) const; 4736 void AddImport(const Namespace& import) const;
4739 RawObject* LookupObject(const String& name) const; 4737 RawObject* LookupObject(const String& name) const;
4740 RawClass* LookupClass(const String& class_name) const; 4738 RawClass* LookupClass(const String& class_name) const;
4741 4739
(...skipping 3112 matching lines...) Expand 10 before | Expand all | Expand 10 after
7854 7852
7855 7853
7856 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7854 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7857 intptr_t index) { 7855 intptr_t index) {
7858 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7856 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7859 } 7857 }
7860 7858
7861 } // namespace dart 7859 } // namespace dart
7862 7860
7863 #endif // VM_OBJECT_H_ 7861 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/platform/globals.h ('k') | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698