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

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

Issue 15772005: - Add different types for persistent and weak persistent handles (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 Object& obj_; 1991 Object& obj_;
1992 intptr_t cur_token_pos_; 1992 intptr_t cur_token_pos_;
1993 Token::Kind cur_token_kind_; 1993 Token::Kind cur_token_kind_;
1994 intptr_t cur_token_obj_index_; 1994 intptr_t cur_token_obj_index_;
1995 }; 1995 };
1996 1996
1997 private: 1997 private:
1998 void SetPrivateKey(const String& value) const; 1998 void SetPrivateKey(const String& value) const;
1999 1999
2000 static RawTokenStream* New(); 2000 static RawTokenStream* New();
2001 static void DataFinalizer(Dart_Handle handle, void *peer); 2001 static void DataFinalizer(Dart_WeakPersistentHandle handle, void *peer);
2002 2002
2003 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); 2003 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object);
2004 friend class Class; 2004 friend class Class;
2005 }; 2005 };
2006 2006
2007 2007
2008 class Script : public Object { 2008 class Script : public Object {
2009 public: 2009 public:
2010 RawString* url() const { return raw_ptr()->url_; } 2010 RawString* url() const { return raw_ptr()->url_; }
2011 bool HasSource() const; 2011 bool HasSource() const;
(...skipping 2680 matching lines...) Expand 10 before | Expand all | Expand 10 after
4692 return &(raw_ptr(str)->external_data_->data()[index]); 4692 return &(raw_ptr(str)->external_data_->data()[index]);
4693 } 4693 }
4694 4694
4695 static void SetExternalData(const String& str, 4695 static void SetExternalData(const String& str,
4696 ExternalStringData<uint8_t>* data) { 4696 ExternalStringData<uint8_t>* data) {
4697 ASSERT(str.IsExternalOneByteString()); 4697 ASSERT(str.IsExternalOneByteString());
4698 NoGCScope no_gc; 4698 NoGCScope no_gc;
4699 raw_ptr(str)->external_data_ = data; 4699 raw_ptr(str)->external_data_ = data;
4700 } 4700 }
4701 4701
4702 static void Finalize(Dart_Handle handle, void* peer); 4702 static void Finalize(Dart_WeakPersistentHandle handle, void* peer);
4703 4703
4704 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader, 4704 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader,
4705 intptr_t object_id, 4705 intptr_t object_id,
4706 intptr_t tags, 4706 intptr_t tags,
4707 Snapshot::Kind kind); 4707 Snapshot::Kind kind);
4708 4708
4709 friend class Class; 4709 friend class Class;
4710 friend class String; 4710 friend class String;
4711 friend class SnapshotReader; 4711 friend class SnapshotReader;
4712 }; 4712 };
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
4758 return &(raw_ptr(str)->external_data_->data()[index]); 4758 return &(raw_ptr(str)->external_data_->data()[index]);
4759 } 4759 }
4760 4760
4761 static void SetExternalData(const String& str, 4761 static void SetExternalData(const String& str,
4762 ExternalStringData<uint16_t>* data) { 4762 ExternalStringData<uint16_t>* data) {
4763 ASSERT(str.IsExternalTwoByteString()); 4763 ASSERT(str.IsExternalTwoByteString());
4764 NoGCScope no_gc; 4764 NoGCScope no_gc;
4765 raw_ptr(str)->external_data_ = data; 4765 raw_ptr(str)->external_data_ = data;
4766 } 4766 }
4767 4767
4768 static void Finalize(Dart_Handle handle, void* peer); 4768 static void Finalize(Dart_WeakPersistentHandle handle, void* peer);
4769 4769
4770 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader, 4770 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader,
4771 intptr_t object_id, 4771 intptr_t object_id,
4772 intptr_t tags, 4772 intptr_t tags,
4773 Snapshot::Kind kind); 4773 Snapshot::Kind kind);
4774 4774
4775 friend class Class; 4775 friend class Class;
4776 friend class String; 4776 friend class String;
4777 friend class SnapshotReader; 4777 friend class SnapshotReader;
4778 }; 4778 };
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
5768 5768
5769 5769
5770 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 5770 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
5771 intptr_t index) { 5771 intptr_t index) {
5772 return array.At((index * kEntryLength) + kTargetFunctionIndex); 5772 return array.At((index * kEntryLength) + kTargetFunctionIndex);
5773 } 5773 }
5774 5774
5775 } // namespace dart 5775 } // namespace dart
5776 5776
5777 #endif // VM_OBJECT_H_ 5777 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698