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

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

Issue 8346014: Use the narrowest character width possible for substrings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Improved changelog message. Created 9 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') | 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 2413 matching lines...) Expand 10 before | Expand all | Expand 10 after
2424 static RawOneByteString* New(const OneByteString& str, 2424 static RawOneByteString* New(const OneByteString& str,
2425 Heap::Space space); 2425 Heap::Space space);
2426 2426
2427 static RawOneByteString* Concat(const String& str1, 2427 static RawOneByteString* Concat(const String& str1,
2428 const String& str2, 2428 const String& str2,
2429 Heap::Space space); 2429 Heap::Space space);
2430 static RawOneByteString* ConcatAll(const Array& strings, 2430 static RawOneByteString* ConcatAll(const Array& strings,
2431 intptr_t len, 2431 intptr_t len,
2432 Heap::Space space); 2432 Heap::Space space);
2433 2433
2434 static RawOneByteString* SubString(const OneByteString& str, 2434 static RawString* SubString(const OneByteString& str,
2435 intptr_t begin_index, 2435 intptr_t begin_index,
2436 intptr_t length, 2436 intptr_t length,
2437 Heap::Space space); 2437 Heap::Space space);
2438 2438
2439 private: 2439 private:
2440 uint8_t* CharAddr(intptr_t index) const { 2440 uint8_t* CharAddr(intptr_t index) const {
2441 // TODO(iposva): Determine if we should throw an exception here. 2441 // TODO(iposva): Determine if we should throw an exception here.
2442 ASSERT((index >= 0) && (index < Length())); 2442 ASSERT((index >= 0) && (index < Length()));
2443 return &raw_ptr()->data_[index]; 2443 return &raw_ptr()->data_[index];
2444 } 2444 }
2445 2445
2446 HEAP_OBJECT_IMPLEMENTATION(OneByteString, String); 2446 HEAP_OBJECT_IMPLEMENTATION(OneByteString, String);
2447 friend class Class; 2447 friend class Class;
(...skipping 27 matching lines...) Expand all
2475 static RawTwoByteString* New(const TwoByteString& str, 2475 static RawTwoByteString* New(const TwoByteString& str,
2476 Heap::Space space); 2476 Heap::Space space);
2477 2477
2478 static RawTwoByteString* Concat(const String& str1, 2478 static RawTwoByteString* Concat(const String& str1,
2479 const String& str2, 2479 const String& str2,
2480 Heap::Space space); 2480 Heap::Space space);
2481 static RawTwoByteString* ConcatAll(const Array& strings, 2481 static RawTwoByteString* ConcatAll(const Array& strings,
2482 intptr_t len, 2482 intptr_t len,
2483 Heap::Space space); 2483 Heap::Space space);
2484 2484
2485 static RawTwoByteString* SubString(const TwoByteString& str, 2485 static RawString* SubString(const TwoByteString& str,
2486 intptr_t begin_index, 2486 intptr_t begin_index,
2487 intptr_t length, 2487 intptr_t length,
2488 Heap::Space space); 2488 Heap::Space space);
2489 2489
2490 private: 2490 private:
2491 uint16_t* CharAddr(intptr_t index) const { 2491 uint16_t* CharAddr(intptr_t index) const {
2492 ASSERT((index >= 0) && (index < Length())); 2492 ASSERT((index >= 0) && (index < Length()));
2493 return &raw_ptr()->data_[index]; 2493 return &raw_ptr()->data_[index];
2494 } 2494 }
2495 2495
2496 HEAP_OBJECT_IMPLEMENTATION(TwoByteString, String); 2496 HEAP_OBJECT_IMPLEMENTATION(TwoByteString, String);
2497 friend class Class; 2497 friend class Class;
2498 friend class String; 2498 friend class String;
(...skipping 23 matching lines...) Expand all
2522 static RawFourByteString* New(const FourByteString& str, 2522 static RawFourByteString* New(const FourByteString& str,
2523 Heap::Space space); 2523 Heap::Space space);
2524 2524
2525 static RawFourByteString* Concat(const String& str1, 2525 static RawFourByteString* Concat(const String& str1,
2526 const String& str2, 2526 const String& str2,
2527 Heap::Space space); 2527 Heap::Space space);
2528 static RawFourByteString* ConcatAll(const Array& strings, 2528 static RawFourByteString* ConcatAll(const Array& strings,
2529 intptr_t len, 2529 intptr_t len,
2530 Heap::Space space); 2530 Heap::Space space);
2531 2531
2532 static RawFourByteString* SubString(const FourByteString& str, 2532 static RawString* SubString(const FourByteString& str,
2533 intptr_t begin_index, 2533 intptr_t begin_index,
2534 intptr_t length, 2534 intptr_t length,
2535 Heap::Space space); 2535 Heap::Space space);
2536 2536
2537 private: 2537 private:
2538 uint32_t* CharAddr(intptr_t index) const { 2538 uint32_t* CharAddr(intptr_t index) const {
2539 ASSERT((index >= 0) && (index < Length())); 2539 ASSERT((index >= 0) && (index < Length()));
2540 return &raw_ptr()->data_[index]; 2540 return &raw_ptr()->data_[index];
2541 } 2541 }
2542 2542
2543 HEAP_OBJECT_IMPLEMENTATION(FourByteString, String); 2543 HEAP_OBJECT_IMPLEMENTATION(FourByteString, String);
2544 friend class Class; 2544 friend class Class;
2545 friend class String; 2545 friend class String;
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
2877 } 2877 }
2878 2878
2879 2879
2880 void Context::SetAt(intptr_t index, const Instance& value) const { 2880 void Context::SetAt(intptr_t index, const Instance& value) const {
2881 StorePointer(InstanceAddr(index), value.raw()); 2881 StorePointer(InstanceAddr(index), value.raw());
2882 } 2882 }
2883 2883
2884 } // namespace dart 2884 } // namespace dart
2885 2885
2886 #endif // VM_OBJECT_H_ 2886 #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