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

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

Issue 635393002: Fix Object::Clone. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 void Print() const; 308 void Print() const;
309 309
310 bool IsZoneHandle() const { 310 bool IsZoneHandle() const {
311 return VMHandles::IsZoneHandle(reinterpret_cast<uword>(this)); 311 return VMHandles::IsZoneHandle(reinterpret_cast<uword>(this));
312 } 312 }
313 313
314 bool IsReadOnlyHandle() const; 314 bool IsReadOnlyHandle() const;
315 315
316 bool IsNotTemporaryScopedHandle() const; 316 bool IsNotTemporaryScopedHandle() const;
317 317
318 static RawObject* Clone(const Object& src, Heap::Space space = Heap::kNew);
319
320 static Object& Handle(Isolate* isolate, RawObject* raw_ptr) { 318 static Object& Handle(Isolate* isolate, RawObject* raw_ptr) {
321 Object* obj = reinterpret_cast<Object*>(VMHandles::AllocateHandle(isolate)); 319 Object* obj = reinterpret_cast<Object*>(VMHandles::AllocateHandle(isolate));
322 initializeHandle(obj, raw_ptr); 320 initializeHandle(obj, raw_ptr);
323 return *obj; 321 return *obj;
324 } 322 }
325 static Object* ReadOnlyHandle() { 323 static Object* ReadOnlyHandle() {
326 Object* obj = reinterpret_cast<Object*>( 324 Object* obj = reinterpret_cast<Object*>(
327 Dart::AllocateReadOnlyHandle()); 325 Dart::AllocateReadOnlyHandle());
328 initializeHandle(obj, Object::null()); 326 initializeHandle(obj, Object::null());
329 return obj; 327 return obj;
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 // Fail at link time if StoreNonPointer is called with an object pointer. 610 // Fail at link time if StoreNonPointer is called with an object pointer.
613 #define STORE_NON_POINTER_ILLEGAL_TYPE(type) \ 611 #define STORE_NON_POINTER_ILLEGAL_TYPE(type) \
614 template<typename ValueType> \ 612 template<typename ValueType> \
615 void StoreNonPointer(Raw##type** addr, ValueType value) const { \ 613 void StoreNonPointer(Raw##type** addr, ValueType value) const { \
616 UnimplementedMethod(); \ 614 UnimplementedMethod(); \
617 } 615 }
618 CLASS_LIST(STORE_NON_POINTER_ILLEGAL_TYPE); 616 CLASS_LIST(STORE_NON_POINTER_ILLEGAL_TYPE);
619 void UnimplementedMethod() const; 617 void UnimplementedMethod() const;
620 #undef STORE_NON_POINTER_ILLEGAL_TYPE 618 #undef STORE_NON_POINTER_ILLEGAL_TYPE
621 619
620 // Allocate an object and copy the body of 'src'.
621 static RawObject* Clone(const Object& src, Heap::Space space);
Ivan Posva 2014/10/10 20:59:04 Please match .cc and .h parameter names.
622
622 RawObject* raw_; // The raw object reference. 623 RawObject* raw_; // The raw object reference.
623 624
624 protected: 625 protected:
625 virtual void PrintJSONImpl(JSONStream* stream, bool ref) const; 626 virtual void PrintJSONImpl(JSONStream* stream, bool ref) const;
626 627
627 private: 628 private:
628 static intptr_t NextFieldOffset() { 629 static intptr_t NextFieldOffset() {
629 // Indicates this class cannot be extended by dart code. 630 // Indicates this class cannot be extended by dart code.
630 return -kWordSize; 631 return -kWordSize;
631 } 632 }
(...skipping 6881 matching lines...) Expand 10 before | Expand all | Expand 10 after
7513 7514
7514 7515
7515 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7516 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7516 intptr_t index) { 7517 intptr_t index) {
7517 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7518 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7518 } 7519 }
7519 7520
7520 } // namespace dart 7521 } // namespace dart
7521 7522
7522 #endif // VM_OBJECT_H_ 7523 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698