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

Side by Side Diff: test/cctest/test-incremental-marking.cc

Issue 1406393005: [test] Move away from deprecated API for heap-related tests. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move delta between last PS1 and PS2 to new API Created 5 years, 1 month 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
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-spaces.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // TODO(jochen): Remove this after the setting is turned on globally.
6 #define V8_IMMINENT_DEPRECATION_WARNINGS
7
5 #include <stdlib.h> 8 #include <stdlib.h>
6 9
7 #ifdef __linux__ 10 #ifdef __linux__
8 #include <errno.h> 11 #include <errno.h>
9 #include <fcntl.h> 12 #include <fcntl.h>
10 #include <sys/stat.h> 13 #include <sys/stat.h>
11 #include <sys/types.h> 14 #include <sys/types.h>
12 #include <unistd.h> 15 #include <unistd.h>
13 #endif 16 #endif
14 17
15 #include <utility> 18 #include <utility>
16 19
17 #include "src/v8.h" 20 #include "src/v8.h"
18 21
19 #include "src/full-codegen/full-codegen.h" 22 #include "src/full-codegen/full-codegen.h"
20 #include "src/global-handles.h" 23 #include "src/global-handles.h"
21 #include "test/cctest/cctest.h" 24 #include "test/cctest/cctest.h"
22 25
23 using v8::IdleTask; 26 using v8::IdleTask;
24 using v8::Task; 27 using v8::Task;
25 using v8::Isolate; 28 using v8::Isolate;
26 29
30 namespace v8 {
31 namespace internal {
27 32
28 class MockPlatform : public v8::Platform { 33 class MockPlatform : public v8::Platform {
29 public: 34 public:
30 explicit MockPlatform(v8::Platform* platform) 35 explicit MockPlatform(v8::Platform* platform)
31 : platform_(platform), idle_task_(nullptr), delayed_task_(nullptr) {} 36 : platform_(platform), idle_task_(nullptr), delayed_task_(nullptr) {}
32 virtual ~MockPlatform() { 37 virtual ~MockPlatform() {
33 delete idle_task_; 38 delete idle_task_;
34 delete delayed_task_; 39 delete delayed_task_;
35 } 40 }
36 41
37 void CallOnBackgroundThread(Task* task, 42 void CallOnBackgroundThread(Task* task,
38 ExpectedRuntime expected_runtime) override { 43 ExpectedRuntime expected_runtime) override {
39 platform_->CallOnBackgroundThread(task, expected_runtime); 44 platform_->CallOnBackgroundThread(task, expected_runtime);
40 } 45 }
41 46
42 void CallOnForegroundThread(Isolate* isolate, Task* task) override { 47 void CallOnForegroundThread(v8::Isolate* isolate, Task* task) override {
43 platform_->CallOnForegroundThread(isolate, task); 48 platform_->CallOnForegroundThread(isolate, task);
44 } 49 }
45 50
46 void CallDelayedOnForegroundThread(Isolate* isolate, Task* task, 51 void CallDelayedOnForegroundThread(v8::Isolate* isolate, Task* task,
47 double delay_in_seconds) override { 52 double delay_in_seconds) override {
48 if (delayed_task_ != nullptr) { 53 if (delayed_task_ != nullptr) {
49 delete delayed_task_; 54 delete delayed_task_;
50 } 55 }
51 delayed_task_ = task; 56 delayed_task_ = task;
52 } 57 }
53 58
54 double MonotonicallyIncreasingTime() override { 59 double MonotonicallyIncreasingTime() override {
55 return platform_->MonotonicallyIncreasingTime(); 60 return platform_->MonotonicallyIncreasingTime();
56 } 61 }
57 62
58 void CallIdleOnForegroundThread(Isolate* isolate, IdleTask* task) override { 63 void CallIdleOnForegroundThread(v8::Isolate* isolate,
64 IdleTask* task) override {
59 CHECK(nullptr == idle_task_); 65 CHECK(nullptr == idle_task_);
60 idle_task_ = task; 66 idle_task_ = task;
61 } 67 }
62 68
63 bool IdleTasksEnabled(Isolate* isolate) override { return true; } 69 bool IdleTasksEnabled(v8::Isolate* isolate) override { return true; }
64 70
65 bool PendingIdleTask() { return idle_task_ != nullptr; } 71 bool PendingIdleTask() { return idle_task_ != nullptr; }
66 72
67 void PerformIdleTask(double idle_time_in_seconds) { 73 void PerformIdleTask(double idle_time_in_seconds) {
68 IdleTask* task = idle_task_; 74 IdleTask* task = idle_task_;
69 idle_task_ = nullptr; 75 idle_task_ = nullptr;
70 task->Run(MonotonicallyIncreasingTime() + idle_time_in_seconds); 76 task->Run(MonotonicallyIncreasingTime() + idle_time_in_seconds);
71 delete task; 77 delete task;
72 } 78 }
73 79
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 165 }
160 // Once we stop notifying idle task progress, the delayed tasks 166 // Once we stop notifying idle task progress, the delayed tasks
161 // should finish marking. 167 // should finish marking.
162 while (!marking->IsStopped() && platform.PendingDelayedTask()) { 168 while (!marking->IsStopped() && platform.PendingDelayedTask()) {
163 platform.PerformDelayedTask(); 169 platform.PerformDelayedTask();
164 } 170 }
165 // There could be pending delayed task from memory reducer after GC finishes. 171 // There could be pending delayed task from memory reducer after GC finishes.
166 CHECK(marking->IsStopped()); 172 CHECK(marking->IsStopped());
167 i::V8::SetPlatformForTesting(old_platform); 173 i::V8::SetPlatformForTesting(old_platform);
168 } 174 }
175
176 } // namespace internal
177 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698