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

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

Issue 2112043002: Land Ivan's change of 'Remove support for verified memory handling' (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address code review comments. Created 4 years, 5 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/jit_optimizer.cc ('k') | 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"
11 #include "vm/json_stream.h" 11 #include "vm/json_stream.h"
12 #include "vm/bitmap.h" 12 #include "vm/bitmap.h"
13 #include "vm/dart.h" 13 #include "vm/dart.h"
14 #include "vm/flags.h" 14 #include "vm/flags.h"
15 #include "vm/globals.h" 15 #include "vm/globals.h"
16 #include "vm/growable_array.h" 16 #include "vm/growable_array.h"
17 #include "vm/handles.h" 17 #include "vm/handles.h"
18 #include "vm/heap.h" 18 #include "vm/heap.h"
19 #include "vm/isolate.h" 19 #include "vm/isolate.h"
20 #include "vm/method_recognizer.h" 20 #include "vm/method_recognizer.h"
21 #include "vm/os.h" 21 #include "vm/os.h"
22 #include "vm/raw_object.h" 22 #include "vm/raw_object.h"
23 #include "vm/report.h" 23 #include "vm/report.h"
24 #include "vm/scanner.h" 24 #include "vm/scanner.h"
25 #include "vm/tags.h" 25 #include "vm/tags.h"
26 #include "vm/thread.h" 26 #include "vm/thread.h"
27 #include "vm/token_position.h" 27 #include "vm/token_position.h"
28 #include "vm/verified_memory.h"
29 28
30 namespace dart { 29 namespace dart {
31 30
32 // Forward declarations. 31 // Forward declarations.
33 #define DEFINE_FORWARD_DECLARATION(clazz) \ 32 #define DEFINE_FORWARD_DECLARATION(clazz) \
34 class clazz; 33 class clazz;
35 CLASS_LIST(DEFINE_FORWARD_DECLARATION) 34 CLASS_LIST(DEFINE_FORWARD_DECLARATION)
36 #undef DEFINE_FORWARD_DECLARATION 35 #undef DEFINE_FORWARD_DECLARATION
37 class Api; 36 class Api;
38 class ArgumentsDescriptor; 37 class ArgumentsDescriptor;
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } 647 }
649 648
650 // Store a range of pointers [from, from + count) into [to, to + count). 649 // Store a range of pointers [from, from + count) into [to, to + count).
651 // TODO(koda): Use this to fix Object::Clone's broken store buffer logic. 650 // TODO(koda): Use this to fix Object::Clone's broken store buffer logic.
652 void StorePointers(RawObject* const* to, 651 void StorePointers(RawObject* const* to,
653 RawObject* const* from, 652 RawObject* const* from,
654 intptr_t count) { 653 intptr_t count) {
655 ASSERT(Contains(reinterpret_cast<uword>(to))); 654 ASSERT(Contains(reinterpret_cast<uword>(to)));
656 if (raw()->IsNewObject()) { 655 if (raw()->IsNewObject()) {
657 memmove(const_cast<RawObject**>(to), from, count * kWordSize); 656 memmove(const_cast<RawObject**>(to), from, count * kWordSize);
658 VerifiedMemory::Accept(reinterpret_cast<uword>(to), count * kWordSize);
659 } else { 657 } else {
660 for (intptr_t i = 0; i < count; ++i) { 658 for (intptr_t i = 0; i < count; ++i) {
661 StorePointer(&to[i], from[i]); 659 StorePointer(&to[i], from[i]);
662 } 660 }
663 } 661 }
664 } 662 }
665 663
666 // Use for storing into an explicitly Smi-typed field of an object 664 // Use for storing into an explicitly Smi-typed field of an object
667 // (i.e., both the previous and new value are Smis). 665 // (i.e., both the previous and new value are Smis).
668 void StoreSmi(RawSmi* const* addr, RawSmi* value) const { 666 void StoreSmi(RawSmi* const* addr, RawSmi* value) const {
(...skipping 6764 matching lines...) Expand 10 before | Expand all | Expand 10 after
7433 NoSafepointScope no_safepoint; 7431 NoSafepointScope no_safepoint;
7434 ASSERT(!IsNull()); 7432 ASSERT(!IsNull());
7435 ASSERT(index < Length()); 7433 ASSERT(index < Length());
7436 return *ObjectAddr(index); 7434 return *ObjectAddr(index);
7437 } 7435 }
7438 void SetAt(intptr_t index, const Object& value) const { 7436 void SetAt(intptr_t index, const Object& value) const {
7439 ASSERT(!IsNull()); 7437 ASSERT(!IsNull());
7440 ASSERT(index < Length()); 7438 ASSERT(index < Length());
7441 7439
7442 // TODO(iposva): Add storing NoSafepointScope. 7440 // TODO(iposva): Add storing NoSafepointScope.
7443 DataStorePointer(ObjectAddr(index), value.raw()); 7441 data()->StorePointer(ObjectAddr(index), value.raw());
7444 } 7442 }
7445 7443
7446 void Add(const Object& value, Heap::Space space = Heap::kNew) const; 7444 void Add(const Object& value, Heap::Space space = Heap::kNew) const;
7447 7445
7448 void Grow(intptr_t new_capacity, Heap::Space space = Heap::kNew) const; 7446 void Grow(intptr_t new_capacity, Heap::Space space = Heap::kNew) const;
7449 RawObject* RemoveLast() const; 7447 RawObject* RemoveLast() const;
7450 7448
7451 virtual RawTypeArguments* GetTypeArguments() const { 7449 virtual RawTypeArguments* GetTypeArguments() const {
7452 return raw_ptr()->type_arguments_; 7450 return raw_ptr()->type_arguments_;
7453 } 7451 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
7503 Heap::Space space = Heap::kNew); 7501 Heap::Space space = Heap::kNew);
7504 static RawGrowableObjectArray* New(const Array& array, 7502 static RawGrowableObjectArray* New(const Array& array,
7505 Heap::Space space = Heap::kNew); 7503 Heap::Space space = Heap::kNew);
7506 7504
7507 private: 7505 private:
7508 RawArray* DataArray() const { return data()->ptr(); } 7506 RawArray* DataArray() const { return data()->ptr(); }
7509 RawObject** ObjectAddr(intptr_t index) const { 7507 RawObject** ObjectAddr(intptr_t index) const {
7510 ASSERT((index >= 0) && (index < Length())); 7508 ASSERT((index >= 0) && (index < Length()));
7511 return &(DataArray()->data()[index]); 7509 return &(DataArray()->data()[index]);
7512 } 7510 }
7513 void DataStorePointer(RawObject** addr, RawObject* value) const {
7514 data()->StorePointer(addr, value);
7515 }
7516 7511
7517 static const int kDefaultInitialCapacity = 4; 7512 static const int kDefaultInitialCapacity = 4;
7518 7513
7519 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance); 7514 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance);
7520 friend class Array; 7515 friend class Array;
7521 friend class Class; 7516 friend class Class;
7522 }; 7517 };
7523 7518
7524 7519
7525 class Float32x4 : public Instance { 7520 class Float32x4 : public Instance {
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
8738 8733
8739 inline void TypeArguments::SetHash(intptr_t value) const { 8734 inline void TypeArguments::SetHash(intptr_t value) const {
8740 // This is only safe because we create a new Smi, which does not cause 8735 // This is only safe because we create a new Smi, which does not cause
8741 // heap allocation. 8736 // heap allocation.
8742 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8737 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8743 } 8738 }
8744 8739
8745 } // namespace dart 8740 } // namespace dart
8746 8741
8747 #endif // VM_OBJECT_H_ 8742 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/jit_optimizer.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698