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

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

Issue 8775039: Add Dart_IsExternalString and Dart_ExternalStringGetPeer to the dart (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/dart.h" 9 #include "vm/dart.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 2457 matching lines...) Expand 10 before | Expand all | Expand 10 after
2468 virtual bool Equals(const Instance& other) const; 2468 virtual bool Equals(const Instance& other) const;
2469 2469
2470 intptr_t CompareTo(const String& other) const; 2470 intptr_t CompareTo(const String& other) const;
2471 2471
2472 bool StartsWith(const String& other) const; 2472 bool StartsWith(const String& other) const;
2473 2473
2474 virtual RawInstance* Canonicalize() const; 2474 virtual RawInstance* Canonicalize() const;
2475 2475
2476 bool IsSymbol() const; 2476 bool IsSymbol() const;
2477 2477
2478 virtual bool IsExternal() const { return false; }
2479 virtual void* GetPeer() const {
2480 UNREACHABLE();
2481 return NULL;
2482 }
2483
2478 static RawString* New(const char* str, Heap::Space space = Heap::kNew); 2484 static RawString* New(const char* str, Heap::Space space = Heap::kNew);
2479 static RawString* New(const uint8_t* characters, 2485 static RawString* New(const uint8_t* characters,
2480 intptr_t len, 2486 intptr_t len,
2481 Heap::Space space = Heap::kNew); 2487 Heap::Space space = Heap::kNew);
2482 static RawString* New(const uint16_t* characters, 2488 static RawString* New(const uint16_t* characters,
2483 intptr_t len, 2489 intptr_t len,
2484 Heap::Space space = Heap::kNew); 2490 Heap::Space space = Heap::kNew);
2485 static RawString* New(const uint32_t* characters, 2491 static RawString* New(const uint32_t* characters,
2486 intptr_t len, 2492 intptr_t len,
2487 Heap::Space space = Heap::kNew); 2493 Heap::Space space = Heap::kNew);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2744 class ExternalOneByteString : public String { 2750 class ExternalOneByteString : public String {
2745 public: 2751 public:
2746 virtual int32_t CharAt(intptr_t index) const { 2752 virtual int32_t CharAt(intptr_t index) const {
2747 return *CharAddr(index); 2753 return *CharAddr(index);
2748 } 2754 }
2749 2755
2750 virtual intptr_t CharSize() const { 2756 virtual intptr_t CharSize() const {
2751 return kOneByteChar; 2757 return kOneByteChar;
2752 } 2758 }
2753 2759
2760 virtual bool IsExternal() const { return true; }
2761 virtual void* GetPeer() const {
2762 return raw_ptr()->external_data_->peer_;
2763 }
2764
2754 static intptr_t InstanceSize() { 2765 static intptr_t InstanceSize() {
2755 return RoundedAllocationSize(sizeof(RawExternalOneByteString)); 2766 return RoundedAllocationSize(sizeof(RawExternalOneByteString));
2756 } 2767 }
2757 2768
2758 static RawExternalOneByteString* New(const uint8_t* characters, 2769 static RawExternalOneByteString* New(const uint8_t* characters,
2759 intptr_t len, 2770 intptr_t len,
2760 void* peer, 2771 void* peer,
2761 PeerFinalizer callback, 2772 PeerFinalizer callback,
2762 Heap::Space space); 2773 Heap::Space space);
2763 2774
(...skipping 17 matching lines...) Expand all
2781 class ExternalTwoByteString : public String { 2792 class ExternalTwoByteString : public String {
2782 public: 2793 public:
2783 virtual int32_t CharAt(intptr_t index) const { 2794 virtual int32_t CharAt(intptr_t index) const {
2784 return *CharAddr(index); 2795 return *CharAddr(index);
2785 } 2796 }
2786 2797
2787 virtual intptr_t CharSize() const { 2798 virtual intptr_t CharSize() const {
2788 return kTwoByteChar; 2799 return kTwoByteChar;
2789 } 2800 }
2790 2801
2802 virtual bool IsExternal() const { return true; }
2803 virtual void* GetPeer() const {
2804 return raw_ptr()->external_data_->peer_;
2805 }
2806
2791 static intptr_t InstanceSize() { 2807 static intptr_t InstanceSize() {
2792 return RoundedAllocationSize(sizeof(RawExternalTwoByteString)); 2808 return RoundedAllocationSize(sizeof(RawExternalTwoByteString));
2793 } 2809 }
2794 2810
2795 static RawExternalTwoByteString* New(const uint16_t* characters, 2811 static RawExternalTwoByteString* New(const uint16_t* characters,
2796 intptr_t len, 2812 intptr_t len,
2797 void* peer, 2813 void* peer,
2798 PeerFinalizer callback, 2814 PeerFinalizer callback,
2799 Heap::Space space = Heap::kNew); 2815 Heap::Space space = Heap::kNew);
2800 2816
(...skipping 17 matching lines...) Expand all
2818 class ExternalFourByteString : public String { 2834 class ExternalFourByteString : public String {
2819 public: 2835 public:
2820 virtual int32_t CharAt(intptr_t index) const { 2836 virtual int32_t CharAt(intptr_t index) const {
2821 return *CharAddr(index); 2837 return *CharAddr(index);
2822 } 2838 }
2823 2839
2824 virtual intptr_t CharSize() const { 2840 virtual intptr_t CharSize() const {
2825 return kFourByteChar; 2841 return kFourByteChar;
2826 } 2842 }
2827 2843
2844 virtual bool IsExternal() const { return true; }
2845 virtual void* GetPeer() const {
2846 return raw_ptr()->external_data_->peer_;
2847 }
2848
2828 static intptr_t InstanceSize() { 2849 static intptr_t InstanceSize() {
2829 return RoundedAllocationSize(sizeof(RawExternalFourByteString)); 2850 return RoundedAllocationSize(sizeof(RawExternalFourByteString));
2830 } 2851 }
2831 2852
2832 static RawExternalFourByteString* New(const uint32_t* characters, 2853 static RawExternalFourByteString* New(const uint32_t* characters,
2833 intptr_t len, 2854 intptr_t len,
2834 void* peer, 2855 void* peer,
2835 PeerFinalizer callback, 2856 PeerFinalizer callback,
2836 Heap::Space space = Heap::kNew); 2857 Heap::Space space = Heap::kNew);
2837 2858
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
3247 } 3268 }
3248 3269
3249 3270
3250 void Context::SetAt(intptr_t index, const Instance& value) const { 3271 void Context::SetAt(intptr_t index, const Instance& value) const {
3251 StorePointer(InstanceAddr(index), value.raw()); 3272 StorePointer(InstanceAddr(index), value.raw());
3252 } 3273 }
3253 3274
3254 } // namespace dart 3275 } // namespace dart
3255 3276
3256 #endif // VM_OBJECT_H_ 3277 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698