Expose a lower bound of malloc'd memory via heap statistics

We expect that the majority of malloc'd memory held by V8 is allocated
in Zone objects. Introduce an Allocator class that is used by Zones to
manage memory, and allows for querying the current usage.

BUG=none
R=titzer@chromium.org,bmeurer@chromium.org,jarin@chromium.org
LOG=n
TBR=rossberg@chromium.org

Review URL: https://codereview.chromium.org/1847543002

Cr-Commit-Position: refs/heads/master@{#35196}
This commit is contained in:
jochen 2016-04-01 03:00:30 -07:00 committed by Commit bot
parent 3ffee875ef
commit cb7aa79b12
78 changed files with 417 additions and 251 deletions

View File

@ -1752,6 +1752,8 @@ source_set("v8_libbase") {
visibility = [ ":*" ] # Only targets in this file can depend on this. visibility = [ ":*" ] # Only targets in this file can depend on this.
sources = [ sources = [
"src/base/accounting-allocator.cc",
"src/base/accounting-allocator.h",
"src/base/adapters.h", "src/base/adapters.h",
"src/base/atomicops.h", "src/base/atomicops.h",
"src/base/atomicops_internals_arm64_gcc.h", "src/base/atomicops_internals_arm64_gcc.h",

View File

@ -5186,6 +5186,7 @@ class V8_EXPORT HeapStatistics {
size_t total_available_size() { return total_available_size_; } size_t total_available_size() { return total_available_size_; }
size_t used_heap_size() { return used_heap_size_; } size_t used_heap_size() { return used_heap_size_; }
size_t heap_size_limit() { return heap_size_limit_; } size_t heap_size_limit() { return heap_size_limit_; }
size_t malloced_memory() { return malloced_memory_; }
size_t does_zap_garbage() { return does_zap_garbage_; } size_t does_zap_garbage() { return does_zap_garbage_; }
private: private:
@ -5195,6 +5196,7 @@ class V8_EXPORT HeapStatistics {
size_t total_available_size_; size_t total_available_size_;
size_t used_heap_size_; size_t used_heap_size_;
size_t heap_size_limit_; size_t heap_size_limit_;
size_t malloced_memory_;
bool does_zap_garbage_; bool does_zap_garbage_;
friend class V8; friend class V8;

View File

@ -5494,13 +5494,15 @@ bool v8::V8::Dispose() {
return true; return true;
} }
HeapStatistics::HeapStatistics()
HeapStatistics::HeapStatistics(): total_heap_size_(0), : total_heap_size_(0),
total_heap_size_executable_(0), total_heap_size_executable_(0),
total_physical_size_(0), total_physical_size_(0),
used_heap_size_(0), total_available_size_(0),
heap_size_limit_(0) { } used_heap_size_(0),
heap_size_limit_(0),
malloced_memory_(0),
does_zap_garbage_(0) {}
HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0),
space_size_(0), space_size_(0),
@ -7401,6 +7403,8 @@ void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) {
heap_statistics->total_available_size_ = heap->Available(); heap_statistics->total_available_size_ = heap->Available();
heap_statistics->used_heap_size_ = heap->SizeOfObjects(); heap_statistics->used_heap_size_ = heap->SizeOfObjects();
heap_statistics->heap_size_limit_ = heap->MaxReserved(); heap_statistics->heap_size_limit_ = heap->MaxReserved();
heap_statistics->malloced_memory_ =
isolate->allocator()->GetCurrentMemoryUsage();
heap_statistics->does_zap_garbage_ = heap->ShouldZapGarbage(); heap_statistics->does_zap_garbage_ = heap->ShouldZapGarbage();
} }

View File

@ -21,7 +21,7 @@ BackgroundParsingTask::BackgroundParsingTask(
// Prepare the data for the internalization phase and compilation phase, which // Prepare the data for the internalization phase and compilation phase, which
// will happen in the main thread after parsing. // will happen in the main thread after parsing.
Zone* zone = new Zone(); Zone* zone = new Zone(isolate->allocator());
ParseInfo* info = new ParseInfo(zone); ParseInfo* info = new ParseInfo(zone);
source->zone.Reset(zone); source->zone.Reset(zone);
source->info.Reset(info); source->info.Reset(info);

View File

@ -0,0 +1,33 @@
// Copyright 2016 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.
#include "src/base/accounting-allocator.h"
#include <cstdlib>
#if V8_LIBC_BIONIC
#include <malloc.h> // NOLINT
#endif
namespace v8 {
namespace base {
void* AccountingAllocator::Allocate(size_t bytes) {
void* memory = malloc(bytes);
if (memory) NoBarrier_AtomicIncrement(&current_memory_usage_, bytes);
return memory;
}
void AccountingAllocator::Free(void* memory, size_t bytes) {
free(memory);
NoBarrier_AtomicIncrement(&current_memory_usage_,
-static_cast<AtomicWord>(bytes));
}
size_t AccountingAllocator::GetCurrentMemoryUsage() const {
return NoBarrier_Load(&current_memory_usage_);
}
} // namespace base
} // namespace v8

View File

@ -0,0 +1,34 @@
// Copyright 2016 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_BASE_ACCOUNTING_ALLOCATOR_H_
#define V8_BASE_ACCOUNTING_ALLOCATOR_H_
#include "src/base/atomicops.h"
#include "src/base/macros.h"
namespace v8 {
namespace base {
class AccountingAllocator final {
public:
AccountingAllocator() = default;
~AccountingAllocator() = default;
// Returns nullptr on failed allocation.
void* Allocate(size_t bytes);
void Free(void* memory, size_t bytes);
size_t GetCurrentMemoryUsage() const;
private:
AtomicWord current_memory_usage_ = 0;
DISALLOW_COPY_AND_ASSIGN(AccountingAllocator);
};
} // namespace base
} // namespace v8
#endif // V8_BASE_ACCOUNTING_ALLOCATOR_H_

View File

@ -4579,7 +4579,7 @@ Handle<Code> MacroAssemblerBuilder(Isolate* isolate,
Handle<Code> CodeStubAssemblerBuilder(Isolate* isolate, Handle<Code> CodeStubAssemblerBuilder(Isolate* isolate,
BuiltinDesc const* builtin_desc) { BuiltinDesc const* builtin_desc) {
Zone zone; Zone zone(isolate->allocator());
compiler::CodeStubAssembler assembler(isolate, &zone, builtin_desc->argc, compiler::CodeStubAssembler assembler(isolate, &zone, builtin_desc->argc,
builtin_desc->flags, builtin_desc->flags,
builtin_desc->s_name); builtin_desc->s_name);

View File

@ -297,7 +297,7 @@ static Handle<Code> DoGenerateCode(Stub* stub) {
if (FLAG_profile_hydrogen_code_stub_compilation) { if (FLAG_profile_hydrogen_code_stub_compilation) {
timer.Start(); timer.Start();
} }
Zone zone; Zone zone(isolate->allocator());
CompilationInfo info(CodeStub::MajorName(stub->MajorKey()), isolate, &zone, CompilationInfo info(CodeStub::MajorName(stub->MajorKey()), isolate, &zone,
stub->GetCodeFlags()); stub->GetCodeFlags());
// Parameter count is number of stack parameters. // Parameter count is number of stack parameters.

View File

@ -455,7 +455,7 @@ void CompareICStub::Generate(MacroAssembler* masm) {
Handle<Code> TurboFanCodeStub::GenerateCode() { Handle<Code> TurboFanCodeStub::GenerateCode() {
const char* name = CodeStub::MajorName(MajorKey()); const char* name = CodeStub::MajorName(MajorKey());
Zone zone; Zone zone(isolate()->allocator());
CallInterfaceDescriptor descriptor(GetCallInterfaceDescriptor()); CallInterfaceDescriptor descriptor(GetCallInterfaceDescriptor());
compiler::CodeStubAssembler assembler(isolate(), &zone, descriptor, compiler::CodeStubAssembler assembler(isolate(), &zone, descriptor,
GetCodeFlags(), name); GetCodeFlags(), name);

View File

@ -85,7 +85,8 @@ class CompilationHandleScope BASE_EMBEDDED {
class CompilationInfoWithZone : public CompilationInfo { class CompilationInfoWithZone : public CompilationInfo {
public: public:
explicit CompilationInfoWithZone(Handle<JSFunction> function) explicit CompilationInfoWithZone(Handle<JSFunction> function)
: CompilationInfo(new ParseInfo(&zone_, function)) {} : CompilationInfo(new ParseInfo(&zone_, function)),
zone_(function->GetIsolate()->allocator()) {}
// Virtual destructor because a CompilationInfoWithZone has to exit the // Virtual destructor because a CompilationInfoWithZone has to exit the
// zone scope and get rid of dependent maps even when the destructor is // zone scope and get rid of dependent maps even when the destructor is
@ -1175,7 +1176,7 @@ bool CompileEvalForDebugging(Handle<JSFunction> function,
Handle<Script> script(Script::cast(shared->script())); Handle<Script> script(Script::cast(shared->script()));
Handle<Context> context(function->context()); Handle<Context> context(function->context());
Zone zone; Zone zone(function->GetIsolate()->allocator());
ParseInfo parse_info(&zone, script); ParseInfo parse_info(&zone, script);
CompilationInfo info(&parse_info); CompilationInfo info(&parse_info);
Isolate* isolate = info.isolate(); Isolate* isolate = info.isolate();
@ -1430,7 +1431,7 @@ bool Compiler::CompileDebugCode(Handle<JSFunction> function) {
bool Compiler::CompileDebugCode(Handle<SharedFunctionInfo> shared) { bool Compiler::CompileDebugCode(Handle<SharedFunctionInfo> shared) {
DCHECK(shared->allows_lazy_compilation_without_context()); DCHECK(shared->allows_lazy_compilation_without_context());
DCHECK(!IsEvalToplevel(shared)); DCHECK(!IsEvalToplevel(shared));
Zone zone; Zone zone(shared->GetIsolate()->allocator());
ParseInfo parse_info(&zone, shared); ParseInfo parse_info(&zone, shared);
CompilationInfo info(&parse_info); CompilationInfo info(&parse_info);
return CompileForDebugging(&info); return CompileForDebugging(&info);
@ -1483,7 +1484,7 @@ bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
void Compiler::CompileForLiveEdit(Handle<Script> script) { void Compiler::CompileForLiveEdit(Handle<Script> script) {
// TODO(635): support extensions. // TODO(635): support extensions.
Zone zone; Zone zone(script->GetIsolate()->allocator());
ParseInfo parse_info(&zone, script); ParseInfo parse_info(&zone, script);
CompilationInfo info(&parse_info); CompilationInfo info(&parse_info);
PostponeInterruptsScope postpone(info.isolate()); PostponeInterruptsScope postpone(info.isolate());
@ -1530,7 +1531,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
script->set_column_offset(column_offset); script->set_column_offset(column_offset);
} }
script->set_origin_options(options); script->set_origin_options(options);
Zone zone; Zone zone(isolate->allocator());
ParseInfo parse_info(&zone, script); ParseInfo parse_info(&zone, script);
CompilationInfo info(&parse_info); CompilationInfo info(&parse_info);
parse_info.set_eval(); parse_info.set_eval();
@ -1654,7 +1655,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
} }
// Compile the function and add it to the cache. // Compile the function and add it to the cache.
Zone zone; Zone zone(isolate->allocator());
ParseInfo parse_info(&zone, script); ParseInfo parse_info(&zone, script);
CompilationInfo info(&parse_info); CompilationInfo info(&parse_info);
if (is_module) { if (is_module) {
@ -1758,7 +1759,7 @@ Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfo(
result->set_is_toplevel(false); result->set_is_toplevel(false);
} }
Zone zone; Zone zone(isolate->allocator());
ParseInfo parse_info(&zone, script); ParseInfo parse_info(&zone, script);
CompilationInfo info(&parse_info); CompilationInfo info(&parse_info);
parse_info.set_literal(literal); parse_info.set_literal(literal);

View File

@ -20,7 +20,7 @@ namespace compiler {
void GraphReplayPrinter::PrintReplay(Graph* graph) { void GraphReplayPrinter::PrintReplay(Graph* graph) {
GraphReplayPrinter replay; GraphReplayPrinter replay;
PrintF(" Node* nil = graph()->NewNode(common()->Dead());\n"); PrintF(" Node* nil = graph()->NewNode(common()->Dead());\n");
Zone zone; Zone zone(graph->zone()->allocator());
AllNodes nodes(&zone, graph); AllNodes nodes(&zone, graph);
// Allocate the nodes first. // Allocate the nodes first.

View File

@ -197,7 +197,8 @@ class JSONGraphEdgeWriter {
std::ostream& operator<<(std::ostream& os, const AsJSON& ad) { std::ostream& operator<<(std::ostream& os, const AsJSON& ad) {
Zone tmp_zone; base::AccountingAllocator allocator;
Zone tmp_zone(&allocator);
os << "{\n\"nodes\":["; os << "{\n\"nodes\":[";
JSONGraphNodeWriter(os, &tmp_zone, &ad.graph, ad.positions).Print(); JSONGraphNodeWriter(os, &tmp_zone, &ad.graph, ad.positions).Print();
os << "],\n\"edges\":["; os << "],\n\"edges\":[";
@ -583,14 +584,16 @@ void GraphC1Visualizer::PrintLiveRange(const LiveRange* range, const char* type,
std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac) { std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac) {
Zone tmp_zone; base::AccountingAllocator allocator;
Zone tmp_zone(&allocator);
GraphC1Visualizer(os, &tmp_zone).PrintCompilation(ac.info_); GraphC1Visualizer(os, &tmp_zone).PrintCompilation(ac.info_);
return os; return os;
} }
std::ostream& operator<<(std::ostream& os, const AsC1V& ac) { std::ostream& operator<<(std::ostream& os, const AsC1V& ac) {
Zone tmp_zone; base::AccountingAllocator allocator;
Zone tmp_zone(&allocator);
GraphC1Visualizer(os, &tmp_zone) GraphC1Visualizer(os, &tmp_zone)
.PrintSchedule(ac.phase_, ac.schedule_, ac.positions_, ac.instructions_); .PrintSchedule(ac.phase_, ac.schedule_, ac.positions_, ac.instructions_);
return os; return os;
@ -599,7 +602,8 @@ std::ostream& operator<<(std::ostream& os, const AsC1V& ac) {
std::ostream& operator<<(std::ostream& os, std::ostream& operator<<(std::ostream& os,
const AsC1VRegisterAllocationData& ac) { const AsC1VRegisterAllocationData& ac) {
Zone tmp_zone; base::AccountingAllocator allocator;
Zone tmp_zone(&allocator);
GraphC1Visualizer(os, &tmp_zone).PrintLiveRanges(ac.phase_, ac.data_); GraphC1Visualizer(os, &tmp_zone).PrintLiveRanges(ac.phase_, ac.data_);
return os; return os;
} }
@ -609,7 +613,8 @@ const int kOnStack = 1;
const int kVisited = 2; const int kVisited = 2;
std::ostream& operator<<(std::ostream& os, const AsRPO& ar) { std::ostream& operator<<(std::ostream& os, const AsRPO& ar) {
Zone local_zone; base::AccountingAllocator allocator;
Zone local_zone(&allocator);
ZoneVector<byte> state(ar.graph.NodeCount(), kUnvisited, &local_zone); ZoneVector<byte> state(ar.graph.NodeCount(), kUnvisited, &local_zone);
ZoneStack<Node*> stack(&local_zone); ZoneStack<Node*> stack(&local_zone);

View File

@ -412,7 +412,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
return NoChange(); return NoChange();
} }
Zone zone; Zone zone(info_->isolate()->allocator());
ParseInfo parse_info(&zone, function); ParseInfo parse_info(&zone, function);
CompilationInfo info(&parse_info); CompilationInfo info(&parse_info);
if (info_->is_deoptimization_enabled()) info.MarkAsDeoptimizationEnabled(); if (info_->is_deoptimization_enabled()) info.MarkAsDeoptimizationEnabled();

View File

@ -143,7 +143,7 @@ void JumpThreading::ApplyForwarding(ZoneVector<RpoNumber>& result,
InstructionSequence* code) { InstructionSequence* code) {
if (!FLAG_turbo_jt) return; if (!FLAG_turbo_jt) return;
Zone local_zone; Zone local_zone(code->isolate()->allocator());
ZoneVector<bool> skip(static_cast<int>(result.size()), false, &local_zone); ZoneVector<bool> skip(static_cast<int>(result.size()), false, &local_zone);
// Skip empty blocks when the previous block doesn't fall through. // Skip empty blocks when the previous block doesn't fall through.

View File

@ -116,6 +116,8 @@ class LoopTree : public ZoneObject {
return nullptr; return nullptr;
} }
Zone* zone() const { return zone_; }
private: private:
friend class LoopFinderImpl; friend class LoopFinderImpl;

View File

@ -184,7 +184,7 @@ static void FindLoopExits(LoopTree* loop_tree, LoopTree::Loop* loop,
bool LoopPeeler::CanPeel(LoopTree* loop_tree, LoopTree::Loop* loop) { bool LoopPeeler::CanPeel(LoopTree* loop_tree, LoopTree::Loop* loop) {
Zone zone; Zone zone(loop_tree->zone()->allocator());
NodeVector exits(&zone); NodeVector exits(&zone);
NodeVector rets(&zone); NodeVector rets(&zone);
FindLoopExits(loop_tree, loop, exits, rets); FindLoopExits(loop_tree, loop, exits, rets);

View File

@ -1094,7 +1094,7 @@ void Pipeline::RunPrintAndVerify(const char* phase, bool untyped) {
Handle<Code> Pipeline::GenerateCode() { Handle<Code> Pipeline::GenerateCode() {
ZonePool zone_pool; ZonePool zone_pool(isolate()->allocator());
base::SmartPointer<PipelineStatistics> pipeline_statistics; base::SmartPointer<PipelineStatistics> pipeline_statistics;
if (FLAG_turbo_stats) { if (FLAG_turbo_stats) {
@ -1255,7 +1255,7 @@ Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate,
CompilationInfo info(debug_name, isolate, graph->zone(), flags); CompilationInfo info(debug_name, isolate, graph->zone(), flags);
// Construct a pipeline for scheduling and code generation. // Construct a pipeline for scheduling and code generation.
ZonePool zone_pool; ZonePool zone_pool(isolate->allocator());
PipelineData data(&zone_pool, &info, graph, schedule); PipelineData data(&zone_pool, &info, graph, schedule);
base::SmartPointer<PipelineStatistics> pipeline_statistics; base::SmartPointer<PipelineStatistics> pipeline_statistics;
if (FLAG_turbo_stats) { if (FLAG_turbo_stats) {
@ -1296,7 +1296,7 @@ Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info,
Graph* graph, Graph* graph,
Schedule* schedule) { Schedule* schedule) {
// Construct a pipeline for scheduling and code generation. // Construct a pipeline for scheduling and code generation.
ZonePool zone_pool; ZonePool zone_pool(info->isolate()->allocator());
PipelineData data(&zone_pool, info, graph, schedule); PipelineData data(&zone_pool, info, graph, schedule);
base::SmartPointer<PipelineStatistics> pipeline_statistics; base::SmartPointer<PipelineStatistics> pipeline_statistics;
if (FLAG_turbo_stats) { if (FLAG_turbo_stats) {
@ -1319,7 +1319,7 @@ bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config,
InstructionSequence* sequence, InstructionSequence* sequence,
bool run_verifier) { bool run_verifier) {
CompilationInfo info("testing", sequence->isolate(), sequence->zone()); CompilationInfo info("testing", sequence->isolate(), sequence->zone());
ZonePool zone_pool; ZonePool zone_pool(sequence->isolate()->allocator());
PipelineData data(&zone_pool, &info, sequence); PipelineData data(&zone_pool, &info, sequence);
Pipeline pipeline(&info); Pipeline pipeline(&info);
pipeline.data_ = &data; pipeline.data_ = &data;
@ -1442,7 +1442,7 @@ void Pipeline::AllocateRegisters(const RegisterConfiguration* config,
base::SmartPointer<Zone> verifier_zone; base::SmartPointer<Zone> verifier_zone;
RegisterAllocatorVerifier* verifier = nullptr; RegisterAllocatorVerifier* verifier = nullptr;
if (run_verifier) { if (run_verifier) {
verifier_zone.Reset(new Zone()); verifier_zone.Reset(new Zone(isolate()->allocator()));
verifier = new (verifier_zone.get()) RegisterAllocatorVerifier( verifier = new (verifier_zone.get()) RegisterAllocatorVerifier(
verifier_zone.get(), config, data->sequence()); verifier_zone.get(), config, data->sequence());
} }

View File

@ -63,7 +63,7 @@ Reduction SelectLowering::Reduce(Node* node) {
bool SelectLowering::ReachableFrom(Node* const sink, Node* const source) { bool SelectLowering::ReachableFrom(Node* const sink, Node* const source) {
// TODO(turbofan): This is probably horribly expensive, and it should be moved // TODO(turbofan): This is probably horribly expensive, and it should be moved
// into node.h or somewhere else?! // into node.h or somewhere else?!
Zone zone; Zone zone(graph()->zone()->allocator());
std::queue<Node*, NodeDeque> queue((NodeDeque(&zone))); std::queue<Node*, NodeDeque> queue((NodeDeque(&zone)));
BoolVector visited(graph()->NodeCount(), false, &zone); BoolVector visited(graph()->NodeCount(), false, &zone);
queue.push(source); queue.push(source);

View File

@ -980,7 +980,7 @@ void Verifier::Visitor::Check(Node* node) {
void Verifier::Run(Graph* graph, Typing typing) { void Verifier::Run(Graph* graph, Typing typing) {
CHECK_NOT_NULL(graph->start()); CHECK_NOT_NULL(graph->start());
CHECK_NOT_NULL(graph->end()); CHECK_NOT_NULL(graph->end());
Zone zone; Zone zone(graph->zone()->allocator());
Visitor visitor(&zone, typing); Visitor visitor(&zone, typing);
AllNodes all(&zone, graph); AllNodes all(&zone, graph);
for (Node* node : all.live) visitor.Check(node); for (Node* node : all.live) visitor.Check(node);
@ -1070,7 +1070,7 @@ static void CheckInputsDominate(Schedule* schedule, BasicBlock* block,
void ScheduleVerifier::Run(Schedule* schedule) { void ScheduleVerifier::Run(Schedule* schedule) {
const size_t count = schedule->BasicBlockCount(); const size_t count = schedule->BasicBlockCount();
Zone tmp_zone; Zone tmp_zone(schedule->zone()->allocator());
Zone* zone = &tmp_zone; Zone* zone = &tmp_zone;
BasicBlock* start = schedule->start(); BasicBlock* start = schedule->start();
BasicBlockVector* rpo_order = schedule->rpo_order(); BasicBlockVector* rpo_order = schedule->rpo_order();

View File

@ -2523,7 +2523,7 @@ Handle<JSFunction> CompileJSToWasmWrapper(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Create the Graph // Create the Graph
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
Zone zone; Zone zone(isolate->allocator());
Graph graph(&zone); Graph graph(&zone);
CommonOperatorBuilder common(&zone); CommonOperatorBuilder common(&zone);
JSOperatorBuilder javascript(&zone); JSOperatorBuilder javascript(&zone);
@ -2615,7 +2615,7 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Create the Graph // Create the Graph
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
Zone zone; Zone zone(isolate->allocator());
Graph graph(&zone); Graph graph(&zone);
CommonOperatorBuilder common(&zone); CommonOperatorBuilder common(&zone);
JSOperatorBuilder javascript(&zone); JSOperatorBuilder javascript(&zone);
@ -2709,7 +2709,7 @@ Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate,
} }
// Create a TF graph during decoding. // Create a TF graph during decoding.
Zone zone; Zone zone(isolate->allocator());
Graph graph(&zone); Graph graph(&zone);
CommonOperatorBuilder common(&zone); CommonOperatorBuilder common(&zone);
MachineOperatorBuilder machine( MachineOperatorBuilder machine(
@ -2721,7 +2721,8 @@ Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate,
module_env, function.sig, module_env->module->module_start, module_env, function.sig, module_env->module->module_start,
module_env->module->module_start + function.code_start_offset, module_env->module->module_start + function.code_start_offset,
module_env->module->module_start + function.code_end_offset}; module_env->module->module_start + function.code_end_offset};
wasm::TreeResult result = wasm::BuildTFGraph(&builder, body); wasm::TreeResult result =
wasm::BuildTFGraph(isolate->allocator(), &builder, body);
if (result.failed()) { if (result.failed()) {
if (FLAG_trace_wasm_compiler) { if (FLAG_trace_wasm_compiler) {
@ -2740,7 +2741,7 @@ Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate,
int index = static_cast<int>(function.func_index); int index = static_cast<int>(function.func_index);
if (index >= FLAG_trace_wasm_ast_start && index < FLAG_trace_wasm_ast_end) { if (index >= FLAG_trace_wasm_ast_start && index < FLAG_trace_wasm_ast_end) {
PrintAst(body); PrintAst(isolate->allocator(), body);
} }
if (FLAG_trace_wasm_decode_time) { if (FLAG_trace_wasm_decode_time) {

View File

@ -64,9 +64,8 @@ void ZonePool::StatsScope::ZoneReturned(Zone* zone) {
} }
} }
ZonePool::ZonePool(base::AccountingAllocator* allocator)
ZonePool::ZonePool() : max_allocated_bytes_(0), total_deleted_bytes_(0) {} : max_allocated_bytes_(0), total_deleted_bytes_(0), allocator_(allocator) {}
ZonePool::~ZonePool() { ZonePool::~ZonePool() {
DCHECK(used_.empty()); DCHECK(used_.empty());
@ -103,7 +102,7 @@ Zone* ZonePool::NewEmptyZone() {
zone = unused_.back(); zone = unused_.back();
unused_.pop_back(); unused_.pop_back();
} else { } else {
zone = new Zone(); zone = new Zone(allocator_);
} }
used_.push_back(zone); used_.push_back(zone);
DCHECK_EQ(0u, zone->allocation_size()); DCHECK_EQ(0u, zone->allocation_size());

View File

@ -61,7 +61,7 @@ class ZonePool final {
DISALLOW_COPY_AND_ASSIGN(StatsScope); DISALLOW_COPY_AND_ASSIGN(StatsScope);
}; };
ZonePool(); explicit ZonePool(base::AccountingAllocator* allocator);
~ZonePool(); ~ZonePool();
size_t GetMaxAllocatedBytes(); size_t GetMaxAllocatedBytes();
@ -82,6 +82,7 @@ class ZonePool final {
Stats stats_; Stats stats_;
size_t max_allocated_bytes_; size_t max_allocated_bytes_;
size_t total_deleted_bytes_; size_t total_deleted_bytes_;
base::AccountingAllocator* allocator_;
DISALLOW_COPY_AND_ASSIGN(ZonePool); DISALLOW_COPY_AND_ASSIGN(ZonePool);
}; };

View File

@ -11,7 +11,7 @@ namespace v8 {
namespace internal { namespace internal {
CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info) CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info)
: name_(name), info_(info) { : name_(name), info_(info), zone_(info->isolate()->allocator()) {
if (FLAG_hydrogen_stats) { if (FLAG_hydrogen_stats) {
info_zone_start_allocation_size_ = info->zone()->allocation_size(); info_zone_start_allocation_size_ = info->zone()->allocation_size();
timer_.Start(); timer_.Start();

View File

@ -510,9 +510,9 @@ LifetimePosition LiveRange::FirstIntersection(LiveRange* other) {
return LifetimePosition::Invalid(); return LifetimePosition::Invalid();
} }
LAllocator::LAllocator(int num_values, HGraph* graph) LAllocator::LAllocator(int num_values, HGraph* graph)
: chunk_(NULL), : zone_(graph->isolate()->allocator()),
chunk_(NULL),
live_in_sets_(graph->blocks()->length(), zone()), live_in_sets_(graph->blocks()->length(), zone()),
live_ranges_(num_values * 2, zone()), live_ranges_(num_values * 2, zone()),
fixed_live_ranges_(NULL), fixed_live_ranges_(NULL),
@ -529,7 +529,6 @@ LAllocator::LAllocator(int num_values, HGraph* graph)
has_osr_entry_(false), has_osr_entry_(false),
allocation_ok_(true) {} allocation_ok_(true) {}
void LAllocator::InitializeLivenessAnalysis() { void LAllocator::InitializeLivenessAnalysis() {
// Initialize the live_in sets for each block to NULL. // Initialize the live_in sets for each block to NULL.
int block_count = graph_->blocks()->length(); int block_count = graph_->blocks()->length();

View File

@ -82,7 +82,7 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector,
// Reparse the code and analyze the scopes. // Reparse the code and analyze the scopes.
Scope* scope = NULL; Scope* scope = NULL;
// Check whether we are in global, eval or function code. // Check whether we are in global, eval or function code.
Zone zone; Zone zone(isolate->allocator());
if (scope_info->scope_type() != FUNCTION_SCOPE) { if (scope_info->scope_type() != FUNCTION_SCOPE) {
// Global or eval code. // Global or eval code.
Handle<Script> script(Script::cast(shared_info->script())); Handle<Script> script(Script::cast(shared_info->script()));

View File

@ -1700,7 +1700,7 @@ static const char* DropActivationsInActiveThreadImpl(Isolate* isolate,
TARGET& target, // NOLINT TARGET& target, // NOLINT
bool do_drop) { bool do_drop) {
Debug* debug = isolate->debug(); Debug* debug = isolate->debug();
Zone zone; Zone zone(isolate->allocator());
Vector<StackFrame*> frames = CreateStackMap(isolate, &zone); Vector<StackFrame*> frames = CreateStackMap(isolate, &zone);

View File

@ -307,7 +307,7 @@ void Deoptimizer::DeoptimizeMarkedCodeForContext(Context* context) {
// Move marked code from the optimized code list to the deoptimized // Move marked code from the optimized code list to the deoptimized
// code list, collecting them into a ZoneList. // code list, collecting them into a ZoneList.
Zone zone; Zone zone(isolate->allocator());
ZoneList<Code*> codes(10, &zone); ZoneList<Code*> codes(10, &zone);
// Walk over all optimized code objects in this native context. // Walk over all optimized code objects in this native context.

View File

@ -17,7 +17,7 @@ namespace v8 {
namespace internal { namespace internal {
FastAccessorAssembler::FastAccessorAssembler(Isolate* isolate) FastAccessorAssembler::FastAccessorAssembler(Isolate* isolate)
: zone_(), : zone_(isolate->allocator()),
isolate_(isolate), isolate_(isolate),
assembler_(new CodeStubAssembler(isolate, zone(), 1, assembler_(new CodeStubAssembler(isolate, zone(), 1,
Code::ComputeFlags(Code::STUB), Code::ComputeFlags(Code::STUB),

View File

@ -1941,7 +1941,7 @@ static void UnregisterCodeEntry(JITCodeEntry* entry) {
static JITCodeEntry* CreateELFObject(CodeDescription* desc, Isolate* isolate) { static JITCodeEntry* CreateELFObject(CodeDescription* desc, Isolate* isolate) {
#ifdef __MACH_O #ifdef __MACH_O
Zone zone; Zone zone(isolate->allocator());
MachO mach_o(&zone); MachO mach_o(&zone);
Writer w(&mach_o); Writer w(&mach_o);
@ -1953,7 +1953,7 @@ static JITCodeEntry* CreateELFObject(CodeDescription* desc, Isolate* isolate) {
mach_o.Write(&w, desc->CodeStart(), desc->CodeSize()); mach_o.Write(&w, desc->CodeStart(), desc->CodeSize());
#else #else
Zone zone; Zone zone(isolate->allocator());
ELF elf(&zone); ELF elf(&zone);
Writer w(&elf); Writer w(&elf);

View File

@ -118,9 +118,8 @@ Address HandleScope::current_limit_address(Isolate* isolate) {
return reinterpret_cast<Address>(&isolate->handle_scope_data()->limit); return reinterpret_cast<Address>(&isolate->handle_scope_data()->limit);
} }
CanonicalHandleScope::CanonicalHandleScope(Isolate* isolate) CanonicalHandleScope::CanonicalHandleScope(Isolate* isolate)
: isolate_(isolate) { : isolate_(isolate), zone_(isolate->allocator()) {
HandleScopeData* handle_scope_data = isolate_->handle_scope_data(); HandleScopeData* handle_scope_data = isolate_->handle_scope_data();
prev_canonical_scope_ = handle_scope_data->canonical_scope; prev_canonical_scope_ = handle_scope_data->canonical_scope;
handle_scope_data->canonical_scope = this; handle_scope_data->canonical_scope = this;

View File

@ -30,7 +30,7 @@ Interpreter::Interpreter(Isolate* isolate) : isolate_(isolate) {
void Interpreter::Initialize() { void Interpreter::Initialize() {
DCHECK(FLAG_ignition); DCHECK(FLAG_ignition);
if (IsDispatchTableInitialized()) return; if (IsDispatchTableInitialized()) return;
Zone zone; Zone zone(isolate_->allocator());
HandleScope scope(isolate_); HandleScope scope(isolate_);
// Generate bytecode handlers for all bytecodes and scales. // Generate bytecode handlers for all bytecodes and scales.

View File

@ -1816,6 +1816,8 @@ Isolate::Isolate(bool enable_serializer)
descriptor_lookup_cache_(NULL), descriptor_lookup_cache_(NULL),
handle_scope_implementer_(NULL), handle_scope_implementer_(NULL),
unicode_cache_(NULL), unicode_cache_(NULL),
runtime_zone_(&allocator_),
interface_descriptor_zone_(&allocator_),
inner_pointer_to_code_cache_(NULL), inner_pointer_to_code_cache_(NULL),
global_handles_(NULL), global_handles_(NULL),
eternal_handles_(NULL), eternal_handles_(NULL),

View File

@ -11,6 +11,7 @@
#include "include/v8-debug.h" #include "include/v8-debug.h"
#include "src/allocation.h" #include "src/allocation.h"
#include "src/assert-scope.h" #include "src/assert-scope.h"
#include "src/base/accounting-allocator.h"
#include "src/base/atomicops.h" #include "src/base/atomicops.h"
#include "src/builtins.h" #include "src/builtins.h"
#include "src/cancelable-task.h" #include "src/cancelable-task.h"
@ -26,8 +27,8 @@
#include "src/messages.h" #include "src/messages.h"
#include "src/optimizing-compile-dispatcher.h" #include "src/optimizing-compile-dispatcher.h"
#include "src/regexp/regexp-stack.h" #include "src/regexp/regexp-stack.h"
#include "src/runtime/runtime.h"
#include "src/runtime-profiler.h" #include "src/runtime-profiler.h"
#include "src/runtime/runtime.h"
#include "src/zone.h" #include "src/zone.h"
namespace v8 { namespace v8 {
@ -1118,6 +1119,8 @@ class Isolate {
interpreter::Interpreter* interpreter() const { return interpreter_; } interpreter::Interpreter* interpreter() const { return interpreter_; }
base::AccountingAllocator* allocator() { return &allocator_; }
protected: protected:
explicit Isolate(bool enable_serializer); explicit Isolate(bool enable_serializer);
@ -1258,6 +1261,7 @@ class Isolate {
HandleScopeData handle_scope_data_; HandleScopeData handle_scope_data_;
HandleScopeImplementer* handle_scope_implementer_; HandleScopeImplementer* handle_scope_implementer_;
UnicodeCache* unicode_cache_; UnicodeCache* unicode_cache_;
base::AccountingAllocator allocator_;
Zone runtime_zone_; Zone runtime_zone_;
Zone interface_descriptor_zone_; Zone interface_descriptor_zone_;
InnerPointerToCodeCache* inner_pointer_to_code_cache_; InnerPointerToCodeCache* inner_pointer_to_code_cache_;

View File

@ -37,6 +37,7 @@ class JsonParser BASE_EMBEDDED {
source_length_(source->length()), source_length_(source->length()),
isolate_(source->map()->GetHeap()->isolate()), isolate_(source->map()->GetHeap()->isolate()),
factory_(isolate_->factory()), factory_(isolate_->factory()),
zone_(isolate_->allocator()),
object_constructor_(isolate_->native_context()->object_function(), object_constructor_(isolate_->native_context()->object_function(),
isolate_), isolate_),
position_(-1) { position_(-1) {

View File

@ -8647,7 +8647,7 @@ Maybe<bool> JSProxy::OwnPropertyKeys(Isolate* isolate,
return accumulator->AddKeysFromProxy(proxy, trap_result); return accumulator->AddKeysFromProxy(proxy, trap_result);
} }
// 16. Let uncheckedResultKeys be a new List which is a copy of trapResult. // 16. Let uncheckedResultKeys be a new List which is a copy of trapResult.
Zone set_zone; Zone set_zone(isolate->allocator());
const int kPresent = 1; const int kPresent = 1;
const int kGone = 0; const int kGone = 0;
IdentityMap<int> unchecked_result_keys(isolate->heap(), &set_zone); IdentityMap<int> unchecked_result_keys(isolate->heap(), &set_zone);

View File

@ -4218,7 +4218,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
// temp_zone is deallocated. These objects are instead allocated in a // temp_zone is deallocated. These objects are instead allocated in a
// parser-persistent zone (see parser_zone_ in AstNodeFactory). // parser-persistent zone (see parser_zone_ in AstNodeFactory).
{ {
Zone temp_zone; Zone temp_zone(zone()->allocator());
AstNodeFactory::BodyScope inner(factory(), &temp_zone, use_temp_zone); AstNodeFactory::BodyScope inner(factory(), &temp_zone, use_temp_zone);
body = ParseEagerFunctionBody(function_name, pos, formals, kind, body = ParseEagerFunctionBody(function_name, pos, formals, kind,

View File

@ -135,7 +135,7 @@ MaybeHandle<Object> RegExpImpl::Compile(Handle<JSRegExp> re,
Handle<String> pattern, Handle<String> pattern,
JSRegExp::Flags flags) { JSRegExp::Flags flags) {
Isolate* isolate = re->GetIsolate(); Isolate* isolate = re->GetIsolate();
Zone zone; Zone zone(isolate->allocator());
CompilationCache* compilation_cache = isolate->compilation_cache(); CompilationCache* compilation_cache = isolate->compilation_cache();
MaybeHandle<FixedArray> maybe_cached = MaybeHandle<FixedArray> maybe_cached =
compilation_cache->LookupRegExp(pattern, flags); compilation_cache->LookupRegExp(pattern, flags);
@ -346,7 +346,7 @@ bool RegExpImpl::CompileIrregexp(Handle<JSRegExp> re,
bool is_one_byte) { bool is_one_byte) {
// Compile the RegExp. // Compile the RegExp.
Isolate* isolate = re->GetIsolate(); Isolate* isolate = re->GetIsolate();
Zone zone; Zone zone(isolate->allocator());
PostponeInterruptsScope postpone(isolate); PostponeInterruptsScope postpone(isolate);
// If we had a compilation error the last time this is saved at the // If we had a compilation error the last time this is saved at the
// saved code index. // saved code index.

View File

@ -386,7 +386,7 @@ bool ComputeLocation(Isolate* isolate, MessageLocation* target) {
Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) { Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) {
MessageLocation location; MessageLocation location;
if (ComputeLocation(isolate, &location)) { if (ComputeLocation(isolate, &location)) {
Zone zone; Zone zone(isolate->allocator());
base::SmartPointer<ParseInfo> info( base::SmartPointer<ParseInfo> info(
location.function()->shared()->is_function() location.function()->shared()->is_function()
? new ParseInfo(&zone, location.function()) ? new ParseInfo(&zone, location.function())

View File

@ -13,12 +13,13 @@ namespace internal {
class TypeCache final { class TypeCache final {
private: private:
// This has to be first for the initialization magic to work. // This has to be first for the initialization magic to work.
base::AccountingAllocator allocator;
Zone zone_; Zone zone_;
public: public:
static TypeCache const& Get(); static TypeCache const& Get();
TypeCache() = default; TypeCache() : zone_(&allocator) {}
Type* const kInt8 = Type* const kInt8 =
CreateNative(CreateRange<int8_t>(), Type::UntaggedIntegral8()); CreateNative(CreateRange<int8_t>(), Type::UntaggedIntegral8());

View File

@ -1626,23 +1626,25 @@ class SR_WasmDecoder : public WasmDecoder {
} }
}; };
std::vector<LocalType>* DecodeLocalDeclsForTesting(const byte* start, std::vector<LocalType>* DecodeLocalDeclsForTesting(
const byte* end) { base::AccountingAllocator* allocator, const byte* start, const byte* end) {
Zone zone; Zone zone(allocator);
FunctionBody body = {nullptr, nullptr, nullptr, start, end}; FunctionBody body = {nullptr, nullptr, nullptr, start, end};
SR_WasmDecoder decoder(&zone, nullptr, body); SR_WasmDecoder decoder(&zone, nullptr, body);
return decoder.DecodeLocalDeclsForTesting(); return decoder.DecodeLocalDeclsForTesting();
} }
TreeResult VerifyWasmCode(FunctionBody& body) { TreeResult VerifyWasmCode(base::AccountingAllocator* allocator,
Zone zone; FunctionBody& body) {
Zone zone(allocator);
SR_WasmDecoder decoder(&zone, nullptr, body); SR_WasmDecoder decoder(&zone, nullptr, body);
TreeResult result = decoder.Decode(); TreeResult result = decoder.Decode();
return result; return result;
} }
TreeResult BuildTFGraph(TFBuilder* builder, FunctionBody& body) { TreeResult BuildTFGraph(base::AccountingAllocator* allocator,
Zone zone; TFBuilder* builder, FunctionBody& body) {
Zone zone(allocator);
SR_WasmDecoder decoder(&zone, builder, body); SR_WasmDecoder decoder(&zone, builder, body);
TreeResult result = decoder.Decode(); TreeResult result = decoder.Decode();
return result; return result;
@ -1686,8 +1688,8 @@ int OpcodeArity(ModuleEnv* module, FunctionSig* sig, const byte* pc,
return decoder.OpcodeArity(pc); return decoder.OpcodeArity(pc);
} }
void PrintAst(FunctionBody& body) { void PrintAst(base::AccountingAllocator* allocator, FunctionBody& body) {
Zone zone; Zone zone(allocator);
SR_WasmDecoder decoder(&zone, nullptr, body); SR_WasmDecoder decoder(&zone, nullptr, body);
OFStream os(stdout); OFStream os(stdout);

View File

@ -194,21 +194,25 @@ typedef Result<Tree*> TreeResult;
std::ostream& operator<<(std::ostream& os, const Tree& tree); std::ostream& operator<<(std::ostream& os, const Tree& tree);
TreeResult VerifyWasmCode(FunctionBody& body); TreeResult VerifyWasmCode(base::AccountingAllocator* allocator,
TreeResult BuildTFGraph(TFBuilder* builder, FunctionBody& body); FunctionBody& body);
void PrintAst(FunctionBody& body); TreeResult BuildTFGraph(base::AccountingAllocator* allocator,
TFBuilder* builder, FunctionBody& body);
void PrintAst(base::AccountingAllocator* allocator, FunctionBody& body);
inline TreeResult VerifyWasmCode(ModuleEnv* module, FunctionSig* sig, inline TreeResult VerifyWasmCode(base::AccountingAllocator* allocator,
ModuleEnv* module, FunctionSig* sig,
const byte* start, const byte* end) { const byte* start, const byte* end) {
FunctionBody body = {module, sig, nullptr, start, end}; FunctionBody body = {module, sig, nullptr, start, end};
return VerifyWasmCode(body); return VerifyWasmCode(allocator, body);
} }
inline TreeResult BuildTFGraph(TFBuilder* builder, ModuleEnv* module, inline TreeResult BuildTFGraph(base::AccountingAllocator* allocator,
TFBuilder* builder, ModuleEnv* module,
FunctionSig* sig, const byte* start, FunctionSig* sig, const byte* start,
const byte* end) { const byte* end) {
FunctionBody body = {module, sig, nullptr, start, end}; FunctionBody body = {module, sig, nullptr, start, end};
return BuildTFGraph(builder, body); return BuildTFGraph(allocator, builder, body);
} }
enum ReadUnsignedLEB128ErrorCode { kNoError, kInvalidLEB128, kMissingLEB128 }; enum ReadUnsignedLEB128ErrorCode { kNoError, kInvalidLEB128, kMissingLEB128 };
@ -216,8 +220,8 @@ enum ReadUnsignedLEB128ErrorCode { kNoError, kInvalidLEB128, kMissingLEB128 };
ReadUnsignedLEB128ErrorCode ReadUnsignedLEB128Operand(const byte*, const byte*, ReadUnsignedLEB128ErrorCode ReadUnsignedLEB128Operand(const byte*, const byte*,
int*, uint32_t*); int*, uint32_t*);
std::vector<LocalType>* DecodeLocalDeclsForTesting(const byte* start, std::vector<LocalType>* DecodeLocalDeclsForTesting(
const byte* end); base::AccountingAllocator* allocator, const byte* start, const byte* end);
BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals,
const byte* start, const byte* end); const byte* start, const byte* end);

View File

@ -575,7 +575,7 @@ class ModuleDecoder : public Decoder {
FunctionBody body = {menv, function->sig, start_, FunctionBody body = {menv, function->sig, start_,
start_ + function->code_start_offset, start_ + function->code_start_offset,
start_ + function->code_end_offset}; start_ + function->code_end_offset};
TreeResult result = VerifyWasmCode(body); TreeResult result = VerifyWasmCode(module_zone->allocator(), body);
if (result.failed()) { if (result.failed()) {
// Wrap the error message from the function decoder. // Wrap the error message from the function decoder.
std::ostringstream str; std::ostringstream str;

View File

@ -86,7 +86,7 @@ void VerifyModule(const v8::FunctionCallbackInfo<v8::Value>& args) {
RawBuffer buffer = GetRawBufferArgument(thrower, args); RawBuffer buffer = GetRawBufferArgument(thrower, args);
if (thrower.error()) return; if (thrower.error()) return;
i::Zone zone; i::Zone zone(isolate->allocator());
internal::wasm::ModuleResult result = internal::wasm::ModuleResult result =
internal::wasm::DecodeWasmModule(isolate, &zone, buffer.start, buffer.end, internal::wasm::DecodeWasmModule(isolate, &zone, buffer.start, buffer.end,
true, internal::wasm::kWasmOrigin); true, internal::wasm::kWasmOrigin);
@ -111,7 +111,7 @@ void VerifyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) {
{ {
// Verification of a single function shouldn't allocate. // Verification of a single function shouldn't allocate.
i::DisallowHeapAllocation no_allocation; i::DisallowHeapAllocation no_allocation;
i::Zone zone; i::Zone zone(isolate->allocator());
result = internal::wasm::DecodeWasmFunction(isolate, &zone, nullptr, result = internal::wasm::DecodeWasmFunction(isolate, &zone, nullptr,
buffer.start, buffer.end); buffer.start, buffer.end);
} }
@ -170,7 +170,7 @@ void InstantiateModuleCommon(const v8::FunctionCallbackInfo<v8::Value>& args,
// Decode but avoid a redundant pass over function bodies for verification. // Decode but avoid a redundant pass over function bodies for verification.
// Verification will happen during compilation. // Verification will happen during compilation.
i::Zone zone; i::Zone zone(isolate->allocator());
internal::wasm::ModuleResult result = internal::wasm::DecodeWasmModule( internal::wasm::ModuleResult result = internal::wasm::DecodeWasmModule(
isolate, &zone, start, end, false, origin); isolate, &zone, start, end, false, origin);
@ -209,7 +209,7 @@ void InstantiateModuleFromAsm(const v8::FunctionCallbackInfo<v8::Value>& args) {
} }
i::Factory* factory = isolate->factory(); i::Factory* factory = isolate->factory();
i::Zone zone; i::Zone zone(isolate->allocator());
Local<String> source = Local<String>::Cast(args[0]); Local<String> source = Local<String>::Cast(args[0]);
i::Handle<i::Script> script = factory->NewScript(Utils::OpenHandle(*source)); i::Handle<i::Script> script = factory->NewScript(Utils::OpenHandle(*source));
i::ParseInfo info(&zone, script); i::ParseInfo info(&zone, script);

View File

@ -589,7 +589,7 @@ compiler::CallDescriptor* ModuleEnv::GetCallDescriptor(Zone* zone,
int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
const byte* module_end, bool asm_js) { const byte* module_end, bool asm_js) {
HandleScope scope(isolate); HandleScope scope(isolate);
Zone zone; Zone zone(isolate->allocator());
// Decode the module, but don't verify function bodies, since we'll // Decode the module, but don't verify function bodies, since we'll
// be compiling them anyway. // be compiling them anyway.
ModuleResult result = DecodeWasmModule(isolate, &zone, module_start, ModuleResult result = DecodeWasmModule(isolate, &zone, module_start,

View File

@ -72,15 +72,14 @@ class Segment {
size_t size_; size_t size_;
}; };
Zone::Zone(base::AccountingAllocator* allocator)
Zone::Zone()
: allocation_size_(0), : allocation_size_(0),
segment_bytes_allocated_(0), segment_bytes_allocated_(0),
position_(0), position_(0),
limit_(0), limit_(0),
allocator_(allocator),
segment_head_(nullptr) {} segment_head_(nullptr) {}
Zone::~Zone() { Zone::~Zone() {
DeleteAll(); DeleteAll();
DeleteKeptSegment(); DeleteKeptSegment();
@ -201,7 +200,7 @@ void Zone::DeleteKeptSegment() {
// Creates a new segment, sets it size, and pushes it to the front // Creates a new segment, sets it size, and pushes it to the front
// of the segment chain. Returns the new segment. // of the segment chain. Returns the new segment.
Segment* Zone::NewSegment(size_t size) { Segment* Zone::NewSegment(size_t size) {
Segment* result = reinterpret_cast<Segment*>(Malloced::New(size)); Segment* result = reinterpret_cast<Segment*>(allocator_->Allocate(size));
segment_bytes_allocated_ += size; segment_bytes_allocated_ += size;
if (result != nullptr) { if (result != nullptr) {
result->Initialize(segment_head_, size); result->Initialize(segment_head_, size);
@ -214,7 +213,7 @@ Segment* Zone::NewSegment(size_t size) {
// Deletes the given segment. Does not touch the segment chain. // Deletes the given segment. Does not touch the segment chain.
void Zone::DeleteSegment(Segment* segment, size_t size) { void Zone::DeleteSegment(Segment* segment, size_t size) {
segment_bytes_allocated_ -= size; segment_bytes_allocated_ -= size;
Malloced::Delete(segment); allocator_->Free(segment, size);
} }

View File

@ -7,7 +7,7 @@
#include <limits> #include <limits>
#include "src/allocation.h" #include "src/base/accounting-allocator.h"
#include "src/base/logging.h" #include "src/base/logging.h"
#include "src/globals.h" #include "src/globals.h"
#include "src/hashmap.h" #include "src/hashmap.h"
@ -35,7 +35,7 @@ class Segment;
// from multi-threaded code. // from multi-threaded code.
class Zone final { class Zone final {
public: public:
Zone(); explicit Zone(base::AccountingAllocator* allocator);
~Zone(); ~Zone();
// Allocate 'size' bytes of memory in the Zone; expands the Zone by // Allocate 'size' bytes of memory in the Zone; expands the Zone by
@ -64,6 +64,8 @@ class Zone final {
size_t allocation_size() const { return allocation_size_; } size_t allocation_size() const { return allocation_size_; }
base::AccountingAllocator* allocator() const { return allocator_; }
private: private:
// All pointers returned from New() have this alignment. In addition, if the // All pointers returned from New() have this alignment. In addition, if the
// object being allocated has a size that is divisible by 8 then its alignment // object being allocated has a size that is divisible by 8 then its alignment
@ -114,6 +116,8 @@ class Zone final {
Address position_; Address position_;
Address limit_; Address limit_;
base::AccountingAllocator* allocator_;
Segment* segment_head_; Segment* segment_head_;
}; };

View File

@ -585,12 +585,13 @@ class InitializedHandleScope {
class HandleAndZoneScope : public InitializedHandleScope { class HandleAndZoneScope : public InitializedHandleScope {
public: public:
HandleAndZoneScope() {} HandleAndZoneScope() : main_zone_(&allocator_) {}
// Prefixing the below with main_ reduces a lot of naming clashes. // Prefixing the below with main_ reduces a lot of naming clashes.
i::Zone* main_zone() { return &main_zone_; } i::Zone* main_zone() { return &main_zone_; }
private: private:
v8::base::AccountingAllocator allocator_;
i::Zone main_zone_; i::Zone main_zone_;
}; };

View File

@ -175,7 +175,7 @@ class FunctionTester : public InitializedHandleScope {
uint32_t flags_; uint32_t flags_;
Handle<JSFunction> Compile(Handle<JSFunction> function) { Handle<JSFunction> Compile(Handle<JSFunction> function) {
Zone zone; Zone zone(function->GetIsolate()->allocator());
ParseInfo parse_info(&zone, function); ParseInfo parse_info(&zone, function);
CompilationInfo info(&parse_info); CompilationInfo info(&parse_info);
info.MarkAsDeoptimizationEnabled(); info.MarkAsDeoptimizationEnabled();
@ -224,7 +224,7 @@ class FunctionTester : public InitializedHandleScope {
// Compile the given machine graph instead of the source of the function // Compile the given machine graph instead of the source of the function
// and replace the JSFunction's code with the result. // and replace the JSFunction's code with the result.
Handle<JSFunction> CompileGraph(Graph* graph) { Handle<JSFunction> CompileGraph(Graph* graph) {
Zone zone; Zone zone(function->GetIsolate()->allocator());
ParseInfo parse_info(&zone, function); ParseInfo parse_info(&zone, function);
CompilationInfo info(&parse_info); CompilationInfo info(&parse_info);

View File

@ -268,7 +268,8 @@ TEST(InstructionAddGapMove) {
TEST(InstructionOperands) { TEST(InstructionOperands) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
{ {
TestInstr* i = TestInstr::New(&zone, 101); TestInstr* i = TestInstr::New(&zone, 101);

View File

@ -106,7 +106,8 @@ class TestCode : public HandleAndZoneScope {
void VerifyForwarding(TestCode& code, int count, int* expected) { void VerifyForwarding(TestCode& code, int count, int* expected) {
Zone local_zone; base::AccountingAllocator allocator;
Zone local_zone(&allocator);
ZoneVector<RpoNumber> result(&local_zone); ZoneVector<RpoNumber> result(&local_zone);
JumpThreading::ComputeForwarding(&local_zone, result, &code.sequence_, true); JumpThreading::ComputeForwarding(&local_zone, result, &code.sequence_, true);

View File

@ -96,7 +96,7 @@ TEST(TestLinkageRuntimeCall) {
TEST(TestLinkageStubCall) { TEST(TestLinkageStubCall) {
Isolate* isolate = CcTest::InitIsolateOnce(); Isolate* isolate = CcTest::InitIsolateOnce();
Zone zone; Zone zone(isolate->allocator());
ToNumberStub stub(isolate); ToNumberStub stub(isolate);
CompilationInfo info("test", isolate, &zone, Code::ComputeFlags(Code::STUB)); CompilationInfo info("test", isolate, &zone, Code::ComputeFlags(Code::STUB));
CallInterfaceDescriptor interface_descriptor = CallInterfaceDescriptor interface_descriptor =

View File

@ -127,7 +127,7 @@ class LoopFinderTester : HandleAndZoneScope {
OFStream os(stdout); OFStream os(stdout);
os << AsRPO(graph); os << AsRPO(graph);
} }
Zone zone; Zone zone(main_isolate()->allocator());
loop_tree = LoopFinder::BuildLoopTree(&graph, &zone); loop_tree = LoopFinder::BuildLoopTree(&graph, &zone);
} }
return loop_tree; return loop_tree;

View File

@ -69,7 +69,8 @@ CallDescriptor* GetCallDescriptor(Zone* zone, int return_count,
TEST(ReturnThreeValues) { TEST(ReturnThreeValues) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
CallDescriptor* desc = GetCallDescriptor(&zone, 3, 2); CallDescriptor* desc = GetCallDescriptor(&zone, 3, 2);
HandleAndZoneScope handles; HandleAndZoneScope handles;
RawMachineAssembler m(handles.main_isolate(), RawMachineAssembler m(handles.main_isolate(),

View File

@ -141,7 +141,8 @@ void CheckInputs(Node* node, Node** inputs, int input_count) {
TEST(NodeUseIteratorReplaceUses) { TEST(NodeUseIteratorReplaceUses) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0); Node* n0 = graph.NewNode(&dummy_operator0);
Node* n1 = graph.NewNode(&dummy_operator1, n0); Node* n1 = graph.NewNode(&dummy_operator1, n0);
@ -166,7 +167,8 @@ TEST(NodeUseIteratorReplaceUses) {
TEST(NodeUseIteratorReplaceUsesSelf) { TEST(NodeUseIteratorReplaceUsesSelf) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0); Node* n0 = graph.NewNode(&dummy_operator0);
Node* n1 = graph.NewNode(&dummy_operator1, n0); Node* n1 = graph.NewNode(&dummy_operator1, n0);
@ -190,7 +192,8 @@ TEST(NodeUseIteratorReplaceUsesSelf) {
TEST(ReplaceInput) { TEST(ReplaceInput) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0); Node* n0 = graph.NewNode(&dummy_operator0);
Node* n1 = graph.NewNode(&dummy_operator0); Node* n1 = graph.NewNode(&dummy_operator0);
@ -216,7 +219,8 @@ TEST(ReplaceInput) {
TEST(OwnedBy) { TEST(OwnedBy) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
{ {
@ -266,7 +270,8 @@ TEST(OwnedBy) {
TEST(Uses) { TEST(Uses) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0); Node* n0 = graph.NewNode(&dummy_operator0);
@ -288,7 +293,8 @@ TEST(Uses) {
TEST(Inputs) { TEST(Inputs) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0); Node* n0 = graph.NewNode(&dummy_operator0);
@ -316,7 +322,8 @@ TEST(Inputs) {
TEST(RemoveInput) { TEST(RemoveInput) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0); Node* n0 = graph.NewNode(&dummy_operator0);
@ -346,7 +353,8 @@ TEST(RemoveInput) {
TEST(AppendInputsAndIterator) { TEST(AppendInputsAndIterator) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0); Node* n0 = graph.NewNode(&dummy_operator0);
@ -368,7 +376,8 @@ TEST(AppendInputsAndIterator) {
TEST(NullInputsSimple) { TEST(NullInputsSimple) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0); Node* n0 = graph.NewNode(&dummy_operator0);
@ -395,7 +404,8 @@ TEST(NullInputsSimple) {
TEST(NullInputsAppended) { TEST(NullInputsAppended) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0); Node* n0 = graph.NewNode(&dummy_operator0);
@ -418,7 +428,8 @@ TEST(NullInputsAppended) {
TEST(ReplaceUsesFromAppendedInputs) { TEST(ReplaceUsesFromAppendedInputs) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0); Node* n0 = graph.NewNode(&dummy_operator0);
@ -446,7 +457,8 @@ TEST(ReplaceUsesFromAppendedInputs) {
TEST(ReplaceInputMultipleUses) { TEST(ReplaceInputMultipleUses) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0); Node* n0 = graph.NewNode(&dummy_operator0);
@ -464,7 +476,8 @@ TEST(ReplaceInputMultipleUses) {
TEST(TrimInputCountInline) { TEST(TrimInputCountInline) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
{ {
@ -532,7 +545,8 @@ TEST(TrimInputCountInline) {
TEST(TrimInputCountOutOfLine1) { TEST(TrimInputCountOutOfLine1) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
{ {
@ -626,7 +640,8 @@ TEST(TrimInputCountOutOfLine1) {
TEST(TrimInputCountOutOfLine2) { TEST(TrimInputCountOutOfLine2) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
{ {
@ -695,7 +710,8 @@ TEST(TrimInputCountOutOfLine2) {
TEST(NullAllInputs) { TEST(NullAllInputs) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
@ -747,7 +763,8 @@ TEST(NullAllInputs) {
TEST(AppendAndTrim) { TEST(AppendAndTrim) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
Node* nodes[] = { Node* nodes[] = {

View File

@ -270,7 +270,7 @@ Handle<Code> CompileGraph(const char* name, CallDescriptor* desc, Graph* graph,
Handle<Code> WrapWithCFunction(Handle<Code> inner, CallDescriptor* desc) { Handle<Code> WrapWithCFunction(Handle<Code> inner, CallDescriptor* desc) {
Zone zone; Zone zone(inner->GetIsolate()->allocator());
MachineSignature* msig = MachineSignature* msig =
const_cast<MachineSignature*>(desc->GetMachineSignature()); const_cast<MachineSignature*>(desc->GetMachineSignature());
int param_count = static_cast<int>(msig->parameter_count()); int param_count = static_cast<int>(msig->parameter_count());
@ -437,7 +437,7 @@ class Computer {
Handle<Code> inner = Handle<Code>::null(); Handle<Code> inner = Handle<Code>::null();
{ {
// Build the graph for the computation. // Build the graph for the computation.
Zone zone; Zone zone(isolate->allocator());
Graph graph(&zone); Graph graph(&zone);
RawMachineAssembler raw(isolate, &graph, desc); RawMachineAssembler raw(isolate, &graph, desc);
build(desc, raw); build(desc, raw);
@ -452,7 +452,7 @@ class Computer {
Handle<Code> wrapper = Handle<Code>::null(); Handle<Code> wrapper = Handle<Code>::null();
{ {
// Wrap the above code with a callable function that passes constants. // Wrap the above code with a callable function that passes constants.
Zone zone; Zone zone(isolate->allocator());
Graph graph(&zone); Graph graph(&zone);
CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig); CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig);
RawMachineAssembler raw(isolate, &graph, cdesc); RawMachineAssembler raw(isolate, &graph, cdesc);
@ -484,7 +484,7 @@ class Computer {
Handle<Code> wrapper = Handle<Code>::null(); Handle<Code> wrapper = Handle<Code>::null();
{ {
// Wrap the above code with a callable function that loads from {input}. // Wrap the above code with a callable function that loads from {input}.
Zone zone; Zone zone(isolate->allocator());
Graph graph(&zone); Graph graph(&zone);
CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig); CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig);
RawMachineAssembler raw(isolate, &graph, cdesc); RawMachineAssembler raw(isolate, &graph, cdesc);
@ -522,7 +522,7 @@ class Computer {
static void TestInt32Sub(CallDescriptor* desc) { static void TestInt32Sub(CallDescriptor* desc) {
Isolate* isolate = CcTest::InitIsolateOnce(); Isolate* isolate = CcTest::InitIsolateOnce();
HandleScope scope(isolate); HandleScope scope(isolate);
Zone zone; Zone zone(isolate->allocator());
GraphAndBuilders inner(&zone); GraphAndBuilders inner(&zone);
{ {
// Build the add function. // Build the add function.
@ -563,7 +563,7 @@ static void CopyTwentyInt32(CallDescriptor* desc) {
Handle<Code> inner = Handle<Code>::null(); Handle<Code> inner = Handle<Code>::null();
{ {
// Writes all parameters into the output buffer. // Writes all parameters into the output buffer.
Zone zone; Zone zone(isolate->allocator());
Graph graph(&zone); Graph graph(&zone);
RawMachineAssembler raw(isolate, &graph, desc); RawMachineAssembler raw(isolate, &graph, desc);
Node* base = raw.PointerConstant(output); Node* base = raw.PointerConstant(output);
@ -580,7 +580,7 @@ static void CopyTwentyInt32(CallDescriptor* desc) {
Handle<Code> wrapper = Handle<Code>::null(); Handle<Code> wrapper = Handle<Code>::null();
{ {
// Loads parameters from the input buffer and calls the above code. // Loads parameters from the input buffer and calls the above code.
Zone zone; Zone zone(isolate->allocator());
Graph graph(&zone); Graph graph(&zone);
CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig); CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig);
RawMachineAssembler raw(isolate, &graph, cdesc); RawMachineAssembler raw(isolate, &graph, cdesc);
@ -619,7 +619,8 @@ static void CopyTwentyInt32(CallDescriptor* desc) {
static void Test_RunInt32SubWithRet(int retreg) { static void Test_RunInt32SubWithRet(int retreg) {
Int32Signature sig(2); Int32Signature sig(2);
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
RegisterPairs pairs; RegisterPairs pairs;
while (pairs.More()) { while (pairs.More()) {
int parray[2]; int parray[2];
@ -670,7 +671,8 @@ TEST(Run_Int32Sub_all_allocatable_single) {
Int32Signature sig(2); Int32Signature sig(2);
RegisterPairs pairs; RegisterPairs pairs;
while (pairs.More()) { while (pairs.More()) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
int parray[1]; int parray[1];
int rarray[1]; int rarray[1];
pairs.Next(&rarray[0], &parray[0], true); pairs.Next(&rarray[0], &parray[0], true);
@ -687,7 +689,8 @@ TEST(Run_CopyTwentyInt32_all_allocatable_pairs) {
Int32Signature sig(20); Int32Signature sig(20);
RegisterPairs pairs; RegisterPairs pairs;
while (pairs.More()) { while (pairs.More()) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
int parray[2]; int parray[2];
int rarray[] = { int rarray[] = {
RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN) RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
@ -739,7 +742,8 @@ static void Test_Int32_WeightedSum_of_size(int count) {
Int32Signature sig(count); Int32Signature sig(count);
for (int p0 = 0; p0 < Register::kNumRegisters; p0++) { for (int p0 = 0; p0 < Register::kNumRegisters; p0++) {
if (Register::from_code(p0).IsAllocatable()) { if (Register::from_code(p0).IsAllocatable()) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
int parray[] = {p0}; int parray[] = {p0};
int rarray[] = { int rarray[] = {
@ -807,7 +811,8 @@ void Test_Int32_Select() {
Allocator rets(rarray, 1, nullptr, 0); Allocator rets(rarray, 1, nullptr, 0);
RegisterConfig config(params, rets); RegisterConfig config(params, rets);
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
for (int i = which + 1; i <= 64; i++) { for (int i = which + 1; i <= 64; i++) {
Int32Signature sig(i); Int32Signature sig(i);
@ -849,7 +854,8 @@ TEST(Int64Select_registers) {
ArgsBuffer<int64_t>::Sig sig(2); ArgsBuffer<int64_t>::Sig sig(2);
RegisterPairs pairs; RegisterPairs pairs;
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
while (pairs.More()) { while (pairs.More()) {
int parray[2]; int parray[2];
pairs.Next(&parray[0], &parray[1], false); pairs.Next(&parray[0], &parray[1], false);
@ -876,7 +882,8 @@ TEST(Float32Select_registers) {
ArgsBuffer<float32>::Sig sig(2); ArgsBuffer<float32>::Sig sig(2);
Float32RegisterPairs pairs; Float32RegisterPairs pairs;
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
while (pairs.More()) { while (pairs.More()) {
int parray[2]; int parray[2];
pairs.Next(&parray[0], &parray[1], false); pairs.Next(&parray[0], &parray[1], false);
@ -904,7 +911,8 @@ TEST(Float64Select_registers) {
ArgsBuffer<float64>::Sig sig(2); ArgsBuffer<float64>::Sig sig(2);
Float64RegisterPairs pairs; Float64RegisterPairs pairs;
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
while (pairs.More()) { while (pairs.More()) {
int parray[2]; int parray[2];
pairs.Next(&parray[0], &parray[1], false); pairs.Next(&parray[0], &parray[1], false);
@ -927,7 +935,8 @@ TEST(Float32Select_stack_params_return_reg) {
Allocator rets(nullptr, 0, rarray, 1); Allocator rets(nullptr, 0, rarray, 1);
RegisterConfig config(params, rets); RegisterConfig config(params, rets);
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
for (int count = 1; count < 6; count++) { for (int count = 1; count < 6; count++) {
ArgsBuffer<float32>::Sig sig(count); ArgsBuffer<float32>::Sig sig(count);
CallDescriptor* desc = config.Create(&zone, &sig); CallDescriptor* desc = config.Create(&zone, &sig);
@ -949,7 +958,8 @@ TEST(Float64Select_stack_params_return_reg) {
Allocator rets(nullptr, 0, rarray, 1); Allocator rets(nullptr, 0, rarray, 1);
RegisterConfig config(params, rets); RegisterConfig config(params, rets);
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
for (int count = 1; count < 6; count++) { for (int count = 1; count < 6; count++) {
ArgsBuffer<float64>::Sig sig(count); ArgsBuffer<float64>::Sig sig(count);
CallDescriptor* desc = config.Create(&zone, &sig); CallDescriptor* desc = config.Create(&zone, &sig);
@ -972,7 +982,7 @@ static void Build_Select_With_Call(CallDescriptor* desc,
{ {
Isolate* isolate = CcTest::InitIsolateOnce(); Isolate* isolate = CcTest::InitIsolateOnce();
// Build the actual select. // Build the actual select.
Zone zone; Zone zone(isolate->allocator());
Graph graph(&zone); Graph graph(&zone);
RawMachineAssembler raw(isolate, &graph, desc); RawMachineAssembler raw(isolate, &graph, desc);
raw.Return(raw.Parameter(which)); raw.Return(raw.Parameter(which));
@ -1002,7 +1012,8 @@ TEST(Float64StackParamsToStackParams) {
Allocator params(nullptr, 0, nullptr, 0); Allocator params(nullptr, 0, nullptr, 0);
Allocator rets(nullptr, 0, rarray, 1); Allocator rets(nullptr, 0, rarray, 1);
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
ArgsBuffer<float64>::Sig sig(2); ArgsBuffer<float64>::Sig sig(2);
RegisterConfig config(params, rets); RegisterConfig config(params, rets);
CallDescriptor* desc = config.Create(&zone, &sig); CallDescriptor* desc = config.Create(&zone, &sig);
@ -1068,7 +1079,8 @@ void MixedParamTest(int start) {
RegisterConfig config(palloc, ralloc); RegisterConfig config(palloc, ralloc);
for (int which = 0; which < num_params; which++) { for (int which = 0; which < num_params; which++) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
HandleScope scope(isolate); HandleScope scope(isolate);
MachineSignature::Builder builder(&zone, 1, num_params); MachineSignature::Builder builder(&zone, 1, num_params);
builder.AddReturn(params[which]); builder.AddReturn(params[which]);
@ -1079,7 +1091,7 @@ void MixedParamTest(int start) {
Handle<Code> select; Handle<Code> select;
{ {
// build the select. // build the select.
Zone zone; Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
RawMachineAssembler raw(isolate, &graph, desc); RawMachineAssembler raw(isolate, &graph, desc);
raw.Return(raw.Parameter(which)); raw.Return(raw.Parameter(which));
@ -1096,7 +1108,7 @@ void MixedParamTest(int start) {
CSignature0<int32_t> csig; CSignature0<int32_t> csig;
{ {
// Wrap the select code with a callable function that passes constants. // Wrap the select code with a callable function that passes constants.
Zone zone; Zone zone(&allocator);
Graph graph(&zone); Graph graph(&zone);
CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig); CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig);
RawMachineAssembler raw(isolate, &graph, cdesc); RawMachineAssembler raw(isolate, &graph, cdesc);
@ -1189,7 +1201,7 @@ void TestStackSlot(MachineType slot_type, T expected) {
Allocator ralloc(rarray_gp, 1, rarray_fp, 1); Allocator ralloc(rarray_gp, 1, rarray_fp, 1);
RegisterConfig config(palloc, ralloc); RegisterConfig config(palloc, ralloc);
Zone zone; Zone zone(isolate->allocator());
HandleScope scope(isolate); HandleScope scope(isolate);
MachineSignature::Builder builder(&zone, 1, 12); MachineSignature::Builder builder(&zone, 1, 12);
builder.AddReturn(MachineType::Int32()); builder.AddReturn(MachineType::Int32());

View File

@ -578,7 +578,7 @@ TEST(InterpreterLoadNamedProperty) {
HandleAndZoneScope handles; HandleAndZoneScope handles;
i::Isolate* isolate = handles.main_isolate(); i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory(); i::Factory* factory = isolate->factory();
i::Zone zone; i::Zone zone(isolate->allocator());
i::FeedbackVectorSpec feedback_spec(&zone); i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); i::FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot();
@ -631,7 +631,7 @@ TEST(InterpreterLoadKeyedProperty) {
HandleAndZoneScope handles; HandleAndZoneScope handles;
i::Isolate* isolate = handles.main_isolate(); i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory(); i::Factory* factory = isolate->factory();
i::Zone zone; i::Zone zone(isolate->allocator());
i::FeedbackVectorSpec feedback_spec(&zone); i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddKeyedLoadICSlot(); i::FeedbackVectorSlot slot = feedback_spec.AddKeyedLoadICSlot();
@ -673,7 +673,7 @@ TEST(InterpreterStoreNamedProperty) {
HandleAndZoneScope handles; HandleAndZoneScope handles;
i::Isolate* isolate = handles.main_isolate(); i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory(); i::Factory* factory = isolate->factory();
i::Zone zone; i::Zone zone(isolate->allocator());
i::FeedbackVectorSpec feedback_spec(&zone); i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddStoreICSlot(); i::FeedbackVectorSlot slot = feedback_spec.AddStoreICSlot();
@ -732,7 +732,7 @@ TEST(InterpreterStoreKeyedProperty) {
HandleAndZoneScope handles; HandleAndZoneScope handles;
i::Isolate* isolate = handles.main_isolate(); i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory(); i::Factory* factory = isolate->factory();
i::Zone zone; i::Zone zone(isolate->allocator());
i::FeedbackVectorSpec feedback_spec(&zone); i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddKeyedStoreICSlot(); i::FeedbackVectorSlot slot = feedback_spec.AddKeyedStoreICSlot();
@ -779,7 +779,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) {
HandleAndZoneScope handles; HandleAndZoneScope handles;
i::Isolate* isolate = handles.main_isolate(); i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory(); i::Factory* factory = isolate->factory();
i::Zone zone; i::Zone zone(isolate->allocator());
i::FeedbackVectorSpec feedback_spec(&zone); i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); i::FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot();

View File

@ -38,7 +38,8 @@ TEST(List) {
List<AstNode*>* list = new List<AstNode*>(0); List<AstNode*>* list = new List<AstNode*>(0);
CHECK_EQ(0, list->length()); CHECK_EQ(0, list->length());
Zone zone; v8::base::AccountingAllocator allocator;
Zone zone(&allocator);
AstValueFactory value_factory(&zone, 0); AstValueFactory value_factory(&zone, 0);
AstNodeFactory factory(&value_factory); AstNodeFactory factory(&value_factory);
AstNode* node = factory.NewEmptyStatement(RelocInfo::kNoPosition); AstNode* node = factory.NewEmptyStatement(RelocInfo::kNoPosition);

View File

@ -35,7 +35,8 @@
using namespace v8::internal; using namespace v8::internal;
TEST(BitVector) { TEST(BitVector) {
Zone zone; v8::base::AccountingAllocator allocator;
Zone zone(&allocator);
{ {
BitVector v(15, &zone); BitVector v(15, &zone);
v.Add(1); v.Add(1);

View File

@ -574,7 +574,7 @@ static void TestGeneralizeRepresentation(
CHECK(map->is_stable()); CHECK(map->is_stable());
CHECK(expectations.Check(*map)); CHECK(expectations.Check(*map));
Zone zone; Zone zone(isolate->allocator());
if (is_detached_map) { if (is_detached_map) {
detach_point_map = Map::ReconfigureProperty( detach_point_map = Map::ReconfigureProperty(
@ -966,7 +966,7 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation(
CHECK(map2->is_stable()); CHECK(map2->is_stable());
CHECK(expectations2.Check(*map2)); CHECK(expectations2.Check(*map2));
Zone zone; Zone zone(isolate->allocator());
Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate);
CompilationInfo info("testing", isolate, &zone); CompilationInfo info("testing", isolate, &zone);
CHECK(!info.dependencies()->HasAborted()); CHECK(!info.dependencies()->HasAborted());
@ -1051,7 +1051,7 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial(
CHECK(map2->is_stable()); CHECK(map2->is_stable());
CHECK(expectations2.Check(*map2)); CHECK(expectations2.Check(*map2));
Zone zone; Zone zone(isolate->allocator());
Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate);
CompilationInfo info("testing", isolate, &zone); CompilationInfo info("testing", isolate, &zone);
CHECK(!info.dependencies()->HasAborted()); CHECK(!info.dependencies()->HasAborted());

View File

@ -95,7 +95,8 @@ void CompareStringsOneWay(const char* s1, const char* s2,
int expected_diff_parameter = -1) { int expected_diff_parameter = -1) {
StringCompareInput input(s1, s2); StringCompareInput input(s1, s2);
Zone zone; v8::base::AccountingAllocator allocator;
Zone zone(&allocator);
DiffChunkStruct* first_chunk; DiffChunkStruct* first_chunk;
ListDiffOutputWriter writer(&first_chunk, &zone); ListDiffOutputWriter writer(&first_chunk, &zone);

View File

@ -153,7 +153,7 @@ TEST(ScanHTMLEndComments) {
i::CompleteParserRecorder log; i::CompleteParserRecorder log;
i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream); scanner.Initialize(&stream);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::AstValueFactory ast_value_factory( i::AstValueFactory ast_value_factory(
&zone, CcTest::i_isolate()->heap()->HashSeed()); &zone, CcTest::i_isolate()->heap()->HashSeed());
i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log,
@ -171,7 +171,7 @@ TEST(ScanHTMLEndComments) {
i::CompleteParserRecorder log; i::CompleteParserRecorder log;
i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream); scanner.Initialize(&stream);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::AstValueFactory ast_value_factory( i::AstValueFactory ast_value_factory(
&zone, CcTest::i_isolate()->heap()->HashSeed()); &zone, CcTest::i_isolate()->heap()->HashSeed());
i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log,
@ -332,7 +332,7 @@ TEST(StandAlonePreParser) {
i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream); scanner.Initialize(&stream);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::AstValueFactory ast_value_factory( i::AstValueFactory ast_value_factory(
&zone, CcTest::i_isolate()->heap()->HashSeed()); &zone, CcTest::i_isolate()->heap()->HashSeed());
i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log,
@ -369,7 +369,7 @@ TEST(StandAlonePreParserNoNatives) {
scanner.Initialize(&stream); scanner.Initialize(&stream);
// Preparser defaults to disallowing natives syntax. // Preparser defaults to disallowing natives syntax.
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::AstValueFactory ast_value_factory( i::AstValueFactory ast_value_factory(
&zone, CcTest::i_isolate()->heap()->HashSeed()); &zone, CcTest::i_isolate()->heap()->HashSeed());
i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log,
@ -438,7 +438,7 @@ TEST(RegressChromium62639) {
i::CompleteParserRecorder log; i::CompleteParserRecorder log;
i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream); scanner.Initialize(&stream);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::AstValueFactory ast_value_factory(&zone, i::AstValueFactory ast_value_factory(&zone,
CcTest::i_isolate()->heap()->HashSeed()); CcTest::i_isolate()->heap()->HashSeed());
i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log,
@ -473,7 +473,7 @@ TEST(Regress928) {
i::CompleteParserRecorder log; i::CompleteParserRecorder log;
i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream); scanner.Initialize(&stream);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::AstValueFactory ast_value_factory(&zone, i::AstValueFactory ast_value_factory(&zone,
CcTest::i_isolate()->heap()->HashSeed()); CcTest::i_isolate()->heap()->HashSeed());
i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log,
@ -526,7 +526,7 @@ TEST(PreParseOverflow) {
i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
scanner.Initialize(&stream); scanner.Initialize(&stream);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::AstValueFactory ast_value_factory(&zone, i::AstValueFactory ast_value_factory(&zone,
CcTest::i_isolate()->heap()->HashSeed()); CcTest::i_isolate()->heap()->HashSeed());
i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log,
@ -843,7 +843,7 @@ void TestScanRegExp(const char* re_source, const char* expected) {
CHECK(start == i::Token::DIV || start == i::Token::ASSIGN_DIV); CHECK(start == i::Token::DIV || start == i::Token::ASSIGN_DIV);
CHECK(scanner.ScanRegExpPattern(start == i::Token::ASSIGN_DIV)); CHECK(scanner.ScanRegExpPattern(start == i::Token::ASSIGN_DIV));
scanner.Next(); // Current token is now the regexp literal. scanner.Next(); // Current token is now the regexp literal.
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::AstValueFactory ast_value_factory(&zone, i::AstValueFactory ast_value_factory(&zone,
CcTest::i_isolate()->heap()->HashSeed()); CcTest::i_isolate()->heap()->HashSeed());
ast_value_factory.Internalize(CcTest::i_isolate()); ast_value_factory.Internalize(CcTest::i_isolate());
@ -1067,7 +1067,7 @@ TEST(ScopeUsesArgumentsSuperThis) {
factory->NewStringFromUtf8(i::CStrVector(program.start())) factory->NewStringFromUtf8(i::CStrVector(program.start()))
.ToHandleChecked(); .ToHandleChecked();
i::Handle<i::Script> script = factory->NewScript(source); i::Handle<i::Script> script = factory->NewScript(source);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::ParseInfo info(&zone, script); i::ParseInfo info(&zone, script);
i::Parser parser(&info); i::Parser parser(&info);
parser.set_allow_harmony_sloppy(true); parser.set_allow_harmony_sloppy(true);
@ -1385,7 +1385,7 @@ TEST(ScopePositions) {
i::CStrVector(program.start())).ToHandleChecked(); i::CStrVector(program.start())).ToHandleChecked();
CHECK_EQ(source->length(), kProgramSize); CHECK_EQ(source->length(), kProgramSize);
i::Handle<i::Script> script = factory->NewScript(source); i::Handle<i::Script> script = factory->NewScript(source);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::ParseInfo info(&zone, script); i::ParseInfo info(&zone, script);
i::Parser parser(&info); i::Parser parser(&info);
parser.set_allow_lazy(true); parser.set_allow_lazy(true);
@ -1434,7 +1434,7 @@ TEST(DiscardFunctionBody) {
i::Handle<i::String> source_code = i::Handle<i::String> source_code =
factory->NewStringFromUtf8(i::CStrVector(source)).ToHandleChecked(); factory->NewStringFromUtf8(i::CStrVector(source)).ToHandleChecked();
i::Handle<i::Script> script = factory->NewScript(source_code); i::Handle<i::Script> script = factory->NewScript(source_code);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::ParseInfo info(&zone, script); i::ParseInfo info(&zone, script);
info.set_allow_lazy_parsing(); info.set_allow_lazy_parsing();
i::Parser parser(&info); i::Parser parser(&info);
@ -1556,7 +1556,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
if (test_preparser) { if (test_preparser) {
i::Scanner scanner(isolate->unicode_cache()); i::Scanner scanner(isolate->unicode_cache());
i::GenericStringUtf16CharacterStream stream(source, 0, source->length()); i::GenericStringUtf16CharacterStream stream(source, 0, source->length());
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::AstValueFactory ast_value_factory( i::AstValueFactory ast_value_factory(
&zone, CcTest::i_isolate()->heap()->HashSeed()); &zone, CcTest::i_isolate()->heap()->HashSeed());
i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log,
@ -1573,7 +1573,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
i::FunctionLiteral* function; i::FunctionLiteral* function;
{ {
i::Handle<i::Script> script = factory->NewScript(source); i::Handle<i::Script> script = factory->NewScript(source);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::ParseInfo info(&zone, script); i::ParseInfo info(&zone, script);
i::Parser parser(&info); i::Parser parser(&info);
SetParserFlags(&parser, flags); SetParserFlags(&parser, flags);
@ -2662,7 +2662,7 @@ TEST(DontRegressPreParserDataSizes) {
i::Handle<i::String> source = i::Handle<i::String> source =
factory->NewStringFromUtf8(i::CStrVector(program)).ToHandleChecked(); factory->NewStringFromUtf8(i::CStrVector(program)).ToHandleChecked();
i::Handle<i::Script> script = factory->NewScript(source); i::Handle<i::Script> script = factory->NewScript(source);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::ParseInfo info(&zone, script); i::ParseInfo info(&zone, script);
i::ScriptData* sd = NULL; i::ScriptData* sd = NULL;
info.set_cached_data(&sd); info.set_cached_data(&sd);
@ -3288,7 +3288,7 @@ TEST(SerializationOfMaybeAssignmentFlag) {
i::Handle<i::String> source = factory->InternalizeUtf8String(program.start()); i::Handle<i::String> source = factory->InternalizeUtf8String(program.start());
source->PrintOn(stdout); source->PrintOn(stdout);
printf("\n"); printf("\n");
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
v8::Local<v8::Value> v = CompileRun(src); v8::Local<v8::Value> v = CompileRun(src);
i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
@ -3338,7 +3338,7 @@ TEST(IfArgumentsArrayAccessedThenParametersMaybeAssigned) {
i::Handle<i::String> source = factory->InternalizeUtf8String(program.start()); i::Handle<i::String> source = factory->InternalizeUtf8String(program.start());
source->PrintOn(stdout); source->PrintOn(stdout);
printf("\n"); printf("\n");
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
v8::Local<v8::Value> v = CompileRun(src); v8::Local<v8::Value> v = CompileRun(src);
i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
@ -3482,7 +3482,7 @@ TEST(InnerAssignment) {
printf("\n"); printf("\n");
i::Handle<i::Script> script = factory->NewScript(source); i::Handle<i::Script> script = factory->NewScript(source);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::ParseInfo info(&zone, script); i::ParseInfo info(&zone, script);
i::Parser parser(&info); i::Parser parser(&info);
CHECK(parser.Parse(&info)); CHECK(parser.Parse(&info));
@ -5627,7 +5627,7 @@ TEST(BasicImportExportParsing) {
// Show that parsing as a module works // Show that parsing as a module works
{ {
i::Handle<i::Script> script = factory->NewScript(source); i::Handle<i::Script> script = factory->NewScript(source);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::ParseInfo info(&zone, script); i::ParseInfo info(&zone, script);
i::Parser parser(&info); i::Parser parser(&info);
info.set_module(); info.set_module();
@ -5652,7 +5652,7 @@ TEST(BasicImportExportParsing) {
// And that parsing a script does not. // And that parsing a script does not.
{ {
i::Handle<i::Script> script = factory->NewScript(source); i::Handle<i::Script> script = factory->NewScript(source);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::ParseInfo info(&zone, script); i::ParseInfo info(&zone, script);
i::Parser parser(&info); i::Parser parser(&info);
info.set_global(); info.set_global();
@ -5742,7 +5742,7 @@ TEST(ImportExportParsingErrors) {
factory->NewStringFromAsciiChecked(kErrorSources[i]); factory->NewStringFromAsciiChecked(kErrorSources[i]);
i::Handle<i::Script> script = factory->NewScript(source); i::Handle<i::Script> script = factory->NewScript(source);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::ParseInfo info(&zone, script); i::ParseInfo info(&zone, script);
i::Parser parser(&info); i::Parser parser(&info);
info.set_module(); info.set_module();
@ -5770,7 +5770,7 @@ TEST(ModuleParsingInternals) {
"import 'q.js'"; "import 'q.js'";
i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource); i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource);
i::Handle<i::Script> script = factory->NewScript(source); i::Handle<i::Script> script = factory->NewScript(source);
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::ParseInfo info(&zone, script); i::ParseInfo info(&zone, script);
i::Parser parser(&info); i::Parser parser(&info);
info.set_module(); info.set_module();
@ -5883,7 +5883,7 @@ void TestLanguageMode(const char* source,
i::Handle<i::Script> script = i::Handle<i::Script> script =
factory->NewScript(factory->NewStringFromAsciiChecked(source)); factory->NewScript(factory->NewStringFromAsciiChecked(source));
i::Zone zone; i::Zone zone(CcTest::i_isolate()->allocator());
i::ParseInfo info(&zone, script); i::ParseInfo info(&zone, script);
i::Parser parser(&info); i::Parser parser(&info);
info.set_global(); info.set_global();

View File

@ -97,7 +97,7 @@ using namespace v8::internal;
static bool CheckParse(const char* input) { static bool CheckParse(const char* input) {
v8::HandleScope scope(CcTest::isolate()); v8::HandleScope scope(CcTest::isolate());
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
RegExpCompileData result; RegExpCompileData result;
return v8::internal::RegExpParser::ParseRegExp( return v8::internal::RegExpParser::ParseRegExp(
@ -108,7 +108,7 @@ static bool CheckParse(const char* input) {
static void CheckParseEq(const char* input, const char* expected, static void CheckParseEq(const char* input, const char* expected,
bool unicode = false) { bool unicode = false) {
v8::HandleScope scope(CcTest::isolate()); v8::HandleScope scope(CcTest::isolate());
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
RegExpCompileData result; RegExpCompileData result;
JSRegExp::Flags flags = JSRegExp::kNone; JSRegExp::Flags flags = JSRegExp::kNone;
@ -128,7 +128,7 @@ static void CheckParseEq(const char* input, const char* expected,
static bool CheckSimple(const char* input) { static bool CheckSimple(const char* input) {
v8::HandleScope scope(CcTest::isolate()); v8::HandleScope scope(CcTest::isolate());
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
RegExpCompileData result; RegExpCompileData result;
CHECK(v8::internal::RegExpParser::ParseRegExp( CHECK(v8::internal::RegExpParser::ParseRegExp(
@ -146,7 +146,7 @@ struct MinMaxPair {
static MinMaxPair CheckMinMaxMatch(const char* input) { static MinMaxPair CheckMinMaxMatch(const char* input) {
v8::HandleScope scope(CcTest::isolate()); v8::HandleScope scope(CcTest::isolate());
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
RegExpCompileData result; RegExpCompileData result;
CHECK(v8::internal::RegExpParser::ParseRegExp( CHECK(v8::internal::RegExpParser::ParseRegExp(
@ -461,7 +461,7 @@ TEST(ParserRegression) {
static void ExpectError(const char* input, static void ExpectError(const char* input,
const char* expected) { const char* expected) {
v8::HandleScope scope(CcTest::isolate()); v8::HandleScope scope(CcTest::isolate());
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
RegExpCompileData result; RegExpCompileData result;
CHECK(!v8::internal::RegExpParser::ParseRegExp( CHECK(!v8::internal::RegExpParser::ParseRegExp(
@ -530,7 +530,7 @@ static bool NotWord(uc16 c) {
static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) { static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) {
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ZoneList<CharacterRange>* ranges = ZoneList<CharacterRange>* ranges =
new(&zone) ZoneList<CharacterRange>(2, &zone); new(&zone) ZoneList<CharacterRange>(2, &zone);
CharacterRange::AddClassEscape(c, ranges, &zone); CharacterRange::AddClassEscape(c, ranges, &zone);
@ -581,7 +581,7 @@ static RegExpNode* Compile(const char* input, bool multiline, bool unicode,
static void Execute(const char* input, bool multiline, bool unicode, static void Execute(const char* input, bool multiline, bool unicode,
bool is_one_byte, bool dot_output = false) { bool is_one_byte, bool dot_output = false) {
v8::HandleScope scope(CcTest::isolate()); v8::HandleScope scope(CcTest::isolate());
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
RegExpNode* node = Compile(input, multiline, unicode, is_one_byte, &zone); RegExpNode* node = Compile(input, multiline, unicode, is_one_byte, &zone);
USE(node); USE(node);
#ifdef DEBUG #ifdef DEBUG
@ -619,7 +619,7 @@ static unsigned PseudoRandom(int i, int j) {
TEST(SplayTreeSimple) { TEST(SplayTreeSimple) {
static const unsigned kLimit = 1000; static const unsigned kLimit = 1000;
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ZoneSplayTree<TestConfig> tree(&zone); ZoneSplayTree<TestConfig> tree(&zone);
bool seen[kLimit]; bool seen[kLimit];
for (unsigned i = 0; i < kLimit; i++) seen[i] = false; for (unsigned i = 0; i < kLimit; i++) seen[i] = false;
@ -686,7 +686,7 @@ TEST(DispatchTableConstruction) {
} }
} }
// Enter test data into dispatch table. // Enter test data into dispatch table.
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
DispatchTable table(&zone); DispatchTable table(&zone);
for (int i = 0; i < kRangeCount; i++) { for (int i = 0; i < kRangeCount; i++) {
uc16* range = ranges[i]; uc16* range = ranges[i];
@ -800,7 +800,7 @@ TEST(MacroAssemblerNativeSuccess) {
ContextInitializer initializer; ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
4); 4);
@ -838,7 +838,7 @@ TEST(MacroAssemblerNativeSimple) {
ContextInitializer initializer; ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
4); 4);
@ -905,7 +905,7 @@ TEST(MacroAssemblerNativeSimpleUC16) {
ContextInitializer initializer; ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::UC16, ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::UC16,
4); 4);
@ -978,7 +978,7 @@ TEST(MacroAssemblerNativeBacktrack) {
ContextInitializer initializer; ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
0); 0);
@ -1019,7 +1019,7 @@ TEST(MacroAssemblerNativeBackReferenceLATIN1) {
ContextInitializer initializer; ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
4); 4);
@ -1069,7 +1069,7 @@ TEST(MacroAssemblerNativeBackReferenceUC16) {
ContextInitializer initializer; ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::UC16, ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::UC16,
4); 4);
@ -1122,7 +1122,7 @@ TEST(MacroAssemblernativeAtStart) {
ContextInitializer initializer; ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
0); 0);
@ -1182,7 +1182,7 @@ TEST(MacroAssemblerNativeBackRefNoCase) {
ContextInitializer initializer; ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
4); 4);
@ -1241,7 +1241,7 @@ TEST(MacroAssemblerNativeRegisters) {
ContextInitializer initializer; ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
6); 6);
@ -1343,7 +1343,7 @@ TEST(MacroAssemblerStackOverflow) {
ContextInitializer initializer; ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
0); 0);
@ -1382,7 +1382,7 @@ TEST(MacroAssemblerNativeLotsOfRegisters) {
ContextInitializer initializer; ContextInitializer initializer;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1,
2); 2);
@ -1430,7 +1430,7 @@ TEST(MacroAssemblerNativeLotsOfRegisters) {
TEST(MacroAssembler) { TEST(MacroAssembler) {
byte codes[1024]; byte codes[1024];
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
RegExpMacroAssemblerIrregexp m(CcTest::i_isolate(), Vector<byte>(codes, 1024), RegExpMacroAssemblerIrregexp m(CcTest::i_isolate(), Vector<byte>(codes, 1024),
&zone); &zone);
// ^f(o)o. // ^f(o)o.
@ -1498,7 +1498,7 @@ TEST(AddInverseToTable) {
static const int kLimit = 1000; static const int kLimit = 1000;
static const int kRangeCount = 16; static const int kRangeCount = 16;
for (int t = 0; t < 10; t++) { for (int t = 0; t < 10; t++) {
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ZoneList<CharacterRange>* ranges = ZoneList<CharacterRange>* ranges =
new(&zone) ZoneList<CharacterRange>(kRangeCount, &zone); new(&zone) ZoneList<CharacterRange>(kRangeCount, &zone);
for (int i = 0; i < kRangeCount; i++) { for (int i = 0; i < kRangeCount; i++) {
@ -1519,7 +1519,7 @@ TEST(AddInverseToTable) {
CHECK_EQ(is_on, set->Get(0) == false); CHECK_EQ(is_on, set->Get(0) == false);
} }
} }
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ZoneList<CharacterRange>* ranges = ZoneList<CharacterRange>* ranges =
new(&zone) ZoneList<CharacterRange>(1, &zone); new(&zone) ZoneList<CharacterRange>(1, &zone);
ranges->Add(CharacterRange::Range(0xFFF0, 0xFFFE), &zone); ranges->Add(CharacterRange::Range(0xFFF0, 0xFFFE), &zone);
@ -1632,7 +1632,7 @@ TEST(UncanonicalizeEquivalence) {
static void TestRangeCaseIndependence(Isolate* isolate, CharacterRange input, static void TestRangeCaseIndependence(Isolate* isolate, CharacterRange input,
Vector<CharacterRange> expected) { Vector<CharacterRange> expected) {
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
int count = expected.length(); int count = expected.length();
ZoneList<CharacterRange>* list = ZoneList<CharacterRange>* list =
new(&zone) ZoneList<CharacterRange>(count, &zone); new(&zone) ZoneList<CharacterRange>(count, &zone);
@ -1701,7 +1701,7 @@ static bool InClass(uc32 c, ZoneList<CharacterRange>* ranges) {
TEST(UnicodeRangeSplitter) { TEST(UnicodeRangeSplitter) {
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ZoneList<CharacterRange>* base = ZoneList<CharacterRange>* base =
new(&zone) ZoneList<CharacterRange>(1, &zone); new(&zone) ZoneList<CharacterRange>(1, &zone);
base->Add(CharacterRange::Everything(), &zone); base->Add(CharacterRange::Everything(), &zone);
@ -1745,7 +1745,7 @@ TEST(UnicodeRangeSplitter) {
TEST(CanonicalizeCharacterSets) { TEST(CanonicalizeCharacterSets) {
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ZoneList<CharacterRange>* list = ZoneList<CharacterRange>* list =
new(&zone) ZoneList<CharacterRange>(4, &zone); new(&zone) ZoneList<CharacterRange>(4, &zone);
CharacterSet set(list); CharacterSet set(list);
@ -1806,7 +1806,7 @@ TEST(CanonicalizeCharacterSets) {
TEST(CharacterRangeMerge) { TEST(CharacterRangeMerge) {
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
ZoneList<CharacterRange> l1(4, &zone); ZoneList<CharacterRange> l1(4, &zone);
ZoneList<CharacterRange> l2(4, &zone); ZoneList<CharacterRange> l2(4, &zone);
// Create all combinations of intersections of ranges, both singletons and // Create all combinations of intersections of ranges, both singletons and

View File

@ -25,8 +25,8 @@ static int32_t DummyStaticFunction(Object* result) { return 1; }
TEST(WasmRelocationIa32) { TEST(WasmRelocationIa32) {
CcTest::InitializeVM(); CcTest::InitializeVM();
Zone zone;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Zone zone(isolate->allocator());
HandleScope scope(isolate); HandleScope scope(isolate);
v8::internal::byte buffer[4096]; v8::internal::byte buffer[4096];
Assembler assm(isolate, buffer, sizeof buffer); Assembler assm(isolate, buffer, sizeof buffer);

View File

@ -25,8 +25,8 @@ static int32_t DummyStaticFunction(Object* result) { return 1; }
TEST(WasmRelocationIa32) { TEST(WasmRelocationIa32) {
CcTest::InitializeVM(); CcTest::InitializeVM();
Zone zone;
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Zone zone(isolate->allocator());
HandleScope scope(isolate); HandleScope scope(isolate);
v8::internal::byte buffer[4096]; v8::internal::byte buffer[4096];
Assembler assm(isolate, buffer, sizeof buffer); Assembler assm(isolate, buffer, sizeof buffer);

View File

@ -40,7 +40,7 @@ struct Tests {
Tests() Tests()
: isolate(CcTest::InitIsolateOnce()), : isolate(CcTest::InitIsolateOnce()),
scope(isolate), scope(isolate),
zone(), zone(isolate->allocator()),
T(&zone, isolate, isolate->random_number_generator()) {} T(&zone, isolate, isolate->random_number_generator()) {}
bool IsBitset(Type* type) { return type->IsBitsetForTesting(); } bool IsBitset(Type* type) { return type->IsBitsetForTesting(); }

View File

@ -143,7 +143,7 @@ TEST(UniqueSet_Add) {
MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
MAKE_UNIQUES_A_B_C; MAKE_UNIQUES_A_B_C;
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
UniqueSet<String>* set = new(&zone) UniqueSet<String>(); UniqueSet<String>* set = new(&zone) UniqueSet<String>();
@ -170,7 +170,7 @@ TEST(UniqueSet_Remove) {
MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
MAKE_UNIQUES_A_B_C; MAKE_UNIQUES_A_B_C;
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
UniqueSet<String>* set = new(&zone) UniqueSet<String>(); UniqueSet<String>* set = new(&zone) UniqueSet<String>();
@ -210,7 +210,7 @@ TEST(UniqueSet_Contains) {
MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
MAKE_UNIQUES_A_B_C; MAKE_UNIQUES_A_B_C;
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
UniqueSet<String>* set = new(&zone) UniqueSet<String>(); UniqueSet<String>* set = new(&zone) UniqueSet<String>();
@ -241,7 +241,7 @@ TEST(UniqueSet_At) {
MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
MAKE_UNIQUES_A_B_C; MAKE_UNIQUES_A_B_C;
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
UniqueSet<String>* set = new(&zone) UniqueSet<String>(); UniqueSet<String>* set = new(&zone) UniqueSet<String>();
@ -278,7 +278,7 @@ TEST(UniqueSet_Equals) {
MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
MAKE_UNIQUES_A_B_C; MAKE_UNIQUES_A_B_C;
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
UniqueSet<String>* set1 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set1 = new(&zone) UniqueSet<String>();
UniqueSet<String>* set2 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set2 = new(&zone) UniqueSet<String>();
@ -316,7 +316,7 @@ TEST(UniqueSet_IsSubset1) {
MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
MAKE_UNIQUES_A_B_C; MAKE_UNIQUES_A_B_C;
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
UniqueSet<String>* set1 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set1 = new(&zone) UniqueSet<String>();
UniqueSet<String>* set2 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set2 = new(&zone) UniqueSet<String>();
@ -351,7 +351,7 @@ TEST(UniqueSet_IsSubset2) {
MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
MAKE_UNIQUES_A_B_C_D_E_F_G; MAKE_UNIQUES_A_B_C_D_E_F_G;
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
UniqueSet<String>* set1 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set1 = new(&zone) UniqueSet<String>();
UniqueSet<String>* set2 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set2 = new(&zone) UniqueSet<String>();
@ -394,7 +394,7 @@ TEST(UniqueSet_IsSubsetExhaustive) {
MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
MAKE_UNIQUES_A_B_C_D_E_F_G; MAKE_UNIQUES_A_B_C_D_E_F_G;
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
Unique<String> elements[] = { Unique<String> elements[] = {
A, B, C, D, E, F, G A, B, C, D, E, F, G
@ -417,7 +417,7 @@ TEST(UniqueSet_Intersect1) {
MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
MAKE_UNIQUES_A_B_C; MAKE_UNIQUES_A_B_C;
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
UniqueSet<String>* set1 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set1 = new(&zone) UniqueSet<String>();
UniqueSet<String>* set2 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set2 = new(&zone) UniqueSet<String>();
@ -458,7 +458,7 @@ TEST(UniqueSet_IntersectExhaustive) {
MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
MAKE_UNIQUES_A_B_C_D_E_F_G; MAKE_UNIQUES_A_B_C_D_E_F_G;
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
Unique<String> elements[] = { Unique<String> elements[] = {
A, B, C, D, E, F, G A, B, C, D, E, F, G
@ -485,7 +485,7 @@ TEST(UniqueSet_Union1) {
MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
MAKE_UNIQUES_A_B_C; MAKE_UNIQUES_A_B_C;
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
UniqueSet<String>* set1 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set1 = new(&zone) UniqueSet<String>();
UniqueSet<String>* set2 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set2 = new(&zone) UniqueSet<String>();
@ -526,7 +526,7 @@ TEST(UniqueSet_UnionExhaustive) {
MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_HANDLES_AND_DISALLOW_ALLOCATION;
MAKE_UNIQUES_A_B_C_D_E_F_G; MAKE_UNIQUES_A_B_C_D_E_F_G;
Zone zone; Zone zone(CcTest::i_isolate()->allocator());
Unique<String> elements[] = { Unique<String> elements[] = {
A, B, C, D, E, F, G A, B, C, D, E, F, G

View File

@ -69,7 +69,8 @@ TEST(Run_WasmModule_CallAdd_rev) {
TEST(Run_WasmModule_Return114) { TEST(Run_WasmModule_Return114) {
static const int32_t kReturnValue = 114; static const int32_t kReturnValue = 114;
Zone zone; v8::base::AccountingAllocator allocator;
Zone zone(&allocator);
WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
uint16_t f_index = builder->AddFunction(); uint16_t f_index = builder->AddFunction();
WasmFunctionBuilder* f = builder->FunctionAt(f_index); WasmFunctionBuilder* f = builder->FunctionAt(f_index);
@ -83,7 +84,8 @@ TEST(Run_WasmModule_Return114) {
TEST(Run_WasmModule_CallAdd) { TEST(Run_WasmModule_CallAdd) {
Zone zone; v8::base::AccountingAllocator allocator;
Zone zone(&allocator);
WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
uint16_t f1_index = builder->AddFunction(); uint16_t f1_index = builder->AddFunction();
WasmFunctionBuilder* f = builder->FunctionAt(f1_index); WasmFunctionBuilder* f = builder->FunctionAt(f1_index);
@ -106,7 +108,8 @@ TEST(Run_WasmModule_CallAdd) {
TEST(Run_WasmModule_ReadLoadedDataSegment) { TEST(Run_WasmModule_ReadLoadedDataSegment) {
static const byte kDataSegmentDest0 = 12; static const byte kDataSegmentDest0 = 12;
Zone zone; v8::base::AccountingAllocator allocator;
Zone zone(&allocator);
WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
uint16_t f_index = builder->AddFunction(); uint16_t f_index = builder->AddFunction();
WasmFunctionBuilder* f = builder->FunctionAt(f_index); WasmFunctionBuilder* f = builder->FunctionAt(f_index);
@ -124,7 +127,8 @@ TEST(Run_WasmModule_ReadLoadedDataSegment) {
TEST(Run_WasmModule_CheckMemoryIsZero) { TEST(Run_WasmModule_CheckMemoryIsZero) {
static const int kCheckSize = 16 * 1024; static const int kCheckSize = 16 * 1024;
Zone zone; v8::base::AccountingAllocator allocator;
Zone zone(&allocator);
WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
uint16_t f_index = builder->AddFunction(); uint16_t f_index = builder->AddFunction();
WasmFunctionBuilder* f = builder->FunctionAt(f_index); WasmFunctionBuilder* f = builder->FunctionAt(f_index);
@ -145,7 +149,8 @@ TEST(Run_WasmModule_CheckMemoryIsZero) {
} }
TEST(Run_WasmModule_CallMain_recursive) { TEST(Run_WasmModule_CallMain_recursive) {
Zone zone; v8::base::AccountingAllocator allocator;
Zone zone(&allocator);
WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
uint16_t f_index = builder->AddFunction(); uint16_t f_index = builder->AddFunction();
WasmFunctionBuilder* f = builder->FunctionAt(f_index); WasmFunctionBuilder* f = builder->FunctionAt(f_index);
@ -166,7 +171,8 @@ TEST(Run_WasmModule_CallMain_recursive) {
} }
TEST(Run_WasmModule_Global) { TEST(Run_WasmModule_Global) {
Zone zone; v8::base::AccountingAllocator allocator;
Zone zone(&allocator);
WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
uint32_t global1 = builder->AddGlobal(MachineType::Int32(), 0); uint32_t global1 = builder->AddGlobal(MachineType::Int32(), 0);
uint32_t global2 = builder->AddGlobal(MachineType::Int32(), 0); uint32_t global2 = builder->AddGlobal(MachineType::Int32(), 0);

View File

@ -1714,8 +1714,8 @@ TEST(Run_Wasm_Infinite_Loop_not_taken2_brif) {
static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) { static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) {
if (!WasmOpcodes::IsSupported(opcode)) return; if (!WasmOpcodes::IsSupported(opcode)) return;
Zone zone;
Isolate* isolate = CcTest::InitIsolateOnce(); Isolate* isolate = CcTest::InitIsolateOnce();
Zone zone(isolate->allocator());
HandleScope scope(isolate); HandleScope scope(isolate);
// Enable all optional operators. // Enable all optional operators.
CommonOperatorBuilder common(&zone); CommonOperatorBuilder common(&zone);
@ -2141,7 +2141,8 @@ static void Run_WasmMixedCall_N(int start) {
int num_params = static_cast<int>(arraysize(mixed)) - start; int num_params = static_cast<int>(arraysize(mixed)) - start;
for (int which = 0; which < num_params; which++) { for (int which = 0; which < num_params; which++) {
Zone zone; v8::base::AccountingAllocator allocator;
Zone zone(&allocator);
TestingModule module; TestingModule module;
module.AddMemory(1024); module.AddMemory(1024);
MachineType* memtypes = &mixed[start]; MachineType* memtypes = &mixed[start];
@ -2780,7 +2781,8 @@ void CompileCallIndirectMany(LocalType param) {
// with many many parameters. // with many many parameters.
TestSignatures sigs; TestSignatures sigs;
for (byte num_params = 0; num_params < 40; num_params++) { for (byte num_params = 0; num_params < 40; num_params++) {
Zone zone; v8::base::AccountingAllocator allocator;
Zone zone(&allocator);
HandleScope scope(CcTest::InitIsolateOnce()); HandleScope scope(CcTest::InitIsolateOnce());
TestingModule module; TestingModule module;
FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params); FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params);

View File

@ -221,7 +221,8 @@ inline void TestBuildingGraph(Zone* zone, JSGraph* jsgraph, ModuleEnv* module,
FunctionSig* sig, const byte* start, FunctionSig* sig, const byte* start,
const byte* end) { const byte* end) {
compiler::WasmGraphBuilder builder(zone, jsgraph, sig); compiler::WasmGraphBuilder builder(zone, jsgraph, sig);
TreeResult result = BuildTFGraph(&builder, module, sig, start, end); TreeResult result =
BuildTFGraph(zone->allocator(), &builder, module, sig, start, end);
if (result.failed()) { if (result.failed()) {
ptrdiff_t pc = result.error_pc - result.start; ptrdiff_t pc = result.error_pc - result.start;
ptrdiff_t pt = result.error_pt - result.start; ptrdiff_t pt = result.error_pt - result.start;
@ -485,8 +486,8 @@ class WasmRunner {
MachineType p1 = MachineType::None(), MachineType p1 = MachineType::None(),
MachineType p2 = MachineType::None(), MachineType p2 = MachineType::None(),
MachineType p3 = MachineType::None()) MachineType p3 = MachineType::None())
: compiled_(false), : zone(&allocator_),
compiled_(false),
signature_(MachineTypeForC<ReturnType>() == MachineType::None() ? 0 : 1, signature_(MachineTypeForC<ReturnType>() == MachineType::None() ? 0 : 1,
GetParameterCount(p0, p1, p2, p3), storage_), GetParameterCount(p0, p1, p2, p3), storage_),
compiler_(&signature_, nullptr) { compiler_(&signature_, nullptr) {
@ -497,7 +498,8 @@ class WasmRunner {
MachineType p1 = MachineType::None(), MachineType p1 = MachineType::None(),
MachineType p2 = MachineType::None(), MachineType p2 = MachineType::None(),
MachineType p3 = MachineType::None()) MachineType p3 = MachineType::None())
: compiled_(false), : zone(&allocator_),
compiled_(false),
signature_(MachineTypeForC<ReturnType>() == MachineType::None() ? 0 : 1, signature_(MachineTypeForC<ReturnType>() == MachineType::None() ? 0 : 1,
GetParameterCount(p0, p1, p2, p3), storage_), GetParameterCount(p0, p1, p2, p3), storage_),
compiler_(&signature_, module) { compiler_(&signature_, module) {
@ -577,6 +579,7 @@ class WasmRunner {
byte AllocateLocal(LocalType type) { return compiler_.AllocateLocal(type); } byte AllocateLocal(LocalType type) { return compiler_.AllocateLocal(type); }
protected: protected:
v8::base::AccountingAllocator allocator_;
Zone zone; Zone zone;
bool compiled_; bool compiled_;
LocalType storage_[WASM_RUNNER_MAX_NUM_PARAMETERS]; LocalType storage_[WASM_RUNNER_MAX_NUM_PARAMETERS];

View File

@ -33,7 +33,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
v8::internal::Handle<v8::internal::Script> script = v8::internal::Handle<v8::internal::Script> script =
factory->NewScript(source.ToHandleChecked()); factory->NewScript(source.ToHandleChecked());
v8::internal::Zone zone; v8::internal::Zone zone(i_isolate->allocator());
v8::internal::ParseInfo info(&zone, script); v8::internal::ParseInfo info(&zone, script);
info.set_global(); info.set_global();
v8::internal::Parser parser(&info); v8::internal::Parser parser(&info);

View File

@ -64,7 +64,7 @@ class LoopPeelingTest : public GraphTest {
OFStream os(stdout); OFStream os(stdout);
os << AsRPO(*graph()); os << AsRPO(*graph());
} }
Zone zone; Zone zone(isolate()->allocator());
return LoopFinder::BuildLoopTree(graph(), &zone); return LoopFinder::BuildLoopTree(graph(), &zone);
} }

View File

@ -12,7 +12,7 @@ namespace compiler {
class ZonePoolTest : public TestWithIsolate { class ZonePoolTest : public TestWithIsolate {
public: public:
ZonePoolTest() {} ZonePoolTest() : zone_pool_(&allocator_) {}
protected: protected:
ZonePool* zone_pool() { return &zone_pool_; } ZonePool* zone_pool() { return &zone_pool_; }
@ -38,6 +38,7 @@ class ZonePoolTest : public TestWithIsolate {
} }
private: private:
base::AccountingAllocator allocator_;
ZonePool zone_pool_; ZonePool zone_pool_;
base::RandomNumberGenerator rng; base::RandomNumberGenerator rng;
}; };

View File

@ -93,12 +93,13 @@ class TestWithIsolate : public virtual ::v8::TestWithIsolate {
class TestWithZone : public virtual ::testing::Test { class TestWithZone : public virtual ::testing::Test {
public: public:
TestWithZone() {} TestWithZone() : zone_(&allocator_) {}
virtual ~TestWithZone(); virtual ~TestWithZone();
Zone* zone() { return &zone_; } Zone* zone() { return &zone_; }
private: private:
base::AccountingAllocator allocator_;
Zone zone_; Zone zone_;
DISALLOW_COPY_AND_ASSIGN(TestWithZone); DISALLOW_COPY_AND_ASSIGN(TestWithZone);
@ -107,12 +108,13 @@ class TestWithZone : public virtual ::testing::Test {
class TestWithIsolateAndZone : public virtual TestWithIsolate { class TestWithIsolateAndZone : public virtual TestWithIsolate {
public: public:
TestWithIsolateAndZone() {} TestWithIsolateAndZone() : zone_(&allocator_) {}
virtual ~TestWithIsolateAndZone(); virtual ~TestWithIsolateAndZone();
Zone* zone() { return &zone_; } Zone* zone() { return &zone_; }
private: private:
base::AccountingAllocator allocator_;
Zone zone_; Zone zone_;
DISALLOW_COPY_AND_ASSIGN(TestWithIsolateAndZone); DISALLOW_COPY_AND_ASSIGN(TestWithIsolateAndZone);

View File

@ -80,7 +80,8 @@ class AstDecoderTest : public TestWithZone {
const byte* end) { const byte* end) {
local_decls.Prepend(&start, &end); local_decls.Prepend(&start, &end);
// Verify the code. // Verify the code.
TreeResult result = VerifyWasmCode(module, sig, start, end); TreeResult result =
VerifyWasmCode(zone()->allocator(), module, sig, start, end);
if (result.error_code != expected) { if (result.error_code != expected) {
ptrdiff_t pc = result.error_pc - result.start; ptrdiff_t pc = result.error_pc - result.start;
@ -2211,7 +2212,9 @@ class LocalDeclDecoderTest : public TestWithZone {
TEST_F(LocalDeclDecoderTest, NoLocals) { TEST_F(LocalDeclDecoderTest, NoLocals) {
static const byte data[] = {0}; static const byte data[] = {0};
LocalTypeMap map = DecodeLocalDeclsForTesting(data, data + sizeof(data)); base::AccountingAllocator allocator;
LocalTypeMap map =
DecodeLocalDeclsForTesting(&allocator, data, data + sizeof(data));
EXPECT_EQ(0, map->size()); EXPECT_EQ(0, map->size());
if (map) delete map; if (map) delete map;
} }
@ -2221,7 +2224,9 @@ TEST_F(LocalDeclDecoderTest, OneLocal) {
LocalType type = kLocalTypes[i]; LocalType type = kLocalTypes[i];
const byte data[] = { const byte data[] = {
1, 1, static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(type))}; 1, 1, static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(type))};
LocalTypeMap map = DecodeLocalDeclsForTesting(data, data + sizeof(data)); base::AccountingAllocator allocator;
LocalTypeMap map =
DecodeLocalDeclsForTesting(&allocator, data, data + sizeof(data));
EXPECT_EQ(1, map->size()); EXPECT_EQ(1, map->size());
EXPECT_EQ(type, map->at(0)); EXPECT_EQ(type, map->at(0));
if (map) delete map; if (map) delete map;
@ -2233,7 +2238,9 @@ TEST_F(LocalDeclDecoderTest, FiveLocals) {
LocalType type = kLocalTypes[i]; LocalType type = kLocalTypes[i];
const byte data[] = { const byte data[] = {
1, 5, static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(type))}; 1, 5, static_cast<byte>(WasmOpcodes::LocalTypeCodeFor(type))};
LocalTypeMap map = DecodeLocalDeclsForTesting(data, data + sizeof(data)); base::AccountingAllocator allocator;
LocalTypeMap map =
DecodeLocalDeclsForTesting(&allocator, data, data + sizeof(data));
EXPECT_EQ(5, map->size()); EXPECT_EQ(5, map->size());
ExpectRun(map, 0, type, 5); ExpectRun(map, 0, type, 5);
if (map) delete map; if (map) delete map;
@ -2247,8 +2254,9 @@ TEST_F(LocalDeclDecoderTest, MixedLocals) {
for (byte d = 0; d < 3; d++) { for (byte d = 0; d < 3; d++) {
const byte data[] = {4, a, kLocalI32, b, kLocalI64, const byte data[] = {4, a, kLocalI32, b, kLocalI64,
c, kLocalF32, d, kLocalF64}; c, kLocalF32, d, kLocalF64};
base::AccountingAllocator allocator;
LocalTypeMap map = LocalTypeMap map =
DecodeLocalDeclsForTesting(data, data + sizeof(data)); DecodeLocalDeclsForTesting(&allocator, data, data + sizeof(data));
EXPECT_EQ(a + b + c + d, map->size()); EXPECT_EQ(a + b + c + d, map->size());
size_t pos = 0; size_t pos = 0;
@ -2274,7 +2282,8 @@ TEST_F(LocalDeclDecoderTest, UseEncoder) {
local_decls.AddLocals(212, kAstI64); local_decls.AddLocals(212, kAstI64);
local_decls.Prepend(&data, &end); local_decls.Prepend(&data, &end);
LocalTypeMap map = DecodeLocalDeclsForTesting(data, end); base::AccountingAllocator allocator;
LocalTypeMap map = DecodeLocalDeclsForTesting(&allocator, data, end);
size_t pos = 0; size_t pos = 0;
pos = ExpectRun(map, pos, kAstF32, 5); pos = ExpectRun(map, pos, kAstF32, 5);
pos = ExpectRun(map, pos, kAstI32, 1337); pos = ExpectRun(map, pos, kAstI32, 1337);

View File

@ -52,7 +52,8 @@ class EncoderTest : public TestWithZone {
TEST_F(EncoderTest, Function_Builder_Variable_Indexing) { TEST_F(EncoderTest, Function_Builder_Variable_Indexing) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
uint16_t f_index = builder->AddFunction(); uint16_t f_index = builder->AddFunction();
WasmFunctionBuilder* function = builder->FunctionAt(f_index); WasmFunctionBuilder* function = builder->FunctionAt(f_index);
@ -90,7 +91,8 @@ TEST_F(EncoderTest, Function_Builder_Variable_Indexing) {
TEST_F(EncoderTest, Function_Builder_Indexing_Variable_Width) { TEST_F(EncoderTest, Function_Builder_Indexing_Variable_Width) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
uint16_t f_index = builder->AddFunction(); uint16_t f_index = builder->AddFunction();
WasmFunctionBuilder* function = builder->FunctionAt(f_index); WasmFunctionBuilder* function = builder->FunctionAt(f_index);
@ -109,7 +111,8 @@ TEST_F(EncoderTest, Function_Builder_Indexing_Variable_Width) {
} }
TEST_F(EncoderTest, Function_Builder_Block_Variable_Width) { TEST_F(EncoderTest, Function_Builder_Block_Variable_Width) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
uint16_t f_index = builder->AddFunction(); uint16_t f_index = builder->AddFunction();
WasmFunctionBuilder* function = builder->FunctionAt(f_index); WasmFunctionBuilder* function = builder->FunctionAt(f_index);
@ -123,7 +126,8 @@ TEST_F(EncoderTest, Function_Builder_Block_Variable_Width) {
} }
TEST_F(EncoderTest, Function_Builder_EmitEditableVarIntImmediate) { TEST_F(EncoderTest, Function_Builder_EmitEditableVarIntImmediate) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
uint16_t f_index = builder->AddFunction(); uint16_t f_index = builder->AddFunction();
WasmFunctionBuilder* function = builder->FunctionAt(f_index); WasmFunctionBuilder* function = builder->FunctionAt(f_index);
@ -139,7 +143,8 @@ TEST_F(EncoderTest, Function_Builder_EmitEditableVarIntImmediate) {
} }
TEST_F(EncoderTest, Function_Builder_EmitEditableVarIntImmediate_Locals) { TEST_F(EncoderTest, Function_Builder_EmitEditableVarIntImmediate_Locals) {
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone);
uint16_t f_index = builder->AddFunction(); uint16_t f_index = builder->AddFunction();
WasmFunctionBuilder* function = builder->FunctionAt(f_index); WasmFunctionBuilder* function = builder->FunctionAt(f_index);

View File

@ -779,7 +779,8 @@ class WasmSignatureDecodeTest : public TestWithZone {};
TEST_F(WasmSignatureDecodeTest, Ok_v_v) { TEST_F(WasmSignatureDecodeTest, Ok_v_v) {
static const byte data[] = {0, 0}; static const byte data[] = {0, 0};
Zone zone; base::AccountingAllocator allocator;
Zone zone(&allocator);
FunctionSig* sig = FunctionSig* sig =
DecodeWasmSignatureForTesting(&zone, data, data + arraysize(data)); DecodeWasmSignatureForTesting(&zone, data, data + arraysize(data));

View File

@ -1674,6 +1674,8 @@
'../..', '../..',
], ],
'sources': [ 'sources': [
'../../src/base/accounting-allocator.cc',
'../../src/base/accounting-allocator.h',
'../../src/base/adapters.h', '../../src/base/adapters.h',
'../../src/base/atomicops.h', '../../src/base/atomicops.h',
'../../src/base/atomicops_internals_arm64_gcc.h', '../../src/base/atomicops_internals_arm64_gcc.h',

View File

@ -102,7 +102,7 @@ std::pair<v8::base::TimeDelta, v8::base::TimeDelta> RunBaselineParser(
i::ScriptData* cached_data_impl = NULL; i::ScriptData* cached_data_impl = NULL;
// First round of parsing (produce data to cache). // First round of parsing (produce data to cache).
{ {
Zone zone; Zone zone(reinterpret_cast<i::Isolate*>(isolate)->allocator());
ParseInfo info(&zone, script); ParseInfo info(&zone, script);
info.set_global(); info.set_global();
info.set_cached_data(&cached_data_impl); info.set_cached_data(&cached_data_impl);
@ -120,7 +120,7 @@ std::pair<v8::base::TimeDelta, v8::base::TimeDelta> RunBaselineParser(
} }
// Second round of parsing (consume cached data). // Second round of parsing (consume cached data).
{ {
Zone zone; Zone zone(reinterpret_cast<i::Isolate*>(isolate)->allocator());
ParseInfo info(&zone, script); ParseInfo info(&zone, script);
info.set_global(); info.set_global();
info.set_cached_data(&cached_data_impl); info.set_cached_data(&cached_data_impl);