OLD | NEW |
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/isolate.h" | 6 #include "vm/isolate.h" |
7 #include "vm/lockers.h" | 7 #include "vm/lockers.h" |
8 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
9 #include "vm/profiler.h" | 9 #include "vm/profiler.h" |
10 #include "vm/safepoint.h" | 10 #include "vm/safepoint.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 | 105 |
106 class TaskWithZoneAllocation : public ThreadPool::Task { | 106 class TaskWithZoneAllocation : public ThreadPool::Task { |
107 public: | 107 public: |
108 TaskWithZoneAllocation(Isolate* isolate, | 108 TaskWithZoneAllocation(Isolate* isolate, |
109 Monitor* monitor, | 109 Monitor* monitor, |
110 bool* done, | 110 bool* done, |
111 intptr_t id) | 111 intptr_t id) |
112 : isolate_(isolate), monitor_(monitor), done_(done), id_(id) {} | 112 : isolate_(isolate), monitor_(monitor), done_(done), id_(id) {} |
113 virtual void Run() { | 113 virtual void Run() { |
114 Thread::EnterIsolateAsHelper(isolate_); | 114 Thread::EnterIsolateAsHelper(isolate_, Thread::kUnknownTask); |
115 { | 115 { |
116 Thread* thread = Thread::Current(); | 116 Thread* thread = Thread::Current(); |
117 // Create a zone (which is also a stack resource) and exercise it a bit. | 117 // Create a zone (which is also a stack resource) and exercise it a bit. |
118 StackZone stack_zone(thread); | 118 StackZone stack_zone(thread); |
119 HANDLESCOPE(thread); | 119 HANDLESCOPE(thread); |
120 Zone* zone = thread->zone(); | 120 Zone* zone = thread->zone(); |
121 EXPECT_EQ(zone, stack_zone.GetZone()); | 121 EXPECT_EQ(zone, stack_zone.GetZone()); |
122 ZoneGrowableArray<bool>* a0 = new(zone) ZoneGrowableArray<bool>(zone, 1); | 122 ZoneGrowableArray<bool>* a0 = new(zone) ZoneGrowableArray<bool>(zone, 1); |
123 GrowableArray<bool> a1(zone, 1); | 123 GrowableArray<bool> a1(zone, 1); |
124 for (intptr_t i = 0; i < 100000; ++i) { | 124 for (intptr_t i = 0; i < 100000; ++i) { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 intptr_t* total_done, | 252 intptr_t* total_done, |
253 intptr_t* exited) | 253 intptr_t* exited) |
254 : isolate_(isolate), | 254 : isolate_(isolate), |
255 monitor_(monitor), | 255 monitor_(monitor), |
256 expected_count_(expected_count), | 256 expected_count_(expected_count), |
257 total_done_(total_done), | 257 total_done_(total_done), |
258 exited_(exited), | 258 exited_(exited), |
259 local_done_(false) {} | 259 local_done_(false) {} |
260 | 260 |
261 virtual void Run() { | 261 virtual void Run() { |
262 Thread::EnterIsolateAsHelper(isolate_); | 262 Thread::EnterIsolateAsHelper(isolate_, Thread::kUnknownTask); |
263 { | 263 { |
264 MonitorLocker ml(monitor_); | 264 MonitorLocker ml(monitor_); |
265 ++*expected_count_; | 265 ++*expected_count_; |
266 } | 266 } |
267 Thread* thread = Thread::Current(); | 267 Thread* thread = Thread::Current(); |
268 for (int i = reinterpret_cast<intptr_t>(thread); ; ++i) { | 268 for (int i = reinterpret_cast<intptr_t>(thread); ; ++i) { |
269 StackZone stack_zone(thread); | 269 StackZone stack_zone(thread); |
270 Zone* zone = thread->zone(); | 270 Zone* zone = thread->zone(); |
271 HANDLESCOPE(thread); | 271 HANDLESCOPE(thread); |
272 const intptr_t kUniqueSmi = 928327281; | 272 const intptr_t kUniqueSmi = 928327281; |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 public: | 527 public: |
528 AllocAndGCTask(Isolate* isolate, | 528 AllocAndGCTask(Isolate* isolate, |
529 Monitor* done_monitor, | 529 Monitor* done_monitor, |
530 bool* done) | 530 bool* done) |
531 : isolate_(isolate), | 531 : isolate_(isolate), |
532 done_monitor_(done_monitor), | 532 done_monitor_(done_monitor), |
533 done_(done) { | 533 done_(done) { |
534 } | 534 } |
535 | 535 |
536 virtual void Run() { | 536 virtual void Run() { |
537 Thread::EnterIsolateAsHelper(isolate_); | 537 Thread::EnterIsolateAsHelper(isolate_, Thread::kUnknownTask); |
538 { | 538 { |
539 Thread* thread = Thread::Current(); | 539 Thread* thread = Thread::Current(); |
540 StackZone stack_zone(thread); | 540 StackZone stack_zone(thread); |
541 Zone* zone = stack_zone.GetZone(); | 541 Zone* zone = stack_zone.GetZone(); |
542 HANDLESCOPE(thread); | 542 HANDLESCOPE(thread); |
543 String& old_str = String::Handle(zone, String::New("old", Heap::kOld)); | 543 String& old_str = String::Handle(zone, String::New("old", Heap::kOld)); |
544 isolate_->heap()->CollectAllGarbage(); | 544 isolate_->heap()->CollectAllGarbage(); |
545 EXPECT(old_str.Equals("old")); | 545 EXPECT(old_str.Equals("old")); |
546 } | 546 } |
547 Thread::ExitIsolateAsHelper(); | 547 Thread::ExitIsolateAsHelper(); |
(...skipping 23 matching lines...) Expand all Loading... |
571 TransitionVMToBlocked transition(thread); | 571 TransitionVMToBlocked transition(thread); |
572 MonitorLocker ml(&done_monitor); | 572 MonitorLocker ml(&done_monitor); |
573 if (done) { | 573 if (done) { |
574 break; | 574 break; |
575 } | 575 } |
576 } | 576 } |
577 } | 577 } |
578 } | 578 } |
579 | 579 |
580 } // namespace dart | 580 } // namespace dart |
OLD | NEW |