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

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

Issue 816123002: MemorySanitizer support. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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
« runtime/platform/memory_sanitizer.h ('K') | « runtime/vm/scavenger.cc ('k') | no next file » | 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 "vm/stack_frame.h" 5 #include "vm/stack_frame.h"
6 6
7 #include "platform/memory_sanitizer.h"
7 #include "vm/assembler.h" 8 #include "vm/assembler.h"
8 #include "vm/deopt_instructions.h" 9 #include "vm/deopt_instructions.h"
9 #include "vm/isolate.h" 10 #include "vm/isolate.h"
10 #include "vm/object.h" 11 #include "vm/object.h"
11 #include "vm/object_store.h" 12 #include "vm/object_store.h"
12 #include "vm/os.h" 13 #include "vm/os.h"
13 #include "vm/parser.h" 14 #include "vm/parser.h"
14 #include "vm/raw_object.h" 15 #include "vm/raw_object.h"
15 #include "vm/reusable_handles.h" 16 #include "vm/reusable_handles.h"
16 #include "vm/stub_code.h" 17 #include "vm/stub_code.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 272
272 void StackFrameIterator::SetupNextExitFrameData() { 273 void StackFrameIterator::SetupNextExitFrameData() {
273 uword exit_address = entry_.fp() + (kExitLinkSlotFromEntryFp * kWordSize); 274 uword exit_address = entry_.fp() + (kExitLinkSlotFromEntryFp * kWordSize);
274 uword exit_marker = *reinterpret_cast<uword*>(exit_address); 275 uword exit_marker = *reinterpret_cast<uword*>(exit_address);
275 frames_.fp_ = exit_marker; 276 frames_.fp_ = exit_marker;
276 frames_.sp_ = 0; 277 frames_.sp_ = 0;
277 frames_.pc_ = 0; 278 frames_.pc_ = 0;
278 } 279 }
279 280
280 281
282 // Tell MemorySanitizer that generated code initializes part of the stack.
283 // TODO(koda): Limit to frames that are actually written by generated code.
284 static void UnpoisonStack(Isolate* isolate) {
siva 2014/12/22 17:01:53 ASSERT(isolate->stack_limit() != ~static_cast<uwor
koda 2014/12/22 23:05:52 Changed to instead take an explicit 'fp' argument,
285 __msan_unpoison(reinterpret_cast<void*>(isolate->stack_limit()),
286 isolate->GetSpecifiedStackSize());
287 }
288
289
281 StackFrameIterator::StackFrameIterator(bool validate, Isolate* isolate) 290 StackFrameIterator::StackFrameIterator(bool validate, Isolate* isolate)
282 : validate_(validate), 291 : validate_(validate),
283 entry_(isolate), 292 entry_(isolate),
284 exit_(isolate), 293 exit_(isolate),
285 frames_(isolate), 294 frames_(isolate),
286 current_frame_(NULL), 295 current_frame_(NULL),
287 isolate_(isolate) { 296 isolate_(isolate) {
288 ASSERT((isolate_ == Isolate::Current()) || 297 ASSERT((isolate_ == Isolate::Current()) ||
289 OS::AllowStackFrameIteratorFromAnotherThread()); 298 OS::AllowStackFrameIteratorFromAnotherThread());
299 UnpoisonStack(isolate);
290 SetupLastExitFrameData(); // Setup data for last exit frame. 300 SetupLastExitFrameData(); // Setup data for last exit frame.
291 } 301 }
292 302
293 303
294 StackFrameIterator::StackFrameIterator(uword last_fp, bool validate, 304 StackFrameIterator::StackFrameIterator(uword last_fp, bool validate,
295 Isolate* isolate) 305 Isolate* isolate)
296 : validate_(validate), 306 : validate_(validate),
297 entry_(isolate), 307 entry_(isolate),
298 exit_(isolate), 308 exit_(isolate),
299 frames_(isolate), 309 frames_(isolate),
300 current_frame_(NULL), 310 current_frame_(NULL),
301 isolate_(isolate) { 311 isolate_(isolate) {
302 ASSERT((isolate_ == Isolate::Current()) || 312 ASSERT((isolate_ == Isolate::Current()) ||
303 OS::AllowStackFrameIteratorFromAnotherThread()); 313 OS::AllowStackFrameIteratorFromAnotherThread());
314 UnpoisonStack(isolate);
304 frames_.fp_ = last_fp; 315 frames_.fp_ = last_fp;
305 frames_.sp_ = 0; 316 frames_.sp_ = 0;
306 frames_.pc_ = 0; 317 frames_.pc_ = 0;
307 } 318 }
308 319
309 320
310 StackFrameIterator::StackFrameIterator(uword fp, uword sp, uword pc, 321 StackFrameIterator::StackFrameIterator(uword fp, uword sp, uword pc,
311 bool validate, Isolate* isolate) 322 bool validate, Isolate* isolate)
312 : validate_(validate), 323 : validate_(validate),
313 entry_(isolate), 324 entry_(isolate),
314 exit_(isolate), 325 exit_(isolate),
315 frames_(isolate), 326 frames_(isolate),
316 current_frame_(NULL), 327 current_frame_(NULL),
317 isolate_(isolate) { 328 isolate_(isolate) {
318 ASSERT((isolate_ == Isolate::Current()) || 329 ASSERT((isolate_ == Isolate::Current()) ||
319 OS::AllowStackFrameIteratorFromAnotherThread()); 330 OS::AllowStackFrameIteratorFromAnotherThread());
331 UnpoisonStack(isolate);
320 frames_.fp_ = fp; 332 frames_.fp_ = fp;
321 frames_.sp_ = sp; 333 frames_.sp_ = sp;
322 frames_.pc_ = pc; 334 frames_.pc_ = pc;
323 } 335 }
324 336
325 337
326 StackFrame* StackFrameIterator::NextFrame() { 338 StackFrame* StackFrameIterator::NextFrame() {
327 // When we are at the start of iteration after having created an 339 // When we are at the start of iteration after having created an
328 // iterator object, current_frame_ will be NULL as we haven't seen 340 // iterator object, current_frame_ will be NULL as we haven't seen
329 // any frames yet (unless we start iterating in the simulator from a given 341 // any frames yet (unless we start iterating in the simulator from a given
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { 491 if (deopt_instr->kind() == DeoptInstr::kCallerFp) {
480 return (index - num_materializations_); 492 return (index - num_materializations_);
481 } 493 }
482 } 494 }
483 UNREACHABLE(); 495 UNREACHABLE();
484 return 0; 496 return 0;
485 } 497 }
486 498
487 499
488 } // namespace dart 500 } // namespace dart
OLDNEW
« runtime/platform/memory_sanitizer.h ('K') | « runtime/vm/scavenger.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698