Commit aee0a257 authored by jochen's avatar jochen Committed by Commit bot

parser fuzzer and parser shell should also work in component builds

R=machenbach@chromium.org,jgruber@chromium.org
CQ_INCLUDE_TRYBOTS=master.tryserver.v8:v8_win_dbg,v8_mac_dbg;master.tryserver.chromium.android:android_arm64_dbg_recipe

Review-Url: https://codereview.chromium.org/2417703003
Cr-Commit-Position: refs/heads/master@{#40297}
parent 1ac958d4
......@@ -2392,32 +2392,6 @@ v8_source_set("fuzzer_support") {
]
}
# 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",
]
if (is_component_build) {
defines = [ "BUILDING_V8_SHARED" ]
}
public_deps = [
":v8_libbase",
":v8_libplatform",
]
}
v8_source_set("simple_fuzzer") {
sources = [
"test/fuzzer/fuzzer.cc",
......@@ -2654,36 +2628,16 @@ v8_executable("v8_parser_shell") {
]
deps = [
":v8",
":v8_libbase",
":v8_libplatform",
"//build/config/sanitizers:deps",
"//build/win:default_exe_manifest",
]
defines = []
if (is_component_build) {
# v8_parser_shell can't be built against a shared library, so we
# need to depend on the underlying static target in that case.
deps += [ ":v8_maybe_snapshot" ]
defines += [ "BUILDING_V8_SHARED" ]
} else {
deps += [ ":v8" ]
}
if (v8_enable_i18n_support) {
deps += [ "//third_party/icu" ]
}
if (is_win) {
# Suppress warnings about importing locally defined symbols.
if (is_component_build) {
ldflags = [
"/ignore:4049",
"/ignore:4217",
]
}
}
}
if (want_v8_shell) {
......@@ -2751,13 +2705,9 @@ v8_source_set("parser_fuzzer") {
]
deps = [
":fuzzer_support_nocomponent",
":fuzzer_support",
]
if (is_component_build) {
defines = [ "BUILDING_V8_SHARED" ]
}
configs = [
":external_config",
":internal_config_base",
......
......@@ -26,7 +26,7 @@ class Utf16CharacterStream;
class Zone;
// A container for the inputs, configuration options, and outputs of parsing.
class ParseInfo {
class V8_EXPORT_PRIVATE ParseInfo {
public:
explicit ParseInfo(Zone* zone);
ParseInfo(Zone* zone, Handle<JSFunction> function);
......
......@@ -292,49 +292,6 @@ FunctionLiteral* Parser::DefaultConstructor(const AstRawString* name,
return function_literal;
}
// ----------------------------------------------------------------------------
// Target is a support class to facilitate manipulation of the
// Parser's target_stack_ (the stack of potential 'break' and
// 'continue' statement targets). Upon construction, a new target is
// added; it is removed upon destruction.
class ParserTarget BASE_EMBEDDED {
public:
ParserTarget(ParserBase<Parser>* parser, BreakableStatement* statement)
: variable_(&parser->impl()->target_stack_),
statement_(statement),
previous_(parser->impl()->target_stack_) {
parser->impl()->target_stack_ = this;
}
~ParserTarget() { *variable_ = previous_; }
ParserTarget* previous() { return previous_; }
BreakableStatement* statement() { return statement_; }
private:
ParserTarget** variable_;
BreakableStatement* statement_;
ParserTarget* previous_;
};
class ParserTargetScope BASE_EMBEDDED {
public:
explicit ParserTargetScope(ParserBase<Parser>* parser)
: variable_(&parser->impl()->target_stack_),
previous_(parser->impl()->target_stack_) {
parser->impl()->target_stack_ = nullptr;
}
~ParserTargetScope() { *variable_ = previous_; }
private:
ParserTarget** variable_;
ParserTarget* previous_;
};
// ----------------------------------------------------------------------------
// The CHECK_OK macro is a convenient macro to enforce error
// handling for functions that may fail (by returning !*ok).
......
......@@ -7,9 +7,11 @@
#include "src/ast/ast.h"
#include "src/ast/scopes.h"
#include "src/base/compiler-specific.h"
#include "src/globals.h"
#include "src/parsing/parser-base.h"
#include "src/parsing/preparse-data.h"
#include "src/parsing/preparse-data-format.h"
#include "src/parsing/preparse-data.h"
#include "src/parsing/preparser.h"
#include "src/pending-compilation-error-handler.h"
......@@ -167,7 +169,7 @@ struct ParserTypes<Parser> {
typedef ParserTargetScope TargetScope;
};
class Parser : public ParserBase<Parser> {
class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
public:
explicit Parser(ParseInfo* info);
~Parser() {
......@@ -1101,6 +1103,47 @@ class Parser : public ParserBase<Parser> {
bool parsing_on_main_thread_;
};
// ----------------------------------------------------------------------------
// Target is a support class to facilitate manipulation of the
// Parser's target_stack_ (the stack of potential 'break' and
// 'continue' statement targets). Upon construction, a new target is
// added; it is removed upon destruction.
class ParserTarget BASE_EMBEDDED {
public:
ParserTarget(ParserBase<Parser>* parser, BreakableStatement* statement)
: variable_(&parser->impl()->target_stack_),
statement_(statement),
previous_(parser->impl()->target_stack_) {
parser->impl()->target_stack_ = this;
}
~ParserTarget() { *variable_ = previous_; }
ParserTarget* previous() { return previous_; }
BreakableStatement* statement() { return statement_; }
private:
ParserTarget** variable_;
BreakableStatement* statement_;
ParserTarget* previous_;
};
class ParserTargetScope BASE_EMBEDDED {
public:
explicit ParserTargetScope(ParserBase<Parser>* parser)
: variable_(&parser->impl()->target_stack_),
previous_(parser->impl()->target_stack_) {
parser->impl()->target_stack_ = nullptr;
}
~ParserTargetScope() { *variable_ = previous_; }
private:
ParserTarget** variable_;
ParserTarget* previous_;
};
} // namespace internal
} // namespace v8
......
......@@ -51,7 +51,7 @@
'target_name': 'parser_fuzzer_lib',
'type': 'static_library',
'dependencies': [
'fuzzer_support_nocomponent',
'fuzzer_support',
],
'include_dirs': [
'../..',
......@@ -59,11 +59,6 @@
'sources': [ ### gcmole(all) ###
'parser.cc',
],
'conditions': [
['component=="shared_library"', {
'defines': [ 'BUILDING_V8_SHARED', ]
}],
],
},
{
'target_name': 'v8_simple_regexp_fuzzer',
......@@ -402,31 +397,6 @@
'fuzzer-support.h',
],
},
{
'target_name': 'fuzzer_support_nocomponent',
'type': 'static_library',
'dependencies': [
'../../src/v8.gyp:v8_libbase',
'../../src/v8.gyp:v8_libplatform',
],
'include_dirs': [
'../..',
],
'sources': [ ### gcmole(all) ###
'fuzzer-support.cc',
'fuzzer-support.h',
],
'conditions': [
['component=="shared_library"', {
# fuzzers can't be built against a shared library, so we need to
# depend on the underlying static target in that case.
'dependencies': ['../../src/v8.gyp:v8_maybe_snapshot'],
'defines': [ 'BUILDING_V8_SHARED', ]
}, {
'dependencies': ['../../src/v8.gyp:v8'],
}],
],
},
],
'conditions': [
['test_isolation_mode != "noop"', {
......
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