Commit 613a1c2f authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[cctest] Add V8_EXPORT_PRIVATE for cctest (wasm part)

Bug: v8:9020
Change-Id: I3a939d65ec8468f034d4670d9b14a911e5ef5a61
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1541044Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60492}
parent c297528d
......@@ -113,7 +113,8 @@ class CompilationState {
void SetWireBytesStorage(std::shared_ptr<WireBytesStorage>);
std::shared_ptr<WireBytesStorage> GetWireBytesStorage() const;
V8_EXPORT_PRIVATE std::shared_ptr<WireBytesStorage> GetWireBytesStorage()
const;
void AddCallback(callback_t);
......
......@@ -65,7 +65,7 @@ struct WasmCompilationResult {
ExecutionTier result_tier;
};
class WasmCompilationUnit final {
class V8_EXPORT_PRIVATE WasmCompilationUnit final {
public:
static ExecutionTier GetDefaultExecutionTier(const WasmModule*);
......
......@@ -23,11 +23,11 @@ struct FunctionBody;
struct WasmModule;
struct WasmFeatures;
DecodeResult BuildTFGraph(AccountingAllocator* allocator,
const WasmFeatures& enabled, const WasmModule* module,
compiler::WasmGraphBuilder* builder,
WasmFeatures* detected, const FunctionBody& body,
compiler::NodeOriginTable* node_origins);
V8_EXPORT_PRIVATE DecodeResult
BuildTFGraph(AccountingAllocator* allocator, const WasmFeatures& enabled,
const WasmModule* module, compiler::WasmGraphBuilder* builder,
WasmFeatures* detected, const FunctionBody& body,
compiler::NodeOriginTable* node_origins);
} // namespace wasm
} // namespace internal
......
......@@ -27,7 +27,7 @@ namespace wasm {
//
// The above illustrates jump table lines {Li} containing slots {Si} with each
// line containing {n} slots and some padding {x} for alignment purposes.
class JumpTableAssembler : public MacroAssembler {
class V8_EXPORT_PRIVATE JumpTableAssembler : public MacroAssembler {
public:
// Translate an offset into the continuous jump table to a jump table index.
static uint32_t SlotOffsetToIndex(uint32_t slot_offset) {
......
......@@ -13,59 +13,59 @@ namespace v8 {
namespace internal {
namespace wasm {
void f32_trunc_wrapper(Address data);
V8_EXPORT_PRIVATE void f32_trunc_wrapper(Address data);
void f32_floor_wrapper(Address data);
V8_EXPORT_PRIVATE void f32_floor_wrapper(Address data);
void f32_ceil_wrapper(Address data);
V8_EXPORT_PRIVATE void f32_ceil_wrapper(Address data);
void f32_nearest_int_wrapper(Address data);
V8_EXPORT_PRIVATE void f32_nearest_int_wrapper(Address data);
void f64_trunc_wrapper(Address data);
V8_EXPORT_PRIVATE void f64_trunc_wrapper(Address data);
void f64_floor_wrapper(Address data);
V8_EXPORT_PRIVATE void f64_floor_wrapper(Address data);
void f64_ceil_wrapper(Address data);
V8_EXPORT_PRIVATE void f64_ceil_wrapper(Address data);
void f64_nearest_int_wrapper(Address data);
V8_EXPORT_PRIVATE void f64_nearest_int_wrapper(Address data);
void int64_to_float32_wrapper(Address data);
V8_EXPORT_PRIVATE void int64_to_float32_wrapper(Address data);
void uint64_to_float32_wrapper(Address data);
V8_EXPORT_PRIVATE void uint64_to_float32_wrapper(Address data);
void int64_to_float64_wrapper(Address data);
V8_EXPORT_PRIVATE void int64_to_float64_wrapper(Address data);
void uint64_to_float64_wrapper(Address data);
V8_EXPORT_PRIVATE void uint64_to_float64_wrapper(Address data);
int32_t float32_to_int64_wrapper(Address data);
V8_EXPORT_PRIVATE int32_t float32_to_int64_wrapper(Address data);
int32_t float32_to_uint64_wrapper(Address data);
V8_EXPORT_PRIVATE int32_t float32_to_uint64_wrapper(Address data);
int32_t float64_to_int64_wrapper(Address data);
V8_EXPORT_PRIVATE int32_t float64_to_int64_wrapper(Address data);
int32_t float64_to_uint64_wrapper(Address data);
V8_EXPORT_PRIVATE int32_t float64_to_uint64_wrapper(Address data);
int32_t int64_div_wrapper(Address data);
V8_EXPORT_PRIVATE int32_t int64_div_wrapper(Address data);
int32_t int64_mod_wrapper(Address data);
V8_EXPORT_PRIVATE int32_t int64_mod_wrapper(Address data);
int32_t uint64_div_wrapper(Address data);
V8_EXPORT_PRIVATE int32_t uint64_div_wrapper(Address data);
int32_t uint64_mod_wrapper(Address data);
V8_EXPORT_PRIVATE int32_t uint64_mod_wrapper(Address data);
uint32_t word32_ctz_wrapper(Address data);
V8_EXPORT_PRIVATE uint32_t word32_ctz_wrapper(Address data);
uint32_t word64_ctz_wrapper(Address data);
V8_EXPORT_PRIVATE uint32_t word64_ctz_wrapper(Address data);
uint32_t word32_popcnt_wrapper(Address data);
V8_EXPORT_PRIVATE uint32_t word32_popcnt_wrapper(Address data);
uint32_t word64_popcnt_wrapper(Address data);
V8_EXPORT_PRIVATE uint32_t word64_popcnt_wrapper(Address data);
uint32_t word32_rol_wrapper(Address data);
V8_EXPORT_PRIVATE uint32_t word32_rol_wrapper(Address data);
uint32_t word32_ror_wrapper(Address data);
V8_EXPORT_PRIVATE uint32_t word32_ror_wrapper(Address data);
void float64_pow_wrapper(Address data);
V8_EXPORT_PRIVATE void float64_pow_wrapper(Address data);
void memory_copy_wrapper(Address dst, Address src, uint32_t size);
......@@ -73,9 +73,10 @@ void memory_fill_wrapper(Address dst, uint32_t value, uint32_t size);
typedef void (*WasmTrapCallbackForTesting)();
void set_trap_callback_for_testing(WasmTrapCallbackForTesting callback);
V8_EXPORT_PRIVATE void set_trap_callback_for_testing(
WasmTrapCallbackForTesting callback);
void call_trap_callback_for_testing();
V8_EXPORT_PRIVATE void call_trap_callback_for_testing();
} // namespace wasm
} // namespace internal
......
......@@ -56,7 +56,7 @@ using ControlTransferMap = ZoneMap<pc_t, ControlTransferEntry>;
// param #0 _/· _/·
// -----------------
//
class InterpretedFrame {
class V8_EXPORT_PRIVATE InterpretedFrame {
public:
const WasmFunction* function() const;
int pc() const;
......@@ -77,7 +77,7 @@ class InterpretedFrame {
// Deleter struct to delete the underlying InterpretedFrameImpl without
// violating language specifications.
struct InterpretedFrameDeleter {
struct V8_EXPORT_PRIVATE InterpretedFrameDeleter {
void operator()(InterpretedFrame* ptr);
};
......
......@@ -98,8 +98,7 @@ class WasmMemoryTracker {
// Decreases the amount of reserved address space.
void ReleaseReservation(size_t num_bytes);
bool IsWasmMemory(const void* buffer_start);
V8_EXPORT_PRIVATE bool IsWasmMemory(const void* buffer_start);
bool IsWasmSharedMemory(const void* buffer_start);
......@@ -109,7 +108,8 @@ class WasmMemoryTracker {
// Returns a pointer to a Wasm buffer's allocation data, or nullptr if the
// buffer is not tracked.
const AllocationData* FindAllocationData(const void* buffer_start);
V8_EXPORT_PRIVATE const AllocationData* FindAllocationData(
const void* buffer_start);
// Checks if a buffer points to a Wasm memory and if so does any necessary
// work to reclaim the buffer. If this function returns false, the caller must
......@@ -266,21 +266,23 @@ class WasmMemoryTracker {
// Attempts to allocate an array buffer with guard regions suitable for trap
// handling. If address space is not available, it will return a buffer with
// mini-guards that will require bounds checks.
MaybeHandle<JSArrayBuffer> NewArrayBuffer(Isolate*, size_t size);
V8_EXPORT_PRIVATE MaybeHandle<JSArrayBuffer> NewArrayBuffer(Isolate*,
size_t size);
// Attempts to allocate a SharedArrayBuffer with guard regions suitable for
// trap handling. If address space is not available, it will try to reserve
// up to the maximum for that memory. If all else fails, it will return a
// buffer with mini-guards of initial size.
MaybeHandle<JSArrayBuffer> NewSharedArrayBuffer(Isolate*, size_t initial_size,
size_t max_size);
V8_EXPORT_PRIVATE MaybeHandle<JSArrayBuffer> NewSharedArrayBuffer(
Isolate*, size_t initial_size, size_t max_size);
Handle<JSArrayBuffer> SetupArrayBuffer(
Isolate*, void* backing_store, size_t size, bool is_external,
SharedFlag shared = SharedFlag::kNotShared);
void DetachMemoryBuffer(Isolate* isolate, Handle<JSArrayBuffer> buffer,
bool free_memory);
V8_EXPORT_PRIVATE void DetachMemoryBuffer(Isolate* isolate,
Handle<JSArrayBuffer> buffer,
bool free_memory);
} // namespace wasm
} // namespace internal
......
......@@ -61,8 +61,9 @@ class IndirectFunctionTableEntry {
inline IndirectFunctionTableEntry(Handle<WasmInstanceObject>, int index);
void clear();
void Set(int sig_id, Handle<WasmInstanceObject> target_instance,
int target_func_index);
V8_EXPORT_PRIVATE void Set(int sig_id,
Handle<WasmInstanceObject> target_instance,
int target_func_index);
void CopyFrom(const IndirectFunctionTableEntry& that);
......@@ -91,8 +92,8 @@ class ImportedFunctionEntry {
// Initialize this entry as a WASM to JS call. This accepts the isolate as a
// parameter, since it must allocate a tuple.
void SetWasmToJs(Isolate*, Handle<JSReceiver> callable,
const wasm::WasmCode* wasm_to_js_wrapper);
V8_EXPORT_PRIVATE void SetWasmToJs(Isolate*, Handle<JSReceiver> callable,
const wasm::WasmCode* wasm_to_js_wrapper);
// Initialize this entry as a WASM to WASM call.
void SetWasmToWasm(WasmInstanceObject target_instance, Address call_target);
......@@ -142,7 +143,7 @@ class WasmModuleObject : public JSObject {
#undef WASM_MODULE_OBJECT_FIELDS
// Creates a new {WasmModuleObject} with a new {NativeModule} underneath.
static Handle<WasmModuleObject> New(
V8_EXPORT_PRIVATE static Handle<WasmModuleObject> New(
Isolate* isolate, const wasm::WasmFeatures& enabled,
std::shared_ptr<const wasm::WasmModule> module,
OwnedVector<const uint8_t> wire_bytes, Handle<Script> script,
......@@ -150,10 +151,10 @@ class WasmModuleObject : public JSObject {
// Creates a new {WasmModuleObject} for an existing {NativeModule} that is
// reference counted and might be shared between multiple Isolates.
static Handle<WasmModuleObject> New(
V8_EXPORT_PRIVATE static Handle<WasmModuleObject> New(
Isolate* isolate, std::shared_ptr<wasm::NativeModule> native_module,
Handle<Script> script, size_t code_size_estimate);
static Handle<WasmModuleObject> New(
V8_EXPORT_PRIVATE static Handle<WasmModuleObject> New(
Isolate* isolate, std::shared_ptr<wasm::NativeModule> native_module,
Handle<Script> script, Handle<FixedArray> export_wrappers,
size_t code_size_estimate);
......@@ -164,8 +165,9 @@ class WasmModuleObject : public JSObject {
// location inside the same function.
// If it points outside a function, or behind the last breakable location,
// this function returns false and does not set any breakpoint.
static bool SetBreakPoint(Handle<WasmModuleObject>, int* position,
Handle<BreakPoint> break_point);
V8_EXPORT_PRIVATE static bool SetBreakPoint(Handle<WasmModuleObject>,
int* position,
Handle<BreakPoint> break_point);
// Check whether this module was generated from asm.js source.
inline bool is_asm_js();
......@@ -225,7 +227,7 @@ class WasmModuleObject : public JSObject {
// entries, mapping wasm byte offsets to line and column in the disassembly.
// The list is guaranteed to be ordered by the byte_offset.
// Returns an empty string and empty vector if the function index is invalid.
debug::WasmDisassembly DisassembleFunction(int func_index);
V8_EXPORT_PRIVATE debug::WasmDisassembly DisassembleFunction(int func_index);
// Extract a portion of the wire bytes as UTF-8 string.
// Returns a null handle if the respective bytes do not form a valid UTF-8
......@@ -237,9 +239,9 @@ class WasmModuleObject : public JSObject {
wasm::WireBytesRef ref);
// Get a list of all possible breakpoints within a given range of this module.
bool GetPossibleBreakpoints(const debug::Location& start,
const debug::Location& end,
std::vector<debug::BreakLocation>* locations);
V8_EXPORT_PRIVATE bool GetPossibleBreakpoints(
const debug::Location& start, const debug::Location& end,
std::vector<debug::BreakLocation>* locations);
// Return an empty handle if no breakpoint is hit at that location, or a
// FixedArray with all hit breakpoint objects.
......@@ -251,7 +253,7 @@ class WasmModuleObject : public JSObject {
};
// Representation of a WebAssembly.Table JavaScript-level object.
class WasmTableObject : public JSObject {
class V8_EXPORT_PRIVATE WasmTableObject : public JSObject {
public:
DECL_CAST(WasmTableObject)
......@@ -346,8 +348,9 @@ class WasmMemoryObject : public JSObject {
#undef WASM_MEMORY_OBJECT_FIELDS
// Add an instance to the internal (weak) list.
static void AddInstance(Isolate* isolate, Handle<WasmMemoryObject> memory,
Handle<WasmInstanceObject> object);
V8_EXPORT_PRIVATE static void AddInstance(Isolate* isolate,
Handle<WasmMemoryObject> memory,
Handle<WasmInstanceObject> object);
inline bool has_maximum_pages();
// Return whether the underlying backing store has guard regions large enough
......@@ -363,7 +366,8 @@ class WasmMemoryObject : public JSObject {
void update_instances(Isolate* isolate, Handle<JSArrayBuffer> buffer);
static int32_t Grow(Isolate*, Handle<WasmMemoryObject>, uint32_t pages);
V8_EXPORT_PRIVATE static int32_t Grow(Isolate*, Handle<WasmMemoryObject>,
uint32_t pages);
OBJECT_CONSTRUCTORS(WasmMemoryObject, JSObject);
};
......@@ -550,18 +554,20 @@ class WasmInstanceObject : public JSObject {
V8_EXPORT_PRIVATE const wasm::WasmModule* module();
static bool EnsureIndirectFunctionTableWithMinimumSize(
V8_EXPORT_PRIVATE static bool EnsureIndirectFunctionTableWithMinimumSize(
Handle<WasmInstanceObject> instance, uint32_t minimum_size);
bool has_indirect_function_table();
void SetRawMemory(byte* mem_start, size_t mem_size);
V8_EXPORT_PRIVATE void SetRawMemory(byte* mem_start, size_t mem_size);
// Get the debug info associated with the given wasm object.
// If no debug info exists yet, it is created automatically.
static Handle<WasmDebugInfo> GetOrCreateDebugInfo(Handle<WasmInstanceObject>);
V8_EXPORT_PRIVATE static Handle<WasmDebugInfo> GetOrCreateDebugInfo(
Handle<WasmInstanceObject>);
static Handle<WasmInstanceObject> New(Isolate*, Handle<WasmModuleObject>);
V8_EXPORT_PRIVATE static Handle<WasmInstanceObject> New(
Isolate*, Handle<WasmModuleObject>);
Address GetCallTarget(uint32_t func_index);
......@@ -656,11 +662,10 @@ class WasmExportedFunction : public JSFunction {
V8_EXPORT_PRIVATE static bool IsWasmExportedFunction(Object object);
static Handle<WasmExportedFunction> New(Isolate* isolate,
Handle<WasmInstanceObject> instance,
MaybeHandle<String> maybe_name,
int func_index, int arity,
Handle<Code> export_wrapper);
V8_EXPORT_PRIVATE static Handle<WasmExportedFunction> New(
Isolate* isolate, Handle<WasmInstanceObject> instance,
MaybeHandle<String> maybe_name, int func_index, int arity,
Handle<Code> export_wrapper);
Address GetWasmCallTarget();
......@@ -742,12 +747,13 @@ class WasmDebugInfo : public Struct {
// Set a breakpoint in the given function at the given byte offset within that
// function. This will redirect all future calls to this function to the
// interpreter and will always pause at the given offset.
static void SetBreakpoint(Handle<WasmDebugInfo>, int func_index, int offset);
V8_EXPORT_PRIVATE static void SetBreakpoint(Handle<WasmDebugInfo>,
int func_index, int offset);
// Make a set of functions always execute in the interpreter without setting
// breakpoints.
static void RedirectToInterpreter(Handle<WasmDebugInfo>,
Vector<int> func_indexes);
V8_EXPORT_PRIVATE static void RedirectToInterpreter(Handle<WasmDebugInfo>,
Vector<int> func_indexes);
void PrepareStep(StepAction);
......@@ -766,11 +772,12 @@ class WasmDebugInfo : public Struct {
std::vector<std::pair<uint32_t, int>> GetInterpretedStack(
Address frame_pointer);
V8_EXPORT_PRIVATE
std::unique_ptr<wasm::InterpretedFrame, wasm::InterpretedFrameDeleter>
GetInterpretedFrame(Address frame_pointer, int frame_index);
// Returns the number of calls / function frames executed in the interpreter.
uint64_t NumInterpretedCalls();
V8_EXPORT_PRIVATE uint64_t NumInterpretedCalls();
// Get scope details for a specific interpreted frame.
// Both of these methods return a JSArrays (for the global scope and local
......@@ -786,8 +793,8 @@ class WasmDebugInfo : public Struct {
Address frame_pointer,
int frame_index);
static Handle<JSFunction> GetCWasmEntry(Handle<WasmDebugInfo>,
wasm::FunctionSig*);
V8_EXPORT_PRIVATE static Handle<JSFunction> GetCWasmEntry(
Handle<WasmDebugInfo>, wasm::FunctionSig*);
OBJECT_CONSTRUCTORS(WasmDebugInfo, Struct);
};
......@@ -798,7 +805,8 @@ class WasmDebugInfo : public Struct {
// - {WasmInstanceObject::exceptions_table}: List of tags used by an instance.
class WasmExceptionTag : public Struct {
public:
static Handle<WasmExceptionTag> New(Isolate* isolate, int index);
V8_EXPORT_PRIVATE static Handle<WasmExceptionTag> New(Isolate* isolate,
int index);
// Note that this index is only useful for debugging purposes and it is not
// unique across modules. The GC however does not allow objects without at
......
......@@ -14,7 +14,7 @@ namespace wasm {
// Support for serializing WebAssembly {NativeModule} objects. This class takes
// a snapshot of the module state at instantiation, and other code that modifies
// the module after that won't affect the serialized result.
class WasmSerializer {
class V8_EXPORT_PRIVATE WasmSerializer {
public:
explicit WasmSerializer(NativeModule* native_module);
......
......@@ -267,10 +267,13 @@ uint32_t TestingModuleBuilder::AddPassiveDataSegment(Vector<const byte> bytes) {
}
CompilationEnv TestingModuleBuilder::CreateCompilationEnv() {
return {
test_module_ptr_,
trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler : kNoTrapHandler,
runtime_exception_support_, enabled_features_, lower_simd()};
// This is a hack so we don't need to call
// trap_handler::IsTrapHandlerEnabled().
const bool is_trap_handler_enabled =
V8_TRAP_HANDLER_SUPPORTED && i::FLAG_wasm_trap_handler;
return {test_module_ptr_,
is_trap_handler_enabled ? kUseTrapHandler : kNoTrapHandler,
runtime_exception_support_, enabled_features_, lower_simd()};
}
const WasmGlobal* TestingModuleBuilder::AddGlobal(ValueType type) {
......
......@@ -471,12 +471,12 @@ class WasmRunner : public WasmRunnerBase {
wrapper_code, wrapper_.signature());
int32_t result;
{
trap_handler::SetThreadInWasm();
SetThreadInWasmFlag();
result = runner.Call(static_cast<void*>(&p)...,
static_cast<void*>(&return_value));
trap_handler::ClearThreadInWasm();
ClearThreadInWasmFlag();
}
CHECK_EQ(WASM_WRAPPER_RETURN_VALUE, result);
return WasmRunnerBase::trap_happened
......@@ -546,6 +546,15 @@ class WasmRunner : public WasmRunnerBase {
Handle<Code> GetWrapperCode() { return wrapper_.GetWrapperCode(); }
private:
void SetThreadInWasmFlag() {
*reinterpret_cast<int*>(trap_handler::GetThreadInWasmThreadLocalAddress()) =
true;
}
void ClearThreadInWasmFlag() {
*reinterpret_cast<int*>(trap_handler::GetThreadInWasmThreadLocalAddress()) =
false;
}
std::vector<Handle<JSFunction>> jsfuncs_;
};
......
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