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

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

Issue 2893553002: More compact string representation on 64 bit. (Closed)
Patch Set: Slava feedback Created 3 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/become.h" 10 #include "vm/become.h"
(...skipping 21319 matching lines...) Expand 10 before | Expand all | Expand 10 after
21330 if (len < 0 || len > kMaxElements) { 21330 if (len < 0 || len > kMaxElements) {
21331 // This should be caught before we reach here. 21331 // This should be caught before we reach here.
21332 FATAL1("Fatal error in OneByteString::New: invalid len %" Pd "\n", len); 21332 FATAL1("Fatal error in OneByteString::New: invalid len %" Pd "\n", len);
21333 } 21333 }
21334 { 21334 {
21335 RawObject* raw = Object::Allocate(OneByteString::kClassId, 21335 RawObject* raw = Object::Allocate(OneByteString::kClassId,
21336 OneByteString::InstanceSize(len), space); 21336 OneByteString::InstanceSize(len), space);
21337 NoSafepointScope no_safepoint; 21337 NoSafepointScope no_safepoint;
21338 RawOneByteString* result = reinterpret_cast<RawOneByteString*>(raw); 21338 RawOneByteString* result = reinterpret_cast<RawOneByteString*>(raw);
21339 result->StoreSmi(&(result->ptr()->length_), Smi::New(len)); 21339 result->StoreSmi(&(result->ptr()->length_), Smi::New(len));
21340 #if !defined(HASH_IN_OBJECT_HEADER)
21340 result->StoreSmi(&(result->ptr()->hash_), Smi::New(0)); 21341 result->StoreSmi(&(result->ptr()->hash_), Smi::New(0));
21342 #endif
21341 return result; 21343 return result;
21342 } 21344 }
21343 } 21345 }
21344 21346
21345 21347
21346 RawOneByteString* OneByteString::New(const uint8_t* characters, 21348 RawOneByteString* OneByteString::New(const uint8_t* characters,
21347 intptr_t len, 21349 intptr_t len,
21348 Heap::Space space) { 21350 Heap::Space space) {
21349 const String& result = String::Handle(OneByteString::New(len, space)); 21351 const String& result = String::Handle(OneByteString::New(len, space));
21350 if (len > 0) { 21352 if (len > 0) {
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
23332 return UserTag::null(); 23334 return UserTag::null();
23333 } 23335 }
23334 23336
23335 23337
23336 const char* UserTag::ToCString() const { 23338 const char* UserTag::ToCString() const {
23337 const String& tag_label = String::Handle(label()); 23339 const String& tag_label = String::Handle(label());
23338 return tag_label.ToCString(); 23340 return tag_label.ToCString();
23339 } 23341 }
23340 23342
23341 } // namespace dart 23343 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698