| Index: include/v8-platform.h
|
| diff --git a/include/v8-testing.h b/include/v8-platform.h
|
| similarity index 52%
|
| copy from include/v8-testing.h
|
| copy to include/v8-platform.h
|
| index ba4fcc44ecd0533155cba894a46d5cf8acc06768..75fddd59a873b75db0d05bd1e3fc733b1e1a9265 100644
|
| --- a/include/v8-testing.h
|
| +++ b/include/v8-platform.h
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2010 the V8 project authors. All rights reserved.
|
| +// Copyright 2013 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -25,47 +25,62 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -#ifndef V8_V8_TEST_H_
|
| -#define V8_V8_TEST_H_
|
| +#ifndef V8_V8_PLATFORM_H_
|
| +#define V8_V8_PLATFORM_H_
|
|
|
| #include "v8.h"
|
|
|
| -/**
|
| - * Testing support for the V8 JavaScript engine.
|
| - */
|
| namespace v8 {
|
|
|
| -class V8_EXPORT Testing {
|
| +/**
|
| + * A Task represents a unit of work.
|
| + */
|
| +class Task {
|
| public:
|
| - enum StressType {
|
| - kStressTypeOpt,
|
| - kStressTypeDeopt
|
| - };
|
| + virtual ~Task() {}
|
|
|
| - /**
|
| - * Set the type of stressing to do. The default if not set is kStressTypeOpt.
|
| - */
|
| - static void SetStressRunType(StressType type);
|
| + virtual void Run() = 0;
|
| +};
|
|
|
| +/**
|
| + * V8 Platform abstraction layer.
|
| + *
|
| + * The embedder has to provide an implementation of this interface before
|
| + * initializing the rest of V8.
|
| + */
|
| +class Platform {
|
| + public:
|
| /**
|
| - * Get the number of runs of a given test that is required to get the full
|
| - * stress coverage.
|
| + * This enum is used to indicate whether a task is potentially long running,
|
| + * or causes a long wait. The embedder might want to use this hint to decide
|
| + * whether to execute the task on a dedicated thread.
|
| */
|
| - static int GetStressRuns();
|
| + enum ExpectedRuntime {
|
| + kShortRunningTask,
|
| + kLongRunningTask
|
| + };
|
|
|
| /**
|
| - * Indicate the number of the run which is about to start. The value of run
|
| - * should be between 0 and one less than the result from GetStressRuns()
|
| + * Schedules a task to be invoked on a background thread. |expected_runtime|
|
| + * indicates that the task will run a long time. The Platform implementation
|
| + * takes ownership of |task|. There is no guarantee about order of execution
|
| + * of tasks wrt order of scheduling, nor is there a guarantee about the
|
| + * thread the task will be run on.
|
| */
|
| - static void PrepareStressRun(int run);
|
| + virtual void CallOnBackgroundThread(Task* task,
|
| + ExpectedRuntime expected_runtime) = 0;
|
|
|
| /**
|
| - * Force deoptimization of all functions.
|
| + * Schedules a task to be invoked on a foreground thread wrt a specific
|
| + * |isolate|. Tasks posted for the same isolate should be execute in order of
|
| + * scheduling. The definition of "foreground" is opaque to V8.
|
| */
|
| - static void DeoptimizeAll();
|
| -};
|
| + virtual void CallOnForegroundThread(Isolate* isolate, Task* task) = 0;
|
|
|
| + protected:
|
| + virtual ~Platform() {}
|
| +};
|
|
|
| } // namespace v8
|
|
|
| -#endif // V8_V8_TEST_H_
|
| +#endif // V8_V8_PLATFORM_H_
|
|
|