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

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

Issue 14862006: Improve performance of String.fromCharCodes by implementing it in Dart. Add tow internal natives to… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
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 4403 matching lines...) Expand 10 before | Expand all | Expand 10 after
4414 friend class ExternalTwoByteString; 4414 friend class ExternalTwoByteString;
4415 }; 4415 };
4416 4416
4417 4417
4418 class OneByteString : public AllStatic { 4418 class OneByteString : public AllStatic {
4419 public: 4419 public:
4420 static int32_t CharAt(const String& str, intptr_t index) { 4420 static int32_t CharAt(const String& str, intptr_t index) {
4421 return *CharAddr(str, index); 4421 return *CharAddr(str, index);
4422 } 4422 }
4423 4423
4424 static void SetCharAt(const String& str, intptr_t index, uint8_t code_point) {
4425 *CharAddr(str, index) = code_point;
4426 }
4424 static RawOneByteString* EscapeSpecialCharacters(const String& str); 4427 static RawOneByteString* EscapeSpecialCharacters(const String& str);
4425 4428
4426 // We use the same maximum elements for all strings. 4429 // We use the same maximum elements for all strings.
4427 static const intptr_t kBytesPerElement = 1; 4430 static const intptr_t kBytesPerElement = 1;
4428 static const intptr_t kMaxElements = String::kMaxElements; 4431 static const intptr_t kMaxElements = String::kMaxElements;
4429 4432
4430 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); } 4433 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); }
4431 4434
4432 static intptr_t InstanceSize() { 4435 static intptr_t InstanceSize() {
4433 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_)); 4436 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_));
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
5721 5724
5722 5725
5723 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 5726 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
5724 intptr_t index) { 5727 intptr_t index) {
5725 return array.At((index * kEntryLength) + kTargetFunctionIndex); 5728 return array.At((index * kEntryLength) + kTargetFunctionIndex);
5726 } 5729 }
5727 5730
5728 } // namespace dart 5731 } // namespace dart
5729 5732
5730 #endif // VM_OBJECT_H_ 5733 #endif // VM_OBJECT_H_
OLDNEW
« runtime/vm/intrinsifier_x64.cc ('K') | « runtime/vm/intrinsifier_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698