OLD | NEW |
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 RUNTIME_VM_OBJECT_H_ | 5 #ifndef RUNTIME_VM_OBJECT_H_ |
6 #define RUNTIME_VM_OBJECT_H_ | 6 #define RUNTIME_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 4029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4040 // of this library. If a top level function 'name' does not exist we look | 4040 // of this library. If a top level function 'name' does not exist we look |
4041 // for a top level getter 'name' that returns a closure. | 4041 // for a top level getter 'name' that returns a closure. |
4042 RawObject* GetFunctionClosure(const String& name) const; | 4042 RawObject* GetFunctionClosure(const String& name) const; |
4043 | 4043 |
4044 private: | 4044 private: |
4045 static const int kInitialImportsCapacity = 4; | 4045 static const int kInitialImportsCapacity = 4; |
4046 static const int kImportsCapacityIncrement = 8; | 4046 static const int kImportsCapacityIncrement = 8; |
4047 | 4047 |
4048 static RawLibrary* New(); | 4048 static RawLibrary* New(); |
4049 | 4049 |
| 4050 // These methods are only used by the Precompiler to obfuscate |
| 4051 // the name and url. |
| 4052 void set_name(const String& name) const; |
| 4053 void set_url(const String& url) const; |
| 4054 |
4050 void set_num_imports(intptr_t value) const; | 4055 void set_num_imports(intptr_t value) const; |
4051 bool HasExports() const; | 4056 bool HasExports() const; |
4052 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } | 4057 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } |
4053 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } | 4058 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } |
4054 RawArray* dictionary() const { return raw_ptr()->dictionary_; } | 4059 RawArray* dictionary() const { return raw_ptr()->dictionary_; } |
4055 void InitClassDictionary() const; | 4060 void InitClassDictionary() const; |
4056 | 4061 |
4057 RawArray* resolved_names() const { return raw_ptr()->resolved_names_; } | 4062 RawArray* resolved_names() const { return raw_ptr()->resolved_names_; } |
4058 bool LookupResolvedNamesCache(const String& name, Object* obj) const; | 4063 bool LookupResolvedNamesCache(const String& name, Object* obj) const; |
4059 void AddToResolvedNamesCache(const String& name, const Object& obj) const; | 4064 void AddToResolvedNamesCache(const String& name, const Object& obj) const; |
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5653 friend class Closure; | 5658 friend class Closure; |
5654 friend class DeferredObject; | 5659 friend class DeferredObject; |
5655 friend class RegExp; | 5660 friend class RegExp; |
5656 friend class SnapshotWriter; | 5661 friend class SnapshotWriter; |
5657 friend class StubCode; | 5662 friend class StubCode; |
5658 friend class TypedDataView; | 5663 friend class TypedDataView; |
5659 friend class InstanceSerializationCluster; | 5664 friend class InstanceSerializationCluster; |
5660 friend class InstanceDeserializationCluster; | 5665 friend class InstanceDeserializationCluster; |
5661 friend class ClassDeserializationCluster; // vtable | 5666 friend class ClassDeserializationCluster; // vtable |
5662 friend class InstanceMorpher; | 5667 friend class InstanceMorpher; |
| 5668 friend class Obfuscator; // RawGetFieldAtOffset, RawSetFieldAtOffset |
5663 }; | 5669 }; |
5664 | 5670 |
5665 class LibraryPrefix : public Instance { | 5671 class LibraryPrefix : public Instance { |
5666 public: | 5672 public: |
5667 RawString* name() const { return raw_ptr()->name_; } | 5673 RawString* name() const { return raw_ptr()->name_; } |
5668 virtual RawString* DictionaryName() const { return name(); } | 5674 virtual RawString* DictionaryName() const { return name(); } |
5669 | 5675 |
5670 RawArray* imports() const { return raw_ptr()->imports_; } | 5676 RawArray* imports() const { return raw_ptr()->imports_; } |
5671 intptr_t num_imports() const { return raw_ptr()->num_imports_; } | 5677 intptr_t num_imports() const { return raw_ptr()->num_imports_; } |
5672 RawLibrary* importer() const { return raw_ptr()->importer_; } | 5678 RawLibrary* importer() const { return raw_ptr()->importer_; } |
(...skipping 3324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8997 | 9003 |
8998 inline void TypeArguments::SetHash(intptr_t value) const { | 9004 inline void TypeArguments::SetHash(intptr_t value) const { |
8999 // This is only safe because we create a new Smi, which does not cause | 9005 // This is only safe because we create a new Smi, which does not cause |
9000 // heap allocation. | 9006 // heap allocation. |
9001 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 9007 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
9002 } | 9008 } |
9003 | 9009 |
9004 } // namespace dart | 9010 } // namespace dart |
9005 | 9011 |
9006 #endif // RUNTIME_VM_OBJECT_H_ | 9012 #endif // RUNTIME_VM_OBJECT_H_ |
OLD | NEW |