[objects.h splitting] Move Microtask-related classes.

BUG=v8:5402,v8:7310

Change-Id: I5861e6508668a751e458216961edd1a03192236b
Reviewed-on: https://chromium-review.googlesource.com/934282
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51591}
This commit is contained in:
Marja Hölttä 2018-02-27 09:58:10 +01:00 committed by Commit Bot
parent fc23e97467
commit 10d8aab1de
12 changed files with 118 additions and 66 deletions

View File

@ -1872,6 +1872,8 @@ v8_source_set("v8_base") {
"src/objects/literal-objects.h",
"src/objects/map-inl.h",
"src/objects/map.h",
"src/objects/microtask-inl.h",
"src/objects/microtask.h",
"src/objects/module-inl.h",
"src/objects/module.cc",
"src/objects/module.h",

View File

@ -17,6 +17,7 @@
#include "src/objects/bigint.h"
#include "src/objects/debug-objects-inl.h"
#include "src/objects/frame-array-inl.h"
#include "src/objects/microtask-inl.h"
#include "src/objects/module.h"
#include "src/objects/promise-inl.h"
#include "src/objects/scope-info.h"

View File

@ -27,6 +27,8 @@ class AliasedArgumentsEntry;
class BreakPointInfo;
class BreakPoint;
class BoilerplateDescription;
class CallableTask;
class CallbackTask;
class ConstantElementsPair;
class CoverageInfo;
class DebugInfo;

View File

@ -80,6 +80,7 @@ class InnerPointerToCodeCache;
class InstructionStream;
class Logger;
class MaterializedObjectStore;
class Microtask;
class OptimizingCompileDispatcher;
class PromiseOnStack;
class Redirection;

View File

@ -17,6 +17,7 @@
#include "src/objects/data-handler-inl.h"
#include "src/objects/debug-objects-inl.h"
#include "src/objects/literal-objects.h"
#include "src/objects/microtask-inl.h"
#include "src/objects/module.h"
#include "src/objects/promise-inl.h"
#include "src/ostreams.h"

View File

@ -575,7 +575,6 @@ CAST_ACCESSOR(AllocationSite)
CAST_ACCESSOR(AsyncGeneratorRequest)
CAST_ACCESSOR(BigInt)
CAST_ACCESSOR(BoilerplateDescription)
CAST_ACCESSOR(CallbackTask)
CAST_ACCESSOR(CallHandlerInfo)
CAST_ACCESSOR(Cell)
CAST_ACCESSOR(ConstantElementsPair)
@ -584,7 +583,6 @@ CAST_ACCESSOR(DescriptorArray)
CAST_ACCESSOR(EnumCache)
CAST_ACCESSOR(FeedbackCell)
CAST_ACCESSOR(Foreign)
CAST_ACCESSOR(CallableTask)
CAST_ACCESSOR(FunctionTemplateInfo)
CAST_ACCESSOR(GlobalDictionary)
CAST_ACCESSOR(HeapObject)
@ -605,7 +603,6 @@ CAST_ACCESSOR(JSReceiver)
CAST_ACCESSOR(JSStringIterator)
CAST_ACCESSOR(JSValue)
CAST_ACCESSOR(LayoutDescriptor)
CAST_ACCESSOR(Microtask)
CAST_ACCESSOR(NameDictionary)
CAST_ACCESSOR(NormalizedMapCache)
CAST_ACCESSOR(NumberDictionary)
@ -2795,12 +2792,6 @@ SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset)
SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset)
SMI_ACCESSORS(JSMessageObject, error_level, kErrorLevelOffset)
ACCESSORS(CallableTask, callable, JSReceiver, kCallableOffset)
ACCESSORS(CallableTask, context, Context, kContextOffset)
ACCESSORS(CallbackTask, callback, Foreign, kCallbackOffset)
ACCESSORS(CallbackTask, data, Foreign, kDataOffset)
ElementsKind JSObject::GetElementsKind() {
ElementsKind kind = map()->elements_kind();
#if VERIFY_HEAP && DEBUG

View File

@ -13,6 +13,7 @@
#include "src/interpreter/bytecodes.h"
#include "src/objects-inl.h"
#include "src/objects/debug-objects-inl.h"
#include "src/objects/microtask-inl.h"
#include "src/objects/promise-inl.h"
#include "src/ostreams.h"
#include "src/regexp/jsregexp.h"

View File

@ -60,6 +60,7 @@
#include "src/objects/frame-array-inl.h"
#include "src/objects/hash-table.h"
#include "src/objects/map.h"
#include "src/objects/microtask-inl.h"
#include "src/objects/promise-inl.h"
#include "src/parsing/preparsed-scope-data.h"
#include "src/property-descriptor.h"

View File

@ -2890,62 +2890,6 @@ class Tuple3 : public Tuple2 {
DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple3);
};
// Abstract base class for all microtasks that can be scheduled on the
// microtask queue. This class merely serves the purpose of a marker
// interface.
class Microtask : public Struct {
public:
// Dispatched behavior.
DECL_CAST(Microtask)
DECL_VERIFIER(Microtask)
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Microtask);
};
// A CallbackTask is a special Microtask that allows us to schedule
// C++ microtask callbacks on the microtask queue. This is heavily
// used by Blink for example.
class CallbackTask : public Microtask {
public:
DECL_ACCESSORS(callback, Foreign)
DECL_ACCESSORS(data, Foreign)
static const int kCallbackOffset = Microtask::kHeaderSize;
static const int kDataOffset = kCallbackOffset + kPointerSize;
static const int kSize = kDataOffset + kPointerSize;
// Dispatched behavior.
DECL_CAST(CallbackTask)
DECL_PRINTER(CallbackTask)
DECL_VERIFIER(CallbackTask)
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(CallbackTask)
};
// A CallableTask is a special (internal) Microtask that allows us to
// schedule arbitrary callables on the microtask queue. We use this
// for various tests of the microtask queue.
class CallableTask : public Microtask {
public:
DECL_ACCESSORS(callable, JSReceiver)
DECL_ACCESSORS(context, Context)
static const int kCallableOffset = Microtask::kHeaderSize;
static const int kContextOffset = kCallableOffset + kPointerSize;
static const int kSize = kContextOffset + kPointerSize;
// Dispatched behavior.
DECL_CAST(CallableTask)
DECL_PRINTER(CallableTask)
DECL_VERIFIER(CallableTask)
void BriefPrintDetails(std::ostream& os);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(CallableTask);
};
class AsyncGeneratorRequest : public Struct {
public:
// Holds an AsyncGeneratorRequest, or Undefined.

View File

@ -0,0 +1,31 @@
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_OBJECTS_MICROTASK_INL_H_
#define V8_OBJECTS_MICROTASK_INL_H_
#include "src/objects/microtask.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
CAST_ACCESSOR(Microtask)
CAST_ACCESSOR(CallbackTask)
CAST_ACCESSOR(CallableTask)
ACCESSORS(CallableTask, callable, JSReceiver, kCallableOffset)
ACCESSORS(CallableTask, context, Context, kContextOffset)
ACCESSORS(CallbackTask, callback, Foreign, kCallbackOffset)
ACCESSORS(CallbackTask, data, Foreign, kDataOffset)
} // namespace internal
} // namespace v8
#include "src/objects/object-macros-undef.h"
#endif // V8_OBJECTS_MICROTASK_INL_H_

77
src/objects/microtask.h Normal file
View File

@ -0,0 +1,77 @@
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_OBJECTS_MICROTASK_H_
#define V8_OBJECTS_MICROTASK_H_
#include "src/objects.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
// Abstract base class for all microtasks that can be scheduled on the
// microtask queue. This class merely serves the purpose of a marker
// interface.
class Microtask : public Struct {
public:
// Dispatched behavior.
DECL_CAST(Microtask)
DECL_VERIFIER(Microtask)
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Microtask);
};
// A CallbackTask is a special Microtask that allows us to schedule
// C++ microtask callbacks on the microtask queue. This is heavily
// used by Blink for example.
class CallbackTask : public Microtask {
public:
DECL_ACCESSORS(callback, Foreign)
DECL_ACCESSORS(data, Foreign)
static const int kCallbackOffset = Microtask::kHeaderSize;
static const int kDataOffset = kCallbackOffset + kPointerSize;
static const int kSize = kDataOffset + kPointerSize;
// Dispatched behavior.
DECL_CAST(CallbackTask)
DECL_PRINTER(CallbackTask)
DECL_VERIFIER(CallbackTask)
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(CallbackTask)
};
// A CallableTask is a special (internal) Microtask that allows us to
// schedule arbitrary callables on the microtask queue. We use this
// for various tests of the microtask queue.
class CallableTask : public Microtask {
public:
DECL_ACCESSORS(callable, JSReceiver)
DECL_ACCESSORS(context, Context)
static const int kCallableOffset = Microtask::kHeaderSize;
static const int kContextOffset = kCallableOffset + kPointerSize;
static const int kSize = kContextOffset + kPointerSize;
// Dispatched behavior.
DECL_CAST(CallableTask)
DECL_PRINTER(CallableTask)
DECL_VERIFIER(CallableTask)
void BriefPrintDetails(std::ostream& os);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(CallableTask);
};
} // namespace internal
} // namespace v8
#include "src/objects/object-macros-undef.h"
#endif // V8_OBJECTS_MICROTASK_H_

View File

@ -5,7 +5,7 @@
#ifndef V8_OBJECTS_PROMISE_H_
#define V8_OBJECTS_PROMISE_H_
#include "src/objects.h"
#include "src/objects/microtask.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"