| OLD | NEW |
| 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 2346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2357 Heap::Space space = Heap::kNew); | 2357 Heap::Space space = Heap::kNew); |
| 2358 | 2358 |
| 2359 static RawString* SubString(const String& str, | 2359 static RawString* SubString(const String& str, |
| 2360 intptr_t begin_index, | 2360 intptr_t begin_index, |
| 2361 Heap::Space space = Heap::kNew); | 2361 Heap::Space space = Heap::kNew); |
| 2362 static RawString* SubString(const String& str, | 2362 static RawString* SubString(const String& str, |
| 2363 intptr_t begin_index, | 2363 intptr_t begin_index, |
| 2364 intptr_t length, | 2364 intptr_t length, |
| 2365 Heap::Space space = Heap::kNew); | 2365 Heap::Space space = Heap::kNew); |
| 2366 | 2366 |
| 2367 static RawString* Transform(int32_t (*mapping)(int32_t ch), |
| 2368 const String& str, |
| 2369 Heap::Space space = Heap::kNew); |
| 2370 |
| 2371 static RawString* ToUpperCase(const String& str, |
| 2372 Heap::Space space = Heap::kNew); |
| 2373 static RawString* ToLowerCase(const String& str, |
| 2374 Heap::Space space = Heap::kNew); |
| 2375 |
| 2367 static RawString* NewSymbol(const char* str); | 2376 static RawString* NewSymbol(const char* str); |
| 2368 template<typename T> | 2377 template<typename T> |
| 2369 static RawString* NewSymbol(const T* characters, intptr_t len); | 2378 static RawString* NewSymbol(const T* characters, intptr_t len); |
| 2370 static RawString* NewSymbol(const String& str); | 2379 static RawString* NewSymbol(const String& str); |
| 2371 static RawString* NewSymbol(const String& str, | 2380 static RawString* NewSymbol(const String& str, |
| 2372 intptr_t begin_index, | 2381 intptr_t begin_index, |
| 2373 intptr_t length); | 2382 intptr_t length); |
| 2374 | 2383 |
| 2375 protected: | 2384 protected: |
| 2376 bool HasHash() const { | 2385 bool HasHash() const { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2428 Heap::Space space); | 2437 Heap::Space space); |
| 2429 static RawOneByteString* ConcatAll(const Array& strings, | 2438 static RawOneByteString* ConcatAll(const Array& strings, |
| 2430 intptr_t len, | 2439 intptr_t len, |
| 2431 Heap::Space space); | 2440 Heap::Space space); |
| 2432 | 2441 |
| 2433 static RawOneByteString* SubString(const OneByteString& str, | 2442 static RawOneByteString* SubString(const OneByteString& str, |
| 2434 intptr_t begin_index, | 2443 intptr_t begin_index, |
| 2435 intptr_t length, | 2444 intptr_t length, |
| 2436 Heap::Space space); | 2445 Heap::Space space); |
| 2437 | 2446 |
| 2447 static RawOneByteString* Transform(int32_t (*mapping)(int32_t ch), |
| 2448 const String& str, |
| 2449 Heap::Space space); |
| 2450 |
| 2438 private: | 2451 private: |
| 2439 uint8_t* CharAddr(intptr_t index) const { | 2452 uint8_t* CharAddr(intptr_t index) const { |
| 2440 // TODO(iposva): Determine if we should throw an exception here. | 2453 // TODO(iposva): Determine if we should throw an exception here. |
| 2441 ASSERT((index >= 0) && (index < Length())); | 2454 ASSERT((index >= 0) && (index < Length())); |
| 2442 return &raw_ptr()->data_[index]; | 2455 return &raw_ptr()->data_[index]; |
| 2443 } | 2456 } |
| 2444 | 2457 |
| 2445 HEAP_OBJECT_IMPLEMENTATION(OneByteString, String); | 2458 HEAP_OBJECT_IMPLEMENTATION(OneByteString, String); |
| 2446 friend class Class; | 2459 friend class Class; |
| 2447 friend class String; | 2460 friend class String; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2479 Heap::Space space); | 2492 Heap::Space space); |
| 2480 static RawTwoByteString* ConcatAll(const Array& strings, | 2493 static RawTwoByteString* ConcatAll(const Array& strings, |
| 2481 intptr_t len, | 2494 intptr_t len, |
| 2482 Heap::Space space); | 2495 Heap::Space space); |
| 2483 | 2496 |
| 2484 static RawTwoByteString* SubString(const TwoByteString& str, | 2497 static RawTwoByteString* SubString(const TwoByteString& str, |
| 2485 intptr_t begin_index, | 2498 intptr_t begin_index, |
| 2486 intptr_t length, | 2499 intptr_t length, |
| 2487 Heap::Space space); | 2500 Heap::Space space); |
| 2488 | 2501 |
| 2502 static RawTwoByteString* Transform(int32_t (*mapping)(int32_t ch), |
| 2503 const String& str, |
| 2504 Heap::Space space); |
| 2505 |
| 2489 private: | 2506 private: |
| 2490 uint16_t* CharAddr(intptr_t index) const { | 2507 uint16_t* CharAddr(intptr_t index) const { |
| 2491 ASSERT((index >= 0) && (index < Length())); | 2508 ASSERT((index >= 0) && (index < Length())); |
| 2492 return &raw_ptr()->data_[index]; | 2509 return &raw_ptr()->data_[index]; |
| 2493 } | 2510 } |
| 2494 | 2511 |
| 2495 HEAP_OBJECT_IMPLEMENTATION(TwoByteString, String); | 2512 HEAP_OBJECT_IMPLEMENTATION(TwoByteString, String); |
| 2496 friend class Class; | 2513 friend class Class; |
| 2497 friend class String; | 2514 friend class String; |
| 2498 }; | 2515 }; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2526 Heap::Space space); | 2543 Heap::Space space); |
| 2527 static RawFourByteString* ConcatAll(const Array& strings, | 2544 static RawFourByteString* ConcatAll(const Array& strings, |
| 2528 intptr_t len, | 2545 intptr_t len, |
| 2529 Heap::Space space); | 2546 Heap::Space space); |
| 2530 | 2547 |
| 2531 static RawFourByteString* SubString(const FourByteString& str, | 2548 static RawFourByteString* SubString(const FourByteString& str, |
| 2532 intptr_t begin_index, | 2549 intptr_t begin_index, |
| 2533 intptr_t length, | 2550 intptr_t length, |
| 2534 Heap::Space space); | 2551 Heap::Space space); |
| 2535 | 2552 |
| 2553 static RawFourByteString* Transform(int32_t (*mapping)(int32_t ch), |
| 2554 const String& str, |
| 2555 Heap::Space space); |
| 2556 |
| 2536 private: | 2557 private: |
| 2537 uint32_t* CharAddr(intptr_t index) const { | 2558 uint32_t* CharAddr(intptr_t index) const { |
| 2538 ASSERT((index >= 0) && (index < Length())); | 2559 ASSERT((index >= 0) && (index < Length())); |
| 2539 return &raw_ptr()->data_[index]; | 2560 return &raw_ptr()->data_[index]; |
| 2540 } | 2561 } |
| 2541 | 2562 |
| 2542 HEAP_OBJECT_IMPLEMENTATION(FourByteString, String); | 2563 HEAP_OBJECT_IMPLEMENTATION(FourByteString, String); |
| 2543 friend class Class; | 2564 friend class Class; |
| 2544 friend class String; | 2565 friend class String; |
| 2545 }; | 2566 }; |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2876 } | 2897 } |
| 2877 | 2898 |
| 2878 | 2899 |
| 2879 void Context::SetAt(intptr_t index, const Instance& value) const { | 2900 void Context::SetAt(intptr_t index, const Instance& value) const { |
| 2880 StorePointer(InstanceAddr(index), value.raw()); | 2901 StorePointer(InstanceAddr(index), value.raw()); |
| 2881 } | 2902 } |
| 2882 | 2903 |
| 2883 } // namespace dart | 2904 } // namespace dart |
| 2884 | 2905 |
| 2885 #endif // VM_OBJECT_H_ | 2906 #endif // VM_OBJECT_H_ |
| OLD | NEW |