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/stack_frame.cc

Issue 1858283002: Initial SIMDBC interpreter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
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 "platform/memory_sanitizer.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/deopt_instructions.h" 9 #include "vm/deopt_instructions.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 } 62 }
63 63
64 64
65 void ExitFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { 65 void ExitFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) {
66 // There are no objects to visit in this frame. 66 // There are no objects to visit in this frame.
67 } 67 }
68 68
69 69
70 void EntryFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { 70 void EntryFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) {
71 #if !defined(TARGET_ARCH_DBC)
71 ASSERT(thread() == Thread::Current()); 72 ASSERT(thread() == Thread::Current());
72 // Visit objects between SP and (FP - callee_save_area). 73 // Visit objects between SP and (FP - callee_save_area).
73 ASSERT(visitor != NULL); 74 ASSERT(visitor != NULL);
74 RawObject** first = reinterpret_cast<RawObject**>(sp()); 75 RawObject** first = reinterpret_cast<RawObject**>(sp());
75 RawObject** last = reinterpret_cast<RawObject**>( 76 RawObject** last = reinterpret_cast<RawObject**>(
76 fp() + (kExitLinkSlotFromEntryFp - 1) * kWordSize); 77 fp() + (kExitLinkSlotFromEntryFp - 1) * kWordSize);
77 visitor->VisitPointers(first, last); 78 visitor->VisitPointers(first, last);
79 #else
80 RawObject** first = reinterpret_cast<RawObject**>(fp());
81 RawObject** last = reinterpret_cast<RawObject**>(sp());
82 visitor->VisitPointers(first, last);
83 #endif
78 } 84 }
79 85
80 86
81 void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) { 87 void StackFrame::VisitObjectPointers(ObjectPointerVisitor* visitor) {
88 #if !defined(TARGET_ARCH_DBC)
82 // NOTE: This code runs while GC is in progress and runs within 89 // NOTE: This code runs while GC is in progress and runs within
83 // a NoHandleScope block. Hence it is not ok to use regular Zone or 90 // a NoHandleScope block. Hence it is not ok to use regular Zone or
84 // Scope handles. We use direct stack handles, the raw pointers in 91 // Scope handles. We use direct stack handles, the raw pointers in
85 // these handles are not traversed. The use of handles is mainly to 92 // these handles are not traversed. The use of handles is mainly to
86 // be able to reuse the handle based code and avoid having to add 93 // be able to reuse the handle based code and avoid having to add
87 // helper functions to the raw object interface. 94 // helper functions to the raw object interface.
88 ASSERT(thread() == Thread::Current()); 95 ASSERT(thread() == Thread::Current());
89 ASSERT(visitor != NULL); 96 ASSERT(visitor != NULL);
90 NoSafepointScope no_safepoint; 97 NoSafepointScope no_safepoint;
91 Code code; 98 Code code;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 visitor->VisitPointers(first, last); 157 visitor->VisitPointers(first, last);
151 return; 158 return;
152 } 159 }
153 } 160 }
154 // For normal unoptimized Dart frames and Stub frames each slot 161 // For normal unoptimized Dart frames and Stub frames each slot
155 // between the first and last included are tagged objects. 162 // between the first and last included are tagged objects.
156 RawObject** first = reinterpret_cast<RawObject**>(sp()); 163 RawObject** first = reinterpret_cast<RawObject**>(sp());
157 RawObject** last = reinterpret_cast<RawObject**>( 164 RawObject** last = reinterpret_cast<RawObject**>(
158 fp() + (kFirstObjectSlotFromFp * kWordSize)); 165 fp() + (kFirstObjectSlotFromFp * kWordSize));
159 visitor->VisitPointers(first, last); 166 visitor->VisitPointers(first, last);
167 #else
168 RawObject** first = reinterpret_cast<RawObject**>(sp());
169 RawObject** last = reinterpret_cast<RawObject**>(
170 fp() + (kFirstObjectSlotFromFp * kWordSize));
171 visitor->VisitPointers(last, first);
172 #endif
160 } 173 }
161 174
162 175
163 RawFunction* StackFrame::LookupDartFunction() const { 176 RawFunction* StackFrame::LookupDartFunction() const {
164 const Code& code = Code::Handle(LookupDartCode()); 177 const Code& code = Code::Handle(LookupDartCode());
165 if (!code.IsNull()) { 178 if (!code.IsNull()) {
166 return code.function(); 179 return code.function();
167 } 180 }
168 return Function::null(); 181 return Function::null();
169 } 182 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 current_frame_(NULL), 323 current_frame_(NULL),
311 thread_(thread) { 324 thread_(thread) {
312 ASSERT((thread_ == Thread::Current()) || 325 ASSERT((thread_ == Thread::Current()) ||
313 OS::AllowStackFrameIteratorFromAnotherThread()); 326 OS::AllowStackFrameIteratorFromAnotherThread());
314 frames_.fp_ = last_fp; 327 frames_.fp_ = last_fp;
315 frames_.sp_ = 0; 328 frames_.sp_ = 0;
316 frames_.pc_ = 0; 329 frames_.pc_ = 0;
317 } 330 }
318 331
319 332
333 #if !defined(TARGET_ARCH_DBC)
320 StackFrameIterator::StackFrameIterator(uword fp, uword sp, uword pc, 334 StackFrameIterator::StackFrameIterator(uword fp, uword sp, uword pc,
321 bool validate, Thread* thread) 335 bool validate, Thread* thread)
322 : validate_(validate), 336 : validate_(validate),
323 entry_(thread), 337 entry_(thread),
324 exit_(thread), 338 exit_(thread),
325 frames_(thread), 339 frames_(thread),
326 current_frame_(NULL), 340 current_frame_(NULL),
327 thread_(thread) { 341 thread_(thread) {
328 ASSERT((thread_ == Thread::Current()) || 342 ASSERT((thread_ == Thread::Current()) ||
329 OS::AllowStackFrameIteratorFromAnotherThread()); 343 OS::AllowStackFrameIteratorFromAnotherThread());
330 frames_.fp_ = fp; 344 frames_.fp_ = fp;
331 frames_.sp_ = sp; 345 frames_.sp_ = sp;
332 frames_.pc_ = pc; 346 frames_.pc_ = pc;
333 } 347 }
348 #endif
334 349
335 350
336 StackFrame* StackFrameIterator::NextFrame() { 351 StackFrame* StackFrameIterator::NextFrame() {
337 // When we are at the start of iteration after having created an 352 // When we are at the start of iteration after having created an
338 // iterator object, current_frame_ will be NULL as we haven't seen 353 // iterator object, current_frame_ will be NULL as we haven't seen
339 // any frames yet (unless we start iterating in the simulator from a given 354 // any frames yet (unless we start iterating in the simulator from a given
340 // triplet of fp, sp, and pc). At this point, if NextFrame is called, it tries 355 // triplet of fp, sp, and pc). At this point, if NextFrame is called, it tries
341 // to set up the next exit frame by reading the top_exit_frame_info 356 // to set up the next exit frame by reading the top_exit_frame_info
342 // from the isolate. If we do not have any dart invocations yet, 357 // from the isolate. If we do not have any dart invocations yet,
343 // top_exit_frame_info will be 0 and so we would return NULL. 358 // top_exit_frame_info will be 0 and so we would return NULL.
344 359
345 // current_frame_ will also be NULL, when we are at the end of having 360 // current_frame_ will also be NULL, when we are at the end of having
346 // iterated through all the frames. If NextFrame is called at this 361 // iterated through all the frames. If NextFrame is called at this
347 // point, we will try and set up the next exit frame, but since we are 362 // point, we will try and set up the next exit frame, but since we are
348 // at the end of the iteration, fp_ will be 0 and we would return NULL. 363 // at the end of the iteration, fp_ will be 0 and we would return NULL.
349 if (current_frame_ == NULL) { 364 if (current_frame_ == NULL) {
350 if (!HasNextFrame()) { 365 if (!HasNextFrame()) {
351 return NULL; 366 return NULL;
352 } 367 }
353 UnpoisonStack(frames_.fp_); 368 UnpoisonStack(frames_.fp_);
369 #if !defined(TARGET_ARCH_DBC)
354 if (frames_.pc_ == 0) { 370 if (frames_.pc_ == 0) {
355 // Iteration starts from an exit frame given by its fp. 371 // Iteration starts from an exit frame given by its fp.
356 current_frame_ = NextExitFrame(); 372 current_frame_ = NextExitFrame();
357 } else if (*(reinterpret_cast<uword*>( 373 } else if (*(reinterpret_cast<uword*>(
358 frames_.fp_ + (kSavedCallerFpSlotFromFp * kWordSize))) == 0) { 374 frames_.fp_ + (kSavedCallerFpSlotFromFp * kWordSize))) == 0) {
359 // Iteration starts from an entry frame given by its fp, sp, and pc. 375 // Iteration starts from an entry frame given by its fp, sp, and pc.
360 current_frame_ = NextEntryFrame(); 376 current_frame_ = NextEntryFrame();
361 } else { 377 } else {
362 // Iteration starts from a Dart or stub frame given by its fp, sp, and pc. 378 // Iteration starts from a Dart or stub frame given by its fp, sp, and pc.
363 current_frame_ = frames_.NextFrame(validate_); 379 current_frame_ = frames_.NextFrame(validate_);
364 } 380 }
381 #else
382 current_frame_ = NextExitFrame();
383 #endif
365 return current_frame_; 384 return current_frame_;
366 } 385 }
367 ASSERT((validate_ == kDontValidateFrames) || current_frame_->IsValid()); 386 ASSERT((validate_ == kDontValidateFrames) || current_frame_->IsValid());
368 if (current_frame_->IsEntryFrame()) { 387 if (current_frame_->IsEntryFrame()) {
369 if (HasNextFrame()) { // We have another chained block. 388 if (HasNextFrame()) { // We have another chained block.
370 current_frame_ = NextExitFrame(); 389 current_frame_ = NextExitFrame();
371 return current_frame_; 390 return current_frame_;
372 } 391 }
373 current_frame_ = NULL; // No more frames. 392 current_frame_ = NULL; // No more frames.
374 return current_frame_; 393 return current_frame_;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { 509 if (deopt_instr->kind() == DeoptInstr::kCallerFp) {
491 return (index - num_materializations_); 510 return (index - num_materializations_);
492 } 511 }
493 } 512 }
494 UNREACHABLE(); 513 UNREACHABLE();
495 return 0; 514 return 0;
496 } 515 }
497 516
498 517
499 } // namespace dart 518 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698