Commit 47a302f3 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[cleanup] Move WriteBarrierKind to v8::internal::compiler namespace

... to minimize pollution of v8::internal namespace.
This CL also removes usages of WriteBarrierKind from CodeAssembler interface.

Bug: v8:9183
Change-Id: I7e87c0a98cfd08b3740a022cf12d3aab415da67a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1599176
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61301}
parent 19dfa835
...@@ -1899,6 +1899,7 @@ v8_compiler_sources = [ ...@@ -1899,6 +1899,7 @@ v8_compiler_sources = [
"src/compiler/verifier.h", "src/compiler/verifier.h",
"src/compiler/wasm-compiler.cc", "src/compiler/wasm-compiler.cc",
"src/compiler/wasm-compiler.h", "src/compiler/wasm-compiler.h",
"src/compiler/write-barrier-kind.h",
"src/compiler/zone-stats.cc", "src/compiler/zone-stats.cc",
"src/compiler/zone-stats.h", "src/compiler/zone-stats.h",
] ]
......
...@@ -2721,8 +2721,7 @@ void CodeStubAssembler::StoreObjectField(Node* object, int offset, ...@@ -2721,8 +2721,7 @@ void CodeStubAssembler::StoreObjectField(Node* object, int offset,
DCHECK_NE(HeapObject::kMapOffset, offset); // Use StoreMap instead. DCHECK_NE(HeapObject::kMapOffset, offset); // Use StoreMap instead.
OptimizedStoreField(MachineRepresentation::kTagged, OptimizedStoreField(MachineRepresentation::kTagged,
UncheckedCast<HeapObject>(object), offset, value, UncheckedCast<HeapObject>(object), offset, value);
WriteBarrierKind::kFullWriteBarrier);
} }
void CodeStubAssembler::StoreObjectField(Node* object, Node* offset, void CodeStubAssembler::StoreObjectField(Node* object, Node* offset,
...@@ -2737,8 +2736,8 @@ void CodeStubAssembler::StoreObjectField(Node* object, Node* offset, ...@@ -2737,8 +2736,8 @@ void CodeStubAssembler::StoreObjectField(Node* object, Node* offset,
void CodeStubAssembler::StoreObjectFieldNoWriteBarrier( void CodeStubAssembler::StoreObjectFieldNoWriteBarrier(
Node* object, int offset, Node* value, MachineRepresentation rep) { Node* object, int offset, Node* value, MachineRepresentation rep) {
OptimizedStoreField(rep, UncheckedCast<HeapObject>(object), offset, value, OptimizedStoreFieldNoWriteBarrier(rep, UncheckedCast<HeapObject>(object),
WriteBarrierKind::kNoWriteBarrier); offset, value);
} }
void CodeStubAssembler::StoreObjectFieldNoWriteBarrier( void CodeStubAssembler::StoreObjectFieldNoWriteBarrier(
...@@ -2762,9 +2761,9 @@ void CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, ...@@ -2762,9 +2761,9 @@ void CodeStubAssembler::StoreMapNoWriteBarrier(Node* object,
void CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) { void CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) {
CSA_SLOW_ASSERT(this, IsMap(map)); CSA_SLOW_ASSERT(this, IsMap(map));
OptimizedStoreField(MachineRepresentation::kTaggedPointer, OptimizedStoreFieldNoWriteBarrier(MachineRepresentation::kTaggedPointer,
UncheckedCast<HeapObject>(object), HeapObject::kMapOffset, UncheckedCast<HeapObject>(object),
map, WriteBarrierKind::kNoWriteBarrier); HeapObject::kMapOffset, map);
} }
void CodeStubAssembler::StoreObjectFieldRoot(Node* object, int offset, void CodeStubAssembler::StoreObjectFieldRoot(Node* object, int offset,
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include "src/base/compiler-specific.h" #include "src/base/compiler-specific.h"
#include "src/compiler/simplified-operator.h" #include "src/compiler/simplified-operator.h"
#include "src/compiler/write-barrier-kind.h"
#include "src/elements-kind.h" #include "src/elements-kind.h"
#include "src/globals.h"
#include "src/objects/js-objects.h" #include "src/objects/js-objects.h"
namespace v8 { namespace v8 {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#define TARGET_ARCH_OPCODE_LIST(V) #define TARGET_ARCH_OPCODE_LIST(V)
#define TARGET_ADDRESSING_MODE_LIST(V) #define TARGET_ADDRESSING_MODE_LIST(V)
#endif #endif
#include "src/globals.h" #include "src/compiler/write-barrier-kind.h"
#include "src/utils.h" #include "src/utils.h"
namespace v8 { namespace v8 {
......
...@@ -994,11 +994,18 @@ Node* CodeAssembler::Store(Node* base, Node* value) { ...@@ -994,11 +994,18 @@ Node* CodeAssembler::Store(Node* base, Node* value) {
void CodeAssembler::OptimizedStoreField(MachineRepresentation rep, void CodeAssembler::OptimizedStoreField(MachineRepresentation rep,
TNode<HeapObject> object, int offset, TNode<HeapObject> object, int offset,
Node* value, Node* value) {
WriteBarrierKind write_barrier) {
raw_assembler()->OptimizedStoreField(rep, object, offset, value, raw_assembler()->OptimizedStoreField(rep, object, offset, value,
write_barrier); WriteBarrierKind::kFullWriteBarrier);
} }
void CodeAssembler::OptimizedStoreFieldNoWriteBarrier(MachineRepresentation rep,
TNode<HeapObject> object,
int offset, Node* value) {
raw_assembler()->OptimizedStoreField(rep, object, offset, value,
WriteBarrierKind::kNoWriteBarrier);
}
void CodeAssembler::OptimizedStoreMap(TNode<HeapObject> object, void CodeAssembler::OptimizedStoreMap(TNode<HeapObject> object,
TNode<Map> map) { TNode<Map> map) {
raw_assembler()->OptimizedStoreMap(object, map); raw_assembler()->OptimizedStoreMap(object, map);
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "src/base/macros.h" #include "src/base/macros.h"
#include "src/builtins/builtins.h" #include "src/builtins/builtins.h"
#include "src/code-factory.h" #include "src/code-factory.h"
#include "src/globals.h"
#include "src/heap/heap.h" #include "src/heap/heap.h"
#include "src/machine-type.h" #include "src/machine-type.h"
#include "src/objects.h" #include "src/objects.h"
...@@ -973,8 +972,10 @@ class V8_EXPORT_PRIVATE CodeAssembler { ...@@ -973,8 +972,10 @@ class V8_EXPORT_PRIVATE CodeAssembler {
AllocationType allocation, AllocationType allocation,
AllowLargeObjects allow_large_objects); AllowLargeObjects allow_large_objects);
void OptimizedStoreField(MachineRepresentation rep, TNode<HeapObject> object, void OptimizedStoreField(MachineRepresentation rep, TNode<HeapObject> object,
int offset, Node* value, int offset, Node* value);
WriteBarrierKind write_barrier); void OptimizedStoreFieldNoWriteBarrier(MachineRepresentation rep,
TNode<HeapObject> object, int offset,
Node* value);
void OptimizedStoreMap(TNode<HeapObject> object, TNode<Map>); void OptimizedStoreMap(TNode<HeapObject> object, TNode<Map>);
// {value_high} is used for 64-bit stores on 32-bit platforms, must be // {value_high} is used for 64-bit stores on 32-bit platforms, must be
// nullptr in other cases. // nullptr in other cases.
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "src/base/compiler-specific.h" #include "src/base/compiler-specific.h"
#include "src/base/enum-set.h" #include "src/base/enum-set.h"
#include "src/base/flags.h" #include "src/base/flags.h"
#include "src/globals.h" #include "src/compiler/write-barrier-kind.h"
#include "src/machine-type.h" #include "src/machine-type.h"
#include "src/zone/zone.h" #include "src/zone/zone.h"
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "src/compiler/node.h" #include "src/compiler/node.h"
#include "src/compiler/operator.h" #include "src/compiler/operator.h"
#include "src/compiler/simplified-operator.h" #include "src/compiler/simplified-operator.h"
#include "src/compiler/write-barrier-kind.h"
#include "src/globals.h" #include "src/globals.h"
#include "src/heap/factory.h" #include "src/heap/factory.h"
#include "src/isolate.h" #include "src/isolate.h"
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "src/base/compiler-specific.h" #include "src/base/compiler-specific.h"
#include "src/compiler/operator.h" #include "src/compiler/operator.h"
#include "src/compiler/types.h" #include "src/compiler/types.h"
#include "src/compiler/write-barrier-kind.h"
#include "src/deoptimize-reason.h" #include "src/deoptimize-reason.h"
#include "src/globals.h" #include "src/globals.h"
#include "src/handles.h" #include "src/handles.h"
......
// Copyright 2019 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_COMPILER_WRITE_BARRIER_KIND_H_
#define V8_COMPILER_WRITE_BARRIER_KIND_H_
#include <ostream>
#include "src/base/logging.h"
namespace v8 {
namespace internal {
namespace compiler {
// Write barrier kinds supported by compiler.
enum WriteBarrierKind : uint8_t {
kNoWriteBarrier,
kMapWriteBarrier,
kPointerWriteBarrier,
kEphemeronKeyWriteBarrier,
kFullWriteBarrier
};
inline size_t hash_value(WriteBarrierKind kind) {
return static_cast<uint8_t>(kind);
}
inline std::ostream& operator<<(std::ostream& os, WriteBarrierKind kind) {
switch (kind) {
case kNoWriteBarrier:
return os << "NoWriteBarrier";
case kMapWriteBarrier:
return os << "MapWriteBarrier";
case kPointerWriteBarrier:
return os << "PointerWriteBarrier";
case kEphemeronKeyWriteBarrier:
return os << "EphemeronKeyWriteBarrier";
case kFullWriteBarrier:
return os << "FullWriteBarrier";
}
UNREACHABLE();
}
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_WRITE_BARRIER_KIND_H_
...@@ -732,35 +732,6 @@ enum AllocationAlignment { kWordAligned, kDoubleAligned, kDoubleUnaligned }; ...@@ -732,35 +732,6 @@ enum AllocationAlignment { kWordAligned, kDoubleAligned, kDoubleUnaligned };
enum class AccessMode { ATOMIC, NON_ATOMIC }; enum class AccessMode { ATOMIC, NON_ATOMIC };
// Supported write barrier modes.
enum WriteBarrierKind : uint8_t {
kNoWriteBarrier,
kMapWriteBarrier,
kPointerWriteBarrier,
kEphemeronKeyWriteBarrier,
kFullWriteBarrier
};
inline size_t hash_value(WriteBarrierKind kind) {
return static_cast<uint8_t>(kind);
}
inline std::ostream& operator<<(std::ostream& os, WriteBarrierKind kind) {
switch (kind) {
case kNoWriteBarrier:
return os << "NoWriteBarrier";
case kMapWriteBarrier:
return os << "MapWriteBarrier";
case kPointerWriteBarrier:
return os << "PointerWriteBarrier";
case kEphemeronKeyWriteBarrier:
return os << "EphemeronKeyWriteBarrier";
case kFullWriteBarrier:
return os << "FullWriteBarrier";
}
UNREACHABLE();
}
enum class AllowLargeObjects { kFalse, kTrue }; enum class AllowLargeObjects { kFalse, kTrue };
enum MinimumCapacity { enum MinimumCapacity {
......
...@@ -415,7 +415,8 @@ void WasmFunctionWrapper::Init(CallDescriptor* call_descriptor, ...@@ -415,7 +415,8 @@ void WasmFunctionWrapper::Init(CallDescriptor* call_descriptor,
if (!return_type.IsNone()) { if (!return_type.IsNone()) {
effect = graph()->NewNode( effect = graph()->NewNode(
machine()->Store(compiler::StoreRepresentation( machine()->Store(compiler::StoreRepresentation(
return_type.representation(), WriteBarrierKind::kNoWriteBarrier)), return_type.representation(),
compiler::WriteBarrierKind::kNoWriteBarrier)),
graph()->NewNode(common()->Parameter(param_types.length()), graph()->NewNode(common()->Parameter(param_types.length()),
graph()->start()), graph()->start()),
graph()->NewNode(common()->Int32Constant(0)), call, effect, graph()->NewNode(common()->Int32Constant(0)), call, effect,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment