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 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 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2338 intptr_t cur_token_pos_; | 2338 intptr_t cur_token_pos_; |
2339 Token::Kind cur_token_kind_; | 2339 Token::Kind cur_token_kind_; |
2340 intptr_t cur_token_obj_index_; | 2340 intptr_t cur_token_obj_index_; |
2341 Iterator::StreamType stream_type_; | 2341 Iterator::StreamType stream_type_; |
2342 }; | 2342 }; |
2343 | 2343 |
2344 private: | 2344 private: |
2345 void SetPrivateKey(const String& value) const; | 2345 void SetPrivateKey(const String& value) const; |
2346 | 2346 |
2347 static RawTokenStream* New(); | 2347 static RawTokenStream* New(); |
2348 static void DataFinalizer(Dart_WeakPersistentHandle handle, void *peer); | 2348 static void DataFinalizer(Dart_Isolate isolate, |
| 2349 Dart_WeakPersistentHandle handle, |
| 2350 void *peer); |
2349 | 2351 |
2350 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); | 2352 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); |
2351 friend class Class; | 2353 friend class Class; |
2352 }; | 2354 }; |
2353 | 2355 |
2354 | 2356 |
2355 class Script : public Object { | 2357 class Script : public Object { |
2356 public: | 2358 public: |
2357 RawString* url() const { return raw_ptr()->url_; } | 2359 RawString* url() const { return raw_ptr()->url_; } |
2358 bool HasSource() const; | 2360 bool HasSource() const; |
(...skipping 2922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5281 // "str" must be OneByteString. | 5283 // "str" must be OneByteString. |
5282 static RawOneByteString* SubStringUnchecked(const String& str, | 5284 static RawOneByteString* SubStringUnchecked(const String& str, |
5283 intptr_t begin_index, | 5285 intptr_t begin_index, |
5284 intptr_t length, | 5286 intptr_t length, |
5285 Heap::Space space); | 5287 Heap::Space space); |
5286 | 5288 |
5287 static void SetPeer(const String& str, | 5289 static void SetPeer(const String& str, |
5288 void* peer, | 5290 void* peer, |
5289 Dart_PeerFinalizer cback); | 5291 Dart_PeerFinalizer cback); |
5290 | 5292 |
5291 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); | 5293 static void Finalize(Dart_Isolate isolate, |
| 5294 Dart_WeakPersistentHandle handle, |
| 5295 void* peer); |
5292 | 5296 |
5293 static const ClassId kClassId = kOneByteStringCid; | 5297 static const ClassId kClassId = kOneByteStringCid; |
5294 | 5298 |
5295 static RawOneByteString* null() { | 5299 static RawOneByteString* null() { |
5296 return reinterpret_cast<RawOneByteString*>(Object::null()); | 5300 return reinterpret_cast<RawOneByteString*>(Object::null()); |
5297 } | 5301 } |
5298 | 5302 |
5299 private: | 5303 private: |
5300 static RawOneByteString* raw(const String& str) { | 5304 static RawOneByteString* raw(const String& str) { |
5301 return reinterpret_cast<RawOneByteString*>(str.raw()); | 5305 return reinterpret_cast<RawOneByteString*>(str.raw()); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5372 Heap::Space space); | 5376 Heap::Space space); |
5373 | 5377 |
5374 static RawTwoByteString* Transform(int32_t (*mapping)(int32_t ch), | 5378 static RawTwoByteString* Transform(int32_t (*mapping)(int32_t ch), |
5375 const String& str, | 5379 const String& str, |
5376 Heap::Space space); | 5380 Heap::Space space); |
5377 | 5381 |
5378 static void SetPeer(const String& str, | 5382 static void SetPeer(const String& str, |
5379 void* peer, | 5383 void* peer, |
5380 Dart_PeerFinalizer cback); | 5384 Dart_PeerFinalizer cback); |
5381 | 5385 |
5382 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); | 5386 static void Finalize(Dart_Isolate isolate, |
| 5387 Dart_WeakPersistentHandle handle, |
| 5388 void* peer); |
5383 | 5389 |
5384 static RawTwoByteString* null() { | 5390 static RawTwoByteString* null() { |
5385 return reinterpret_cast<RawTwoByteString*>(Object::null()); | 5391 return reinterpret_cast<RawTwoByteString*>(Object::null()); |
5386 } | 5392 } |
5387 | 5393 |
5388 | 5394 |
5389 static const ClassId kClassId = kTwoByteStringCid; | 5395 static const ClassId kClassId = kTwoByteStringCid; |
5390 | 5396 |
5391 private: | 5397 private: |
5392 static RawTwoByteString* raw(const String& str) { | 5398 static RawTwoByteString* raw(const String& str) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5465 return &(raw_ptr(str)->external_data_->data()[index]); | 5471 return &(raw_ptr(str)->external_data_->data()[index]); |
5466 } | 5472 } |
5467 | 5473 |
5468 static void SetExternalData(const String& str, | 5474 static void SetExternalData(const String& str, |
5469 ExternalStringData<uint8_t>* data) { | 5475 ExternalStringData<uint8_t>* data) { |
5470 ASSERT(str.IsExternalOneByteString()); | 5476 ASSERT(str.IsExternalOneByteString()); |
5471 NoGCScope no_gc; | 5477 NoGCScope no_gc; |
5472 raw_ptr(str)->external_data_ = data; | 5478 raw_ptr(str)->external_data_ = data; |
5473 } | 5479 } |
5474 | 5480 |
5475 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); | 5481 static void Finalize(Dart_Isolate isolate, |
| 5482 Dart_WeakPersistentHandle handle, |
| 5483 void* peer); |
5476 | 5484 |
5477 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader, | 5485 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader, |
5478 intptr_t object_id, | 5486 intptr_t object_id, |
5479 intptr_t tags, | 5487 intptr_t tags, |
5480 Snapshot::Kind kind); | 5488 Snapshot::Kind kind); |
5481 | 5489 |
5482 static intptr_t NextFieldOffset() { | 5490 static intptr_t NextFieldOffset() { |
5483 // Indicates this class cannot be extended by dart code. | 5491 // Indicates this class cannot be extended by dart code. |
5484 return -kWordSize; | 5492 return -kWordSize; |
5485 } | 5493 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5536 return &(raw_ptr(str)->external_data_->data()[index]); | 5544 return &(raw_ptr(str)->external_data_->data()[index]); |
5537 } | 5545 } |
5538 | 5546 |
5539 static void SetExternalData(const String& str, | 5547 static void SetExternalData(const String& str, |
5540 ExternalStringData<uint16_t>* data) { | 5548 ExternalStringData<uint16_t>* data) { |
5541 ASSERT(str.IsExternalTwoByteString()); | 5549 ASSERT(str.IsExternalTwoByteString()); |
5542 NoGCScope no_gc; | 5550 NoGCScope no_gc; |
5543 raw_ptr(str)->external_data_ = data; | 5551 raw_ptr(str)->external_data_ = data; |
5544 } | 5552 } |
5545 | 5553 |
5546 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); | 5554 static void Finalize(Dart_Isolate isolate, |
| 5555 Dart_WeakPersistentHandle handle, |
| 5556 void* peer); |
5547 | 5557 |
5548 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader, | 5558 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader, |
5549 intptr_t object_id, | 5559 intptr_t object_id, |
5550 intptr_t tags, | 5560 intptr_t tags, |
5551 Snapshot::Kind kind); | 5561 Snapshot::Kind kind); |
5552 | 5562 |
5553 static intptr_t NextFieldOffset() { | 5563 static intptr_t NextFieldOffset() { |
5554 // Indicates this class cannot be extended by dart code. | 5564 // Indicates this class cannot be extended by dart code. |
5555 return -kWordSize; | 5565 return -kWordSize; |
5556 } | 5566 } |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6666 | 6676 |
6667 | 6677 |
6668 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6678 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6669 intptr_t index) { | 6679 intptr_t index) { |
6670 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6680 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6671 } | 6681 } |
6672 | 6682 |
6673 } // namespace dart | 6683 } // namespace dart |
6674 | 6684 |
6675 #endif // VM_OBJECT_H_ | 6685 #endif // VM_OBJECT_H_ |
OLD | NEW |