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

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

Issue 8340017: Use a common subroutine for the snapshot reading and writing of strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments 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
« no previous file with comments | « no previous file | runtime/vm/raw_object_snapshot.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) 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 2471 matching lines...) Expand 10 before | Expand all | Expand 10 after
2482 // heap allocation. 2482 // heap allocation.
2483 raw_ptr()->length_ = Smi::New(value); 2483 raw_ptr()->length_ = Smi::New(value);
2484 } 2484 }
2485 2485
2486 void SetHash(intptr_t value) const { 2486 void SetHash(intptr_t value) const {
2487 // This is only safe because we create a new Smi, which does not cause 2487 // This is only safe because we create a new Smi, which does not cause
2488 // heap allocation. 2488 // heap allocation.
2489 raw_ptr()->hash_ = Smi::New(value); 2489 raw_ptr()->hash_ = Smi::New(value);
2490 } 2490 }
2491 2491
2492 template<typename HandleType, typename ElementType>
2493 static RawString* ReadFromImpl(SnapshotReader* reader,
2494 intptr_t object_id,
2495 bool classes_serialized);
2496
2492 HEAP_OBJECT_IMPLEMENTATION(String, Instance); 2497 HEAP_OBJECT_IMPLEMENTATION(String, Instance);
2493 }; 2498 };
2494 2499
2495 2500
2496 class OneByteString : public String { 2501 class OneByteString : public String {
2497 public: 2502 public:
2498 virtual int32_t CharAt(intptr_t index) const { 2503 virtual int32_t CharAt(intptr_t index) const {
2499 return *CharAddr(index); 2504 return *CharAddr(index);
2500 } 2505 }
2501 2506
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
2989 } 2994 }
2990 2995
2991 2996
2992 void Context::SetAt(intptr_t index, const Instance& value) const { 2997 void Context::SetAt(intptr_t index, const Instance& value) const {
2993 StorePointer(InstanceAddr(index), value.raw()); 2998 StorePointer(InstanceAddr(index), value.raw());
2994 } 2999 }
2995 3000
2996 } // namespace dart 3001 } // namespace dart
2997 3002
2998 #endif // VM_OBJECT_H_ 3003 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698