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

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

Issue 8440051: Intrinsify String.charCodeAt, String.length and String.hashCode. Improves frog performance by 2x. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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) 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 2477 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 HEAP_OBJECT_IMPLEMENTATION(String, Instance); 2488 HEAP_OBJECT_IMPLEMENTATION(String, Instance);
2489 }; 2489 };
2490 2490
2491 2491
2492 class OneByteString : public String { 2492 class OneByteString : public String {
2493 public: 2493 public:
2494 virtual int32_t CharAt(intptr_t index) const { 2494 virtual int32_t CharAt(intptr_t index) const {
2495 return *CharAddr(index); 2495 return *CharAddr(index);
2496 } 2496 }
2497 2497
2498 static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); }
2499
2498 static intptr_t InstanceSize() { 2500 static intptr_t InstanceSize() {
2499 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_)); 2501 ASSERT(sizeof(RawOneByteString) == OFFSET_OF(RawOneByteString, data_));
2500 return 0; 2502 return 0;
2501 } 2503 }
2502 2504
2503 static intptr_t InstanceSize(intptr_t len) { 2505 static intptr_t InstanceSize(intptr_t len) {
2504 return RoundedAllocationSize(sizeof(RawOneByteString) + len); 2506 return RoundedAllocationSize(sizeof(RawOneByteString) + len);
2505 } 2507 }
2506 2508
2507 static RawOneByteString* New(intptr_t len, 2509 static RawOneByteString* New(intptr_t len,
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
2983 } 2985 }
2984 2986
2985 2987
2986 void Context::SetAt(intptr_t index, const Instance& value) const { 2988 void Context::SetAt(intptr_t index, const Instance& value) const {
2987 StorePointer(InstanceAddr(index), value.raw()); 2989 StorePointer(InstanceAddr(index), value.raw());
2988 } 2990 }
2989 2991
2990 } // namespace dart 2992 } // namespace dart
2991 2993
2992 #endif // VM_OBJECT_H_ 2994 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698