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

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

Issue 12568007: Translate raw strings to regular strings during source code generation. This should hopefully avoid… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | 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) 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 4245 matching lines...) Expand 10 before | Expand all | Expand 10 after
4256 static void Copy(const String& dst, 4256 static void Copy(const String& dst,
4257 intptr_t dst_offset, 4257 intptr_t dst_offset,
4258 const uint16_t* characters, 4258 const uint16_t* characters,
4259 intptr_t len); 4259 intptr_t len);
4260 static void Copy(const String& dst, 4260 static void Copy(const String& dst,
4261 intptr_t dst_offset, 4261 intptr_t dst_offset,
4262 const String& src, 4262 const String& src,
4263 intptr_t src_offset, 4263 intptr_t src_offset,
4264 intptr_t len); 4264 intptr_t len);
4265 4265
4266 static RawString* EscapeSpecialCharacters(const String& str, bool raw_str); 4266 static RawString* EscapeSpecialCharacters(const String& str);
4267 4267
4268 static RawString* Concat(const String& str1, 4268 static RawString* Concat(const String& str1,
4269 const String& str2, 4269 const String& str2,
4270 Heap::Space space = Heap::kNew); 4270 Heap::Space space = Heap::kNew);
4271 static RawString* ConcatAll(const Array& strings, 4271 static RawString* ConcatAll(const Array& strings,
4272 Heap::Space space = Heap::kNew); 4272 Heap::Space space = Heap::kNew);
4273 4273
4274 static RawString* SubString(const String& str, 4274 static RawString* SubString(const String& str,
4275 intptr_t begin_index, 4275 intptr_t begin_index,
4276 Heap::Space space = Heap::kNew); 4276 Heap::Space space = Heap::kNew);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
4331 friend class ExternalTwoByteString; 4331 friend class ExternalTwoByteString;
4332 }; 4332 };
4333 4333
4334 4334
4335 class OneByteString : public AllStatic { 4335 class OneByteString : public AllStatic {
4336 public: 4336 public:
4337 static int32_t CharAt(const String& str, intptr_t index) { 4337 static int32_t CharAt(const String& str, intptr_t index) {
4338 return *CharAddr(str, index); 4338 return *CharAddr(str, index);
4339 } 4339 }
4340 4340
4341 static RawOneByteString* EscapeSpecialCharacters(const String& str, 4341 static RawOneByteString* EscapeSpecialCharacters(const String& str);
4342 bool raw_str);
4343 4342
4344 // We use the same maximum elements for all strings. 4343 // We use the same maximum elements for all strings.
4345 static const intptr_t kBytesPerElement = 1; 4344 static const intptr_t kBytesPerElement = 1;
4346 static const intptr_t kMaxElements = String::kMaxElements; 4345 static const intptr_t kMaxElements = String::kMaxElements;
4347 4346
4348 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); } 4347 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); }
4349 4348
4350 static intptr_t InstanceSize() { 4349 static intptr_t InstanceSize() {
4351 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_)); 4350 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_));
4352 return 0; 4351 return 0;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
4434 friend class SnapshotReader; 4433 friend class SnapshotReader;
4435 }; 4434 };
4436 4435
4437 4436
4438 class TwoByteString : public AllStatic { 4437 class TwoByteString : public AllStatic {
4439 public: 4438 public:
4440 static int32_t CharAt(const String& str, intptr_t index) { 4439 static int32_t CharAt(const String& str, intptr_t index) {
4441 return *CharAddr(str, index); 4440 return *CharAddr(str, index);
4442 } 4441 }
4443 4442
4444 static RawTwoByteString* EscapeSpecialCharacters(const String& str, 4443 static RawTwoByteString* EscapeSpecialCharacters(const String& str);
4445 bool raw_str);
4446 4444
4447 // We use the same maximum elements for all strings. 4445 // We use the same maximum elements for all strings.
4448 static const intptr_t kBytesPerElement = 2; 4446 static const intptr_t kBytesPerElement = 2;
4449 static const intptr_t kMaxElements = String::kMaxElements; 4447 static const intptr_t kMaxElements = String::kMaxElements;
4450 4448
4451 static intptr_t data_offset() { return OFFSET_OF(RawTwoByteString, data_); } 4449 static intptr_t data_offset() { return OFFSET_OF(RawTwoByteString, data_); }
4452 4450
4453 static intptr_t InstanceSize() { 4451 static intptr_t InstanceSize() {
4454 ASSERT(sizeof(RawTwoByteString) == OFFSET_OF(RawTwoByteString, data_)); 4452 ASSERT(sizeof(RawTwoByteString) == OFFSET_OF(RawTwoByteString, data_));
4455 return 0; 4453 return 0;
(...skipping 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after
6888 6886
6889 6887
6890 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6888 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6891 intptr_t index) { 6889 intptr_t index) {
6892 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6890 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6893 } 6891 }
6894 6892
6895 } // namespace dart 6893 } // namespace dart
6896 6894
6897 #endif // VM_OBJECT_H_ 6895 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698