add gn jumbo build support

To speed up compilation times, jumbo allows files to be compiled
together. This is a well known method ("unity builds") to both
compile faster and create a poor man's "full program optimization".
We are only interested in compile times.

Background:
https://chromium.googlesource.com/chromium/src/+/master/docs/jumbo.md

Note that jumbo builds are not enabled by default.  To try this out,
add use_jumbo_build=true to your GN args.

BUG=chromium:746958

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ieb9fdccb6c135e9806dbed91c09a29aa8b8bee11
Reviewed-on: https://chromium-review.googlesource.com/579090
Commit-Queue: Mostyn Bramley-Moore <mostynb@opera.com>
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47239}
This commit is contained in:
Mostyn Bramley-Moore 2017-08-09 10:11:21 +02:00 committed by Commit Bot
parent b7227dc8d2
commit 2ddca9c260
70 changed files with 414 additions and 185 deletions

View File

@ -6,6 +6,7 @@ import("//build/config/android/config.gni")
import("//build/config/arm.gni") import("//build/config/arm.gni")
import("//build/config/dcheck_always_on.gni") import("//build/config/dcheck_always_on.gni")
import("//build/config/host_byteorder.gni") import("//build/config/host_byteorder.gni")
import("//build/config/jumbo.gni")
import("//build/config/mips.gni") import("//build/config/mips.gni")
import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sanitizers/sanitizers.gni")
@ -867,6 +868,15 @@ v8_source_set("v8_nosnapshot") {
"src/snapshot/snapshot-empty.cc", "src/snapshot/snapshot-empty.cc",
] ]
if (use_jumbo_build == true) {
jumbo_excluded_sources = [
# TODO(mostynb@opera.com): don't exclude these http://crbug.com/752428
# Generated source, contains same variable names as libraries.cc
"$target_gen_dir/experimental-extras-libraries.cc",
"$target_gen_dir/libraries.cc",
]
}
configs = [ ":internal_config" ] configs = [ ":internal_config" ]
} }
@ -898,6 +908,15 @@ v8_source_set("v8_snapshot") {
"src/setup-isolate-deserialize.cc", "src/setup-isolate-deserialize.cc",
] ]
if (use_jumbo_build == true) {
jumbo_excluded_sources = [
# TODO(mostynb@opera.com): don't exclude these http://crbug.com/752428
# Generated source, contains same variable names as libraries.cc
"$target_gen_dir/experimental-extras-libraries.cc",
"$target_gen_dir/libraries.cc",
]
}
configs = [ ":internal_config" ] configs = [ ":internal_config" ]
} }
@ -1001,6 +1020,14 @@ v8_source_set("v8_builtins_generators") {
"src/interpreter/setup-interpreter.h", "src/interpreter/setup-interpreter.h",
] ]
if (use_jumbo_build == true) {
jumbo_excluded_sources = [
# TODO(mostynb@opera.com): don't exclude these http://crbug.com/752428
"src/builtins/builtins-async-iterator-gen.cc",
"src/builtins/builtins-async-generator-gen.cc",
]
}
if (v8_current_cpu == "x86") { if (v8_current_cpu == "x86") {
sources += [ sources += [
### gcmole(arch:ia32) ### ### gcmole(arch:ia32) ###
@ -2045,6 +2072,18 @@ v8_source_set("v8_base") {
"src/zone/zone.h", "src/zone/zone.h",
] ]
if (use_jumbo_build == true) {
jumbo_excluded_sources = [
# TODO(mostynb@opera.com): don't exclude these http://crbug.com/752428
"src/profiler/heap-snapshot-generator.cc", # Macro clash in mman-linux.h
"src/compiler/c-linkage.cc", # Symbol clashes with linkage.cc
"src/compiler/wasm-linkage.cc", # regloc symbol clash with linkage.cc
"src/compiler/escape-analysis.cc", # Symbol clashes with new-escape-analysis.cc
"src/compiler/escape-analysis-reducer.cc", # Symbol clashes with new-escape-analysis-reducer.cc
]
}
if (v8_current_cpu == "x86") { if (v8_current_cpu == "x86") {
sources += [ ### gcmole(arch:ia32) ### sources += [ ### gcmole(arch:ia32) ###
"src/compiler/ia32/code-generator-ia32.cc", "src/compiler/ia32/code-generator-ia32.cc",

View File

@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/jumbo.gni")
import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/v8_target_cpu.gni") import("//build/config/v8_target_cpu.gni")
import("//build/split_static_library.gni") import("//build/split_static_library.gni")
@ -109,7 +110,11 @@ template("v8_source_set") {
} else if (defined(v8_static_library) && v8_static_library) { } else if (defined(v8_static_library) && v8_static_library) {
link_target_type = "static_library" link_target_type = "static_library"
} else { } else {
link_target_type = "source_set" if (use_jumbo_build) {
link_target_type = "jumbo_source_set"
} else {
link_target_type = "source_set"
}
} }
target(link_target_type, target_name) { target(link_target_type, target_name) {
forward_variables_from(invoker, "*", [ "configs" ]) forward_variables_from(invoker, "*", [ "configs" ])
@ -120,7 +125,7 @@ template("v8_source_set") {
} }
template("v8_header_set") { template("v8_header_set") {
source_set(target_name) { jumbo_source_set(target_name) {
forward_variables_from(invoker, "*", [ "configs" ]) forward_variables_from(invoker, "*", [ "configs" ])
configs += invoker.configs configs += invoker.configs
configs -= v8_remove_configs configs -= v8_remove_configs
@ -151,14 +156,13 @@ template("v8_executable") {
# reasons. # reasons.
if (is_clang) { if (is_clang) {
configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ] configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
configs += [ "//build/config/sanitizers:default_sanitizer_flags_but_coverage" ] configs +=
[ "//build/config/sanitizers:default_sanitizer_flags_but_coverage" ]
} else { } else {
configs -= [ v8_path_prefix + ":v8_gcov_coverage_cflags" ] configs -= [ v8_path_prefix + ":v8_gcov_coverage_cflags" ]
} }
} }
deps += [ deps += [ v8_path_prefix + ":v8_dump_build_config" ]
v8_path_prefix + ":v8_dump_build_config",
]
} }
} }

View File

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_API_ARGUMENTS_INL_H_
#define V8_API_ARGUMENTS_INL_H_
#include "src/api-arguments.h" #include "src/api-arguments.h"
#include "src/tracing/trace-event.h" #include "src/tracing/trace-event.h"
@ -153,3 +156,5 @@ void PropertyCallbackArguments::Call(AccessorNameSetterCallback f,
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // V8_API_ARGUMENTS_INL_H_

View File

@ -2460,3 +2460,5 @@ void AsmJsParser::GatherCases(ZoneVector<int32_t>* cases) {
} // namespace wasm } // namespace wasm
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#undef RECURSE

View File

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_BASE_PLATFORM_PLATFORM_POSIX_TIME_H_
#define V8_BASE_PLATFORM_PLATFORM_POSIX_TIME_H_
#include "src/base/platform/platform-posix.h" #include "src/base/platform/platform-posix.h"
namespace v8 { namespace v8 {
@ -17,3 +20,5 @@ class PosixDefaultTimezoneCache : public PosixTimezoneCache {
} // namespace base } // namespace base
} // namespace v8 } // namespace v8
#endif // V8_BASE_PLATFORM_PLATFORM_POSIX_TIME_H_

View File

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_BUILTINS_BUILTINS_ARGUMENTS_GEN_H_
#define V8_BUILTINS_BUILTINS_ARGUMENTS_GEN_H_
#include "src/code-stub-assembler.h" #include "src/code-stub-assembler.h"
namespace v8 { namespace v8 {
@ -53,3 +56,5 @@ class ArgumentsBuiltinsAssembler : public CodeStubAssembler {
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // V8_BUILTINS_BUILTINS_ARGUMENTS_GEN_H_

View File

@ -1,8 +1,10 @@
// Copyright 2017 the V8 project authors. All rights reserved. // Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_BUILTINS_BUILTINS_FORIN_GEN_H_
#define V8_BUILTINS_BUILTINS_FORIN_GEN_H_
#include "src/code-stub-assembler.h" #include "src/code-stub-assembler.h"
namespace v8 { namespace v8 {
@ -32,3 +34,5 @@ class ForInBuiltinsAssembler : public CodeStubAssembler {
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // V8_BUILTINS_BUILTINS_FORIN_GEN_H_

View File

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_BUILTINS_BUILTINS_ITERATOR_GEN_H_
#define V8_BUILTINS_BUILTINS_ITERATOR_GEN_H_
#include "src/code-stub-assembler.h" #include "src/code-stub-assembler.h"
namespace v8 { namespace v8 {
@ -47,3 +50,5 @@ class IteratorBuiltinsAssembler : public CodeStubAssembler {
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // V8_BUILTINS_BUILTINS_ITERATOR_GEN_H_

View File

@ -341,7 +341,7 @@ ZoneVector<MachineType> const* MachineTypesOf(Operator const* op) {
return OpParameter<TypedObjectStateInfo>(op).machine_types(); return OpParameter<TypedObjectStateInfo>(op).machine_types();
} }
#define CACHED_OP_LIST(V) \ #define COMMON_CACHED_OP_LIST(V) \
V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \ V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \
V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
@ -501,7 +501,7 @@ struct CommonOperatorGlobalCache final {
control_output_count) {} \ control_output_count) {} \
}; \ }; \
Name##Operator k##Name##Operator; Name##Operator k##Name##Operator;
CACHED_OP_LIST(CACHED) COMMON_CACHED_OP_LIST(CACHED)
#undef CACHED #undef CACHED
template <size_t kInputCount> template <size_t kInputCount>
@ -752,14 +752,11 @@ struct CommonOperatorGlobalCache final {
#undef CACHED_STATE_VALUES #undef CACHED_STATE_VALUES
}; };
static base::LazyInstance<CommonOperatorGlobalCache>::type
static base::LazyInstance<CommonOperatorGlobalCache>::type kCache = kCommonOperatorGlobalCache = LAZY_INSTANCE_INITIALIZER;
LAZY_INSTANCE_INITIALIZER;
CommonOperatorBuilder::CommonOperatorBuilder(Zone* zone) CommonOperatorBuilder::CommonOperatorBuilder(Zone* zone)
: cache_(kCache.Get()), zone_(zone) {} : cache_(kCommonOperatorGlobalCache.Get()), zone_(zone) {}
#define CACHED(Name, properties, value_input_count, effect_input_count, \ #define CACHED(Name, properties, value_input_count, effect_input_count, \
control_input_count, value_output_count, effect_output_count, \ control_input_count, value_output_count, effect_output_count, \
@ -767,7 +764,7 @@ CommonOperatorBuilder::CommonOperatorBuilder(Zone* zone)
const Operator* CommonOperatorBuilder::Name() { \ const Operator* CommonOperatorBuilder::Name() { \
return &cache_.k##Name##Operator; \ return &cache_.k##Name##Operator; \
} }
CACHED_OP_LIST(CACHED) COMMON_CACHED_OP_LIST(CACHED)
#undef CACHED #undef CACHED

View File

@ -228,6 +228,8 @@ void ControlEquivalence::BracketListTRACE(BracketList& blist) {
} }
} }
#undef TRACE
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -1788,6 +1788,8 @@ bool EscapeAnalysis::ExistsVirtualAllocate() {
Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); }
#undef TRACE
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -746,6 +746,8 @@ SimplifiedOperatorBuilder* JSInliner::simplified() const {
return jsgraph()->simplified(); return jsgraph()->simplified();
} }
#undef TRACE
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -39,13 +39,6 @@ bool HasOnlyJSArrayMaps(MapHandles const& maps) {
return true; return true;
} }
bool HasOnlyStringMaps(MapHandles const& maps) {
for (auto map : maps) {
if (!map->IsStringMap()) return false;
}
return true;
}
} // namespace } // namespace
struct JSNativeContextSpecialization::ScriptContextTableLookupResult { struct JSNativeContextSpecialization::ScriptContextTableLookupResult {

View File

@ -632,11 +632,11 @@ struct JSOperatorGlobalCache final {
#undef COMPARE_OP #undef COMPARE_OP
}; };
static base::LazyInstance<JSOperatorGlobalCache>::type kCache = static base::LazyInstance<JSOperatorGlobalCache>::type kJSOperatorGlobalCache =
LAZY_INSTANCE_INITIALIZER; LAZY_INSTANCE_INITIALIZER;
JSOperatorBuilder::JSOperatorBuilder(Zone* zone) JSOperatorBuilder::JSOperatorBuilder(Zone* zone)
: cache_(kCache.Get()), zone_(zone) {} : cache_(kJSOperatorGlobalCache.Get()), zone_(zone) {}
#define CACHED_OP(Name, properties, value_input_count, value_output_count) \ #define CACHED_OP(Name, properties, value_input_count, value_output_count) \
const Operator* JSOperatorBuilder::Name() { \ const Operator* JSOperatorBuilder::Name() { \

View File

@ -197,6 +197,8 @@ void JumpThreading::ApplyForwarding(ZoneVector<RpoNumber>& result,
} }
} }
#undef TRACE
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -174,6 +174,7 @@ void LiveRangeMerger::Merge() {
} }
} }
#undef TRACE
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal

View File

@ -132,7 +132,7 @@ Reduction LoadElimination::Reduce(Node* node) {
namespace { namespace {
bool IsCompatibleCheck(Node const* a, Node const* b) { bool LoadEliminationIsCompatibleCheck(Node const* a, Node const* b) {
if (a->op() != b->op()) return false; if (a->op() != b->op()) return false;
for (int i = a->op()->ValueInputCount(); --i >= 0;) { for (int i = a->op()->ValueInputCount(); --i >= 0;) {
if (!MustAlias(a->InputAt(i), b->InputAt(i))) return false; if (!MustAlias(a->InputAt(i), b->InputAt(i))) return false;
@ -144,7 +144,8 @@ bool IsCompatibleCheck(Node const* a, Node const* b) {
Node* LoadElimination::AbstractChecks::Lookup(Node* node) const { Node* LoadElimination::AbstractChecks::Lookup(Node* node) const {
for (Node* const check : nodes_) { for (Node* const check : nodes_) {
if (check && !check->IsDead() && IsCompatibleCheck(check, node)) { if (check && !check->IsDead() &&
LoadEliminationIsCompatibleCheck(check, node)) {
return check; return check;
} }
} }

View File

@ -26,7 +26,7 @@ struct NodeInfo {
// Temporary loop info needed during traversal and building the loop tree. // Temporary loop info needed during traversal and building the loop tree.
struct LoopInfo { struct TempLoopInfo {
Node* header; Node* header;
NodeInfo* header_list; NodeInfo* header_list;
NodeInfo* exit_list; NodeInfo* exit_list;
@ -93,7 +93,7 @@ class LoopFinderImpl {
} }
int i = 0; int i = 0;
for (LoopInfo& li : loops_) { for (TempLoopInfo& li : loops_) {
PrintF("Loop %d headed at #%d\n", i, li.header->id()); PrintF("Loop %d headed at #%d\n", i, li.header->id());
i++; i++;
} }
@ -109,7 +109,7 @@ class LoopFinderImpl {
NodeDeque queue_; NodeDeque queue_;
NodeMarker<bool> queued_; NodeMarker<bool> queued_;
ZoneVector<NodeInfo> info_; ZoneVector<NodeInfo> info_;
ZoneVector<LoopInfo> loops_; ZoneVector<TempLoopInfo> loops_;
ZoneVector<int> loop_num_; ZoneVector<int> loop_num_;
LoopTree* loop_tree_; LoopTree* loop_tree_;
int loops_found_; int loops_found_;
@ -295,7 +295,7 @@ class LoopFinderImpl {
// Propagate marks forward from loops. // Propagate marks forward from loops.
void PropagateForward() { void PropagateForward() {
ResizeForwardMarks(); ResizeForwardMarks();
for (LoopInfo& li : loops_) { for (TempLoopInfo& li : loops_) {
SetForwardMark(li.header, LoopNum(li.header)); SetForwardMark(li.header, LoopNum(li.header));
Queue(li.header); Queue(li.header);
} }
@ -350,7 +350,7 @@ class LoopFinderImpl {
} }
} }
void AddNodeToLoop(NodeInfo* node_info, LoopInfo* loop, int loop_num) { void AddNodeToLoop(NodeInfo* node_info, TempLoopInfo* loop, int loop_num) {
if (LoopNum(node_info->node) == loop_num) { if (LoopNum(node_info->node) == loop_num) {
if (IsLoopHeaderNode(node_info->node)) { if (IsLoopHeaderNode(node_info->node)) {
node_info->next = loop->header_list; node_info->next = loop->header_list;
@ -381,7 +381,7 @@ class LoopFinderImpl {
for (NodeInfo& ni : info_) { for (NodeInfo& ni : info_) {
if (ni.node == nullptr) continue; if (ni.node == nullptr) continue;
LoopInfo* innermost = nullptr; TempLoopInfo* innermost = nullptr;
int innermost_index = 0; int innermost_index = 0;
int pos = ni.node->id() * width_; int pos = ni.node->id() * width_;
// Search the marks word by word. // Search the marks word by word.
@ -391,7 +391,7 @@ class LoopFinderImpl {
if (marks & (1u << j)) { if (marks & (1u << j)) {
int loop_num = i * 32 + j; int loop_num = i * 32 + j;
if (loop_num == 0) continue; if (loop_num == 0) continue;
LoopInfo* loop = &loops_[loop_num - 1]; TempLoopInfo* loop = &loops_[loop_num - 1];
if (innermost == nullptr || if (innermost == nullptr ||
loop->loop->depth_ > innermost->loop->depth_) { loop->loop->depth_ > innermost->loop->depth_) {
innermost = loop; innermost = loop;
@ -415,7 +415,7 @@ class LoopFinderImpl {
// Handle the simpler case of a single loop (no checks for nesting necessary). // Handle the simpler case of a single loop (no checks for nesting necessary).
void FinishSingleLoop() { void FinishSingleLoop() {
// Place nodes into the loop header and body. // Place nodes into the loop header and body.
LoopInfo* li = &loops_[0]; TempLoopInfo* li = &loops_[0];
li->loop = &loop_tree_->all_loops_[0]; li->loop = &loop_tree_->all_loops_[0];
loop_tree_->SetParent(nullptr, li->loop); loop_tree_->SetParent(nullptr, li->loop);
size_t count = 0; size_t count = 0;
@ -434,7 +434,7 @@ class LoopFinderImpl {
// so that nested loops occupy nested intervals. // so that nested loops occupy nested intervals.
void SerializeLoop(LoopTree::Loop* loop) { void SerializeLoop(LoopTree::Loop* loop) {
int loop_num = loop_tree_->LoopNum(loop); int loop_num = loop_tree_->LoopNum(loop);
LoopInfo& li = loops_[loop_num - 1]; TempLoopInfo& li = loops_[loop_num - 1];
// Serialize the header. // Serialize the header.
loop->header_start_ = static_cast<int>(loop_tree_->loop_nodes_.size()); loop->header_start_ = static_cast<int>(loop_tree_->loop_nodes_.size());
@ -465,7 +465,7 @@ class LoopFinderImpl {
// Connect the LoopTree loops to their parents recursively. // Connect the LoopTree loops to their parents recursively.
LoopTree::Loop* ConnectLoopTree(int loop_num) { LoopTree::Loop* ConnectLoopTree(int loop_num) {
LoopInfo& li = loops_[loop_num - 1]; TempLoopInfo& li = loops_[loop_num - 1];
if (li.loop != nullptr) return li.loop; if (li.loop != nullptr) return li.loop;
NodeInfo& ni = info(li.header); NodeInfo& ni = info(li.header);

View File

@ -405,6 +405,8 @@ void LoopVariableOptimizer::ChangeToPhisAndInsertGuards() {
} }
} }
#undef TRACE
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -144,7 +144,7 @@ MachineType AtomicOpRepresentationOf(Operator const* op) {
V(Uint64LessThan, Operator::kNoProperties, 2, 0, 1) \ V(Uint64LessThan, Operator::kNoProperties, 2, 0, 1) \
V(Uint64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1) V(Uint64LessThanOrEqual, Operator::kNoProperties, 2, 0, 1)
#define PURE_OP_LIST(V) \ #define MACHINE_PURE_OP_LIST(V) \
PURE_BINARY_OP_LIST_32(V) \ PURE_BINARY_OP_LIST_32(V) \
PURE_BINARY_OP_LIST_64(V) \ PURE_BINARY_OP_LIST_64(V) \
V(Word32Clz, Operator::kNoProperties, 1, 0, 1) \ V(Word32Clz, Operator::kNoProperties, 1, 0, 1) \
@ -443,7 +443,7 @@ struct MachineOperatorGlobalCache {
0) {} \ 0) {} \
}; \ }; \
Name##Operator k##Name; Name##Operator k##Name;
PURE_OP_LIST(PURE) MACHINE_PURE_OP_LIST(PURE)
PURE_OPTIONAL_OP_LIST(PURE) PURE_OPTIONAL_OP_LIST(PURE)
#undef PURE #undef PURE
@ -669,14 +669,14 @@ struct CommentOperator : public Operator1<const char*> {
"Comment", 0, 0, 0, 0, 0, 0, msg) {} "Comment", 0, 0, 0, 0, 0, 0, msg) {}
}; };
static base::LazyInstance<MachineOperatorGlobalCache>::type kCache = static base::LazyInstance<MachineOperatorGlobalCache>::type
LAZY_INSTANCE_INITIALIZER; kMachineOperatorGlobalCache = LAZY_INSTANCE_INITIALIZER;
MachineOperatorBuilder::MachineOperatorBuilder( MachineOperatorBuilder::MachineOperatorBuilder(
Zone* zone, MachineRepresentation word, Flags flags, Zone* zone, MachineRepresentation word, Flags flags,
AlignmentRequirements alignmentRequirements) AlignmentRequirements alignmentRequirements)
: zone_(zone), : zone_(zone),
cache_(kCache.Get()), cache_(kMachineOperatorGlobalCache.Get()),
word_(word), word_(word),
flags_(flags), flags_(flags),
alignment_requirements_(alignmentRequirements) { alignment_requirements_(alignmentRequirements) {
@ -713,7 +713,7 @@ const Operator* MachineOperatorBuilder::UnalignedStore(
#define PURE(Name, properties, value_input_count, control_input_count, \ #define PURE(Name, properties, value_input_count, control_input_count, \
output_count) \ output_count) \
const Operator* MachineOperatorBuilder::Name() { return &cache_.k##Name; } const Operator* MachineOperatorBuilder::Name() { return &cache_.k##Name; }
PURE_OP_LIST(PURE) MACHINE_PURE_OP_LIST(PURE)
#undef PURE #undef PURE
#define PURE(Name, properties, value_input_count, control_input_count, \ #define PURE(Name, properties, value_input_count, control_input_count, \

View File

@ -403,6 +403,9 @@ Node* NodeHashCache::Constructor::MutableNode() {
} }
return tmp_; return tmp_;
} }
#undef TRACE
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -11,6 +11,15 @@
#include "src/compiler/simplified-operator.h" #include "src/compiler/simplified-operator.h"
#include "src/objects-inl.h" #include "src/objects-inl.h"
#ifdef DEBUG
#define TRACE(...) \
do { \
if (FLAG_trace_turbo_escape) PrintF(__VA_ARGS__); \
} while (false)
#else
#define TRACE(...)
#endif
namespace v8 { namespace v8 {
namespace internal { namespace internal {
namespace compiler { namespace compiler {
@ -690,6 +699,8 @@ VirtualObject::VirtualObject(VariableTracker* var_states, VirtualObject::Id id,
} }
} }
#undef TRACE
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -11,15 +11,6 @@
#include "src/compiler/persistent-map.h" #include "src/compiler/persistent-map.h"
#include "src/globals.h" #include "src/globals.h"
#ifdef DEBUG
#define TRACE(...) \
do { \
if (FLAG_trace_turbo_escape) PrintF(__VA_ARGS__); \
} while (false)
#else
#define TRACE(...)
#endif
namespace v8 { namespace v8 {
namespace internal { namespace internal {
namespace compiler { namespace compiler {

View File

@ -336,6 +336,8 @@ void OsrHelper::SetupFrame(Frame* frame) {
frame->ReserveSpillSlots(UnoptimizedFrameSlots()); frame->ReserveSpillSlots(UnoptimizedFrameSlots());
} }
#undef TRACE
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -31,6 +31,13 @@ SimplifiedOperatorBuilder* PropertyAccessBuilder::simplified() const {
return jsgraph()->simplified(); return jsgraph()->simplified();
} }
bool HasOnlyStringMaps(MapHandles const& maps) {
for (auto map : maps) {
if (!map->IsStringMap()) return false;
}
return true;
}
namespace { namespace {
bool HasOnlyNumberMaps(MapHandles const& maps) { bool HasOnlyNumberMaps(MapHandles const& maps) {
@ -40,13 +47,6 @@ bool HasOnlyNumberMaps(MapHandles const& maps) {
return true; return true;
} }
bool HasOnlyStringMaps(MapHandles const& maps) {
for (auto map : maps) {
if (!map->IsStringMap()) return false;
}
return true;
}
bool HasOnlySequentialStringMaps(MapHandles const& maps) { bool HasOnlySequentialStringMaps(MapHandles const& maps) {
for (auto map : maps) { for (auto map : maps) {
if (!map->IsStringMap()) return false; if (!map->IsStringMap()) return false;

View File

@ -73,6 +73,8 @@ class PropertyAccessBuilder {
CompilationDependencies* dependencies_; CompilationDependencies* dependencies_;
}; };
bool HasOnlyStringMaps(MapHandles const& maps);
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -4013,6 +4013,7 @@ void LiveRangeConnector::CommitSpillsInDeferredBlocks(
} }
} }
#undef TRACE
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal

View File

@ -1777,6 +1777,8 @@ void Scheduler::MovePlannedNodes(BasicBlock* from, BasicBlock* to) {
} }
} }
#undef TRACE
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -249,7 +249,7 @@ void SimdScalarLowering::SetLoweredType(Node* node, Node* output) {
} }
} }
static int GetParameterIndexAfterLowering( static int GetParameterIndexAfterLoweringSimd128(
Signature<MachineRepresentation>* signature, int old_index) { Signature<MachineRepresentation>* signature, int old_index) {
// In function calls, the simd128 types are passed as 4 Int32 types. The // In function calls, the simd128 types are passed as 4 Int32 types. The
// parameters are typecast to the types as needed for various operations. // parameters are typecast to the types as needed for various operations.
@ -264,15 +264,15 @@ static int GetParameterIndexAfterLowering(
int SimdScalarLowering::GetParameterCountAfterLowering() { int SimdScalarLowering::GetParameterCountAfterLowering() {
if (parameter_count_after_lowering_ == -1) { if (parameter_count_after_lowering_ == -1) {
// GetParameterIndexAfterLowering(parameter_count) returns the parameter // GetParameterIndexAfterLoweringSimd128(parameter_count) returns the
// count after lowering. // parameter count after lowering.
parameter_count_after_lowering_ = GetParameterIndexAfterLowering( parameter_count_after_lowering_ = GetParameterIndexAfterLoweringSimd128(
signature(), static_cast<int>(signature()->parameter_count())); signature(), static_cast<int>(signature()->parameter_count()));
} }
return parameter_count_after_lowering_; return parameter_count_after_lowering_;
} }
static int GetReturnCountAfterLowering( static int GetReturnCountAfterLoweringSimd128(
Signature<MachineRepresentation>* signature) { Signature<MachineRepresentation>* signature) {
int result = static_cast<int>(signature->return_count()); int result = static_cast<int>(signature->return_count());
for (int i = 0; i < static_cast<int>(signature->return_count()); ++i) { for (int i = 0; i < static_cast<int>(signature->return_count()); ++i) {
@ -714,7 +714,8 @@ void SimdScalarLowering::LowerNode(Node* node) {
if (GetParameterCountAfterLowering() != if (GetParameterCountAfterLowering() !=
static_cast<int>(signature()->parameter_count())) { static_cast<int>(signature()->parameter_count())) {
int old_index = ParameterIndexOf(node->op()); int old_index = ParameterIndexOf(node->op());
int new_index = GetParameterIndexAfterLowering(signature(), old_index); int new_index =
GetParameterIndexAfterLoweringSimd128(signature(), old_index);
if (old_index == new_index) { if (old_index == new_index) {
NodeProperties::ChangeOp(node, common()->Parameter(new_index)); NodeProperties::ChangeOp(node, common()->Parameter(new_index));
@ -772,7 +773,7 @@ void SimdScalarLowering::LowerNode(Node* node) {
} }
case IrOpcode::kReturn: { case IrOpcode::kReturn: {
DefaultLowering(node); DefaultLowering(node);
int new_return_count = GetReturnCountAfterLowering(signature()); int new_return_count = GetReturnCountAfterLoweringSimd128(signature());
if (static_cast<int>(signature()->return_count()) != new_return_count) { if (static_cast<int>(signature()->return_count()) != new_return_count) {
NodeProperties::ChangeOp(node, common()->Return(new_return_count)); NodeProperties::ChangeOp(node, common()->Return(new_return_count));
} }

View File

@ -3773,6 +3773,8 @@ Operator const* SimplifiedLowering::ToNumberOperator() {
return to_number_operator_.get(); return to_number_operator_.get();
} }
#undef TRACE
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -830,13 +830,11 @@ struct SimplifiedOperatorGlobalCache final {
#undef BUFFER_ACCESS #undef BUFFER_ACCESS
}; };
static base::LazyInstance<SimplifiedOperatorGlobalCache>::type
static base::LazyInstance<SimplifiedOperatorGlobalCache>::type kCache = kSimplifiedOperatorGlobalCache = LAZY_INSTANCE_INITIALIZER;
LAZY_INSTANCE_INITIALIZER;
SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone) SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone)
: cache_(kCache.Get()), zone_(zone) {} : cache_(kSimplifiedOperatorGlobalCache.Get()), zone_(zone) {}
#define GET_FROM_CACHE(Name, ...) \ #define GET_FROM_CACHE(Name, ...) \
const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; } const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; }

View File

@ -12,12 +12,12 @@ namespace compiler {
namespace { namespace {
base::LazyInstance<TypeCache>::type kCache = LAZY_INSTANCE_INITIALIZER; base::LazyInstance<TypeCache>::type kTypeCache = LAZY_INSTANCE_INITIALIZER;
} // namespace } // namespace
// static // static
TypeCache const& TypeCache::Get() { return kCache.Get(); } TypeCache const& TypeCache::Get() { return kTypeCache.Get(); }
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal

View File

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_HEAP_ARRAY_BUFFER_TRACKER_INL_H_
#define V8_HEAP_ARRAY_BUFFER_TRACKER_INL_H_
#include "src/conversions-inl.h" #include "src/conversions-inl.h"
#include "src/heap/array-buffer-tracker.h" #include "src/heap/array-buffer-tracker.h"
#include "src/heap/heap.h" #include "src/heap/heap.h"
@ -68,3 +71,5 @@ void LocalArrayBufferTracker::Remove(JSArrayBuffer* buffer, size_t length) {
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // V8_HEAP_ARRAY_BUFFER_TRACKER_INL_H_

View File

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_HEAP_CODE_STATS_H_
#define V8_HEAP_CODE_STATS_H_
namespace v8 { namespace v8 {
namespace internal { namespace internal {
@ -41,3 +44,5 @@ class CodeStatistics {
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // V8_HEAP_CODE_STATS_H_

View File

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_HEAP_LOCAL_ALLOCATOR_H_
#define V8_HEAP_LOCAL_ALLOCATOR_H_
#include "src/globals.h" #include "src/globals.h"
#include "src/heap/heap.h" #include "src/heap/heap.h"
#include "src/heap/spaces.h" #include "src/heap/spaces.h"
@ -137,3 +140,5 @@ class LocalAllocator {
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // V8_HEAP_LOCAL_ALLOCATOR_H_

View File

@ -7,6 +7,7 @@
#include <utility> #include <utility>
#include "src/base/bits.h" #include "src/base/bits.h"
#include "src/base/macros.h"
#include "src/base/platform/platform.h" #include "src/base/platform/platform.h"
#include "src/base/platform/semaphore.h" #include "src/base/platform/semaphore.h"
#include "src/counters.h" #include "src/counters.h"
@ -138,7 +139,7 @@ bool CodeRange::SetUp(size_t requested) {
base += reserved_area; base += reserved_area;
} }
Address aligned_base = RoundUp(base, MemoryChunk::kAlignment); Address aligned_base = ::RoundUp(base, MemoryChunk::kAlignment);
size_t size = reservation.size() - (aligned_base - base) - reserved_area; size_t size = reservation.size() - (aligned_base - base) - reserved_area;
allocation_list_.Add(FreeBlock(aligned_base, size)); allocation_list_.Add(FreeBlock(aligned_base, size));
current_allocation_block_index_ = 0; current_allocation_block_index_ = 0;
@ -261,7 +262,7 @@ bool CodeRange::ReserveBlock(const size_t requested_size, FreeBlock* block) {
if (!GetNextAllocationBlock(requested_size)) return false; if (!GetNextAllocationBlock(requested_size)) return false;
} }
// Commit the requested memory at the start of the current allocation block. // Commit the requested memory at the start of the current allocation block.
size_t aligned_requested = RoundUp(requested_size, MemoryChunk::kAlignment); size_t aligned_requested = ::RoundUp(requested_size, MemoryChunk::kAlignment);
*block = allocation_list_[current_allocation_block_index_]; *block = allocation_list_[current_allocation_block_index_];
// Don't leave a small free block, useless for a large object or chunk. // Don't leave a small free block, useless for a large object or chunk.
if (aligned_requested < (block->size - Page::kPageSize)) { if (aligned_requested < (block->size - Page::kPageSize)) {
@ -295,7 +296,7 @@ MemoryAllocator::MemoryAllocator(Isolate* isolate)
unmapper_(isolate->heap(), this) {} unmapper_(isolate->heap(), this) {}
bool MemoryAllocator::SetUp(size_t capacity, size_t code_range_size) { bool MemoryAllocator::SetUp(size_t capacity, size_t code_range_size) {
capacity_ = RoundUp(capacity, Page::kPageSize); capacity_ = ::RoundUp(capacity, Page::kPageSize);
size_ = 0; size_ = 0;
size_executable_ = 0; size_executable_ = 0;
@ -465,9 +466,9 @@ Address MemoryAllocator::ReserveAlignedMemory(size_t size, size_t alignment,
return nullptr; return nullptr;
const Address base = const Address base =
RoundUp(static_cast<Address>(reservation.address()), alignment); ::RoundUp(static_cast<Address>(reservation.address()), alignment);
if (base + size != reservation.end()) { if (base + size != reservation.end()) {
const Address unused_start = RoundUp(base + size, GetCommitPageSize()); const Address unused_start = ::RoundUp(base + size, GetCommitPageSize());
reservation.ReleasePartial(unused_start); reservation.ReleasePartial(unused_start);
} }
size_.Increment(reservation.size()); size_.Increment(reservation.size());
@ -663,9 +664,9 @@ bool MemoryChunk::CommitArea(size_t requested) {
IsFlagSet(IS_EXECUTABLE) ? MemoryAllocator::CodePageGuardSize() : 0; IsFlagSet(IS_EXECUTABLE) ? MemoryAllocator::CodePageGuardSize() : 0;
size_t header_size = area_start() - address() - guard_size; size_t header_size = area_start() - address() - guard_size;
size_t commit_size = size_t commit_size =
RoundUp(header_size + requested, MemoryAllocator::GetCommitPageSize()); ::RoundUp(header_size + requested, MemoryAllocator::GetCommitPageSize());
size_t committed_size = RoundUp(header_size + (area_end() - area_start()), size_t committed_size = ::RoundUp(header_size + (area_end() - area_start()),
MemoryAllocator::GetCommitPageSize()); MemoryAllocator::GetCommitPageSize());
if (commit_size > committed_size) { if (commit_size > committed_size) {
// Commit size should be less or equal than the reserved size. // Commit size should be less or equal than the reserved size.
@ -777,13 +778,13 @@ MemoryChunk* MemoryAllocator::AllocateChunk(size_t reserve_area_size,
// //
if (executable == EXECUTABLE) { if (executable == EXECUTABLE) {
chunk_size = RoundUp(CodePageAreaStartOffset() + reserve_area_size, chunk_size = ::RoundUp(CodePageAreaStartOffset() + reserve_area_size,
GetCommitPageSize()) + GetCommitPageSize()) +
CodePageGuardSize(); CodePageGuardSize();
// Size of header (not executable) plus area (executable). // Size of header (not executable) plus area (executable).
size_t commit_size = RoundUp(CodePageGuardStartOffset() + commit_area_size, size_t commit_size = ::RoundUp(
GetCommitPageSize()); CodePageGuardStartOffset() + commit_area_size, GetCommitPageSize());
// Allocate executable memory either from code range or from the // Allocate executable memory either from code range or from the
// OS. // OS.
#ifdef V8_TARGET_ARCH_MIPS64 #ifdef V8_TARGET_ARCH_MIPS64
@ -818,11 +819,11 @@ MemoryChunk* MemoryAllocator::AllocateChunk(size_t reserve_area_size,
area_start = base + CodePageAreaStartOffset(); area_start = base + CodePageAreaStartOffset();
area_end = area_start + commit_area_size; area_end = area_start + commit_area_size;
} else { } else {
chunk_size = RoundUp(MemoryChunk::kObjectStartOffset + reserve_area_size, chunk_size = ::RoundUp(MemoryChunk::kObjectStartOffset + reserve_area_size,
GetCommitPageSize()); GetCommitPageSize());
size_t commit_size = size_t commit_size =
RoundUp(MemoryChunk::kObjectStartOffset + commit_area_size, ::RoundUp(MemoryChunk::kObjectStartOffset + commit_area_size,
GetCommitPageSize()); GetCommitPageSize());
base = base =
AllocateAlignedMemory(chunk_size, commit_size, MemoryChunk::kAlignment, AllocateAlignedMemory(chunk_size, commit_size, MemoryChunk::kAlignment,
executable, address_hint, &reservation); executable, address_hint, &reservation);
@ -1145,7 +1146,7 @@ void MemoryAllocator::ReportStatistics() {
size_t MemoryAllocator::CodePageGuardStartOffset() { size_t MemoryAllocator::CodePageGuardStartOffset() {
// We are guarding code pages: the first OS page after the header // We are guarding code pages: the first OS page after the header
// will be protected as non-writable. // will be protected as non-writable.
return RoundUp(Page::kObjectStartOffset, GetCommitPageSize()); return ::RoundUp(Page::kObjectStartOffset, GetCommitPageSize());
} }
size_t MemoryAllocator::CodePageGuardSize() { size_t MemoryAllocator::CodePageGuardSize() {
@ -1795,7 +1796,7 @@ void NewSpace::Grow() {
void NewSpace::Shrink() { void NewSpace::Shrink() {
size_t new_capacity = Max(InitialTotalCapacity(), 2 * Size()); size_t new_capacity = Max(InitialTotalCapacity(), 2 * Size());
size_t rounded_new_capacity = RoundUp(new_capacity, Page::kPageSize); size_t rounded_new_capacity = ::RoundUp(new_capacity, Page::kPageSize);
if (rounded_new_capacity < TotalCapacity() && if (rounded_new_capacity < TotalCapacity() &&
to_space_.ShrinkTo(rounded_new_capacity)) { to_space_.ShrinkTo(rounded_new_capacity)) {
// Only shrink from-space if we managed to shrink to-space. // Only shrink from-space if we managed to shrink to-space.
@ -3167,8 +3168,8 @@ Address LargePage::GetAddressToShrink() {
if (executable() == EXECUTABLE) { if (executable() == EXECUTABLE) {
return 0; return 0;
} }
size_t used_size = RoundUp((object->address() - address()) + object->Size(), size_t used_size = ::RoundUp((object->address() - address()) + object->Size(),
MemoryAllocator::GetCommitPageSize()); MemoryAllocator::GetCommitPageSize());
if (used_size < CommittedPhysicalMemory()) { if (used_size < CommittedPhysicalMemory()) {
return address() + used_size; return address() + used_size;
} }
@ -3359,8 +3360,8 @@ void LargeObjectSpace::RemoveChunkMapEntries(LargePage* page) {
void LargeObjectSpace::RemoveChunkMapEntries(LargePage* page, void LargeObjectSpace::RemoveChunkMapEntries(LargePage* page,
Address free_start) { Address free_start) {
uintptr_t start = RoundUp(reinterpret_cast<uintptr_t>(free_start), uintptr_t start = ::RoundUp(reinterpret_cast<uintptr_t>(free_start),
MemoryChunk::kAlignment) / MemoryChunk::kAlignment) /
MemoryChunk::kAlignment; MemoryChunk::kAlignment;
uintptr_t limit = (reinterpret_cast<uintptr_t>(page) + (page->size() - 1)) / uintptr_t limit = (reinterpret_cast<uintptr_t>(page) + (page->size() - 1)) /
MemoryChunk::kAlignment; MemoryChunk::kAlignment;

View File

@ -6,6 +6,7 @@
#include <algorithm> #include <algorithm>
#include "src/base/macros.h"
#include "src/counters.h" #include "src/counters.h"
#include "src/heap/incremental-marking.h" #include "src/heap/incremental-marking.h"
#include "src/isolate.h" #include "src/isolate.h"
@ -38,7 +39,7 @@ void StoreBuffer::SetUp() {
} }
uintptr_t start_as_int = reinterpret_cast<uintptr_t>(reservation.address()); uintptr_t start_as_int = reinterpret_cast<uintptr_t>(reservation.address());
start_[0] = start_[0] =
reinterpret_cast<Address*>(RoundUp(start_as_int, kStoreBufferSize)); reinterpret_cast<Address*>(::RoundUp(start_as_int, kStoreBufferSize));
limit_[0] = start_[0] + (kStoreBufferSize / kPointerSize); limit_[0] = start_[0] + (kStoreBufferSize / kPointerSize);
start_[1] = limit_[0]; start_[1] = limit_[0];
limit_[1] = start_[1] + (kStoreBufferSize / kPointerSize); limit_[1] = start_[1] + (kStoreBufferSize / kPointerSize);

View File

@ -186,6 +186,8 @@ String16 breakLocationType(v8::debug::BreakLocationType type) {
return String16(); return String16();
} }
} // namespace
String16 scopeType(v8::debug::ScopeIterator::ScopeType type) { String16 scopeType(v8::debug::ScopeIterator::ScopeType type) {
switch (type) { switch (type) {
case v8::debug::ScopeIterator::ScopeTypeGlobal: case v8::debug::ScopeIterator::ScopeTypeGlobal:
@ -211,6 +213,8 @@ String16 scopeType(v8::debug::ScopeIterator::ScopeType type) {
return String16(); return String16();
} }
namespace {
Response buildScopes(v8::debug::ScopeIterator* iterator, Response buildScopes(v8::debug::ScopeIterator* iterator,
InjectedScript* injectedScript, InjectedScript* injectedScript,
std::unique_ptr<Array<Scope>>* scopes) { std::unique_ptr<Array<Scope>>* scopes) {

View File

@ -8,6 +8,7 @@
#include <vector> #include <vector>
#include "src/base/macros.h" #include "src/base/macros.h"
#include "src/debug/debug-interface.h"
#include "src/debug/interface-types.h" #include "src/debug/interface-types.h"
#include "src/inspector/protocol/Debugger.h" #include "src/inspector/protocol/Debugger.h"
#include "src/inspector/protocol/Forward.h" #include "src/inspector/protocol/Forward.h"
@ -202,6 +203,8 @@ class V8DebuggerAgentImpl : public protocol::Debugger::Backend {
DISALLOW_COPY_AND_ASSIGN(V8DebuggerAgentImpl); DISALLOW_COPY_AND_ASSIGN(V8DebuggerAgentImpl);
}; };
String16 scopeType(v8::debug::ScopeIterator::ScopeType type);
} // namespace v8_inspector } // namespace v8_inspector
#endif // V8_INSPECTOR_V8DEBUGGERAGENTIMPL_H_ #endif // V8_INSPECTOR_V8DEBUGGERAGENTIMPL_H_

View File

@ -130,31 +130,6 @@ void cleanupExpiredWeakPointers(Map& map) {
} }
} }
String16 scopeType(v8::debug::ScopeIterator::ScopeType type) {
switch (type) {
case v8::debug::ScopeIterator::ScopeTypeGlobal:
return protocol::Debugger::Scope::TypeEnum::Global;
case v8::debug::ScopeIterator::ScopeTypeLocal:
return protocol::Debugger::Scope::TypeEnum::Local;
case v8::debug::ScopeIterator::ScopeTypeWith:
return protocol::Debugger::Scope::TypeEnum::With;
case v8::debug::ScopeIterator::ScopeTypeClosure:
return protocol::Debugger::Scope::TypeEnum::Closure;
case v8::debug::ScopeIterator::ScopeTypeCatch:
return protocol::Debugger::Scope::TypeEnum::Catch;
case v8::debug::ScopeIterator::ScopeTypeBlock:
return protocol::Debugger::Scope::TypeEnum::Block;
case v8::debug::ScopeIterator::ScopeTypeScript:
return protocol::Debugger::Scope::TypeEnum::Script;
case v8::debug::ScopeIterator::ScopeTypeEval:
return protocol::Debugger::Scope::TypeEnum::Eval;
case v8::debug::ScopeIterator::ScopeTypeModule:
return protocol::Debugger::Scope::TypeEnum::Module;
}
UNREACHABLE();
return String16();
}
} // namespace } // namespace
V8Debugger::V8Debugger(v8::Isolate* isolate, V8InspectorImpl* inspector) V8Debugger::V8Debugger(v8::Isolate* isolate, V8InspectorImpl* inspector)
@ -592,7 +567,7 @@ v8::MaybeLocal<v8::Value> V8Debugger::getTargetScopes(
if (!markAsInternal(context, scope, V8InternalValueType::kScope)) { if (!markAsInternal(context, scope, V8InternalValueType::kScope)) {
return v8::MaybeLocal<v8::Value>(); return v8::MaybeLocal<v8::Value>();
} }
String16 type = scopeType(iterator->GetType()); String16 type = v8_inspector::scopeType(iterator->GetType());
String16 name; String16 name;
v8::Local<v8::Function> closure = iterator->GetFunction(); v8::Local<v8::Function> closure = iterator->GetFunction();
if (!closure.IsEmpty()) { if (!closure.IsEmpty()) {

View File

@ -15,9 +15,20 @@
#include "src/inspector/v8-debugger.h" #include "src/inspector/v8-debugger.h"
#include "src/inspector/v8-inspector-impl.h" #include "src/inspector/v8-inspector-impl.h"
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wheader-hygiene"
#endif
using namespace v8_inspector; using namespace v8_inspector;
using namespace v8; using namespace v8;
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic pop
#endif
class WasmTranslation::TranslatorImpl { class WasmTranslation::TranslatorImpl {
public: public:
struct TransLocation { struct TransLocation {

View File

@ -453,6 +453,8 @@ void IntrinsicsGenerator::AbortIfArgCountMismatch(int expected, Node* actual) {
__ BIND(&match); __ BIND(&match);
} }
#undef __
} // namespace interpreter } // namespace interpreter
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_LOOKUP_CACHE_INL_H_
#define V8_LOOKUP_CACHE_INL_H_
#include "src/lookup-cache.h" #include "src/lookup-cache.h"
#include "src/objects-inl.h" #include "src/objects-inl.h"
@ -38,3 +41,5 @@ void DescriptorLookupCache::Update(Map* source, Name* name, int result) {
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // V8_LOOKUP_CACHE_INL_H_

View File

@ -14,15 +14,15 @@ namespace internal {
namespace { namespace {
class Rewriter final : public AstTraversalVisitor<Rewriter> { class Reparenter final : public AstTraversalVisitor<Reparenter> {
public: public:
Rewriter(uintptr_t stack_limit, Expression* initializer, Scope* scope) Reparenter(uintptr_t stack_limit, Expression* initializer, Scope* scope)
: AstTraversalVisitor(stack_limit, initializer), scope_(scope) {} : AstTraversalVisitor(stack_limit, initializer), scope_(scope) {}
private: private:
// This is required so that the overriden Visit* methods can be // This is required so that the overriden Visit* methods can be
// called by the base class (template). // called by the base class (template).
friend class AstTraversalVisitor<Rewriter>; friend class AstTraversalVisitor<Reparenter>;
void VisitFunctionLiteral(FunctionLiteral* expr); void VisitFunctionLiteral(FunctionLiteral* expr);
void VisitClassLiteral(ClassLiteral* expr); void VisitClassLiteral(ClassLiteral* expr);
@ -35,11 +35,11 @@ class Rewriter final : public AstTraversalVisitor<Rewriter> {
Scope* scope_; Scope* scope_;
}; };
void Rewriter::VisitFunctionLiteral(FunctionLiteral* function_literal) { void Reparenter::VisitFunctionLiteral(FunctionLiteral* function_literal) {
function_literal->scope()->ReplaceOuterScope(scope_); function_literal->scope()->ReplaceOuterScope(scope_);
} }
void Rewriter::VisitClassLiteral(ClassLiteral* class_literal) { void Reparenter::VisitClassLiteral(ClassLiteral* class_literal) {
class_literal->scope()->ReplaceOuterScope(scope_); class_literal->scope()->ReplaceOuterScope(scope_);
// No need to visit the constructor since it will have the class // No need to visit the constructor since it will have the class
// scope on its scope chain. // scope on its scope chain.
@ -60,7 +60,7 @@ void Rewriter::VisitClassLiteral(ClassLiteral* class_literal) {
#endif #endif
} }
void Rewriter::VisitVariableProxy(VariableProxy* proxy) { void Reparenter::VisitVariableProxy(VariableProxy* proxy) {
if (!proxy->is_resolved()) { if (!proxy->is_resolved()) {
if (scope_->outer_scope()->RemoveUnresolved(proxy)) { if (scope_->outer_scope()->RemoveUnresolved(proxy)) {
scope_->AddUnresolved(proxy); scope_->AddUnresolved(proxy);
@ -72,19 +72,19 @@ void Rewriter::VisitVariableProxy(VariableProxy* proxy) {
} }
} }
void Rewriter::VisitBlock(Block* stmt) { void Reparenter::VisitBlock(Block* stmt) {
if (stmt->scope() != nullptr) if (stmt->scope() != nullptr)
stmt->scope()->ReplaceOuterScope(scope_); stmt->scope()->ReplaceOuterScope(scope_);
else else
VisitStatements(stmt->statements()); VisitStatements(stmt->statements());
} }
void Rewriter::VisitTryCatchStatement(TryCatchStatement* stmt) { void Reparenter::VisitTryCatchStatement(TryCatchStatement* stmt) {
Visit(stmt->try_block()); Visit(stmt->try_block());
stmt->scope()->ReplaceOuterScope(scope_); stmt->scope()->ReplaceOuterScope(scope_);
} }
void Rewriter::VisitWithStatement(WithStatement* stmt) { void Reparenter::VisitWithStatement(WithStatement* stmt) {
Visit(stmt->expression()); Visit(stmt->expression());
stmt->scope()->ReplaceOuterScope(scope_); stmt->scope()->ReplaceOuterScope(scope_);
} }
@ -105,8 +105,8 @@ void ReparentExpressionScope(uintptr_t stack_limit, Expression* expr,
DCHECK_IMPLIES(!scope->is_declaration_scope(), DCHECK_IMPLIES(!scope->is_declaration_scope(),
scope->outer_scope()->is_hidden()); scope->outer_scope()->is_hidden());
Rewriter rewriter(stack_limit, expr, scope); Reparenter r(stack_limit, expr, scope);
rewriter.Run(); r.Run();
} }
} // namespace internal } // namespace internal

View File

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_SETUP_ISOLATE_H_
#define V8_SETUP_ISOLATE_H_
namespace v8 { namespace v8 {
namespace internal { namespace internal {
@ -45,3 +48,5 @@ class SetupIsolateDelegate {
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // V8_SETUP_ISOLATE_H_

View File

@ -2372,6 +2372,8 @@ BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
static_cast<int>(num_locals), zone); static_cast<int>(num_locals), zone);
} }
#undef TRACE
} // namespace wasm } // namespace wasm
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -6,9 +6,20 @@
#include "src/wasm/leb-helper.h" #include "src/wasm/leb-helper.h"
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wheader-hygiene"
#endif
using namespace v8::internal; using namespace v8::internal;
using namespace v8::internal::wasm; using namespace v8::internal::wasm;
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic pop
#endif
void LocalDeclEncoder::Prepend(Zone* zone, const byte** start, void LocalDeclEncoder::Prepend(Zone* zone, const byte** start,
const byte** end) const { const byte** end) const {
size_t size = (*end - *start); size_t size = (*end - *start);

View File

@ -520,24 +520,6 @@ double MonotonicallyIncreasingTimeInMs() {
base::Time::kMillisecondsPerSecond; base::Time::kMillisecondsPerSecond;
} }
void RejectPromise(Isolate* isolate, Handle<Context> context,
ErrorThrower& thrower, Handle<JSPromise> promise) {
v8::Local<v8::Promise::Resolver> resolver =
v8::Utils::PromiseToLocal(promise).As<v8::Promise::Resolver>();
auto maybe = resolver->Reject(v8::Utils::ToLocal(context),
v8::Utils::ToLocal(thrower.Reify()));
CHECK_IMPLIES(!maybe.FromMaybe(false), isolate->has_scheduled_exception());
}
void ResolvePromise(Isolate* isolate, Handle<Context> context,
Handle<JSPromise> promise, Handle<Object> result) {
v8::Local<v8::Promise::Resolver> resolver =
v8::Utils::PromiseToLocal(promise).As<v8::Promise::Resolver>();
auto maybe = resolver->Resolve(v8::Utils::ToLocal(context),
v8::Utils::ToLocal(result));
CHECK_IMPLIES(!maybe.FromMaybe(false), isolate->has_scheduled_exception());
}
void SetFunctionTablesToDefault(Factory* factory, wasm::ModuleEnv* module_env) { void SetFunctionTablesToDefault(Factory* factory, wasm::ModuleEnv* module_env) {
for (uint32_t i = 0, for (uint32_t i = 0,
e = static_cast<uint32_t>(module_env->function_tables().size()); e = static_cast<uint32_t>(module_env->function_tables().size());
@ -2317,6 +2299,9 @@ class AsyncCompileJob::FinishModule : public CompileStep {
return job_->AsyncCompileSucceeded(result); return job_->AsyncCompileSucceeded(result);
} }
}; };
#undef TRACE
} // namespace wasm } // namespace wasm
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -1528,6 +1528,8 @@ void DecodeLocalNames(const byte* module_start, const byte* module_end,
} }
} }
#undef TRACE
} // namespace wasm } // namespace wasm
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -15,9 +15,20 @@
#include "src/wasm/wasm-objects.h" #include "src/wasm/wasm-objects.h"
#include "src/wasm/wasm-result.h" #include "src/wasm/wasm-result.h"
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wheader-hygiene"
#endif
using namespace v8::internal; using namespace v8::internal;
using namespace v8::internal::wasm; using namespace v8::internal::wasm;
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic pop
#endif
void StreamingDecoder::OnBytesReceived(Vector<const uint8_t> bytes) { void StreamingDecoder::OnBytesReceived(Vector<const uint8_t> bytes) {
size_t current = 0; size_t current = 0;
while (decoder()->ok() && current < bytes.size()) { while (decoder()->ok() && current < bytes.size()) {

View File

@ -11,10 +11,21 @@
#include "src/wasm/wasm-module.h" #include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-opcodes.h" #include "src/wasm/wasm-opcodes.h"
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wheader-hygiene"
#endif
using namespace v8::internal; using namespace v8::internal;
using namespace v8::internal::wasm; using namespace v8::internal::wasm;
namespace { #if __clang__
#pragma clang diagnostic pop
#endif
namespace v8 {
namespace internal {
namespace wasm {
int ExtractDirectCallIndex(wasm::Decoder& decoder, const byte* pc) { int ExtractDirectCallIndex(wasm::Decoder& decoder, const byte* pc) {
DCHECK_EQ(static_cast<int>(kExprCallFunction), static_cast<int>(*pc)); DCHECK_EQ(static_cast<int>(kExprCallFunction), static_cast<int>(*pc));
@ -25,6 +36,12 @@ int ExtractDirectCallIndex(wasm::Decoder& decoder, const byte* pc) {
return static_cast<int>(call_idx); return static_cast<int>(call_idx);
} }
} // namespace wasm
} // namespace internal
} // namespace v8
namespace {
int AdvanceSourcePositionTableIterator(SourcePositionTableIterator& iterator, int AdvanceSourcePositionTableIterator(SourcePositionTableIterator& iterator,
size_t offset_l) { size_t offset_l) {
DCHECK_GE(kMaxInt, offset_l); DCHECK_GE(kMaxInt, offset_l);

View File

@ -7,12 +7,15 @@
#include "src/assembler.h" #include "src/assembler.h"
#include "src/identity-map.h" #include "src/identity-map.h"
#include "src/wasm/decoder.h"
#include "src/wasm/wasm-objects.h" #include "src/wasm/wasm-objects.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
namespace wasm { namespace wasm {
int ExtractDirectCallIndex(wasm::Decoder& decoder, const byte* pc);
// Helper class to specialize wasm code for a specific instance, or to update // Helper class to specialize wasm code for a specific instance, or to update
// code when memory / globals / tables change. // code when memory / globals / tables change.
// This class in unhandlified, and contains a DisallowHeapAllocation field to // This class in unhandlified, and contains a DisallowHeapAllocation field to

View File

@ -20,9 +20,18 @@
#include "src/wasm/wasm-objects.h" #include "src/wasm/wasm-objects.h"
#include "src/zone/accounting-allocator.h" #include "src/zone/accounting-allocator.h"
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wheader-hygiene"
#endif
using namespace v8::internal; using namespace v8::internal;
using namespace v8::internal::wasm; using namespace v8::internal::wasm;
#if __clang__
#pragma clang diagnostic pop
#endif
namespace { namespace {
template <bool internal, typename... Args> template <bool internal, typename... Args>

View File

@ -2696,6 +2696,8 @@ WasmInterpreter::HeapObjectsScope::~HeapObjectsScope() {
reinterpret_cast<HeapObjectsScopeImpl*>(data)->~HeapObjectsScopeImpl(); reinterpret_cast<HeapObjectsScopeImpl*>(data)->~HeapObjectsScopeImpl();
} }
#undef TRACE
} // namespace wasm } // namespace wasm
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -24,10 +24,21 @@
#include "src/wasm/wasm-objects.h" #include "src/wasm/wasm-objects.h"
#include "src/wasm/wasm-result.h" #include "src/wasm/wasm-result.h"
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wheader-hygiene"
#endif
using namespace v8::internal; using namespace v8::internal;
using namespace v8::internal::wasm; using namespace v8::internal::wasm;
namespace base = v8::base; namespace base = v8::base;
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic pop
#endif
#define TRACE(...) \ #define TRACE(...) \
do { \ do { \
if (FLAG_trace_wasm_instances) PrintF(__VA_ARGS__); \ if (FLAG_trace_wasm_instances) PrintF(__VA_ARGS__); \
@ -195,16 +206,6 @@ int AdvanceSourcePositionTableIterator(SourcePositionTableIterator& iterator,
return byte_pos; return byte_pos;
} }
int ExtractDirectCallIndex(wasm::Decoder& decoder, const byte* pc) {
DCHECK_EQ(static_cast<int>(kExprCallFunction), static_cast<int>(*pc));
// Read the leb128 encoded u32 value (up to 5 bytes starting at pc + 1).
decoder.Reset(pc + 1, pc + 6);
uint32_t call_idx = decoder.consume_u32v("call index");
DCHECK(decoder.ok());
DCHECK_GE(kMaxInt, call_idx);
return static_cast<int>(call_idx);
}
void RecordLazyCodeStats(Code* code, Counters* counters) { void RecordLazyCodeStats(Code* code, Counters* counters) {
counters->wasm_lazily_compiled_functions()->Increment(); counters->wasm_lazily_compiled_functions()->Increment();
counters->wasm_generated_code_size()->Increment(code->body_size()); counters->wasm_generated_code_size()->Increment(code->body_size());
@ -839,7 +840,9 @@ MaybeHandle<WasmInstanceObject> wasm::SyncCompileAndInstantiate(
Handle<JSArrayBuffer>::null()); Handle<JSArrayBuffer>::null());
} }
namespace { namespace v8 {
namespace internal {
namespace wasm {
void RejectPromise(Isolate* isolate, Handle<Context> context, void RejectPromise(Isolate* isolate, Handle<Context> context,
ErrorThrower& thrower, Handle<JSPromise> promise) { ErrorThrower& thrower, Handle<JSPromise> promise) {
@ -859,7 +862,9 @@ void ResolvePromise(Isolate* isolate, Handle<Context> context,
CHECK_IMPLIES(!maybe.FromMaybe(false), isolate->has_scheduled_exception()); CHECK_IMPLIES(!maybe.FromMaybe(false), isolate->has_scheduled_exception());
} }
} // namespace } // namespace wasm
} // namespace internal
} // namespace v8
void wasm::AsyncInstantiate(Isolate* isolate, Handle<JSPromise> promise, void wasm::AsyncInstantiate(Isolate* isolate, Handle<JSPromise> promise,
Handle<WasmModuleObject> module_object, Handle<WasmModuleObject> module_object,

View File

@ -611,6 +611,12 @@ void ValidateOrphanedInstance(Isolate* isolate,
Handle<WasmInstanceObject> instance); Handle<WasmInstanceObject> instance);
} // namespace testing } // namespace testing
void ResolvePromise(Isolate* isolate, Handle<Context> context,
Handle<JSPromise> promise, Handle<Object> result);
void RejectPromise(Isolate* isolate, Handle<Context> context,
ErrorThrower& thrower, Handle<JSPromise> promise);
} // namespace wasm } // namespace wasm
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8

View File

@ -26,9 +26,20 @@
instance->PrintInstancesChain(); \ instance->PrintInstancesChain(); \
} while (false) } while (false)
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wheader-hygiene"
#endif
using namespace v8::internal; using namespace v8::internal;
using namespace v8::internal::wasm; using namespace v8::internal::wasm;
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic pop
#endif
namespace { namespace {
// An iterator that returns first the module itself, then all modules linked via // An iterator that returns first the module itself, then all modules linked via

View File

@ -14,10 +14,21 @@
#include "src/wasm/wasm-opcodes.h" #include "src/wasm/wasm-opcodes.h"
#include "src/zone/zone.h" #include "src/zone/zone.h"
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wheader-hygiene"
#endif
using namespace v8; using namespace v8;
using namespace v8::internal; using namespace v8::internal;
using namespace v8::internal::wasm; using namespace v8::internal::wasm;
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic pop
#endif
namespace { namespace {
bool IsValidFunctionName(const Vector<const char> &name) { bool IsValidFunctionName(const Vector<const char> &name) {
if (name.is_empty()) return false; if (name.is_empty()) return false;

View File

@ -18,10 +18,21 @@
#include "test/common/wasm/wasm-module-runner.h" #include "test/common/wasm/wasm-module-runner.h"
#include "test/fuzzer/fuzzer-support.h" #include "test/fuzzer/fuzzer-support.h"
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wheader-hygiene"
#endif
using namespace v8::internal; using namespace v8::internal;
using namespace v8::internal::wasm; using namespace v8::internal::wasm;
using namespace v8::internal::wasm::testing; using namespace v8::internal::wasm::testing;
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic pop
#endif
#define ASSIGN(type, var, expr) \ #define ASSIGN(type, var, expr) \
v8::Local<type> var; \ v8::Local<type> var; \
do { \ do { \

View File

@ -21,10 +21,21 @@
#define MAX_NUM_FUNCTIONS 3 #define MAX_NUM_FUNCTIONS 3
#define MAX_NUM_PARAMS 3 #define MAX_NUM_PARAMS 3
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wheader-hygiene"
#endif
using namespace v8::internal; using namespace v8::internal;
using namespace v8::internal::wasm; using namespace v8::internal::wasm;
using namespace v8::internal::wasm::fuzzer; using namespace v8::internal::wasm::fuzzer;
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic pop
#endif
class WasmCallFuzzer : public WasmExecutionFuzzer { class WasmCallFuzzer : public WasmExecutionFuzzer {
template <typename V> template <typename V>
static inline V read_value(const uint8_t** data, size_t* size, bool* ok) { static inline V read_value(const uint8_t** data, size_t* size, bool* ok) {

View File

@ -13,10 +13,21 @@
#include "test/common/wasm/test-signatures.h" #include "test/common/wasm/test-signatures.h"
#include "test/fuzzer/wasm-fuzzer-common.h" #include "test/fuzzer/wasm-fuzzer-common.h"
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wheader-hygiene"
#endif
using namespace v8::internal; using namespace v8::internal;
using namespace v8::internal::wasm; using namespace v8::internal::wasm;
using namespace v8::internal::wasm::fuzzer; using namespace v8::internal::wasm::fuzzer;
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic pop
#endif
class WasmCodeFuzzer : public WasmExecutionFuzzer { class WasmCodeFuzzer : public WasmExecutionFuzzer {
virtual bool GenerateModule( virtual bool GenerateModule(
Isolate* isolate, Zone* zone, const uint8_t* data, size_t size, Isolate* isolate, Zone* zone, const uint8_t* data, size_t size,

View File

@ -23,10 +23,21 @@
typedef uint8_t byte; typedef uint8_t byte;
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wheader-hygiene"
#endif
using namespace v8::internal; using namespace v8::internal;
using namespace v8::internal::wasm; using namespace v8::internal::wasm;
using namespace v8::internal::wasm::fuzzer; using namespace v8::internal::wasm::fuzzer;
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic pop
#endif
namespace { namespace {
class DataRange { class DataRange {

View File

@ -5,8 +5,7 @@
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "test/fuzzer/wasm-fuzzer-common.h" #include "test/fuzzer/wasm-fuzzer-common.h"
using namespace v8::internal::wasm::fuzzer;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return FuzzWasmSection(v8::internal::wasm::kDataSectionCode, data, size); return v8::internal::wasm::fuzzer::FuzzWasmSection(
v8::internal::wasm::kDataSectionCode, data, size);
} }

View File

@ -5,8 +5,7 @@
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "test/fuzzer/wasm-fuzzer-common.h" #include "test/fuzzer/wasm-fuzzer-common.h"
using namespace v8::internal::wasm::fuzzer;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return FuzzWasmSection(v8::internal::wasm::kFunctionSectionCode, data, size); return v8::internal::wasm::fuzzer::FuzzWasmSection(
v8::internal::wasm::kFunctionSectionCode, data, size);
} }

View File

@ -16,10 +16,21 @@
#define WASM_CODE_FUZZER_HASH_SEED 83 #define WASM_CODE_FUZZER_HASH_SEED 83
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wheader-hygiene"
#endif
using namespace v8::internal; using namespace v8::internal;
using namespace v8::internal::wasm; using namespace v8::internal::wasm;
using namespace v8::internal::wasm::fuzzer; using namespace v8::internal::wasm::fuzzer;
#if __clang__
// TODO(mostynb@opera.com): remove the using statements and these pragmas.
#pragma clang diagnostic pop
#endif
static const char* kNameString = "name"; static const char* kNameString = "name";
static const size_t kNameStringLength = 4; static const size_t kNameStringLength = 4;

View File

@ -5,8 +5,7 @@
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "test/fuzzer/wasm-fuzzer-common.h" #include "test/fuzzer/wasm-fuzzer-common.h"
using namespace v8::internal::wasm::fuzzer;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return FuzzWasmSection(v8::internal::wasm::kGlobalSectionCode, data, size); return v8::internal::wasm::fuzzer::FuzzWasmSection(
v8::internal::wasm::kGlobalSectionCode, data, size);
} }

View File

@ -5,8 +5,7 @@
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "test/fuzzer/wasm-fuzzer-common.h" #include "test/fuzzer/wasm-fuzzer-common.h"
using namespace v8::internal::wasm::fuzzer;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return FuzzWasmSection(v8::internal::wasm::kImportSectionCode, data, size); return v8::internal::wasm::fuzzer::FuzzWasmSection(
v8::internal::wasm::kImportSectionCode, data, size);
} }

View File

@ -5,8 +5,7 @@
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "test/fuzzer/wasm-fuzzer-common.h" #include "test/fuzzer/wasm-fuzzer-common.h"
using namespace v8::internal::wasm::fuzzer;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return FuzzWasmSection(v8::internal::wasm::kMemorySectionCode, data, size); return v8::internal::wasm::fuzzer::FuzzWasmSection(
v8::internal::wasm::kMemorySectionCode, data, size);
} }

View File

@ -5,9 +5,8 @@
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "test/fuzzer/wasm-fuzzer-common.h" #include "test/fuzzer/wasm-fuzzer-common.h"
using namespace v8::internal::wasm::fuzzer;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// TODO(titzer): Names section requires a preceding function section. // TODO(titzer): Names section requires a preceding function section.
return FuzzWasmSection(v8::internal::wasm::kNameSectionCode, data, size); return v8::internal::wasm::fuzzer::FuzzWasmSection(
v8::internal::wasm::kNameSectionCode, data, size);
} }

View File

@ -5,8 +5,7 @@
#include "src/objects-inl.h" #include "src/objects-inl.h"
#include "test/fuzzer/wasm-fuzzer-common.h" #include "test/fuzzer/wasm-fuzzer-common.h"
using namespace v8::internal::wasm::fuzzer;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return FuzzWasmSection(v8::internal::wasm::kTypeSectionCode, data, size); return v8::internal::wasm::fuzzer::FuzzWasmSection(
v8::internal::wasm::kTypeSectionCode, data, size);
} }