@@ -129,19 +129,19 @@ class ProfilerStackWalker : public ValueObject {
129129 public:
130130 ProfilerStackWalker (Dart_Port port_id,
131131 Sample* head_sample,
132- SampleBuffer* sample_buffer ,
132+ Isolate* isolate ,
133133 intptr_t skip_count = 0 )
134134 : port_id_(port_id),
135135 sample_ (head_sample),
136- sample_buffer_(sample_buffer ),
136+ isolate_(isolate ),
137137 skip_count_(skip_count),
138138 frames_skipped_(0 ),
139139 frame_index_(0 ),
140140 total_frames_(0 ) {
141141 if (sample_ == nullptr ) {
142- ASSERT (sample_buffer_ == nullptr );
142+ ASSERT (isolate_ == nullptr );
143143 } else {
144- ASSERT (sample_buffer_ != nullptr );
144+ ASSERT (isolate_ != nullptr );
145145 ASSERT (sample_->head_sample ());
146146 }
147147 }
@@ -164,7 +164,7 @@ class ProfilerStackWalker : public ValueObject {
164164 }
165165 ASSERT (sample_ != nullptr );
166166 if (frame_index_ == Sample::kPCArraySizeInWords ) {
167- Sample* new_sample = sample_buffer_-> ReserveSampleAndLink (sample_);
167+ Sample* new_sample = SampleBlock:: ReserveSampleAndLink (sample_, isolate_ );
168168 if (new_sample == nullptr ) {
169169 // Could not reserve new sample- mark this as truncated.
170170 sample_->set_truncated_trace (true );
@@ -183,7 +183,7 @@ class ProfilerStackWalker : public ValueObject {
183183 protected:
184184 Dart_Port port_id_;
185185 Sample* sample_;
186- SampleBuffer* sample_buffer_ ;
186+ Isolate* isolate_ ;
187187 intptr_t skip_count_;
188188 intptr_t frames_skipped_;
189189 intptr_t frame_index_;
@@ -245,14 +245,14 @@ class ProfilerNativeStackWalker : public ProfilerStackWalker {
245245 ProfilerNativeStackWalker (ProfilerCounters* counters,
246246 Dart_Port port_id,
247247 Sample* sample,
248- SampleBuffer* sample_buffer ,
248+ Isolate* isolate ,
249249 uword stack_lower,
250250 uword stack_upper,
251251 uword pc,
252252 uword fp,
253253 uword sp,
254254 intptr_t skip_count = 0 )
255- : ProfilerStackWalker(port_id, sample, sample_buffer , skip_count),
255+ : ProfilerStackWalker(port_id, sample, isolate , skip_count),
256256 counters_ (counters),
257257 stack_upper_(stack_upper),
258258 original_pc_(pc),
@@ -845,10 +845,9 @@ Sample* SampleBlock::ReserveSample() {
845845 return nullptr ;
846846}
847847
848- Sample* SampleBlock::ReserveSampleAndLink (Sample* previous) {
848+ Sample* SampleBlock::ReserveSampleAndLink (Sample* previous, Isolate* isolate ) {
849849 ASSERT (previous != nullptr );
850850 SampleBlockBuffer* buffer = Profiler::sample_block_buffer ();
851- Isolate* isolate = owner_;
852851 ASSERT (isolate != nullptr );
853852 Sample* next = previous->is_allocation_sample ()
854853 ? buffer->ReserveAllocationSample (isolate)
@@ -1050,20 +1049,16 @@ void ClearProfileVisitor::VisitSample(Sample* sample) {
10501049class ProfilerDartStackWalker : public ProfilerStackWalker {
10511050 public:
10521051 ProfilerDartStackWalker (Thread* thread,
1052+ Dart_Port port,
10531053 Sample* sample,
1054- SampleBuffer* sample_buffer ,
1054+ Isolate* isolate ,
10551055 uword pc,
10561056 uword fp,
10571057 uword sp,
10581058 uword lr,
10591059 bool allocation_sample,
10601060 intptr_t skip_count = 0 )
1061- : ProfilerStackWalker((thread->IGNORE_RACE (isolate)() != nullptr)
1062- ? thread->IGNORE_RACE(isolate)()->main_port()
1063- : ILLEGAL_PORT,
1064- sample,
1065- sample_buffer,
1066- skip_count),
1061+ : ProfilerStackWalker(port, sample, isolate, skip_count),
10671062 thread_ (thread),
10681063 pc_(reinterpret_cast <uword*>(pc)),
10691064 fp_(reinterpret_cast <uword*>(fp)),
@@ -1368,7 +1363,7 @@ void Profiler::SampleAllocation(Thread* thread,
13681363 }
13691364
13701365 Sample* sample =
1371- SetupSample (thread, /* allocation_block */ true , os_thread->trace_id ());
1366+ SetupSample (thread, /* allocation_sample= */ true , os_thread->trace_id ());
13721367 if (sample == nullptr ) {
13731368 // We were unable to assign a sample for this allocation.
13741369 counters_.sample_allocation_failure ++;
@@ -1377,16 +1372,16 @@ void Profiler::SampleAllocation(Thread* thread,
13771372 sample->SetAllocationCid (cid);
13781373 sample->set_allocation_identity_hash (identity_hash);
13791374
1375+ Dart_Port port = (isolate != nullptr ) ? isolate->main_port () : ILLEGAL_PORT;
13801376 if (FLAG_profile_vm_allocation) {
1381- ProfilerNativeStackWalker native_stack_walker (
1382- &counters_, (isolate != nullptr ) ? isolate->main_port () : ILLEGAL_PORT,
1383- sample, isolate->current_allocation_sample_block (), stack_lower,
1384- stack_upper, pc, fp, sp);
1377+ ProfilerNativeStackWalker native_stack_walker (&counters_, port, sample,
1378+ isolate, stack_lower,
1379+ stack_upper, pc, fp, sp);
13851380 native_stack_walker.walk ();
13861381 } else if (exited_dart_code) {
1387- ProfilerDartStackWalker dart_exit_stack_walker (
1388- thread, sample, isolate-> current_allocation_sample_block () , pc, fp, sp,
1389- lr, /* allocation_sample*/ true );
1382+ ProfilerDartStackWalker dart_exit_stack_walker (thread, port, sample,
1383+ isolate, pc, fp, sp, lr ,
1384+ /* allocation_sample= */ true );
13901385 dart_exit_stack_walker.walk ();
13911386 } else {
13921387 // Fall back.
@@ -1504,7 +1499,7 @@ void Profiler::SampleThread(Thread* thread,
15041499
15051500 // Setup sample.
15061501 Sample* sample =
1507- SetupSample (thread, /* allocation_block */ false , os_thread->trace_id ());
1502+ SetupSample (thread, /* allocation_sample= */ false , os_thread->trace_id ());
15081503 if (sample == nullptr ) {
15091504 // We were unable to assign a sample for this profiler tick.
15101505 counters_.sample_allocation_failure ++;
@@ -1543,14 +1538,13 @@ void Profiler::SampleThread(Thread* thread,
15431538 }
15441539#endif
15451540
1541+ Dart_Port port = (isolate != nullptr ) ? isolate->main_port () : ILLEGAL_PORT;
15461542 ProfilerNativeStackWalker native_stack_walker (
1547- &counters_, (isolate != nullptr ) ? isolate->main_port () : ILLEGAL_PORT,
1548- sample, isolate->current_sample_block (), stack_lower, stack_upper, pc, fp,
1549- sp);
1543+ &counters_, port, sample, isolate, stack_lower, stack_upper, pc, fp, sp);
15501544 const bool exited_dart_code = thread->IGNORE_RACE2 (HasExitedDartCode)();
1551- ProfilerDartStackWalker dart_stack_walker (
1552- thread, sample, isolate-> current_sample_block (), pc, fp, sp, lr,
1553- /* allocation_sample*/ false );
1545+ ProfilerDartStackWalker dart_stack_walker (thread, port, sample, isolate, pc,
1546+ fp, sp, lr,
1547+ /* allocation_sample= */ false );
15541548
15551549 // All memory access is done inside CollectSample.
15561550 CollectSample (isolate, exited_dart_code, in_dart_code, sample,
@@ -1768,7 +1762,7 @@ ProcessedSample* SampleBuffer::BuildProcessedSample(
17681762 }
17691763
17701764 if (!sample->exit_frame_sample ()) {
1771- processed_sample->FixupCaller (clt, /* pc_marker */ 0 ,
1765+ processed_sample->FixupCaller (clt, /* pc_marker= */ 0 ,
17721766 sample->GetStackBuffer ());
17731767 }
17741768
0 commit comments