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

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

Issue 205153002: Auto delete persistent weak handles during finalization after invoking the callback associated with… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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 2340 matching lines...) Expand 10 before | Expand all | Expand 10 after
2351 intptr_t cur_token_pos_; 2351 intptr_t cur_token_pos_;
2352 Token::Kind cur_token_kind_; 2352 Token::Kind cur_token_kind_;
2353 intptr_t cur_token_obj_index_; 2353 intptr_t cur_token_obj_index_;
2354 Iterator::StreamType stream_type_; 2354 Iterator::StreamType stream_type_;
2355 }; 2355 };
2356 2356
2357 private: 2357 private:
2358 void SetPrivateKey(const String& value) const; 2358 void SetPrivateKey(const String& value) const;
2359 2359
2360 static RawTokenStream* New(); 2360 static RawTokenStream* New();
2361 static void DataFinalizer(Dart_Isolate isolate, 2361 static void DataFinalizer(void* isolate_callback_data,
2362 Dart_WeakPersistentHandle handle, 2362 Dart_WeakPersistentHandle handle,
2363 void *peer); 2363 void *peer);
2364 2364
2365 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); 2365 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object);
2366 friend class Class; 2366 friend class Class;
2367 }; 2367 };
2368 2368
2369 2369
2370 class Script : public Object { 2370 class Script : public Object {
2371 public: 2371 public:
(...skipping 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after
5311 // "str" must be OneByteString. 5311 // "str" must be OneByteString.
5312 static RawOneByteString* SubStringUnchecked(const String& str, 5312 static RawOneByteString* SubStringUnchecked(const String& str,
5313 intptr_t begin_index, 5313 intptr_t begin_index,
5314 intptr_t length, 5314 intptr_t length,
5315 Heap::Space space); 5315 Heap::Space space);
5316 5316
5317 static void SetPeer(const String& str, 5317 static void SetPeer(const String& str,
5318 void* peer, 5318 void* peer,
5319 Dart_PeerFinalizer cback); 5319 Dart_PeerFinalizer cback);
5320 5320
5321 static void Finalize(Dart_Isolate isolate, 5321 static void Finalize(void* isolate_callback_data,
5322 Dart_WeakPersistentHandle handle, 5322 Dart_WeakPersistentHandle handle,
5323 void* peer); 5323 void* peer);
5324 5324
5325 static const ClassId kClassId = kOneByteStringCid; 5325 static const ClassId kClassId = kOneByteStringCid;
5326 5326
5327 static RawOneByteString* null() { 5327 static RawOneByteString* null() {
5328 return reinterpret_cast<RawOneByteString*>(Object::null()); 5328 return reinterpret_cast<RawOneByteString*>(Object::null());
5329 } 5329 }
5330 5330
5331 private: 5331 private:
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
5404 Heap::Space space); 5404 Heap::Space space);
5405 5405
5406 static RawTwoByteString* Transform(int32_t (*mapping)(int32_t ch), 5406 static RawTwoByteString* Transform(int32_t (*mapping)(int32_t ch),
5407 const String& str, 5407 const String& str,
5408 Heap::Space space); 5408 Heap::Space space);
5409 5409
5410 static void SetPeer(const String& str, 5410 static void SetPeer(const String& str,
5411 void* peer, 5411 void* peer,
5412 Dart_PeerFinalizer cback); 5412 Dart_PeerFinalizer cback);
5413 5413
5414 static void Finalize(Dart_Isolate isolate, 5414 static void Finalize(void* isolate_callback_data,
5415 Dart_WeakPersistentHandle handle, 5415 Dart_WeakPersistentHandle handle,
5416 void* peer); 5416 void* peer);
5417 5417
5418 static RawTwoByteString* null() { 5418 static RawTwoByteString* null() {
5419 return reinterpret_cast<RawTwoByteString*>(Object::null()); 5419 return reinterpret_cast<RawTwoByteString*>(Object::null());
5420 } 5420 }
5421 5421
5422 5422
5423 static const ClassId kClassId = kTwoByteStringCid; 5423 static const ClassId kClassId = kTwoByteStringCid;
5424 5424
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
5499 return &(raw_ptr(str)->external_data_->data()[index]); 5499 return &(raw_ptr(str)->external_data_->data()[index]);
5500 } 5500 }
5501 5501
5502 static void SetExternalData(const String& str, 5502 static void SetExternalData(const String& str,
5503 ExternalStringData<uint8_t>* data) { 5503 ExternalStringData<uint8_t>* data) {
5504 ASSERT(str.IsExternalOneByteString()); 5504 ASSERT(str.IsExternalOneByteString());
5505 NoGCScope no_gc; 5505 NoGCScope no_gc;
5506 raw_ptr(str)->external_data_ = data; 5506 raw_ptr(str)->external_data_ = data;
5507 } 5507 }
5508 5508
5509 static void Finalize(Dart_Isolate isolate, 5509 static void Finalize(void* isolate_callback_data,
5510 Dart_WeakPersistentHandle handle, 5510 Dart_WeakPersistentHandle handle,
5511 void* peer); 5511 void* peer);
5512 5512
5513 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader, 5513 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader,
5514 intptr_t object_id, 5514 intptr_t object_id,
5515 intptr_t tags, 5515 intptr_t tags,
5516 Snapshot::Kind kind); 5516 Snapshot::Kind kind);
5517 5517
5518 static intptr_t NextFieldOffset() { 5518 static intptr_t NextFieldOffset() {
5519 // Indicates this class cannot be extended by dart code. 5519 // Indicates this class cannot be extended by dart code.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
5572 return &(raw_ptr(str)->external_data_->data()[index]); 5572 return &(raw_ptr(str)->external_data_->data()[index]);
5573 } 5573 }
5574 5574
5575 static void SetExternalData(const String& str, 5575 static void SetExternalData(const String& str,
5576 ExternalStringData<uint16_t>* data) { 5576 ExternalStringData<uint16_t>* data) {
5577 ASSERT(str.IsExternalTwoByteString()); 5577 ASSERT(str.IsExternalTwoByteString());
5578 NoGCScope no_gc; 5578 NoGCScope no_gc;
5579 raw_ptr(str)->external_data_ = data; 5579 raw_ptr(str)->external_data_ = data;
5580 } 5580 }
5581 5581
5582 static void Finalize(Dart_Isolate isolate, 5582 static void Finalize(void* isolate_callback_data,
5583 Dart_WeakPersistentHandle handle, 5583 Dart_WeakPersistentHandle handle,
5584 void* peer); 5584 void* peer);
5585 5585
5586 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader, 5586 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader,
5587 intptr_t object_id, 5587 intptr_t object_id,
5588 intptr_t tags, 5588 intptr_t tags,
5589 Snapshot::Kind kind); 5589 Snapshot::Kind kind);
5590 5590
5591 static intptr_t NextFieldOffset() { 5591 static intptr_t NextFieldOffset() {
5592 // Indicates this class cannot be extended by dart code. 5592 // Indicates this class cannot be extended by dart code.
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
6732 6732
6733 6733
6734 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6734 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6735 intptr_t index) { 6735 intptr_t index) {
6736 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6736 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6737 } 6737 }
6738 6738
6739 } // namespace dart 6739 } // namespace dart
6740 6740
6741 #endif // VM_OBJECT_H_ 6741 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698