| OLD | NEW |
| 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 Loading... |
| 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) | |
| 21341 result->StoreSmi(&(result->ptr()->hash_), Smi::New(0)); | 21340 result->StoreSmi(&(result->ptr()->hash_), Smi::New(0)); |
| 21342 #endif | |
| 21343 return result; | 21341 return result; |
| 21344 } | 21342 } |
| 21345 } | 21343 } |
| 21346 | 21344 |
| 21347 | 21345 |
| 21348 RawOneByteString* OneByteString::New(const uint8_t* characters, | 21346 RawOneByteString* OneByteString::New(const uint8_t* characters, |
| 21349 intptr_t len, | 21347 intptr_t len, |
| 21350 Heap::Space space) { | 21348 Heap::Space space) { |
| 21351 const String& result = String::Handle(OneByteString::New(len, space)); | 21349 const String& result = String::Handle(OneByteString::New(len, space)); |
| 21352 if (len > 0) { | 21350 if (len > 0) { |
| (...skipping 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 23334 return UserTag::null(); | 23332 return UserTag::null(); |
| 23335 } | 23333 } |
| 23336 | 23334 |
| 23337 | 23335 |
| 23338 const char* UserTag::ToCString() const { | 23336 const char* UserTag::ToCString() const { |
| 23339 const String& tag_label = String::Handle(label()); | 23337 const String& tag_label = String::Handle(label()); |
| 23340 return tag_label.ToCString(); | 23338 return tag_label.ToCString(); |
| 23341 } | 23339 } |
| 23342 | 23340 |
| 23343 } // namespace dart | 23341 } // namespace dart |
| OLD | NEW |