diff --git a/BUILD.gn b/BUILD.gn index adeade36b6..9d9814f610 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -6,6 +6,7 @@ import("//build/config/android/config.gni") import("//build/config/arm.gni") import("//build/config/dcheck_always_on.gni") import("//build/config/host_byteorder.gni") +import("//build/config/jumbo.gni") import("//build/config/mips.gni") import("//build/config/sanitizers/sanitizers.gni") @@ -867,6 +868,15 @@ v8_source_set("v8_nosnapshot") { "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" ] } @@ -898,6 +908,15 @@ v8_source_set("v8_snapshot") { "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" ] } @@ -1001,6 +1020,14 @@ v8_source_set("v8_builtins_generators") { "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") { sources += [ ### gcmole(arch:ia32) ### @@ -2045,6 +2072,18 @@ v8_source_set("v8_base") { "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") { sources += [ ### gcmole(arch:ia32) ### "src/compiler/ia32/code-generator-ia32.cc", diff --git a/gni/v8.gni b/gni/v8.gni index 9a2bb3dff4..0467720f45 100644 --- a/gni/v8.gni +++ b/gni/v8.gni @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/jumbo.gni") import("//build/config/sanitizers/sanitizers.gni") import("//build/config/v8_target_cpu.gni") import("//build/split_static_library.gni") @@ -109,7 +110,11 @@ template("v8_source_set") { } else if (defined(v8_static_library) && v8_static_library) { link_target_type = "static_library" } 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) { forward_variables_from(invoker, "*", [ "configs" ]) @@ -120,7 +125,7 @@ template("v8_source_set") { } template("v8_header_set") { - source_set(target_name) { + jumbo_source_set(target_name) { forward_variables_from(invoker, "*", [ "configs" ]) configs += invoker.configs configs -= v8_remove_configs @@ -151,14 +156,13 @@ template("v8_executable") { # reasons. if (is_clang) { 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 { configs -= [ v8_path_prefix + ":v8_gcov_coverage_cflags" ] } } - deps += [ - v8_path_prefix + ":v8_dump_build_config", - ] + deps += [ v8_path_prefix + ":v8_dump_build_config" ] } } diff --git a/src/api-arguments-inl.h b/src/api-arguments-inl.h index 91ac253396..4035e715c1 100644 --- a/src/api-arguments-inl.h +++ b/src/api-arguments-inl.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef V8_API_ARGUMENTS_INL_H_ +#define V8_API_ARGUMENTS_INL_H_ + #include "src/api-arguments.h" #include "src/tracing/trace-event.h" @@ -153,3 +156,5 @@ void PropertyCallbackArguments::Call(AccessorNameSetterCallback f, } // namespace internal } // namespace v8 + +#endif // V8_API_ARGUMENTS_INL_H_ diff --git a/src/asmjs/asm-parser.cc b/src/asmjs/asm-parser.cc index 645d87338e..dafa1df5c9 100644 --- a/src/asmjs/asm-parser.cc +++ b/src/asmjs/asm-parser.cc @@ -2460,3 +2460,5 @@ void AsmJsParser::GatherCases(ZoneVector* cases) { } // namespace wasm } // namespace internal } // namespace v8 + +#undef RECURSE diff --git a/src/base/platform/platform-posix-time.h b/src/base/platform/platform-posix-time.h index 945ea3b2e9..3fc1bfd900 100644 --- a/src/base/platform/platform-posix-time.h +++ b/src/base/platform/platform-posix-time.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // 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" namespace v8 { @@ -17,3 +20,5 @@ class PosixDefaultTimezoneCache : public PosixTimezoneCache { } // namespace base } // namespace v8 + +#endif // V8_BASE_PLATFORM_PLATFORM_POSIX_TIME_H_ diff --git a/src/builtins/builtins-arguments-gen.h b/src/builtins/builtins-arguments-gen.h index e7c3823930..438d10ab59 100644 --- a/src/builtins/builtins-arguments-gen.h +++ b/src/builtins/builtins-arguments-gen.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // 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" namespace v8 { @@ -53,3 +56,5 @@ class ArgumentsBuiltinsAssembler : public CodeStubAssembler { } // namespace internal } // namespace v8 + +#endif // V8_BUILTINS_BUILTINS_ARGUMENTS_GEN_H_ diff --git a/src/builtins/builtins-forin-gen.h b/src/builtins/builtins-forin-gen.h index 3aeb0bee51..1740ba32f3 100644 --- a/src/builtins/builtins-forin-gen.h +++ b/src/builtins/builtins-forin-gen.h @@ -1,8 +1,10 @@ - // Copyright 2017 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef V8_BUILTINS_BUILTINS_FORIN_GEN_H_ +#define V8_BUILTINS_BUILTINS_FORIN_GEN_H_ + #include "src/code-stub-assembler.h" namespace v8 { @@ -32,3 +34,5 @@ class ForInBuiltinsAssembler : public CodeStubAssembler { } // namespace internal } // namespace v8 + +#endif // V8_BUILTINS_BUILTINS_FORIN_GEN_H_ diff --git a/src/builtins/builtins-iterator-gen.h b/src/builtins/builtins-iterator-gen.h index 0ed6077024..9eb332e926 100644 --- a/src/builtins/builtins-iterator-gen.h +++ b/src/builtins/builtins-iterator-gen.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // 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" namespace v8 { @@ -47,3 +50,5 @@ class IteratorBuiltinsAssembler : public CodeStubAssembler { } // namespace internal } // namespace v8 + +#endif // V8_BUILTINS_BUILTINS_ITERATOR_GEN_H_ diff --git a/src/compiler/common-operator.cc b/src/compiler/common-operator.cc index 30a9252971..becd0ff77f 100644 --- a/src/compiler/common-operator.cc +++ b/src/compiler/common-operator.cc @@ -341,7 +341,7 @@ ZoneVector const* MachineTypesOf(Operator const* op) { return OpParameter(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(IfTrue, 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) {} \ }; \ Name##Operator k##Name##Operator; - CACHED_OP_LIST(CACHED) + COMMON_CACHED_OP_LIST(CACHED) #undef CACHED template @@ -752,14 +752,11 @@ struct CommonOperatorGlobalCache final { #undef CACHED_STATE_VALUES }; - -static base::LazyInstance::type kCache = - LAZY_INSTANCE_INITIALIZER; - +static base::LazyInstance::type + kCommonOperatorGlobalCache = LAZY_INSTANCE_INITIALIZER; CommonOperatorBuilder::CommonOperatorBuilder(Zone* zone) - : cache_(kCache.Get()), zone_(zone) {} - + : cache_(kCommonOperatorGlobalCache.Get()), zone_(zone) {} #define CACHED(Name, properties, value_input_count, effect_input_count, \ control_input_count, value_output_count, effect_output_count, \ @@ -767,7 +764,7 @@ CommonOperatorBuilder::CommonOperatorBuilder(Zone* zone) const Operator* CommonOperatorBuilder::Name() { \ return &cache_.k##Name##Operator; \ } -CACHED_OP_LIST(CACHED) +COMMON_CACHED_OP_LIST(CACHED) #undef CACHED diff --git a/src/compiler/control-equivalence.cc b/src/compiler/control-equivalence.cc index 2144b844a3..7df7fded78 100644 --- a/src/compiler/control-equivalence.cc +++ b/src/compiler/control-equivalence.cc @@ -228,6 +228,8 @@ void ControlEquivalence::BracketListTRACE(BracketList& blist) { } } +#undef TRACE + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/src/compiler/escape-analysis.cc b/src/compiler/escape-analysis.cc index d886c148d0..e1574e89f3 100644 --- a/src/compiler/escape-analysis.cc +++ b/src/compiler/escape-analysis.cc @@ -1788,6 +1788,8 @@ bool EscapeAnalysis::ExistsVirtualAllocate() { Graph* EscapeAnalysis::graph() const { return status_analysis_->graph(); } +#undef TRACE + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/src/compiler/js-inlining.cc b/src/compiler/js-inlining.cc index a5dde99774..b858ac674d 100644 --- a/src/compiler/js-inlining.cc +++ b/src/compiler/js-inlining.cc @@ -746,6 +746,8 @@ SimplifiedOperatorBuilder* JSInliner::simplified() const { return jsgraph()->simplified(); } +#undef TRACE + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/src/compiler/js-native-context-specialization.cc b/src/compiler/js-native-context-specialization.cc index 361ce6e33d..f4f66268f1 100644 --- a/src/compiler/js-native-context-specialization.cc +++ b/src/compiler/js-native-context-specialization.cc @@ -39,13 +39,6 @@ bool HasOnlyJSArrayMaps(MapHandles const& maps) { return true; } -bool HasOnlyStringMaps(MapHandles const& maps) { - for (auto map : maps) { - if (!map->IsStringMap()) return false; - } - return true; -} - } // namespace struct JSNativeContextSpecialization::ScriptContextTableLookupResult { diff --git a/src/compiler/js-operator.cc b/src/compiler/js-operator.cc index 0d277f8fac..4720aca228 100644 --- a/src/compiler/js-operator.cc +++ b/src/compiler/js-operator.cc @@ -632,11 +632,11 @@ struct JSOperatorGlobalCache final { #undef COMPARE_OP }; -static base::LazyInstance::type kCache = +static base::LazyInstance::type kJSOperatorGlobalCache = LAZY_INSTANCE_INITIALIZER; 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) \ const Operator* JSOperatorBuilder::Name() { \ diff --git a/src/compiler/jump-threading.cc b/src/compiler/jump-threading.cc index 86d25de327..a480204e47 100644 --- a/src/compiler/jump-threading.cc +++ b/src/compiler/jump-threading.cc @@ -197,6 +197,8 @@ void JumpThreading::ApplyForwarding(ZoneVector& result, } } +#undef TRACE + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/src/compiler/live-range-separator.cc b/src/compiler/live-range-separator.cc index db65593906..67d1c77a83 100644 --- a/src/compiler/live-range-separator.cc +++ b/src/compiler/live-range-separator.cc @@ -174,6 +174,7 @@ void LiveRangeMerger::Merge() { } } +#undef TRACE } // namespace compiler } // namespace internal diff --git a/src/compiler/load-elimination.cc b/src/compiler/load-elimination.cc index 2626cb1ec9..daa14b1e31 100644 --- a/src/compiler/load-elimination.cc +++ b/src/compiler/load-elimination.cc @@ -132,7 +132,7 @@ Reduction LoadElimination::Reduce(Node* node) { namespace { -bool IsCompatibleCheck(Node const* a, Node const* b) { +bool LoadEliminationIsCompatibleCheck(Node const* a, Node const* b) { if (a->op() != b->op()) return false; for (int i = a->op()->ValueInputCount(); --i >= 0;) { 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 { for (Node* const check : nodes_) { - if (check && !check->IsDead() && IsCompatibleCheck(check, node)) { + if (check && !check->IsDead() && + LoadEliminationIsCompatibleCheck(check, node)) { return check; } } diff --git a/src/compiler/loop-analysis.cc b/src/compiler/loop-analysis.cc index f3a793347f..23591b2411 100644 --- a/src/compiler/loop-analysis.cc +++ b/src/compiler/loop-analysis.cc @@ -26,7 +26,7 @@ struct NodeInfo { // Temporary loop info needed during traversal and building the loop tree. -struct LoopInfo { +struct TempLoopInfo { Node* header; NodeInfo* header_list; NodeInfo* exit_list; @@ -93,7 +93,7 @@ class LoopFinderImpl { } int i = 0; - for (LoopInfo& li : loops_) { + for (TempLoopInfo& li : loops_) { PrintF("Loop %d headed at #%d\n", i, li.header->id()); i++; } @@ -109,7 +109,7 @@ class LoopFinderImpl { NodeDeque queue_; NodeMarker queued_; ZoneVector info_; - ZoneVector loops_; + ZoneVector loops_; ZoneVector loop_num_; LoopTree* loop_tree_; int loops_found_; @@ -295,7 +295,7 @@ class LoopFinderImpl { // Propagate marks forward from loops. void PropagateForward() { ResizeForwardMarks(); - for (LoopInfo& li : loops_) { + for (TempLoopInfo& li : loops_) { SetForwardMark(li.header, LoopNum(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 (IsLoopHeaderNode(node_info->node)) { node_info->next = loop->header_list; @@ -381,7 +381,7 @@ class LoopFinderImpl { for (NodeInfo& ni : info_) { if (ni.node == nullptr) continue; - LoopInfo* innermost = nullptr; + TempLoopInfo* innermost = nullptr; int innermost_index = 0; int pos = ni.node->id() * width_; // Search the marks word by word. @@ -391,7 +391,7 @@ class LoopFinderImpl { if (marks & (1u << j)) { int loop_num = i * 32 + j; if (loop_num == 0) continue; - LoopInfo* loop = &loops_[loop_num - 1]; + TempLoopInfo* loop = &loops_[loop_num - 1]; if (innermost == nullptr || loop->loop->depth_ > innermost->loop->depth_) { innermost = loop; @@ -415,7 +415,7 @@ class LoopFinderImpl { // Handle the simpler case of a single loop (no checks for nesting necessary). void FinishSingleLoop() { // Place nodes into the loop header and body. - LoopInfo* li = &loops_[0]; + TempLoopInfo* li = &loops_[0]; li->loop = &loop_tree_->all_loops_[0]; loop_tree_->SetParent(nullptr, li->loop); size_t count = 0; @@ -434,7 +434,7 @@ class LoopFinderImpl { // so that nested loops occupy nested intervals. void SerializeLoop(LoopTree::Loop* loop) { int loop_num = loop_tree_->LoopNum(loop); - LoopInfo& li = loops_[loop_num - 1]; + TempLoopInfo& li = loops_[loop_num - 1]; // Serialize the header. loop->header_start_ = static_cast(loop_tree_->loop_nodes_.size()); @@ -465,7 +465,7 @@ class LoopFinderImpl { // Connect the LoopTree loops to their parents recursively. 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; NodeInfo& ni = info(li.header); diff --git a/src/compiler/loop-variable-optimizer.cc b/src/compiler/loop-variable-optimizer.cc index d5c37860f6..eed55793be 100644 --- a/src/compiler/loop-variable-optimizer.cc +++ b/src/compiler/loop-variable-optimizer.cc @@ -405,6 +405,8 @@ void LoopVariableOptimizer::ChangeToPhisAndInsertGuards() { } } +#undef TRACE + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/src/compiler/machine-operator.cc b/src/compiler/machine-operator.cc index 604e280408..c20e6e196f 100644 --- a/src/compiler/machine-operator.cc +++ b/src/compiler/machine-operator.cc @@ -144,7 +144,7 @@ MachineType AtomicOpRepresentationOf(Operator const* op) { V(Uint64LessThan, 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_64(V) \ V(Word32Clz, Operator::kNoProperties, 1, 0, 1) \ @@ -443,7 +443,7 @@ struct MachineOperatorGlobalCache { 0) {} \ }; \ Name##Operator k##Name; - PURE_OP_LIST(PURE) + MACHINE_PURE_OP_LIST(PURE) PURE_OPTIONAL_OP_LIST(PURE) #undef PURE @@ -669,14 +669,14 @@ struct CommentOperator : public Operator1 { "Comment", 0, 0, 0, 0, 0, 0, msg) {} }; -static base::LazyInstance::type kCache = - LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance::type + kMachineOperatorGlobalCache = LAZY_INSTANCE_INITIALIZER; MachineOperatorBuilder::MachineOperatorBuilder( Zone* zone, MachineRepresentation word, Flags flags, AlignmentRequirements alignmentRequirements) : zone_(zone), - cache_(kCache.Get()), + cache_(kMachineOperatorGlobalCache.Get()), word_(word), flags_(flags), alignment_requirements_(alignmentRequirements) { @@ -713,7 +713,7 @@ const Operator* MachineOperatorBuilder::UnalignedStore( #define PURE(Name, properties, value_input_count, control_input_count, \ output_count) \ const Operator* MachineOperatorBuilder::Name() { return &cache_.k##Name; } -PURE_OP_LIST(PURE) +MACHINE_PURE_OP_LIST(PURE) #undef PURE #define PURE(Name, properties, value_input_count, control_input_count, \ diff --git a/src/compiler/new-escape-analysis-reducer.cc b/src/compiler/new-escape-analysis-reducer.cc index 0e70e25ad0..6ac2e03a5c 100644 --- a/src/compiler/new-escape-analysis-reducer.cc +++ b/src/compiler/new-escape-analysis-reducer.cc @@ -403,6 +403,9 @@ Node* NodeHashCache::Constructor::MutableNode() { } return tmp_; } + +#undef TRACE + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/src/compiler/new-escape-analysis.cc b/src/compiler/new-escape-analysis.cc index be2dd69684..e90d35145d 100644 --- a/src/compiler/new-escape-analysis.cc +++ b/src/compiler/new-escape-analysis.cc @@ -11,6 +11,15 @@ #include "src/compiler/simplified-operator.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 internal { namespace compiler { @@ -690,6 +699,8 @@ VirtualObject::VirtualObject(VariableTracker* var_states, VirtualObject::Id id, } } +#undef TRACE + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/src/compiler/new-escape-analysis.h b/src/compiler/new-escape-analysis.h index 37ee7814ae..316a20793d 100644 --- a/src/compiler/new-escape-analysis.h +++ b/src/compiler/new-escape-analysis.h @@ -11,15 +11,6 @@ #include "src/compiler/persistent-map.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 internal { namespace compiler { diff --git a/src/compiler/osr.cc b/src/compiler/osr.cc index 969dabc6b4..96ee9b273b 100644 --- a/src/compiler/osr.cc +++ b/src/compiler/osr.cc @@ -336,6 +336,8 @@ void OsrHelper::SetupFrame(Frame* frame) { frame->ReserveSpillSlots(UnoptimizedFrameSlots()); } +#undef TRACE + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/src/compiler/property-access-builder.cc b/src/compiler/property-access-builder.cc index 417f541bca..4edc3ee300 100644 --- a/src/compiler/property-access-builder.cc +++ b/src/compiler/property-access-builder.cc @@ -31,6 +31,13 @@ SimplifiedOperatorBuilder* PropertyAccessBuilder::simplified() const { return jsgraph()->simplified(); } +bool HasOnlyStringMaps(MapHandles const& maps) { + for (auto map : maps) { + if (!map->IsStringMap()) return false; + } + return true; +} + namespace { bool HasOnlyNumberMaps(MapHandles const& maps) { @@ -40,13 +47,6 @@ bool HasOnlyNumberMaps(MapHandles const& maps) { return true; } -bool HasOnlyStringMaps(MapHandles const& maps) { - for (auto map : maps) { - if (!map->IsStringMap()) return false; - } - return true; -} - bool HasOnlySequentialStringMaps(MapHandles const& maps) { for (auto map : maps) { if (!map->IsStringMap()) return false; diff --git a/src/compiler/property-access-builder.h b/src/compiler/property-access-builder.h index 2774423b4c..6ae3a7bd0f 100644 --- a/src/compiler/property-access-builder.h +++ b/src/compiler/property-access-builder.h @@ -73,6 +73,8 @@ class PropertyAccessBuilder { CompilationDependencies* dependencies_; }; +bool HasOnlyStringMaps(MapHandles const& maps); + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/src/compiler/register-allocator.cc b/src/compiler/register-allocator.cc index 69f23beb91..8006abd9fc 100644 --- a/src/compiler/register-allocator.cc +++ b/src/compiler/register-allocator.cc @@ -4013,6 +4013,7 @@ void LiveRangeConnector::CommitSpillsInDeferredBlocks( } } +#undef TRACE } // namespace compiler } // namespace internal diff --git a/src/compiler/scheduler.cc b/src/compiler/scheduler.cc index 75fb3f8ca5..e7ae97dfc9 100644 --- a/src/compiler/scheduler.cc +++ b/src/compiler/scheduler.cc @@ -1777,6 +1777,8 @@ void Scheduler::MovePlannedNodes(BasicBlock* from, BasicBlock* to) { } } +#undef TRACE + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/src/compiler/simd-scalar-lowering.cc b/src/compiler/simd-scalar-lowering.cc index 1604f020e6..198dc43ed9 100644 --- a/src/compiler/simd-scalar-lowering.cc +++ b/src/compiler/simd-scalar-lowering.cc @@ -249,7 +249,7 @@ void SimdScalarLowering::SetLoweredType(Node* node, Node* output) { } } -static int GetParameterIndexAfterLowering( +static int GetParameterIndexAfterLoweringSimd128( Signature* signature, int old_index) { // In function calls, the simd128 types are passed as 4 Int32 types. The // parameters are typecast to the types as needed for various operations. @@ -264,15 +264,15 @@ static int GetParameterIndexAfterLowering( int SimdScalarLowering::GetParameterCountAfterLowering() { if (parameter_count_after_lowering_ == -1) { - // GetParameterIndexAfterLowering(parameter_count) returns the parameter - // count after lowering. - parameter_count_after_lowering_ = GetParameterIndexAfterLowering( + // GetParameterIndexAfterLoweringSimd128(parameter_count) returns the + // parameter count after lowering. + parameter_count_after_lowering_ = GetParameterIndexAfterLoweringSimd128( signature(), static_cast(signature()->parameter_count())); } return parameter_count_after_lowering_; } -static int GetReturnCountAfterLowering( +static int GetReturnCountAfterLoweringSimd128( Signature* signature) { int result = static_cast(signature->return_count()); for (int i = 0; i < static_cast(signature->return_count()); ++i) { @@ -714,7 +714,8 @@ void SimdScalarLowering::LowerNode(Node* node) { if (GetParameterCountAfterLowering() != static_cast(signature()->parameter_count())) { 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) { NodeProperties::ChangeOp(node, common()->Parameter(new_index)); @@ -772,7 +773,7 @@ void SimdScalarLowering::LowerNode(Node* node) { } case IrOpcode::kReturn: { DefaultLowering(node); - int new_return_count = GetReturnCountAfterLowering(signature()); + int new_return_count = GetReturnCountAfterLoweringSimd128(signature()); if (static_cast(signature()->return_count()) != new_return_count) { NodeProperties::ChangeOp(node, common()->Return(new_return_count)); } diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc index d89dda1674..abfe6fe08e 100644 --- a/src/compiler/simplified-lowering.cc +++ b/src/compiler/simplified-lowering.cc @@ -3773,6 +3773,8 @@ Operator const* SimplifiedLowering::ToNumberOperator() { return to_number_operator_.get(); } +#undef TRACE + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc index a8478d0ab5..c4fa376051 100644 --- a/src/compiler/simplified-operator.cc +++ b/src/compiler/simplified-operator.cc @@ -830,13 +830,11 @@ struct SimplifiedOperatorGlobalCache final { #undef BUFFER_ACCESS }; - -static base::LazyInstance::type kCache = - LAZY_INSTANCE_INITIALIZER; - +static base::LazyInstance::type + kSimplifiedOperatorGlobalCache = LAZY_INSTANCE_INITIALIZER; SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone) - : cache_(kCache.Get()), zone_(zone) {} + : cache_(kSimplifiedOperatorGlobalCache.Get()), zone_(zone) {} #define GET_FROM_CACHE(Name, ...) \ const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; } diff --git a/src/compiler/type-cache.cc b/src/compiler/type-cache.cc index cd80dc315a..4c6252e5fc 100644 --- a/src/compiler/type-cache.cc +++ b/src/compiler/type-cache.cc @@ -12,12 +12,12 @@ namespace compiler { namespace { -base::LazyInstance::type kCache = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance::type kTypeCache = LAZY_INSTANCE_INITIALIZER; } // namespace // static -TypeCache const& TypeCache::Get() { return kCache.Get(); } +TypeCache const& TypeCache::Get() { return kTypeCache.Get(); } } // namespace compiler } // namespace internal diff --git a/src/heap/array-buffer-tracker-inl.h b/src/heap/array-buffer-tracker-inl.h index 0688a29f3a..c676db784c 100644 --- a/src/heap/array-buffer-tracker-inl.h +++ b/src/heap/array-buffer-tracker-inl.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // 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/heap/array-buffer-tracker.h" #include "src/heap/heap.h" @@ -68,3 +71,5 @@ void LocalArrayBufferTracker::Remove(JSArrayBuffer* buffer, size_t length) { } // namespace internal } // namespace v8 + +#endif // V8_HEAP_ARRAY_BUFFER_TRACKER_INL_H_ diff --git a/src/heap/code-stats.h b/src/heap/code-stats.h index fa106d6435..ef964caa85 100644 --- a/src/heap/code-stats.h +++ b/src/heap/code-stats.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef V8_HEAP_CODE_STATS_H_ +#define V8_HEAP_CODE_STATS_H_ + namespace v8 { namespace internal { @@ -41,3 +44,5 @@ class CodeStatistics { } // namespace internal } // namespace v8 + +#endif // V8_HEAP_CODE_STATS_H_ diff --git a/src/heap/local-allocator.h b/src/heap/local-allocator.h index 5628b413f8..2f21b382b6 100644 --- a/src/heap/local-allocator.h +++ b/src/heap/local-allocator.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef V8_HEAP_LOCAL_ALLOCATOR_H_ +#define V8_HEAP_LOCAL_ALLOCATOR_H_ + #include "src/globals.h" #include "src/heap/heap.h" #include "src/heap/spaces.h" @@ -137,3 +140,5 @@ class LocalAllocator { } // namespace internal } // namespace v8 + +#endif // V8_HEAP_LOCAL_ALLOCATOR_H_ diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc index c1d7a796c2..2b9c4dcbff 100644 --- a/src/heap/spaces.cc +++ b/src/heap/spaces.cc @@ -7,6 +7,7 @@ #include #include "src/base/bits.h" +#include "src/base/macros.h" #include "src/base/platform/platform.h" #include "src/base/platform/semaphore.h" #include "src/counters.h" @@ -138,7 +139,7 @@ bool CodeRange::SetUp(size_t requested) { 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; allocation_list_.Add(FreeBlock(aligned_base, size)); 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; } // 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_]; // Don't leave a small free block, useless for a large object or chunk. if (aligned_requested < (block->size - Page::kPageSize)) { @@ -295,7 +296,7 @@ MemoryAllocator::MemoryAllocator(Isolate* isolate) unmapper_(isolate->heap(), this) {} bool MemoryAllocator::SetUp(size_t capacity, size_t code_range_size) { - capacity_ = RoundUp(capacity, Page::kPageSize); + capacity_ = ::RoundUp(capacity, Page::kPageSize); size_ = 0; size_executable_ = 0; @@ -465,9 +466,9 @@ Address MemoryAllocator::ReserveAlignedMemory(size_t size, size_t alignment, return nullptr; const Address base = - RoundUp(static_cast
(reservation.address()), alignment); + ::RoundUp(static_cast
(reservation.address()), alignment); 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); } size_.Increment(reservation.size()); @@ -663,9 +664,9 @@ bool MemoryChunk::CommitArea(size_t requested) { IsFlagSet(IS_EXECUTABLE) ? MemoryAllocator::CodePageGuardSize() : 0; size_t header_size = area_start() - address() - guard_size; size_t commit_size = - RoundUp(header_size + requested, MemoryAllocator::GetCommitPageSize()); - size_t committed_size = RoundUp(header_size + (area_end() - area_start()), - MemoryAllocator::GetCommitPageSize()); + ::RoundUp(header_size + requested, MemoryAllocator::GetCommitPageSize()); + size_t committed_size = ::RoundUp(header_size + (area_end() - area_start()), + MemoryAllocator::GetCommitPageSize()); if (commit_size > committed_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) { - chunk_size = RoundUp(CodePageAreaStartOffset() + reserve_area_size, - GetCommitPageSize()) + + chunk_size = ::RoundUp(CodePageAreaStartOffset() + reserve_area_size, + GetCommitPageSize()) + CodePageGuardSize(); // Size of header (not executable) plus area (executable). - size_t commit_size = RoundUp(CodePageGuardStartOffset() + commit_area_size, - GetCommitPageSize()); + size_t commit_size = ::RoundUp( + CodePageGuardStartOffset() + commit_area_size, GetCommitPageSize()); // Allocate executable memory either from code range or from the // OS. #ifdef V8_TARGET_ARCH_MIPS64 @@ -818,11 +819,11 @@ MemoryChunk* MemoryAllocator::AllocateChunk(size_t reserve_area_size, area_start = base + CodePageAreaStartOffset(); area_end = area_start + commit_area_size; } else { - chunk_size = RoundUp(MemoryChunk::kObjectStartOffset + reserve_area_size, - GetCommitPageSize()); + chunk_size = ::RoundUp(MemoryChunk::kObjectStartOffset + reserve_area_size, + GetCommitPageSize()); size_t commit_size = - RoundUp(MemoryChunk::kObjectStartOffset + commit_area_size, - GetCommitPageSize()); + ::RoundUp(MemoryChunk::kObjectStartOffset + commit_area_size, + GetCommitPageSize()); base = AllocateAlignedMemory(chunk_size, commit_size, MemoryChunk::kAlignment, executable, address_hint, &reservation); @@ -1145,7 +1146,7 @@ void MemoryAllocator::ReportStatistics() { size_t MemoryAllocator::CodePageGuardStartOffset() { // We are guarding code pages: the first OS page after the header // will be protected as non-writable. - return RoundUp(Page::kObjectStartOffset, GetCommitPageSize()); + return ::RoundUp(Page::kObjectStartOffset, GetCommitPageSize()); } size_t MemoryAllocator::CodePageGuardSize() { @@ -1795,7 +1796,7 @@ void NewSpace::Grow() { void NewSpace::Shrink() { 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() && to_space_.ShrinkTo(rounded_new_capacity)) { // Only shrink from-space if we managed to shrink to-space. @@ -3167,8 +3168,8 @@ Address LargePage::GetAddressToShrink() { if (executable() == EXECUTABLE) { return 0; } - size_t used_size = RoundUp((object->address() - address()) + object->Size(), - MemoryAllocator::GetCommitPageSize()); + size_t used_size = ::RoundUp((object->address() - address()) + object->Size(), + MemoryAllocator::GetCommitPageSize()); if (used_size < CommittedPhysicalMemory()) { return address() + used_size; } @@ -3359,8 +3360,8 @@ void LargeObjectSpace::RemoveChunkMapEntries(LargePage* page) { void LargeObjectSpace::RemoveChunkMapEntries(LargePage* page, Address free_start) { - uintptr_t start = RoundUp(reinterpret_cast(free_start), - MemoryChunk::kAlignment) / + uintptr_t start = ::RoundUp(reinterpret_cast(free_start), + MemoryChunk::kAlignment) / MemoryChunk::kAlignment; uintptr_t limit = (reinterpret_cast(page) + (page->size() - 1)) / MemoryChunk::kAlignment; diff --git a/src/heap/store-buffer.cc b/src/heap/store-buffer.cc index 2a2d3e251b..981aa76649 100644 --- a/src/heap/store-buffer.cc +++ b/src/heap/store-buffer.cc @@ -6,6 +6,7 @@ #include +#include "src/base/macros.h" #include "src/counters.h" #include "src/heap/incremental-marking.h" #include "src/isolate.h" @@ -38,7 +39,7 @@ void StoreBuffer::SetUp() { } uintptr_t start_as_int = reinterpret_cast(reservation.address()); start_[0] = - reinterpret_cast(RoundUp(start_as_int, kStoreBufferSize)); + reinterpret_cast(::RoundUp(start_as_int, kStoreBufferSize)); limit_[0] = start_[0] + (kStoreBufferSize / kPointerSize); start_[1] = limit_[0]; limit_[1] = start_[1] + (kStoreBufferSize / kPointerSize); diff --git a/src/inspector/v8-debugger-agent-impl.cc b/src/inspector/v8-debugger-agent-impl.cc index 063d44d969..546b7cba7a 100644 --- a/src/inspector/v8-debugger-agent-impl.cc +++ b/src/inspector/v8-debugger-agent-impl.cc @@ -186,6 +186,8 @@ String16 breakLocationType(v8::debug::BreakLocationType type) { return String16(); } +} // namespace + String16 scopeType(v8::debug::ScopeIterator::ScopeType type) { switch (type) { case v8::debug::ScopeIterator::ScopeTypeGlobal: @@ -211,6 +213,8 @@ String16 scopeType(v8::debug::ScopeIterator::ScopeType type) { return String16(); } +namespace { + Response buildScopes(v8::debug::ScopeIterator* iterator, InjectedScript* injectedScript, std::unique_ptr>* scopes) { diff --git a/src/inspector/v8-debugger-agent-impl.h b/src/inspector/v8-debugger-agent-impl.h index d3b4b4c270..6f6a397e07 100644 --- a/src/inspector/v8-debugger-agent-impl.h +++ b/src/inspector/v8-debugger-agent-impl.h @@ -8,6 +8,7 @@ #include #include "src/base/macros.h" +#include "src/debug/debug-interface.h" #include "src/debug/interface-types.h" #include "src/inspector/protocol/Debugger.h" #include "src/inspector/protocol/Forward.h" @@ -202,6 +203,8 @@ class V8DebuggerAgentImpl : public protocol::Debugger::Backend { DISALLOW_COPY_AND_ASSIGN(V8DebuggerAgentImpl); }; +String16 scopeType(v8::debug::ScopeIterator::ScopeType type); + } // namespace v8_inspector #endif // V8_INSPECTOR_V8DEBUGGERAGENTIMPL_H_ diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc index 4f5649e939..55b203be71 100644 --- a/src/inspector/v8-debugger.cc +++ b/src/inspector/v8-debugger.cc @@ -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 V8Debugger::V8Debugger(v8::Isolate* isolate, V8InspectorImpl* inspector) @@ -592,7 +567,7 @@ v8::MaybeLocal V8Debugger::getTargetScopes( if (!markAsInternal(context, scope, V8InternalValueType::kScope)) { return v8::MaybeLocal(); } - String16 type = scopeType(iterator->GetType()); + String16 type = v8_inspector::scopeType(iterator->GetType()); String16 name; v8::Local closure = iterator->GetFunction(); if (!closure.IsEmpty()) { diff --git a/src/inspector/wasm-translation.cc b/src/inspector/wasm-translation.cc index 87e3e2b9f0..6d763e83d5 100644 --- a/src/inspector/wasm-translation.cc +++ b/src/inspector/wasm-translation.cc @@ -15,9 +15,20 @@ #include "src/inspector/v8-debugger.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; +#if __clang__ +// TODO(mostynb@opera.com): remove the using statements and these pragmas. +#pragma clang diagnostic pop +#endif + class WasmTranslation::TranslatorImpl { public: struct TransLocation { diff --git a/src/interpreter/interpreter-intrinsics-generator.cc b/src/interpreter/interpreter-intrinsics-generator.cc index b3c81201d2..b239d7df54 100644 --- a/src/interpreter/interpreter-intrinsics-generator.cc +++ b/src/interpreter/interpreter-intrinsics-generator.cc @@ -453,6 +453,8 @@ void IntrinsicsGenerator::AbortIfArgCountMismatch(int expected, Node* actual) { __ BIND(&match); } +#undef __ + } // namespace interpreter } // namespace internal } // namespace v8 diff --git a/src/lookup-cache-inl.h b/src/lookup-cache-inl.h index 1998a9de9a..9b27268756 100644 --- a/src/lookup-cache-inl.h +++ b/src/lookup-cache-inl.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef V8_LOOKUP_CACHE_INL_H_ +#define V8_LOOKUP_CACHE_INL_H_ + #include "src/lookup-cache.h" #include "src/objects-inl.h" @@ -38,3 +41,5 @@ void DescriptorLookupCache::Update(Map* source, Name* name, int result) { } // namespace internal } // namespace v8 + +#endif // V8_LOOKUP_CACHE_INL_H_ diff --git a/src/parsing/expression-scope-reparenter.cc b/src/parsing/expression-scope-reparenter.cc index 1130b94d1c..f8327e2d62 100644 --- a/src/parsing/expression-scope-reparenter.cc +++ b/src/parsing/expression-scope-reparenter.cc @@ -14,15 +14,15 @@ namespace internal { namespace { -class Rewriter final : public AstTraversalVisitor { +class Reparenter final : public AstTraversalVisitor { 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) {} private: // This is required so that the overriden Visit* methods can be // called by the base class (template). - friend class AstTraversalVisitor; + friend class AstTraversalVisitor; void VisitFunctionLiteral(FunctionLiteral* expr); void VisitClassLiteral(ClassLiteral* expr); @@ -35,11 +35,11 @@ class Rewriter final : public AstTraversalVisitor { Scope* scope_; }; -void Rewriter::VisitFunctionLiteral(FunctionLiteral* function_literal) { +void Reparenter::VisitFunctionLiteral(FunctionLiteral* function_literal) { function_literal->scope()->ReplaceOuterScope(scope_); } -void Rewriter::VisitClassLiteral(ClassLiteral* class_literal) { +void Reparenter::VisitClassLiteral(ClassLiteral* class_literal) { class_literal->scope()->ReplaceOuterScope(scope_); // No need to visit the constructor since it will have the class // scope on its scope chain. @@ -60,7 +60,7 @@ void Rewriter::VisitClassLiteral(ClassLiteral* class_literal) { #endif } -void Rewriter::VisitVariableProxy(VariableProxy* proxy) { +void Reparenter::VisitVariableProxy(VariableProxy* proxy) { if (!proxy->is_resolved()) { if (scope_->outer_scope()->RemoveUnresolved(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) stmt->scope()->ReplaceOuterScope(scope_); else VisitStatements(stmt->statements()); } -void Rewriter::VisitTryCatchStatement(TryCatchStatement* stmt) { +void Reparenter::VisitTryCatchStatement(TryCatchStatement* stmt) { Visit(stmt->try_block()); stmt->scope()->ReplaceOuterScope(scope_); } -void Rewriter::VisitWithStatement(WithStatement* stmt) { +void Reparenter::VisitWithStatement(WithStatement* stmt) { Visit(stmt->expression()); stmt->scope()->ReplaceOuterScope(scope_); } @@ -105,8 +105,8 @@ void ReparentExpressionScope(uintptr_t stack_limit, Expression* expr, DCHECK_IMPLIES(!scope->is_declaration_scope(), scope->outer_scope()->is_hidden()); - Rewriter rewriter(stack_limit, expr, scope); - rewriter.Run(); + Reparenter r(stack_limit, expr, scope); + r.Run(); } } // namespace internal diff --git a/src/setup-isolate.h b/src/setup-isolate.h index bb605b6d58..99bdd9bcfa 100644 --- a/src/setup-isolate.h +++ b/src/setup-isolate.h @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef V8_SETUP_ISOLATE_H_ +#define V8_SETUP_ISOLATE_H_ + namespace v8 { namespace internal { @@ -45,3 +48,5 @@ class SetupIsolateDelegate { } // namespace internal } // namespace v8 + +#endif // V8_SETUP_ISOLATE_H_ diff --git a/src/wasm/function-body-decoder.cc b/src/wasm/function-body-decoder.cc index f9f62f0ae8..99e393c913 100644 --- a/src/wasm/function-body-decoder.cc +++ b/src/wasm/function-body-decoder.cc @@ -2372,6 +2372,8 @@ BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, static_cast(num_locals), zone); } +#undef TRACE + } // namespace wasm } // namespace internal } // namespace v8 diff --git a/src/wasm/local-decl-encoder.cc b/src/wasm/local-decl-encoder.cc index cf50cd0df4..0f3da2f383 100644 --- a/src/wasm/local-decl-encoder.cc +++ b/src/wasm/local-decl-encoder.cc @@ -6,9 +6,20 @@ #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::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, const byte** end) const { size_t size = (*end - *start); diff --git a/src/wasm/module-compiler.cc b/src/wasm/module-compiler.cc index 2c585d82bb..edbfc38dae 100644 --- a/src/wasm/module-compiler.cc +++ b/src/wasm/module-compiler.cc @@ -520,24 +520,6 @@ double MonotonicallyIncreasingTimeInMs() { base::Time::kMillisecondsPerSecond; } -void RejectPromise(Isolate* isolate, Handle context, - ErrorThrower& thrower, Handle promise) { - v8::Local resolver = - v8::Utils::PromiseToLocal(promise).As(); - 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, - Handle promise, Handle result) { - v8::Local resolver = - v8::Utils::PromiseToLocal(promise).As(); - 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) { for (uint32_t i = 0, e = static_cast(module_env->function_tables().size()); @@ -2317,6 +2299,9 @@ class AsyncCompileJob::FinishModule : public CompileStep { return job_->AsyncCompileSucceeded(result); } }; + +#undef TRACE + } // namespace wasm } // namespace internal } // namespace v8 diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc index 08f673ca32..7f0753e6ad 100644 --- a/src/wasm/module-decoder.cc +++ b/src/wasm/module-decoder.cc @@ -1528,6 +1528,8 @@ void DecodeLocalNames(const byte* module_start, const byte* module_end, } } +#undef TRACE + } // namespace wasm } // namespace internal } // namespace v8 diff --git a/src/wasm/streaming-decoder.cc b/src/wasm/streaming-decoder.cc index 4e9d1a843d..c0c51c9d76 100644 --- a/src/wasm/streaming-decoder.cc +++ b/src/wasm/streaming-decoder.cc @@ -15,9 +15,20 @@ #include "src/wasm/wasm-objects.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::wasm; +#if __clang__ +// TODO(mostynb@opera.com): remove the using statements and these pragmas. +#pragma clang diagnostic pop +#endif + void StreamingDecoder::OnBytesReceived(Vector bytes) { size_t current = 0; while (decoder()->ok() && current < bytes.size()) { diff --git a/src/wasm/wasm-code-specialization.cc b/src/wasm/wasm-code-specialization.cc index c274497fec..37458022ab 100644 --- a/src/wasm/wasm-code-specialization.cc +++ b/src/wasm/wasm-code-specialization.cc @@ -11,10 +11,21 @@ #include "src/wasm/wasm-module.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::wasm; -namespace { +#if __clang__ +#pragma clang diagnostic pop +#endif + +namespace v8 { +namespace internal { +namespace wasm { int ExtractDirectCallIndex(wasm::Decoder& decoder, const byte* pc) { DCHECK_EQ(static_cast(kExprCallFunction), static_cast(*pc)); @@ -25,6 +36,12 @@ int ExtractDirectCallIndex(wasm::Decoder& decoder, const byte* pc) { return static_cast(call_idx); } +} // namespace wasm +} // namespace internal +} // namespace v8 + +namespace { + int AdvanceSourcePositionTableIterator(SourcePositionTableIterator& iterator, size_t offset_l) { DCHECK_GE(kMaxInt, offset_l); diff --git a/src/wasm/wasm-code-specialization.h b/src/wasm/wasm-code-specialization.h index fa54235ec3..71aa7e8909 100644 --- a/src/wasm/wasm-code-specialization.h +++ b/src/wasm/wasm-code-specialization.h @@ -7,12 +7,15 @@ #include "src/assembler.h" #include "src/identity-map.h" +#include "src/wasm/decoder.h" #include "src/wasm/wasm-objects.h" namespace v8 { namespace internal { namespace wasm { +int ExtractDirectCallIndex(wasm::Decoder& decoder, const byte* pc); + // Helper class to specialize wasm code for a specific instance, or to update // code when memory / globals / tables change. // This class in unhandlified, and contains a DisallowHeapAllocation field to diff --git a/src/wasm/wasm-debug.cc b/src/wasm/wasm-debug.cc index 179f894914..0770940484 100644 --- a/src/wasm/wasm-debug.cc +++ b/src/wasm/wasm-debug.cc @@ -20,9 +20,18 @@ #include "src/wasm/wasm-objects.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::wasm; +#if __clang__ +#pragma clang diagnostic pop +#endif + namespace { template diff --git a/src/wasm/wasm-interpreter.cc b/src/wasm/wasm-interpreter.cc index c7d369e8ff..d6f19a15a5 100644 --- a/src/wasm/wasm-interpreter.cc +++ b/src/wasm/wasm-interpreter.cc @@ -2696,6 +2696,8 @@ WasmInterpreter::HeapObjectsScope::~HeapObjectsScope() { reinterpret_cast(data)->~HeapObjectsScopeImpl(); } +#undef TRACE + } // namespace wasm } // namespace internal } // namespace v8 diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc index 364b75431f..bd7b1e4706 100644 --- a/src/wasm/wasm-module.cc +++ b/src/wasm/wasm-module.cc @@ -24,10 +24,21 @@ #include "src/wasm/wasm-objects.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::wasm; namespace base = v8::base; +#if __clang__ +// TODO(mostynb@opera.com): remove the using statements and these pragmas. +#pragma clang diagnostic pop +#endif + #define TRACE(...) \ do { \ if (FLAG_trace_wasm_instances) PrintF(__VA_ARGS__); \ @@ -195,16 +206,6 @@ int AdvanceSourcePositionTableIterator(SourcePositionTableIterator& iterator, return byte_pos; } -int ExtractDirectCallIndex(wasm::Decoder& decoder, const byte* pc) { - DCHECK_EQ(static_cast(kExprCallFunction), static_cast(*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(call_idx); -} - void RecordLazyCodeStats(Code* code, Counters* counters) { counters->wasm_lazily_compiled_functions()->Increment(); counters->wasm_generated_code_size()->Increment(code->body_size()); @@ -839,7 +840,9 @@ MaybeHandle wasm::SyncCompileAndInstantiate( Handle::null()); } -namespace { +namespace v8 { +namespace internal { +namespace wasm { void RejectPromise(Isolate* isolate, Handle context, ErrorThrower& thrower, Handle promise) { @@ -859,7 +862,9 @@ void ResolvePromise(Isolate* isolate, Handle context, CHECK_IMPLIES(!maybe.FromMaybe(false), isolate->has_scheduled_exception()); } -} // namespace +} // namespace wasm +} // namespace internal +} // namespace v8 void wasm::AsyncInstantiate(Isolate* isolate, Handle promise, Handle module_object, diff --git a/src/wasm/wasm-module.h b/src/wasm/wasm-module.h index 6553c3bf53..39ce2d515a 100644 --- a/src/wasm/wasm-module.h +++ b/src/wasm/wasm-module.h @@ -611,6 +611,12 @@ void ValidateOrphanedInstance(Isolate* isolate, Handle instance); } // namespace testing +void ResolvePromise(Isolate* isolate, Handle context, + Handle promise, Handle result); + +void RejectPromise(Isolate* isolate, Handle context, + ErrorThrower& thrower, Handle promise); + } // namespace wasm } // namespace internal } // namespace v8 diff --git a/src/wasm/wasm-objects.cc b/src/wasm/wasm-objects.cc index ea2489ac62..c332eb3dd8 100644 --- a/src/wasm/wasm-objects.cc +++ b/src/wasm/wasm-objects.cc @@ -26,9 +26,20 @@ instance->PrintInstancesChain(); \ } 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::wasm; +#if __clang__ +// TODO(mostynb@opera.com): remove the using statements and these pragmas. +#pragma clang diagnostic pop +#endif + namespace { // An iterator that returns first the module itself, then all modules linked via diff --git a/src/wasm/wasm-text.cc b/src/wasm/wasm-text.cc index f49fce5cbe..e596d6770a 100644 --- a/src/wasm/wasm-text.cc +++ b/src/wasm/wasm-text.cc @@ -14,10 +14,21 @@ #include "src/wasm/wasm-opcodes.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::internal; using namespace v8::internal::wasm; +#if __clang__ +// TODO(mostynb@opera.com): remove the using statements and these pragmas. +#pragma clang diagnostic pop +#endif + namespace { bool IsValidFunctionName(const Vector &name) { if (name.is_empty()) return false; diff --git a/test/fuzzer/wasm-async.cc b/test/fuzzer/wasm-async.cc index ed7d1040d0..b408d9c454 100644 --- a/test/fuzzer/wasm-async.cc +++ b/test/fuzzer/wasm-async.cc @@ -18,10 +18,21 @@ #include "test/common/wasm/wasm-module-runner.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::wasm; 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) \ v8::Local var; \ do { \ diff --git a/test/fuzzer/wasm-call.cc b/test/fuzzer/wasm-call.cc index 1b1e5cebbf..77604f2dba 100644 --- a/test/fuzzer/wasm-call.cc +++ b/test/fuzzer/wasm-call.cc @@ -21,10 +21,21 @@ #define MAX_NUM_FUNCTIONS 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::wasm; 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 { template static inline V read_value(const uint8_t** data, size_t* size, bool* ok) { diff --git a/test/fuzzer/wasm-code.cc b/test/fuzzer/wasm-code.cc index 65543a1649..949e45b09d 100644 --- a/test/fuzzer/wasm-code.cc +++ b/test/fuzzer/wasm-code.cc @@ -13,10 +13,21 @@ #include "test/common/wasm/test-signatures.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::wasm; 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 { virtual bool GenerateModule( Isolate* isolate, Zone* zone, const uint8_t* data, size_t size, diff --git a/test/fuzzer/wasm-compile.cc b/test/fuzzer/wasm-compile.cc index 3e084968ae..d356aab981 100644 --- a/test/fuzzer/wasm-compile.cc +++ b/test/fuzzer/wasm-compile.cc @@ -23,10 +23,21 @@ 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::wasm; 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 { class DataRange { diff --git a/test/fuzzer/wasm-data-section.cc b/test/fuzzer/wasm-data-section.cc index 91c3fb586e..c6a7547767 100644 --- a/test/fuzzer/wasm-data-section.cc +++ b/test/fuzzer/wasm-data-section.cc @@ -5,8 +5,7 @@ #include "src/objects-inl.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) { - return FuzzWasmSection(v8::internal::wasm::kDataSectionCode, data, size); + return v8::internal::wasm::fuzzer::FuzzWasmSection( + v8::internal::wasm::kDataSectionCode, data, size); } diff --git a/test/fuzzer/wasm-function-sigs-section.cc b/test/fuzzer/wasm-function-sigs-section.cc index fc1fe2b987..2c894d6ee5 100644 --- a/test/fuzzer/wasm-function-sigs-section.cc +++ b/test/fuzzer/wasm-function-sigs-section.cc @@ -5,8 +5,7 @@ #include "src/objects-inl.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) { - return FuzzWasmSection(v8::internal::wasm::kFunctionSectionCode, data, size); + return v8::internal::wasm::fuzzer::FuzzWasmSection( + v8::internal::wasm::kFunctionSectionCode, data, size); } diff --git a/test/fuzzer/wasm-fuzzer-common.cc b/test/fuzzer/wasm-fuzzer-common.cc index bd6254cdd6..8d83653a4d 100644 --- a/test/fuzzer/wasm-fuzzer-common.cc +++ b/test/fuzzer/wasm-fuzzer-common.cc @@ -16,10 +16,21 @@ #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::wasm; 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 size_t kNameStringLength = 4; diff --git a/test/fuzzer/wasm-globals-section.cc b/test/fuzzer/wasm-globals-section.cc index 3aab373a5a..23a8dcf339 100644 --- a/test/fuzzer/wasm-globals-section.cc +++ b/test/fuzzer/wasm-globals-section.cc @@ -5,8 +5,7 @@ #include "src/objects-inl.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) { - return FuzzWasmSection(v8::internal::wasm::kGlobalSectionCode, data, size); + return v8::internal::wasm::fuzzer::FuzzWasmSection( + v8::internal::wasm::kGlobalSectionCode, data, size); } diff --git a/test/fuzzer/wasm-imports-section.cc b/test/fuzzer/wasm-imports-section.cc index 587d091417..a8f455eeb8 100644 --- a/test/fuzzer/wasm-imports-section.cc +++ b/test/fuzzer/wasm-imports-section.cc @@ -5,8 +5,7 @@ #include "src/objects-inl.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) { - return FuzzWasmSection(v8::internal::wasm::kImportSectionCode, data, size); + return v8::internal::wasm::fuzzer::FuzzWasmSection( + v8::internal::wasm::kImportSectionCode, data, size); } diff --git a/test/fuzzer/wasm-memory-section.cc b/test/fuzzer/wasm-memory-section.cc index 261fd75b78..b80545ae19 100644 --- a/test/fuzzer/wasm-memory-section.cc +++ b/test/fuzzer/wasm-memory-section.cc @@ -5,8 +5,7 @@ #include "src/objects-inl.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) { - return FuzzWasmSection(v8::internal::wasm::kMemorySectionCode, data, size); + return v8::internal::wasm::fuzzer::FuzzWasmSection( + v8::internal::wasm::kMemorySectionCode, data, size); } diff --git a/test/fuzzer/wasm-names-section.cc b/test/fuzzer/wasm-names-section.cc index 8cfbd6c903..6dec25555c 100644 --- a/test/fuzzer/wasm-names-section.cc +++ b/test/fuzzer/wasm-names-section.cc @@ -5,9 +5,8 @@ #include "src/objects-inl.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) { // 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); } diff --git a/test/fuzzer/wasm-types-section.cc b/test/fuzzer/wasm-types-section.cc index cdd99067e7..e3c6b58da7 100644 --- a/test/fuzzer/wasm-types-section.cc +++ b/test/fuzzer/wasm-types-section.cc @@ -5,8 +5,7 @@ #include "src/objects-inl.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) { - return FuzzWasmSection(v8::internal::wasm::kTypeSectionCode, data, size); + return v8::internal::wasm::fuzzer::FuzzWasmSection( + v8::internal::wasm::kTypeSectionCode, data, size); }