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

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

Issue 2895183002: More compact string representation on 64 bit. (Closed)
Patch Set: 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 21338 matching lines...) Expand 10 before | Expand all | Expand 10 after
21349 if (len < 0 || len > kMaxElements) { 21349 if (len < 0 || len > kMaxElements) {
21350 // This should be caught before we reach here. 21350 // This should be caught before we reach here.
21351 FATAL1("Fatal error in OneByteString::New: invalid len %" Pd "\n", len); 21351 FATAL1("Fatal error in OneByteString::New: invalid len %" Pd "\n", len);
21352 } 21352 }
21353 { 21353 {
21354 RawObject* raw = Object::Allocate(OneByteString::kClassId, 21354 RawObject* raw = Object::Allocate(OneByteString::kClassId,
21355 OneByteString::InstanceSize(len), space); 21355 OneByteString::InstanceSize(len), space);
21356 NoSafepointScope no_safepoint; 21356 NoSafepointScope no_safepoint;
21357 RawOneByteString* result = reinterpret_cast<RawOneByteString*>(raw); 21357 RawOneByteString* result = reinterpret_cast<RawOneByteString*>(raw);
21358 result->StoreSmi(&(result->ptr()->length_), Smi::New(len)); 21358 result->StoreSmi(&(result->ptr()->length_), Smi::New(len));
21359 #if !defined(HASH_IN_OBJECT_HEADER)
21359 result->StoreSmi(&(result->ptr()->hash_), Smi::New(0)); 21360 result->StoreSmi(&(result->ptr()->hash_), Smi::New(0));
21361 #endif
21360 return result; 21362 return result;
21361 } 21363 }
21362 } 21364 }
21363 21365
21364 21366
21365 RawOneByteString* OneByteString::New(const uint8_t* characters, 21367 RawOneByteString* OneByteString::New(const uint8_t* characters,
21366 intptr_t len, 21368 intptr_t len,
21367 Heap::Space space) { 21369 Heap::Space space) {
21368 const String& result = String::Handle(OneByteString::New(len, space)); 21370 const String& result = String::Handle(OneByteString::New(len, space));
21369 if (len > 0) { 21371 if (len > 0) {
(...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after
23351 return UserTag::null(); 23353 return UserTag::null();
23352 } 23354 }
23353 23355
23354 23356
23355 const char* UserTag::ToCString() const { 23357 const char* UserTag::ToCString() const {
23356 const String& tag_label = String::Handle(label()); 23358 const String& tag_label = String::Handle(label());
23357 return tag_label.ToCString(); 23359 return tag_label.ToCString();
23358 } 23360 }
23359 23361
23360 } // namespace dart 23362 } // 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