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

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

Issue 765743003: Support use of external strings as inputs to LoadCodeUnitsInstr. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: safety Created 6 years 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/intermediate_language_x64.cc ('k') | 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) 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 6071 matching lines...) Expand 10 before | Expand all | Expand 10 after
6082 public: 6082 public:
6083 static uint16_t CharAt(const String& str, intptr_t index) { 6083 static uint16_t CharAt(const String& str, intptr_t index) {
6084 NoGCScope no_gc; 6084 NoGCScope no_gc;
6085 return *CharAddr(str, index); 6085 return *CharAddr(str, index);
6086 } 6086 }
6087 6087
6088 static void* GetPeer(const String& str) { 6088 static void* GetPeer(const String& str) {
6089 return raw_ptr(str)->external_data_->peer(); 6089 return raw_ptr(str)->external_data_->peer();
6090 } 6090 }
6091 6091
6092 static intptr_t external_data_offset() {
6093 return OFFSET_OF(RawExternalOneByteString, external_data_);
6094 }
6095
6092 // We use the same maximum elements for all strings. 6096 // We use the same maximum elements for all strings.
6093 static const intptr_t kBytesPerElement = 1; 6097 static const intptr_t kBytesPerElement = 1;
6094 static const intptr_t kMaxElements = String::kMaxElements; 6098 static const intptr_t kMaxElements = String::kMaxElements;
6095 6099
6096 static intptr_t InstanceSize() { 6100 static intptr_t InstanceSize() {
6097 return String::RoundedAllocationSize(sizeof(RawExternalOneByteString)); 6101 return String::RoundedAllocationSize(sizeof(RawExternalOneByteString));
6098 } 6102 }
6099 6103
6100 static RawExternalOneByteString* New(const uint8_t* characters, 6104 static RawExternalOneByteString* New(const uint8_t* characters,
6101 intptr_t len, 6105 intptr_t len,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
6158 public: 6162 public:
6159 static uint16_t CharAt(const String& str, intptr_t index) { 6163 static uint16_t CharAt(const String& str, intptr_t index) {
6160 NoGCScope no_gc; 6164 NoGCScope no_gc;
6161 return *CharAddr(str, index); 6165 return *CharAddr(str, index);
6162 } 6166 }
6163 6167
6164 static void* GetPeer(const String& str) { 6168 static void* GetPeer(const String& str) {
6165 return raw_ptr(str)->external_data_->peer(); 6169 return raw_ptr(str)->external_data_->peer();
6166 } 6170 }
6167 6171
6172 static intptr_t external_data_offset() {
6173 return OFFSET_OF(RawExternalTwoByteString, external_data_);
6174 }
6175
6168 // We use the same maximum elements for all strings. 6176 // We use the same maximum elements for all strings.
6169 static const intptr_t kBytesPerElement = 2; 6177 static const intptr_t kBytesPerElement = 2;
6170 static const intptr_t kMaxElements = String::kMaxElements; 6178 static const intptr_t kMaxElements = String::kMaxElements;
6171 6179
6172 static intptr_t InstanceSize() { 6180 static intptr_t InstanceSize() {
6173 return String::RoundedAllocationSize(sizeof(RawExternalTwoByteString)); 6181 return String::RoundedAllocationSize(sizeof(RawExternalTwoByteString));
6174 } 6182 }
6175 6183
6176 static RawExternalTwoByteString* New(const uint16_t* characters, 6184 static RawExternalTwoByteString* New(const uint16_t* characters,
6177 intptr_t len, 6185 intptr_t len,
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after
7582 7590
7583 7591
7584 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7592 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7585 intptr_t index) { 7593 intptr_t index) {
7586 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7594 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7587 } 7595 }
7588 7596
7589 } // namespace dart 7597 } // namespace dart
7590 7598
7591 #endif // VM_OBJECT_H_ 7599 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698