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

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

Issue 25344002: Fix crashing bug due to the fact that external one byte strings cannot be escaped (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4925 matching lines...) Expand 10 before | Expand all | Expand 10 after
4936 return &raw_ptr(str)->data_[index]; 4936 return &raw_ptr(str)->data_[index];
4937 } 4937 }
4938 4938
4939 static RawOneByteString* ReadFrom(SnapshotReader* reader, 4939 static RawOneByteString* ReadFrom(SnapshotReader* reader,
4940 intptr_t object_id, 4940 intptr_t object_id,
4941 intptr_t tags, 4941 intptr_t tags,
4942 Snapshot::Kind kind); 4942 Snapshot::Kind kind);
4943 4943
4944 friend class Class; 4944 friend class Class;
4945 friend class String; 4945 friend class String;
4946 friend class ExternalOneByteString;
4946 friend class SnapshotReader; 4947 friend class SnapshotReader;
4947 }; 4948 };
4948 4949
4949 4950
4950 class TwoByteString : public AllStatic { 4951 class TwoByteString : public AllStatic {
4951 public: 4952 public:
4952 static int32_t CharAt(const String& str, intptr_t index) { 4953 static int32_t CharAt(const String& str, intptr_t index) {
4953 return *CharAddr(str, index); 4954 return *CharAddr(str, index);
4954 } 4955 }
4955 4956
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
5057 static RawExternalOneByteString* New(const uint8_t* characters, 5058 static RawExternalOneByteString* New(const uint8_t* characters,
5058 intptr_t len, 5059 intptr_t len,
5059 void* peer, 5060 void* peer,
5060 Dart_PeerFinalizer callback, 5061 Dart_PeerFinalizer callback,
5061 Heap::Space space); 5062 Heap::Space space);
5062 5063
5063 static RawExternalOneByteString* null() { 5064 static RawExternalOneByteString* null() {
5064 return reinterpret_cast<RawExternalOneByteString*>(Object::null()); 5065 return reinterpret_cast<RawExternalOneByteString*>(Object::null());
5065 } 5066 }
5066 5067
5068 static RawOneByteString* EscapeSpecialCharacters(const String& str);
5069
5067 static const ClassId kClassId = kExternalOneByteStringCid; 5070 static const ClassId kClassId = kExternalOneByteStringCid;
5068 5071
5069 private: 5072 private:
5070 static RawExternalOneByteString* raw(const String& str) { 5073 static RawExternalOneByteString* raw(const String& str) {
5071 return reinterpret_cast<RawExternalOneByteString*>(str.raw()); 5074 return reinterpret_cast<RawExternalOneByteString*>(str.raw());
5072 } 5075 }
5073 5076
5074 static RawExternalOneByteString* raw_ptr(const String& str) { 5077 static RawExternalOneByteString* raw_ptr(const String& str) {
5075 return reinterpret_cast<RawExternalOneByteString*>(str.raw_ptr()); 5078 return reinterpret_cast<RawExternalOneByteString*>(str.raw_ptr());
5076 } 5079 }
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
6212 6215
6213 6216
6214 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6217 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6215 intptr_t index) { 6218 intptr_t index) {
6216 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6219 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6217 } 6220 }
6218 6221
6219 } // namespace dart 6222 } // namespace dart
6220 6223
6221 #endif // VM_OBJECT_H_ 6224 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698