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

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
« no previous file with comments | « runtime/vm/intrinsifier_x64.cc ('k') | no next file » | 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 4404 matching lines...) Expand 10 before | Expand all | Expand 10 after
4415 friend class ExternalTwoByteString; 4415 friend class ExternalTwoByteString;
4416 }; 4416 };
4417 4417
4418 4418
4419 class OneByteString : public AllStatic { 4419 class OneByteString : public AllStatic {
4420 public: 4420 public:
4421 static int32_t CharAt(const String& str, intptr_t index) { 4421 static int32_t CharAt(const String& str, intptr_t index) {
4422 return *CharAddr(str, index); 4422 return *CharAddr(str, index);
4423 } 4423 }
4424 4424
4425 static void SetCharAt(const String& str, intptr_t index, uint8_t code_point) {
4426 *CharAddr(str, index) = code_point;
4427 }
4425 static RawOneByteString* EscapeSpecialCharacters(const String& str); 4428 static RawOneByteString* EscapeSpecialCharacters(const String& str);
4426 4429
4427 // We use the same maximum elements for all strings. 4430 // We use the same maximum elements for all strings.
4428 static const intptr_t kBytesPerElement = 1; 4431 static const intptr_t kBytesPerElement = 1;
4429 static const intptr_t kMaxElements = String::kMaxElements; 4432 static const intptr_t kMaxElements = String::kMaxElements;
4430 4433
4431 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); } 4434 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); }
4432 4435
4433 static intptr_t InstanceSize() { 4436 static intptr_t InstanceSize() {
4434 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_)); 4437 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_));
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
5723 5726
5724 5727
5725 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 5728 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
5726 intptr_t index) { 5729 intptr_t index) {
5727 return array.At((index * kEntryLength) + kTargetFunctionIndex); 5730 return array.At((index * kEntryLength) + kTargetFunctionIndex);
5728 } 5731 }
5729 5732
5730 } // namespace dart 5733 } // namespace dart
5731 5734
5732 #endif // VM_OBJECT_H_ 5735 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698