Commit 22606f0c authored by jgruber's avatar jgruber Committed by Commit bot

Enable component builds for fuzzers

V8 is collecting a growing amount of fuzzers, all of which take substantial
space on the bots and in chromium build archives. This CL improves that
situation by allowing component (shared library) builds for almost all fuzzers.

The parser fuzzer is handled as an exception since it would require exporting a
large number of additional functions.

A component build results in about a 50-100x improvement in file size for each
fuzzer (~50M-100M to around 1.1M).

BUG=chromium:648864
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_compile_dbg_ng;master.tryserver.chromium.android:android_clang_dbg_recipe

Review-Url: https://codereview.chromium.org/2360983002
Cr-Commit-Position: refs/heads/master@{#39709}
parent a52e5647
......@@ -2334,6 +2334,27 @@ v8_source_set("fuzzer_support") {
configs = [ ":internal_config_base" ]
deps = [
":v8",
]
public_deps = [
":v8_libplatform",
]
}
# Used by fuzzers that would require exposing too many symbols for a proper
# component build.
v8_source_set("fuzzer_support_nocomponent") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
sources = [
"test/fuzzer/fuzzer-support.cc",
"test/fuzzer/fuzzer-support.h",
]
configs = [ ":internal_config_base" ]
deps = [
":v8_maybe_snapshot",
]
......@@ -2652,7 +2673,10 @@ v8_source_set("json_fuzzer") {
":fuzzer_support",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_fuzzer("json_fuzzer") {
......@@ -2664,10 +2688,13 @@ v8_source_set("parser_fuzzer") {
]
deps = [
":fuzzer_support",
":fuzzer_support_nocomponent",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_fuzzer("parser_fuzzer") {
......@@ -2682,7 +2709,10 @@ v8_source_set("regexp_fuzzer") {
":fuzzer_support",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_fuzzer("regexp_fuzzer") {
......@@ -2694,7 +2724,10 @@ v8_source_set("wasm_module_runner") {
"test/common/wasm/wasm-module-runner.h",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_source_set("wasm_fuzzer") {
......@@ -2707,7 +2740,10 @@ v8_source_set("wasm_fuzzer") {
":wasm_module_runner",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_fuzzer("wasm_fuzzer") {
......@@ -2723,7 +2759,10 @@ v8_source_set("wasm_asmjs_fuzzer") {
":wasm_module_runner",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_fuzzer("wasm_asmjs_fuzzer") {
......@@ -2739,7 +2778,10 @@ v8_source_set("wasm_code_fuzzer") {
":wasm_module_runner",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_fuzzer("wasm_code_fuzzer") {
......@@ -2751,7 +2793,10 @@ v8_source_set("lib_wasm_section_fuzzer") {
"test/fuzzer/wasm-section-fuzzers.h",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_source_set("wasm_types_section_fuzzer") {
......@@ -2765,7 +2810,10 @@ v8_source_set("wasm_types_section_fuzzer") {
":wasm_module_runner",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_fuzzer("wasm_types_section_fuzzer") {
......@@ -2782,7 +2830,10 @@ v8_source_set("wasm_names_section_fuzzer") {
":wasm_module_runner",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_fuzzer("wasm_names_section_fuzzer") {
......@@ -2799,7 +2850,10 @@ v8_source_set("wasm_globals_section_fuzzer") {
":wasm_module_runner",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_fuzzer("wasm_globals_section_fuzzer") {
......@@ -2816,7 +2870,10 @@ v8_source_set("wasm_imports_section_fuzzer") {
":wasm_module_runner",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_fuzzer("wasm_imports_section_fuzzer") {
......@@ -2833,7 +2890,10 @@ v8_source_set("wasm_function_sigs_section_fuzzer") {
":wasm_module_runner",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_fuzzer("wasm_function_sigs_section_fuzzer") {
......@@ -2850,7 +2910,10 @@ v8_source_set("wasm_memory_section_fuzzer") {
":wasm_module_runner",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_fuzzer("wasm_memory_section_fuzzer") {
......@@ -2867,7 +2930,10 @@ v8_source_set("wasm_data_section_fuzzer") {
":wasm_module_runner",
]
configs = [ ":internal_config" ]
configs = [
":external_config",
":internal_config_base",
]
}
v8_fuzzer("wasm_data_section_fuzzer") {
......
......@@ -7,6 +7,7 @@
#include <stdint.h>
#include "src/base/macros.h"
#include "src/globals.h"
namespace v8 {
namespace internal {
......@@ -33,14 +34,13 @@ enum PerIsolateAssertType {
COMPILATION_ASSERT
};
template <PerThreadAssertType kType, bool kAllow>
class PerThreadAssertScope {
public:
PerThreadAssertScope();
~PerThreadAssertScope();
V8_EXPORT_PRIVATE PerThreadAssertScope();
V8_EXPORT_PRIVATE ~PerThreadAssertScope();
static bool IsAllowed();
V8_EXPORT_PRIVATE static bool IsAllowed();
private:
PerThreadAssertData* data_;
......
......@@ -428,7 +428,7 @@ class Context: public FixedArray {
void set_global_proxy(JSObject* global);
// Get the JSGlobalObject object.
JSGlobalObject* global_object();
V8_EXPORT_PRIVATE JSGlobalObject* global_object();
// Get the script context by traversing the context chain.
Context* script_context();
......@@ -551,7 +551,8 @@ class Context: public FixedArray {
private:
#ifdef DEBUG
// Bootstrapping-aware type checks.
static bool IsBootstrappingOrNativeContext(Isolate* isolate, Object* object);
V8_EXPORT_PRIVATE static bool IsBootstrappingOrNativeContext(Isolate* isolate,
Object* object);
static bool IsBootstrappingOrValidParentContext(Object* object, Context* kid);
#endif
......
......@@ -21,11 +21,9 @@ class Execution final : public AllStatic {
// When the function called is not in strict mode, receiver is
// converted to an object.
//
MUST_USE_RESULT static MaybeHandle<Object> Call(Isolate* isolate,
Handle<Object> callable,
Handle<Object> receiver,
int argc,
Handle<Object> argv[]);
V8_EXPORT_PRIVATE MUST_USE_RESULT static MaybeHandle<Object> Call(
Isolate* isolate, Handle<Object> callable, Handle<Object> receiver,
int argc, Handle<Object> argv[]);
// Construct object from function, the caller supplies an array of
// arguments.
......
......@@ -81,7 +81,8 @@ class Factory final {
// Finds the internalized copy for string in the string table.
// If not found, a new string is added to the table and returned.
Handle<String> InternalizeUtf8String(Vector<const char> str);
V8_EXPORT_PRIVATE Handle<String> InternalizeUtf8String(
Vector<const char> str);
Handle<String> InternalizeUtf8String(const char* str) {
return InternalizeUtf8String(CStrVector(str));
}
......@@ -126,9 +127,8 @@ class Factory final {
// will be converted to Latin1, otherwise it will be left as two-byte.
//
// One-byte strings are pretenured when used as keys in the SourceCodeCache.
MUST_USE_RESULT MaybeHandle<String> NewStringFromOneByte(
Vector<const uint8_t> str,
PretenureFlag pretenure = NOT_TENURED);
V8_EXPORT_PRIVATE MUST_USE_RESULT MaybeHandle<String> NewStringFromOneByte(
Vector<const uint8_t> str, PretenureFlag pretenure = NOT_TENURED);
template <size_t N>
inline Handle<String> NewStringFromStaticChars(
......@@ -173,9 +173,8 @@ class Factory final {
MUST_USE_RESULT V8_EXPORT_PRIVATE MaybeHandle<String> NewStringFromUtf8(
Vector<const char> str, PretenureFlag pretenure = NOT_TENURED);
MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte(
Vector<const uc16> str,
PretenureFlag pretenure = NOT_TENURED);
V8_EXPORT_PRIVATE MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte(
Vector<const uc16> str, PretenureFlag pretenure = NOT_TENURED);
MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte(
const ZoneVector<uc16>* str, PretenureFlag pretenure = NOT_TENURED);
......@@ -307,7 +306,7 @@ class Factory final {
Handle<AccessorInfo> NewAccessorInfo();
Handle<Script> NewScript(Handle<String> source);
V8_EXPORT_PRIVATE Handle<Script> NewScript(Handle<String> source);
// Foreign objects are pretenured when allocated by the bootstrapper.
Handle<Foreign> NewForeign(Address addr,
......@@ -451,7 +450,7 @@ class Factory final {
// Create a JSArray with a specified length and elements initialized
// according to the specified mode.
Handle<JSArray> NewJSArray(
V8_EXPORT_PRIVATE Handle<JSArray> NewJSArray(
ElementsKind elements_kind, int length, int capacity,
ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS,
PretenureFlag pretenure = NOT_TENURED);
......
......@@ -266,7 +266,7 @@ class HandleScope {
inline ~HandleScope();
// Counts the number of allocated handles.
static int NumberOfHandles(Isolate* isolate);
V8_EXPORT_PRIVATE static int NumberOfHandles(Isolate* isolate);
// Create a new handle or lookup a canonical handle.
V8_INLINE static Object** GetHandle(Isolate* isolate, Object* value);
......@@ -275,7 +275,7 @@ class HandleScope {
V8_INLINE static Object** CreateHandle(Isolate* isolate, Object* value);
// Deallocates any extensions used by the current scope.
static void DeleteExtensions(Isolate* isolate);
V8_EXPORT_PRIVATE static void DeleteExtensions(Isolate* isolate);
static Address current_next_address(Isolate* isolate);
static Address current_limit_address(Isolate* isolate);
......@@ -310,11 +310,11 @@ class HandleScope {
Object** prev_limit);
// Extend the handle scope making room for more handles.
static Object** Extend(Isolate* isolate);
V8_EXPORT_PRIVATE static Object** Extend(Isolate* isolate);
#ifdef ENABLE_HANDLE_ZAPPING
// Zaps the handles in the half-open interval [start, end).
static void ZapRange(Object** start, Object** end);
V8_EXPORT_PRIVATE static void ZapRange(Object** start, Object** end);
#endif
friend class v8::HandleScope;
......@@ -344,7 +344,7 @@ class CanonicalHandleScope final {
~CanonicalHandleScope();
private:
Object** Lookup(Object* object);
V8_EXPORT_PRIVATE Object** Lookup(Object* object);
Isolate* isolate_;
Zone zone_;
......
......@@ -275,7 +275,7 @@ class LookupIterator final BASE_EMBEDDED {
MUST_USE_RESULT inline JSReceiver* NextHolder(Map* map);
template <bool is_element>
void Start();
V8_EXPORT_PRIVATE void Start();
template <bool is_element>
void NextInternal(Map* map, JSReceiver* holder);
template <bool is_element>
......
......@@ -218,7 +218,8 @@ V8_INLINE size_t hash_value(MachineType type) {
static_cast<size_t>(type.semantic()) * 16;
}
std::ostream& operator<<(std::ostream& os, MachineRepresentation rep);
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
MachineRepresentation rep);
std::ostream& operator<<(std::ostream& os, MachineSemantic type);
std::ostream& operator<<(std::ostream& os, MachineType type);
......
......@@ -1302,7 +1302,8 @@ class Object {
MUST_USE_RESULT static MaybeHandle<Object> InstanceOf(
Isolate* isolate, Handle<Object> object, Handle<Object> callable);
MUST_USE_RESULT static MaybeHandle<Object> GetProperty(LookupIterator* it);
V8_EXPORT_PRIVATE MUST_USE_RESULT static MaybeHandle<Object> GetProperty(
LookupIterator* it);
// ES6 [[Set]] (when passed DONT_THROW)
// Invariants for this and related functions (unless stated otherwise):
......@@ -1965,7 +1966,7 @@ class JSReceiver: public HeapObject {
PropertyDescriptor* desc, PropertyDescriptor* current,
ShouldThrow should_throw, Handle<Name> property_name = Handle<Name>());
MUST_USE_RESULT static Maybe<bool> GetOwnPropertyDescriptor(
V8_EXPORT_PRIVATE MUST_USE_RESULT static Maybe<bool> GetOwnPropertyDescriptor(
Isolate* isolate, Handle<JSReceiver> object, Handle<Object> key,
PropertyDescriptor* desc);
MUST_USE_RESULT static Maybe<bool> GetOwnPropertyDescriptor(
......@@ -3504,7 +3505,8 @@ class StringTable: public HashTable<StringTable,
public:
// Find string in the string table. If it is not there yet, it is
// added. The return value is the string found.
static Handle<String> LookupString(Isolate* isolate, Handle<String> key);
V8_EXPORT_PRIVATE static Handle<String> LookupString(Isolate* isolate,
Handle<String> key);
static Handle<String> LookupKey(Isolate* isolate, HashTableKey* key);
static String* LookupKeyIfExists(Isolate* isolate, HashTableKey* key);
......@@ -8527,7 +8529,8 @@ class JSRegExp: public JSObject {
DECL_ACCESSORS(flags, Object)
DECL_ACCESSORS(source, Object)
static MaybeHandle<JSRegExp> New(Handle<String> source, Flags flags);
V8_EXPORT_PRIVATE static MaybeHandle<JSRegExp> New(Handle<String> source,
Flags flags);
static Handle<JSRegExp> Copy(Handle<JSRegExp> regexp);
static MaybeHandle<JSRegExp> Initialize(Handle<JSRegExp> regexp,
......@@ -8984,8 +8987,7 @@ class AliasedArgumentsEntry: public Struct {
enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS};
enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL};
class StringHasher {
class V8_EXPORT_PRIVATE StringHasher {
public:
explicit inline StringHasher(int length, uint32_t seed);
......@@ -9608,7 +9610,7 @@ class String: public Name {
static bool SlowEquals(Handle<String> one, Handle<String> two);
// Slow case of AsArrayIndex.
bool SlowAsArrayIndex(uint32_t* index);
V8_EXPORT_PRIVATE bool SlowAsArrayIndex(uint32_t* index);
// Compute and set the hash code.
uint32_t ComputeAndSetHash();
......
......@@ -46,7 +46,7 @@ class RegExpImpl {
// See ECMA-262 section 15.10.6.2.
// This function calls the garbage collector if necessary.
MUST_USE_RESULT static MaybeHandle<Object> Exec(
V8_EXPORT_PRIVATE MUST_USE_RESULT static MaybeHandle<Object> Exec(
Handle<JSRegExp> regexp, Handle<String> subject, int index,
Handle<JSObject> lastMatchInfo);
......
......@@ -237,7 +237,8 @@ inline std::ostream& operator<<(std::ostream& os, const DecodeStruct& tree) {
return os;
}
DecodeResult VerifyWasmCode(AccountingAllocator* allocator, FunctionBody& body);
V8_EXPORT_PRIVATE DecodeResult VerifyWasmCode(AccountingAllocator* allocator,
FunctionBody& body);
DecodeResult BuildTFGraph(AccountingAllocator* allocator, TFBuilder* builder,
FunctionBody& body);
bool PrintAst(AccountingAllocator* allocator, const FunctionBody& body,
......
......@@ -111,7 +111,7 @@ class ZoneBuffer : public ZoneObject {
class WasmModuleBuilder;
class WasmFunctionBuilder : public ZoneObject {
class V8_EXPORT_PRIVATE WasmFunctionBuilder : public ZoneObject {
public:
// Building methods.
void SetSignature(FunctionSig* sig);
......@@ -207,7 +207,7 @@ struct WasmFunctionImport {
int name_length;
};
class WasmModuleBuilder : public ZoneObject {
class V8_EXPORT_PRIVATE WasmModuleBuilder : public ZoneObject {
public:
explicit WasmModuleBuilder(Zone* zone);
......
......@@ -12,9 +12,11 @@ namespace v8 {
namespace internal {
namespace wasm {
// Decodes the bytes of a WASM module between {module_start} and {module_end}.
ModuleResult DecodeWasmModule(Isolate* isolate, Zone* zone,
const byte* module_start, const byte* module_end,
bool verify_functions, ModuleOrigin origin);
V8_EXPORT_PRIVATE ModuleResult DecodeWasmModule(Isolate* isolate, Zone* zone,
const byte* module_start,
const byte* module_end,
bool verify_functions,
ModuleOrigin origin);
// Exposed for testing. Decodes a single function signature, allocating it
// in the given zone. Returns {nullptr} upon failure.
......
......@@ -102,7 +102,7 @@ class WasmFrame {
};
// An interpreter capable of executing WASM.
class WasmInterpreter {
class V8_EXPORT_PRIVATE WasmInterpreter {
public:
// State machine for a Thread:
// +---------------Run()-----------+
......
......@@ -15,12 +15,11 @@ class WasmJs {
public:
static void Install(Isolate* isolate, Handle<JSGlobalObject> global_object);
static void InstallWasmModuleSymbolIfNeeded(Isolate* isolate,
Handle<JSGlobalObject> global,
Handle<Context> context);
V8_EXPORT_PRIVATE static void InstallWasmModuleSymbolIfNeeded(
Isolate* isolate, Handle<JSGlobalObject> global, Handle<Context> context);
static void InstallWasmMapsIfNeeded(Isolate* isolate,
Handle<Context> context);
V8_EXPORT_PRIVATE static void InstallWasmMapsIfNeeded(
Isolate* isolate, Handle<Context> context);
static void InstallWasmConstructors(Isolate* isolate,
Handle<JSGlobalObject> global,
Handle<Context> context);
......
......@@ -79,7 +79,7 @@ const uint8_t kWasmFunctionTypeForm = 0x40;
class WasmDebugInfo;
struct WasmSection {
struct V8_EXPORT_PRIVATE WasmSection {
enum class Code : uint32_t {
#define F(enumerator, order, string) enumerator,
FOR_EACH_WASM_SECTION_TYPE(F)
......@@ -233,10 +233,9 @@ struct WasmModule {
}
// Creates a new instantiation of the module in the given isolate.
static MaybeHandle<JSObject> Instantiate(Isolate* isolate,
Handle<JSObject> module_object,
Handle<JSReceiver> ffi,
Handle<JSArrayBuffer> memory);
V8_EXPORT_PRIVATE static MaybeHandle<JSObject> Instantiate(
Isolate* isolate, Handle<JSObject> module_object, Handle<JSReceiver> ffi,
Handle<JSArrayBuffer> memory);
MaybeHandle<FixedArray> CompileFunctions(Isolate* isolate,
ErrorThrower* thrower) const;
......@@ -402,11 +401,9 @@ Handle<JSObject> CreateCompiledModuleObject(Isolate* isolate,
Handle<FixedArray> compiled_module,
ModuleOrigin origin);
MaybeHandle<JSObject> CreateModuleObjectFromBytes(Isolate* isolate,
const byte* start,
const byte* end,
ErrorThrower* thrower,
ModuleOrigin origin);
V8_EXPORT_PRIVATE MaybeHandle<JSObject> CreateModuleObjectFromBytes(
Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower,
ModuleOrigin origin);
// Assumed to be called with a code object associated to a wasm module instance.
// Intended to be called from runtime functions.
......
......@@ -97,7 +97,7 @@ std::ostream& operator<<(std::ostream& os, const Result<T>& result) {
std::ostream& operator<<(std::ostream& os, const ErrorCode& error_code);
// A helper for generating error messages that bubble up to JS exceptions.
class ErrorThrower {
class V8_EXPORT_PRIVATE ErrorThrower {
public:
ErrorThrower(i::Isolate* isolate, const char* context)
: isolate_(isolate), context_(context) {}
......
......@@ -17,7 +17,7 @@
namespace v8 {
namespace internal {
class AccountingAllocator {
class V8_EXPORT_PRIVATE AccountingAllocator {
public:
AccountingAllocator() = default;
virtual ~AccountingAllocator() = default;
......
......@@ -29,7 +29,7 @@ namespace internal {
//
// Note: The implementation is inherently not thread safe. Do not use
// from multi-threaded code.
class Zone final {
class V8_EXPORT_PRIVATE Zone final {
public:
explicit Zone(AccountingAllocator* allocator);
~Zone();
......
......@@ -51,7 +51,7 @@
'target_name': 'parser_fuzzer_lib',
'type': 'static_library',
'dependencies': [
'fuzzer_support',
'fuzzer_support_nocomponent',
],
'include_dirs': [
'../..',
......@@ -383,6 +383,21 @@
{
'target_name': 'fuzzer_support',
'type': 'static_library',
'dependencies': [
'../../src/v8.gyp:v8',
'../../src/v8.gyp:v8_libplatform',
],
'include_dirs': [
'../..',
],
'sources': [ ### gcmole(all) ###
'fuzzer-support.cc',
'fuzzer-support.h',
],
},
{
'target_name': 'fuzzer_support_nocomponent',
'type': 'static_library',
'dependencies': [
'../../src/v8.gyp:v8_libplatform',
],
......
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