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

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

Issue 2995543004: [vm, gc] Require a safepoint for heap iteration. (Closed)
Patch Set: explicit-thread Created 3 years, 4 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_graph_test.cc ('k') | runtime/vm/pages.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 #include "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/code_descriptors.h" 9 #include "vm/code_descriptors.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 4049 matching lines...) Expand 10 before | Expand all | Expand 10 after
4060 } 4060 }
4061 4061
4062 private: 4062 private:
4063 GrowableArray<Object*>* objects_; 4063 GrowableArray<Object*>* objects_;
4064 }; 4064 };
4065 4065
4066 ISOLATE_UNIT_TEST_CASE(PrintJSON) { 4066 ISOLATE_UNIT_TEST_CASE(PrintJSON) {
4067 Heap* heap = Isolate::Current()->heap(); 4067 Heap* heap = Isolate::Current()->heap();
4068 heap->CollectAllGarbage(); 4068 heap->CollectAllGarbage();
4069 GrowableArray<Object*> objects; 4069 GrowableArray<Object*> objects;
4070 ObjectAccumulator acc(&objects); 4070 {
4071 heap->IterateObjects(&acc); 4071 HeapIterationScope iteration(Thread::Current());
4072 ObjectAccumulator acc(&objects);
4073 iteration.IterateObjects(&acc);
4074 }
4072 for (intptr_t i = 0; i < objects.length(); ++i) { 4075 for (intptr_t i = 0; i < objects.length(); ++i) {
4073 JSONStream js; 4076 JSONStream js;
4074 objects[i]->PrintJSON(&js, false); 4077 objects[i]->PrintJSON(&js, false);
4075 EXPECT_SUBSTRING("\"type\":", js.ToCString()); 4078 EXPECT_SUBSTRING("\"type\":", js.ToCString());
4076 } 4079 }
4077 } 4080 }
4078 4081
4079 ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) { 4082 ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
4080 char buffer[1024]; 4083 char buffer[1024];
4081 Isolate* isolate = Isolate::Current(); 4084 Isolate* isolate = Isolate::Current();
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
4639 // utf32->utf16 conversion. 4642 // utf32->utf16 conversion.
4640 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff, 4643 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff,
4641 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff}; 4644 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff};
4642 4645
4643 const String& str = 4646 const String& str =
4644 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); 4647 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes)));
4645 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); 4648 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes)));
4646 } 4649 }
4647 4650
4648 } // namespace dart 4651 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_graph_test.cc ('k') | runtime/vm/pages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698