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

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

Issue 396213005: Fix PcDescriptor iteratot to never return a pointer to a memory location since the data can move wi… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/coverage.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/assert.h" 5 #include "platform/assert.h"
6 #include "vm/globals.h" 6 #include "vm/globals.h"
7 7
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/code_descriptors.h" 10 #include "vm/code_descriptors.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 stack_bitmap->Set(2, false); // var k. 252 stack_bitmap->Set(2, false); // var k.
253 stack_bitmap->Set(3, true); // var s2. 253 stack_bitmap->Set(3, true); // var s2.
254 stack_bitmap->Set(4, true); // var s3. 254 stack_bitmap->Set(4, true); // var s3.
255 const Code& code = Code::Handle(function_foo.unoptimized_code()); 255 const Code& code = Code::Handle(function_foo.unoptimized_code());
256 // Search for the pc of the call to 'func'. 256 // Search for the pc of the call to 'func'.
257 const PcDescriptors& descriptors = 257 const PcDescriptors& descriptors =
258 PcDescriptors::Handle(code.pc_descriptors()); 258 PcDescriptors::Handle(code.pc_descriptors());
259 int call_count = 0; 259 int call_count = 0;
260 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kUnoptStaticCall); 260 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kUnoptStaticCall);
261 while (iter.HasNext()) { 261 while (iter.HasNext()) {
262 const RawPcDescriptors::PcDescriptorRec& rec = iter.Next(); 262 const uword pc = iter.NextPc();
263 stackmap_table_builder->AddEntry(rec.pc() - code.EntryPoint(), 263 stackmap_table_builder->AddEntry(pc - code.EntryPoint(),
264 stack_bitmap, 264 stack_bitmap,
265 0); 265 0);
266 ++call_count; 266 ++call_count;
267 } 267 }
268 // We can't easily check that we put the stackmap at the correct pc, but 268 // We can't easily check that we put the stackmap at the correct pc, but
269 // we did if there was exactly one call seen. 269 // we did if there was exactly one call seen.
270 EXPECT(call_count == 1); 270 EXPECT(call_count == 1);
271 const Array& stack_maps = 271 const Array& stack_maps =
272 Array::Handle(stackmap_table_builder->FinalizeStackmaps(code)); 272 Array::Handle(stackmap_table_builder->FinalizeStackmaps(code));
273 code.set_stackmaps(stack_maps); 273 code.set_stackmaps(stack_maps);
274 274
275 // Now invoke 'A.moo' and it will trigger a GC when the native function 275 // Now invoke 'A.moo' and it will trigger a GC when the native function
276 // is called, this should then cause the stack map of function 'A.foo' 276 // is called, this should then cause the stack map of function 'A.foo'
277 // to be traversed and the appropriate objects visited. 277 // to be traversed and the appropriate objects visited.
278 const Object& result = Object::Handle( 278 const Object& result = Object::Handle(
279 DartEntry::InvokeFunction(function_foo, Object::empty_array())); 279 DartEntry::InvokeFunction(function_foo, Object::empty_array()));
280 EXPECT(!result.IsError()); 280 EXPECT(!result.IsError());
281 } 281 }
282 282
283 } // namespace dart 283 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/coverage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698