Replace SmartPointer<T> with unique_ptr<T>
R=ishell@chromium.org,bmeurer@chromium.org TBR=rossberg@chromium.org BUG= Review-Url: https://codereview.chromium.org/2175233003 Cr-Commit-Position: refs/heads/master@{#38009}
This commit is contained in:
parent
5bed1516c8
commit
0a6ccaf268
1
BUILD.gn
1
BUILD.gn
@ -2039,7 +2039,6 @@ v8_source_set("v8_libbase") {
|
||||
"src/base/safe_conversions_impl.h",
|
||||
"src/base/safe_math.h",
|
||||
"src/base/safe_math_impl.h",
|
||||
"src/base/smart-pointers.h",
|
||||
"src/base/sys-info.cc",
|
||||
"src/base/sys-info.h",
|
||||
"src/base/utils/random-number-generator.cc",
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#if V8_TARGET_ARCH_ARM
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/arm/simulator-arm.h"
|
||||
#include "src/codegen.h"
|
||||
#include "src/macro-assembler.h"
|
||||
@ -746,7 +748,7 @@ CodeAgingHelper::CodeAgingHelper(Isolate* isolate) {
|
||||
// to avoid overloading the stack in stress conditions.
|
||||
// DONT_FLUSH is used because the CodeAgingHelper is initialized early in
|
||||
// the process, before ARM simulator ICache is setup.
|
||||
base::SmartPointer<CodePatcher> patcher(
|
||||
std::unique_ptr<CodePatcher> patcher(
|
||||
new CodePatcher(isolate, young_sequence_.start(),
|
||||
young_sequence_.length() / Assembler::kInstrSize,
|
||||
CodePatcher::DONT_FLUSH));
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "src/ast/variables.h"
|
||||
#include "src/bailout-reason.h"
|
||||
#include "src/base/flags.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/factory.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/isolate.h"
|
||||
|
@ -23,8 +23,8 @@ BackgroundParsingTask::BackgroundParsingTask(
|
||||
// will happen in the main thread after parsing.
|
||||
Zone* zone = new Zone(isolate->allocator());
|
||||
ParseInfo* info = new ParseInfo(zone);
|
||||
source->zone.Reset(zone);
|
||||
source->info.Reset(info);
|
||||
source->zone.reset(zone);
|
||||
source->info.reset(info);
|
||||
info->set_isolate(isolate);
|
||||
info->set_source_stream(source->source_stream.get());
|
||||
info->set_source_stream_encoding(source->encoding);
|
||||
@ -55,11 +55,11 @@ void BackgroundParsingTask::Run() {
|
||||
source_->info->set_stack_limit(stack_limit);
|
||||
// Parser needs to stay alive for finalizing the parsing on the main
|
||||
// thread. Passing &parse_info is OK because Parser doesn't store it.
|
||||
source_->parser.Reset(new Parser(source_->info.get()));
|
||||
source_->parser.reset(new Parser(source_->info.get()));
|
||||
source_->parser->ParseOnBackground(source_->info.get());
|
||||
|
||||
if (script_data != NULL) {
|
||||
source_->cached_data.Reset(new ScriptCompiler::CachedData(
|
||||
source_->cached_data.reset(new ScriptCompiler::CachedData(
|
||||
script_data->data(), script_data->length(),
|
||||
ScriptCompiler::CachedData::BufferOwned));
|
||||
script_data->ReleaseDataOwnership();
|
||||
|
@ -5,9 +5,10 @@
|
||||
#ifndef V8_BACKGROUND_PARSING_TASK_H_
|
||||
#define V8_BACKGROUND_PARSING_TASK_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/base/platform/platform.h"
|
||||
#include "src/base/platform/semaphore.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/compiler.h"
|
||||
#include "src/parsing/parser.h"
|
||||
|
||||
@ -23,17 +24,17 @@ struct StreamedSource {
|
||||
: source_stream(source_stream), encoding(encoding) {}
|
||||
|
||||
// Internal implementation of v8::ScriptCompiler::StreamedSource.
|
||||
base::SmartPointer<ScriptCompiler::ExternalSourceStream> source_stream;
|
||||
std::unique_ptr<ScriptCompiler::ExternalSourceStream> source_stream;
|
||||
ScriptCompiler::StreamedSource::Encoding encoding;
|
||||
base::SmartPointer<ScriptCompiler::CachedData> cached_data;
|
||||
std::unique_ptr<ScriptCompiler::CachedData> cached_data;
|
||||
|
||||
// Data needed for parsing, and data needed to to be passed between thread
|
||||
// between parsing and compilation. These need to be initialized before the
|
||||
// compilation starts.
|
||||
UnicodeCache unicode_cache;
|
||||
base::SmartPointer<Zone> zone;
|
||||
base::SmartPointer<ParseInfo> info;
|
||||
base::SmartPointer<Parser> parser;
|
||||
std::unique_ptr<Zone> zone;
|
||||
std::unique_ptr<ParseInfo> info;
|
||||
std::unique_ptr<Parser> parser;
|
||||
|
||||
private:
|
||||
// Prevent copying. Not implemented.
|
||||
|
@ -1,104 +0,0 @@
|
||||
// Copyright 2011 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_SMART_POINTERS_H_
|
||||
#define V8_BASE_SMART_POINTERS_H_
|
||||
|
||||
#include "src/base/logging.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace base {
|
||||
|
||||
template <typename Deallocator, typename T>
|
||||
class SmartPointerBase {
|
||||
public:
|
||||
// Default constructor. Constructs an empty scoped pointer.
|
||||
SmartPointerBase() : p_(NULL) {}
|
||||
|
||||
// Constructs a scoped pointer from a plain one.
|
||||
explicit SmartPointerBase(T* ptr) : p_(ptr) {}
|
||||
|
||||
// Copy constructor removes the pointer from the original to avoid double
|
||||
// freeing.
|
||||
SmartPointerBase(const SmartPointerBase<Deallocator, T>& rhs) : p_(rhs.p_) {
|
||||
const_cast<SmartPointerBase<Deallocator, T>&>(rhs).p_ = NULL;
|
||||
}
|
||||
|
||||
T* operator->() const { return p_; }
|
||||
|
||||
T& operator*() const { return *p_; }
|
||||
|
||||
T* get() const { return p_; }
|
||||
|
||||
// You can use [n] to index as if it was a plain pointer.
|
||||
T& operator[](size_t i) { return p_[i]; }
|
||||
|
||||
// You can use [n] to index as if it was a plain pointer.
|
||||
const T& operator[](size_t i) const { return p_[i]; }
|
||||
|
||||
// We don't have implicit conversion to a T* since that hinders migration:
|
||||
// You would not be able to change a method from returning a T* to
|
||||
// returning an SmartArrayPointer<T> and then get errors wherever it is used.
|
||||
|
||||
|
||||
// If you want to take out the plain pointer and don't want it automatically
|
||||
// deleted then call Detach(). Afterwards, the smart pointer is empty
|
||||
// (NULL).
|
||||
T* Detach() {
|
||||
T* temp = p_;
|
||||
p_ = NULL;
|
||||
return temp;
|
||||
}
|
||||
|
||||
void Reset(T* new_value) {
|
||||
DCHECK(p_ == NULL || p_ != new_value);
|
||||
if (p_) Deallocator::Delete(p_);
|
||||
p_ = new_value;
|
||||
}
|
||||
|
||||
// Assignment requires an empty (NULL) SmartArrayPointer as the receiver. Like
|
||||
// the copy constructor it removes the pointer in the original to avoid
|
||||
// double freeing.
|
||||
SmartPointerBase<Deallocator, T>& operator=(
|
||||
const SmartPointerBase<Deallocator, T>& rhs) {
|
||||
DCHECK(is_empty());
|
||||
T* tmp = rhs.p_; // swap to handle self-assignment
|
||||
const_cast<SmartPointerBase<Deallocator, T>&>(rhs).p_ = NULL;
|
||||
p_ = tmp;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool is_empty() const { return p_ == NULL; }
|
||||
|
||||
protected:
|
||||
// When the destructor of the scoped pointer is executed the plain pointer
|
||||
// is deleted using DeleteArray. This implies that you must allocate with
|
||||
// NewArray.
|
||||
~SmartPointerBase() {
|
||||
if (p_) Deallocator::Delete(p_);
|
||||
}
|
||||
|
||||
private:
|
||||
T* p_;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ObjectDeallocator {
|
||||
static void Delete(T* object) { delete object; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class SmartPointer : public SmartPointerBase<ObjectDeallocator<T>, T> {
|
||||
public:
|
||||
SmartPointer() {}
|
||||
explicit SmartPointer(T* ptr)
|
||||
: SmartPointerBase<ObjectDeallocator<T>, T>(ptr) {}
|
||||
SmartPointer(const SmartPointer<T>& rhs)
|
||||
: SmartPointerBase<ObjectDeallocator<T>, T>(rhs) {}
|
||||
};
|
||||
|
||||
} // namespace base
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_SMART_POINTERS_H_
|
@ -773,7 +773,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
|
||||
DCHECK(!isolate->has_pending_exception());
|
||||
PostponeInterruptsScope postpone(isolate);
|
||||
bool use_turbofan = UseTurboFan(shared);
|
||||
base::SmartPointer<CompilationJob> job(
|
||||
std::unique_ptr<CompilationJob> job(
|
||||
use_turbofan ? compiler::Pipeline::NewCompilationJob(function)
|
||||
: new HCompilationJob(function));
|
||||
CompilationInfo* info = job->info();
|
||||
@ -819,7 +819,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
|
||||
|
||||
if (mode == Compiler::CONCURRENT) {
|
||||
if (GetOptimizedCodeLater(job.get())) {
|
||||
job.Detach(); // The background recompile job owns this now.
|
||||
job.release(); // The background recompile job owns this now.
|
||||
return isolate->builtins()->InOptimizationQueue();
|
||||
}
|
||||
} else {
|
||||
@ -1843,7 +1843,7 @@ MaybeHandle<Code> Compiler::GetOptimizedCodeForOSR(Handle<JSFunction> function,
|
||||
|
||||
void Compiler::FinalizeCompilationJob(CompilationJob* raw_job) {
|
||||
// Take ownership of compilation job. Deleting job also tears down the zone.
|
||||
base::SmartPointer<CompilationJob> job(raw_job);
|
||||
std::unique_ptr<CompilationJob> job(raw_job);
|
||||
CompilationInfo* info = job->info();
|
||||
Isolate* isolate = info->isolate();
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define V8_COMPILER_CODE_ASSEMBLER_H_
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
// Clients of this interface shouldn't depend on lots of compiler internals.
|
||||
// Do not include anything from src/compiler here!
|
||||
@ -410,7 +411,7 @@ class CodeAssembler {
|
||||
Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args);
|
||||
Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args);
|
||||
|
||||
base::SmartPointer<RawMachineAssembler> raw_assembler_;
|
||||
std::unique_ptr<RawMachineAssembler> raw_assembler_;
|
||||
Code::Flags flags_;
|
||||
const char* name_;
|
||||
bool code_generated_;
|
||||
|
@ -9,8 +9,6 @@
|
||||
#include <iosfwd>
|
||||
#include <memory>
|
||||
|
||||
#include "src/base/smart-pointers.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
|
@ -14,8 +14,8 @@ namespace compiler {
|
||||
|
||||
void PipelineStatistics::CommonStats::Begin(
|
||||
PipelineStatistics* pipeline_stats) {
|
||||
DCHECK(scope_.is_empty());
|
||||
scope_.Reset(new ZonePool::StatsScope(pipeline_stats->zone_pool_));
|
||||
DCHECK(!scope_);
|
||||
scope_.reset(new ZonePool::StatsScope(pipeline_stats->zone_pool_));
|
||||
timer_.Start();
|
||||
outer_zone_initial_size_ = pipeline_stats->OuterZoneSize();
|
||||
allocated_bytes_at_start_ =
|
||||
@ -28,7 +28,7 @@ void PipelineStatistics::CommonStats::Begin(
|
||||
void PipelineStatistics::CommonStats::End(
|
||||
PipelineStatistics* pipeline_stats,
|
||||
CompilationStatistics::BasicStats* diff) {
|
||||
DCHECK(!scope_.is_empty());
|
||||
DCHECK(scope_);
|
||||
diff->function_name_ = pipeline_stats->function_name_;
|
||||
diff->delta_ = timer_.Elapsed();
|
||||
size_t outer_zone_diff =
|
||||
@ -38,7 +38,7 @@ void PipelineStatistics::CommonStats::End(
|
||||
diff->max_allocated_bytes_ + allocated_bytes_at_start_;
|
||||
diff->total_allocated_bytes_ =
|
||||
outer_zone_diff + scope_->GetTotalAllocatedBytes();
|
||||
scope_.Reset(nullptr);
|
||||
scope_.reset();
|
||||
timer_.Stop();
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
#ifndef V8_COMPILER_PIPELINE_STATISTICS_H_
|
||||
#define V8_COMPILER_PIPELINE_STATISTICS_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "src/base/platform/elapsed-timer.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/compilation-statistics.h"
|
||||
#include "src/compiler/zone-pool.h"
|
||||
|
||||
@ -39,16 +39,19 @@ class PipelineStatistics : public Malloced {
|
||||
void End(PipelineStatistics* pipeline_stats,
|
||||
CompilationStatistics::BasicStats* diff);
|
||||
|
||||
base::SmartPointer<ZonePool::StatsScope> scope_;
|
||||
std::unique_ptr<ZonePool::StatsScope> scope_;
|
||||
base::ElapsedTimer timer_;
|
||||
size_t outer_zone_initial_size_;
|
||||
size_t allocated_bytes_at_start_;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CommonStats);
|
||||
};
|
||||
|
||||
bool InPhaseKind() { return !phase_kind_stats_.scope_.is_empty(); }
|
||||
bool InPhaseKind() { return !!phase_kind_stats_.scope_; }
|
||||
|
||||
friend class PhaseScope;
|
||||
bool InPhase() { return !phase_stats_.scope_.is_empty(); }
|
||||
bool InPhase() { return !!phase_stats_.scope_; }
|
||||
void BeginPhase(const char* name);
|
||||
void EndPhase();
|
||||
|
||||
|
@ -581,10 +581,12 @@ class PipelineCompilationJob final : public CompilationJob {
|
||||
ZonePool zone_pool_;
|
||||
ParseInfo parse_info_;
|
||||
CompilationInfo info_;
|
||||
base::SmartPointer<PipelineStatistics> pipeline_statistics_;
|
||||
std::unique_ptr<PipelineStatistics> pipeline_statistics_;
|
||||
PipelineData data_;
|
||||
PipelineImpl pipeline_;
|
||||
Linkage* linkage_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(PipelineCompilationJob);
|
||||
};
|
||||
|
||||
PipelineCompilationJob::Status PipelineCompilationJob::CreateGraphImpl() {
|
||||
@ -1565,9 +1567,9 @@ Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate,
|
||||
// Construct a pipeline for scheduling and code generation.
|
||||
ZonePool zone_pool(isolate->allocator());
|
||||
PipelineData data(&zone_pool, &info, graph, schedule);
|
||||
base::SmartPointer<PipelineStatistics> pipeline_statistics;
|
||||
std::unique_ptr<PipelineStatistics> pipeline_statistics;
|
||||
if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) {
|
||||
pipeline_statistics.Reset(new PipelineStatistics(&info, &zone_pool));
|
||||
pipeline_statistics.reset(new PipelineStatistics(&info, &zone_pool));
|
||||
pipeline_statistics->BeginPhaseKind("stub codegen");
|
||||
}
|
||||
|
||||
@ -1590,7 +1592,7 @@ Handle<Code> Pipeline::GenerateCodeForCodeStub(Isolate* isolate,
|
||||
// static
|
||||
Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info) {
|
||||
ZonePool zone_pool(info->isolate()->allocator());
|
||||
base::SmartPointer<PipelineStatistics> pipeline_statistics(
|
||||
std::unique_ptr<PipelineStatistics> pipeline_statistics(
|
||||
CreatePipelineStatistics(info, &zone_pool));
|
||||
PipelineData data(&zone_pool, info, pipeline_statistics.get());
|
||||
PipelineImpl pipeline(&data);
|
||||
@ -1619,9 +1621,9 @@ Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info,
|
||||
// Construct a pipeline for scheduling and code generation.
|
||||
ZonePool zone_pool(info->isolate()->allocator());
|
||||
PipelineData data(&zone_pool, info, graph, schedule);
|
||||
base::SmartPointer<PipelineStatistics> pipeline_statistics;
|
||||
std::unique_ptr<PipelineStatistics> pipeline_statistics;
|
||||
if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) {
|
||||
pipeline_statistics.Reset(new PipelineStatistics(info, &zone_pool));
|
||||
pipeline_statistics.reset(new PipelineStatistics(info, &zone_pool));
|
||||
pipeline_statistics->BeginPhaseKind("test codegen");
|
||||
}
|
||||
|
||||
@ -1788,10 +1790,10 @@ void PipelineImpl::AllocateRegisters(const RegisterConfiguration* config,
|
||||
bool run_verifier) {
|
||||
PipelineData* data = this->data_;
|
||||
// Don't track usage for this zone in compiler stats.
|
||||
base::SmartPointer<Zone> verifier_zone;
|
||||
std::unique_ptr<Zone> verifier_zone;
|
||||
RegisterAllocatorVerifier* verifier = nullptr;
|
||||
if (run_verifier) {
|
||||
verifier_zone.Reset(new Zone(isolate()->allocator()));
|
||||
verifier_zone.reset(new Zone(isolate()->allocator()));
|
||||
verifier = new (verifier_zone.get()) RegisterAllocatorVerifier(
|
||||
verifier_zone.get(), config, data->sequence());
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "src/compiler/wasm-compiler.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/isolate-inl.h"
|
||||
|
||||
#include "src/base/platform/elapsed-timer.h"
|
||||
@ -3379,7 +3381,7 @@ void WasmCompilationUnit::ExecuteCompilation() {
|
||||
double decode_ms = 0;
|
||||
size_t node_count = 0;
|
||||
|
||||
base::SmartPointer<Zone> graph_zone(graph_zone_.Detach());
|
||||
std::unique_ptr<Zone> graph_zone(graph_zone_.release());
|
||||
SourcePositionTable* source_positions = BuildGraphForWasmFunction(&decode_ms);
|
||||
|
||||
if (graph_construction_result_.failed()) {
|
||||
@ -3400,7 +3402,7 @@ void WasmCompilationUnit::ExecuteCompilation() {
|
||||
descriptor =
|
||||
module_env_->GetI32WasmCallDescriptor(&compilation_zone_, descriptor);
|
||||
}
|
||||
job_.Reset(Pipeline::NewWasmCompilationJob(&info_, jsgraph_->graph(),
|
||||
job_.reset(Pipeline::NewWasmCompilationJob(&info_, jsgraph_->graph(),
|
||||
descriptor, source_positions));
|
||||
|
||||
// The function name {OptimizeGraph()} is misleading but necessary because we
|
||||
|
@ -5,6 +5,8 @@
|
||||
#ifndef V8_COMPILER_WASM_COMPILER_H_
|
||||
#define V8_COMPILER_WASM_COMPILER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
// Clients of this interface shouldn't depend on lots of compiler internals.
|
||||
// Do not include anything from src/compiler here!
|
||||
#include "src/compiler.h"
|
||||
@ -67,14 +69,16 @@ class WasmCompilationUnit final {
|
||||
wasm::ModuleEnv* module_env_;
|
||||
const wasm::WasmFunction* function_;
|
||||
// The graph zone is deallocated at the end of ExecuteCompilation.
|
||||
base::SmartPointer<Zone> graph_zone_;
|
||||
std::unique_ptr<Zone> graph_zone_;
|
||||
JSGraph* jsgraph_;
|
||||
Zone compilation_zone_;
|
||||
CompilationInfo info_;
|
||||
base::SmartPointer<CompilationJob> job_;
|
||||
std::unique_ptr<CompilationJob> job_;
|
||||
uint32_t index_;
|
||||
wasm::Result<wasm::DecodeStruct*> graph_construction_result_;
|
||||
bool ok_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WasmCompilationUnit);
|
||||
};
|
||||
|
||||
// Wraps a JS function, producing a code object that can be called from WASM.
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "src/debug/debug-scopes.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/ast/scopes.h"
|
||||
#include "src/compiler.h"
|
||||
#include "src/debug/debug.h"
|
||||
@ -85,11 +87,11 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector,
|
||||
// Reparse the code and analyze the scopes.
|
||||
// Check whether we are in global, eval or function code.
|
||||
Zone zone(isolate->allocator());
|
||||
base::SmartPointer<ParseInfo> info;
|
||||
std::unique_ptr<ParseInfo> info;
|
||||
if (scope_info->scope_type() != FUNCTION_SCOPE) {
|
||||
// Global or eval code.
|
||||
Handle<Script> script(Script::cast(shared_info->script()));
|
||||
info.Reset(new ParseInfo(&zone, script));
|
||||
info.reset(new ParseInfo(&zone, script));
|
||||
info->set_toplevel();
|
||||
if (scope_info->scope_type() == SCRIPT_SCOPE) {
|
||||
info->set_global();
|
||||
@ -103,7 +105,7 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector,
|
||||
}
|
||||
} else {
|
||||
// Inner function.
|
||||
info.Reset(new ParseInfo(&zone, function));
|
||||
info.reset(new ParseInfo(&zone, function));
|
||||
}
|
||||
Scope* scope = NULL;
|
||||
if (Compiler::ParseAndAnalyze(info.get())) scope = info->literal()->scope();
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "src/debug/debug.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/api.h"
|
||||
#include "src/arguments.h"
|
||||
#include "src/bootstrapper.h"
|
||||
@ -241,7 +243,7 @@ BreakLocation BreakLocation::BytecodeArrayIterator::GetBreakLocation() {
|
||||
// the address.
|
||||
BreakLocation BreakLocation::FromCodeOffset(Handle<DebugInfo> debug_info,
|
||||
int offset) {
|
||||
base::SmartPointer<Iterator> it(GetIterator(debug_info));
|
||||
std::unique_ptr<Iterator> it(GetIterator(debug_info));
|
||||
it->SkipTo(BreakIndexFromCodeOffset(debug_info, offset));
|
||||
return it->GetBreakLocation();
|
||||
}
|
||||
@ -257,7 +259,7 @@ BreakLocation BreakLocation::FromFrame(Handle<DebugInfo> debug_info,
|
||||
void BreakLocation::AllForStatementPosition(Handle<DebugInfo> debug_info,
|
||||
int statement_position,
|
||||
List<BreakLocation>* result_out) {
|
||||
for (base::SmartPointer<Iterator> it(GetIterator(debug_info)); !it->Done();
|
||||
for (std::unique_ptr<Iterator> it(GetIterator(debug_info)); !it->Done();
|
||||
it->Next()) {
|
||||
if (it->statement_position() == statement_position) {
|
||||
result_out->Add(it->GetBreakLocation());
|
||||
@ -271,7 +273,7 @@ int BreakLocation::BreakIndexFromCodeOffset(Handle<DebugInfo> debug_info,
|
||||
int closest_break = 0;
|
||||
int distance = kMaxInt;
|
||||
DCHECK(0 <= offset && offset < debug_info->abstract_code()->Size());
|
||||
for (base::SmartPointer<Iterator> it(GetIterator(debug_info)); !it->Done();
|
||||
for (std::unique_ptr<Iterator> it(GetIterator(debug_info)); !it->Done();
|
||||
it->Next()) {
|
||||
// Check if this break point is closer that what was previously found.
|
||||
if (it->code_offset() <= offset && offset - it->code_offset() < distance) {
|
||||
@ -291,7 +293,7 @@ BreakLocation BreakLocation::FromPosition(Handle<DebugInfo> debug_info,
|
||||
// Run through all break points to locate the one closest to the source
|
||||
// position.
|
||||
int distance = kMaxInt;
|
||||
base::SmartPointer<Iterator> it(GetIterator(debug_info));
|
||||
std::unique_ptr<Iterator> it(GetIterator(debug_info));
|
||||
BreakLocation closest_break = it->GetBreakLocation();
|
||||
while (!it->Done()) {
|
||||
int next_position;
|
||||
@ -851,7 +853,7 @@ void Debug::ClearBreakPoint(Handle<Object> break_point_object) {
|
||||
void Debug::ClearAllBreakPoints() {
|
||||
for (DebugInfoListNode* node = debug_info_list_; node != NULL;
|
||||
node = node->next()) {
|
||||
for (base::SmartPointer<BreakLocation::Iterator> it(
|
||||
for (std::unique_ptr<BreakLocation::Iterator> it(
|
||||
BreakLocation::GetIterator(node->debug_info()));
|
||||
!it->Done(); it->Next()) {
|
||||
it->GetBreakLocation().ClearDebugBreak();
|
||||
@ -885,7 +887,7 @@ void Debug::FloodWithOneShot(Handle<JSFunction> function,
|
||||
|
||||
// Flood the function with break points.
|
||||
Handle<DebugInfo> debug_info(shared->GetDebugInfo());
|
||||
for (base::SmartPointer<BreakLocation::Iterator> it(
|
||||
for (std::unique_ptr<BreakLocation::Iterator> it(
|
||||
BreakLocation::GetIterator(debug_info, type));
|
||||
!it->Done(); it->Next()) {
|
||||
it->GetBreakLocation().SetOneShot();
|
||||
@ -1127,7 +1129,7 @@ void Debug::ClearOneShot() {
|
||||
// removed from the list.
|
||||
for (DebugInfoListNode* node = debug_info_list_; node != NULL;
|
||||
node = node->next()) {
|
||||
for (base::SmartPointer<BreakLocation::Iterator> it(
|
||||
for (std::unique_ptr<BreakLocation::Iterator> it(
|
||||
BreakLocation::GetIterator(node->debug_info()));
|
||||
!it->Done(); it->Next()) {
|
||||
it->GetBreakLocation().ClearOneShot();
|
||||
|
@ -6,11 +6,11 @@
|
||||
#define V8_FAST_ACCESSOR_ASSEMBLER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "include/v8-experimental.h"
|
||||
#include "src/base/macros.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/handles.h"
|
||||
|
||||
// For CodeStubAssembler::Label. (We cannot forward-declare inner classes.)
|
||||
@ -83,7 +83,7 @@ class FastAccessorAssembler {
|
||||
|
||||
Zone zone_;
|
||||
Isolate* isolate_;
|
||||
base::SmartPointer<CodeStubAssembler> assembler_;
|
||||
std::unique_ptr<CodeStubAssembler> assembler_;
|
||||
|
||||
// To prevent exposing the RMA internals to the outside world, we'll map
|
||||
// Node + Label pointers integers wrapped in ValueId and LabelId instances.
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define V8_HEAP_SPACES_H_
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
#include "src/allocation.h"
|
||||
#include "src/base/atomic-utils.h"
|
||||
@ -935,7 +936,7 @@ class Space : public Malloced {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
v8::base::SmartPointer<List<AllocationObserver*>> allocation_observers_;
|
||||
std::unique_ptr<List<AllocationObserver*>> allocation_observers_;
|
||||
bool allocation_observers_paused_;
|
||||
|
||||
private:
|
||||
@ -946,6 +947,8 @@ class Space : public Malloced {
|
||||
// Keeps track of committed memory in a space.
|
||||
intptr_t committed_;
|
||||
intptr_t max_committed_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Space);
|
||||
};
|
||||
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#define V8_INTERPRETER_INTERPRETER_ASSEMBLER_H_
|
||||
|
||||
#include "src/allocation.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/code-stub-assembler.h"
|
||||
#include "src/frames.h"
|
||||
|
@ -6,7 +6,6 @@
|
||||
#define V8_INTERPRETER_INTERPRETER_INTRINSICS_H_
|
||||
|
||||
#include "src/allocation.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/frames.h"
|
||||
#include "src/interpreter/bytecodes.h"
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/handles.h"
|
||||
#include "src/list.h"
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#if V8_TARGET_ARCH_MIPS
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/codegen.h"
|
||||
#include "src/macro-assembler.h"
|
||||
#include "src/mips/simulator-mips.h"
|
||||
@ -1051,7 +1053,7 @@ CodeAgingHelper::CodeAgingHelper(Isolate* isolate) {
|
||||
// to avoid overloading the stack in stress conditions.
|
||||
// DONT_FLUSH is used because the CodeAgingHelper is initialized early in
|
||||
// the process, before MIPS simulator ICache is setup.
|
||||
base::SmartPointer<CodePatcher> patcher(
|
||||
std::unique_ptr<CodePatcher> patcher(
|
||||
new CodePatcher(isolate, young_sequence_.start(),
|
||||
young_sequence_.length() / Assembler::kInstrSize,
|
||||
CodePatcher::DONT_FLUSH));
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#if V8_TARGET_ARCH_MIPS64
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/codegen.h"
|
||||
#include "src/macro-assembler.h"
|
||||
#include "src/mips64/simulator-mips64.h"
|
||||
@ -1050,7 +1052,7 @@ CodeAgingHelper::CodeAgingHelper(Isolate* isolate) {
|
||||
// to avoid overloading the stack in stress conditions.
|
||||
// DONT_FLUSH is used because the CodeAgingHelper is initialized early in
|
||||
// the process, before MIPS simulator ICache is setup.
|
||||
base::SmartPointer<CodePatcher> patcher(
|
||||
std::unique_ptr<CodePatcher> patcher(
|
||||
new CodePatcher(isolate, young_sequence_.start(),
|
||||
young_sequence_.length() / Assembler::kInstrSize,
|
||||
CodePatcher::DONT_FLUSH));
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "src/bailout-reason.h"
|
||||
#include "src/base/bits.h"
|
||||
#include "src/base/flags.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/checks.h"
|
||||
#include "src/elements-kind.h"
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#if V8_TARGET_ARCH_PPC
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/codegen.h"
|
||||
#include "src/macro-assembler.h"
|
||||
#include "src/ppc/simulator-ppc.h"
|
||||
@ -466,7 +468,7 @@ CodeAgingHelper::CodeAgingHelper(Isolate* isolate) {
|
||||
// to avoid overloading the stack in stress conditions.
|
||||
// DONT_FLUSH is used because the CodeAgingHelper is initialized early in
|
||||
// the process, before ARM simulator ICache is setup.
|
||||
base::SmartPointer<CodePatcher> patcher(
|
||||
std::unique_ptr<CodePatcher> patcher(
|
||||
new CodePatcher(isolate, young_sequence_.start(),
|
||||
young_sequence_.length() / Assembler::kInstrSize,
|
||||
CodePatcher::DONT_FLUSH));
|
||||
|
@ -34,7 +34,7 @@ HeapProfiler::~HeapProfiler() {
|
||||
void HeapProfiler::DeleteAllSnapshots() {
|
||||
snapshots_.Iterate(DeleteHeapSnapshot);
|
||||
snapshots_.Clear();
|
||||
names_.Reset(new StringsStorage(heap()));
|
||||
names_.reset(new StringsStorage(heap()));
|
||||
}
|
||||
|
||||
|
||||
@ -90,14 +90,14 @@ bool HeapProfiler::StartSamplingHeapProfiler(
|
||||
if (sampling_heap_profiler_.get()) {
|
||||
return false;
|
||||
}
|
||||
sampling_heap_profiler_.Reset(new SamplingHeapProfiler(
|
||||
sampling_heap_profiler_.reset(new SamplingHeapProfiler(
|
||||
heap(), names_.get(), sample_interval, stack_depth, flags));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void HeapProfiler::StopSamplingHeapProfiler() {
|
||||
sampling_heap_profiler_.Reset(nullptr);
|
||||
sampling_heap_profiler_.reset();
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ void HeapProfiler::StartHeapObjectsTracking(bool track_allocations) {
|
||||
is_tracking_object_moves_ = true;
|
||||
DCHECK(!is_tracking_allocations());
|
||||
if (track_allocations) {
|
||||
allocation_tracker_.Reset(new AllocationTracker(ids_.get(), names_.get()));
|
||||
allocation_tracker_.reset(new AllocationTracker(ids_.get(), names_.get()));
|
||||
heap()->DisableInlineAllocation();
|
||||
heap()->isolate()->debug()->feature_tracker()->Track(
|
||||
DebugFeatureTracker::kAllocationTracking);
|
||||
@ -132,7 +132,7 @@ SnapshotObjectId HeapProfiler::PushHeapObjectsStats(OutputStream* stream,
|
||||
void HeapProfiler::StopHeapObjectsTracking() {
|
||||
ids_->StopHeapObjectsTracking();
|
||||
if (is_tracking_allocations()) {
|
||||
allocation_tracker_.Reset(NULL);
|
||||
allocation_tracker_.reset();
|
||||
heap()->EnableInlineAllocation();
|
||||
}
|
||||
}
|
||||
@ -170,7 +170,7 @@ SnapshotObjectId HeapProfiler::GetSnapshotObjectId(Handle<Object> obj) {
|
||||
void HeapProfiler::ObjectMoveEvent(Address from, Address to, int size) {
|
||||
base::LockGuard<base::Mutex> guard(&profiler_mutex_);
|
||||
bool known_object = ids_->MoveObject(from, to, size);
|
||||
if (!known_object && !allocation_tracker_.is_empty()) {
|
||||
if (!known_object && allocation_tracker_) {
|
||||
allocation_tracker_->address_to_trace()->MoveObject(from, to, size);
|
||||
}
|
||||
}
|
||||
@ -178,7 +178,7 @@ void HeapProfiler::ObjectMoveEvent(Address from, Address to, int size) {
|
||||
|
||||
void HeapProfiler::AllocationEvent(Address addr, int size) {
|
||||
DisallowHeapAllocation no_allocation;
|
||||
if (!allocation_tracker_.is_empty()) {
|
||||
if (allocation_tracker_) {
|
||||
allocation_tracker_->AllocationEvent(addr, size);
|
||||
}
|
||||
}
|
||||
@ -214,7 +214,7 @@ Handle<HeapObject> HeapProfiler::FindHeapObjectById(SnapshotObjectId id) {
|
||||
|
||||
|
||||
void HeapProfiler::ClearHeapObjectMap() {
|
||||
ids_.Reset(new HeapObjectsMap(heap()));
|
||||
ids_.reset(new HeapObjectsMap(heap()));
|
||||
if (!is_tracking_allocations()) is_tracking_object_moves_ = false;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,8 @@
|
||||
#ifndef V8_PROFILER_HEAP_PROFILER_H_
|
||||
#define V8_PROFILER_HEAP_PROFILER_H_
|
||||
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include <memory>
|
||||
|
||||
#include "src/isolate.h"
|
||||
#include "src/list.h"
|
||||
|
||||
@ -33,7 +34,7 @@ class HeapProfiler {
|
||||
bool StartSamplingHeapProfiler(uint64_t sample_interval, int stack_depth,
|
||||
v8::HeapProfiler::SamplingFlags);
|
||||
void StopSamplingHeapProfiler();
|
||||
bool is_sampling_allocations() { return !sampling_heap_profiler_.is_empty(); }
|
||||
bool is_sampling_allocations() { return !!sampling_heap_profiler_; }
|
||||
AllocationProfile* GetAllocationProfile();
|
||||
|
||||
void StartHeapObjectsTracking(bool track_allocations);
|
||||
@ -66,9 +67,7 @@ class HeapProfiler {
|
||||
void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);
|
||||
|
||||
bool is_tracking_object_moves() const { return is_tracking_object_moves_; }
|
||||
bool is_tracking_allocations() const {
|
||||
return !allocation_tracker_.is_empty();
|
||||
}
|
||||
bool is_tracking_allocations() const { return !!allocation_tracker_; }
|
||||
|
||||
Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id);
|
||||
void ClearHeapObjectMap();
|
||||
@ -79,14 +78,16 @@ class HeapProfiler {
|
||||
Heap* heap() const;
|
||||
|
||||
// Mapping from HeapObject addresses to objects' uids.
|
||||
base::SmartPointer<HeapObjectsMap> ids_;
|
||||
std::unique_ptr<HeapObjectsMap> ids_;
|
||||
List<HeapSnapshot*> snapshots_;
|
||||
base::SmartPointer<StringsStorage> names_;
|
||||
std::unique_ptr<StringsStorage> names_;
|
||||
List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
|
||||
base::SmartPointer<AllocationTracker> allocation_tracker_;
|
||||
std::unique_ptr<AllocationTracker> allocation_tracker_;
|
||||
bool is_tracking_object_moves_;
|
||||
base::Mutex profiler_mutex_;
|
||||
base::SmartPointer<SamplingHeapProfiler> sampling_heap_profiler_;
|
||||
std::unique_ptr<SamplingHeapProfiler> sampling_heap_profiler_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(HeapProfiler);
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include "include/v8-profiler.h"
|
||||
#include "src/heap/heap.h"
|
||||
@ -141,8 +142,8 @@ class SamplingHeapProfiler {
|
||||
|
||||
Isolate* const isolate_;
|
||||
Heap* const heap_;
|
||||
base::SmartPointer<SamplingAllocationObserver> new_space_observer_;
|
||||
base::SmartPointer<SamplingAllocationObserver> other_spaces_observer_;
|
||||
std::unique_ptr<SamplingAllocationObserver> new_space_observer_;
|
||||
std::unique_ptr<SamplingAllocationObserver> other_spaces_observer_;
|
||||
StringsStorage* const names_;
|
||||
AllocationNode profile_root_;
|
||||
std::set<Sample*> samples_;
|
||||
@ -151,6 +152,8 @@ class SamplingHeapProfiler {
|
||||
v8::HeapProfiler::SamplingFlags flags_;
|
||||
|
||||
friend class SamplingAllocationObserver;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(SamplingHeapProfiler);
|
||||
};
|
||||
|
||||
class SamplingAllocationObserver : public AllocationObserver {
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/objects-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
|
@ -805,7 +805,7 @@ namespace {
|
||||
void ConvertCaseWithTransliterator(icu::UnicodeString* input,
|
||||
const char* transliterator_id) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
base::SmartPointer<icu::Transliterator> translit(
|
||||
std::unique_ptr<icu::Transliterator> translit(
|
||||
icu::Transliterator::createInstance(
|
||||
icu::UnicodeString(transliterator_id, -1, US_INV), UTRANS_FORWARD,
|
||||
status));
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "src/runtime/runtime-utils.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/arguments.h"
|
||||
#include "src/ast/prettyprinter.h"
|
||||
#include "src/bootstrapper.h"
|
||||
@ -431,7 +433,7 @@ Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) {
|
||||
MessageLocation location;
|
||||
if (ComputeLocation(isolate, &location)) {
|
||||
Zone zone(isolate->allocator());
|
||||
base::SmartPointer<ParseInfo> info(
|
||||
std::unique_ptr<ParseInfo> info(
|
||||
location.function()->shared()->is_function()
|
||||
? new ParseInfo(&zone, location.function())
|
||||
: new ParseInfo(&zone, location.script()));
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#if V8_TARGET_ARCH_S390
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/codegen.h"
|
||||
#include "src/macro-assembler.h"
|
||||
#include "src/s390/simulator-s390.h"
|
||||
@ -466,7 +468,7 @@ CodeAgingHelper::CodeAgingHelper(Isolate* isolate) {
|
||||
// to avoid overloading the stack in stress conditions.
|
||||
// DONT_FLUSH is used because the CodeAgingHelper is initialized early in
|
||||
// the process, before ARM simulator ICache is setup.
|
||||
base::SmartPointer<CodePatcher> patcher(
|
||||
std::unique_ptr<CodePatcher> patcher(
|
||||
new CodePatcher(isolate, young_sequence_.start(),
|
||||
young_sequence_.length(), CodePatcher::DONT_FLUSH));
|
||||
PredictableCodeSizeScope scope(patcher->masm(), young_sequence_.length());
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "src/snapshot/code-serializer.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/code-stubs.h"
|
||||
#include "src/log.h"
|
||||
#include "src/macro-assembler.h"
|
||||
@ -154,9 +156,9 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
|
||||
|
||||
HandleScope scope(isolate);
|
||||
|
||||
base::SmartPointer<SerializedCodeData> scd(
|
||||
std::unique_ptr<SerializedCodeData> scd(
|
||||
SerializedCodeData::FromCachedData(isolate, cached_data, *source));
|
||||
if (scd.is_empty()) {
|
||||
if (!scd) {
|
||||
if (FLAG_profile_deserialization) PrintF("[Cached code failed check]\n");
|
||||
DCHECK(cached_data->rejected());
|
||||
return MaybeHandle<SharedFunctionInfo>();
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <memory>
|
||||
|
||||
#include "src/allocation.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/handles.h"
|
||||
#include "src/vector.h"
|
||||
|
||||
|
@ -1780,7 +1780,6 @@
|
||||
'base/safe_conversions_impl.h',
|
||||
'base/safe_math.h',
|
||||
'base/safe_math_impl.h',
|
||||
'base/smart-pointers.h',
|
||||
'base/sys-info.cc',
|
||||
'base/sys-info.h',
|
||||
'base/utils/random-number-generator.cc',
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <memory>
|
||||
|
||||
#include "src/base/compiler-specific.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/flags.h"
|
||||
#include "src/signature.h"
|
||||
#include "src/utils.h"
|
||||
|
@ -8,8 +8,6 @@
|
||||
#include "src/signature.h"
|
||||
#include "src/zone-containers.h"
|
||||
|
||||
#include "src/base/smart-pointers.h"
|
||||
|
||||
#include "src/wasm/leb-helper.h"
|
||||
#include "src/wasm/wasm-macro-gen.h"
|
||||
#include "src/wasm/wasm-module.h"
|
||||
|
@ -5,6 +5,8 @@
|
||||
#ifndef V8_WASM_MODULE_H_
|
||||
#define V8_WASM_MODULE_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/api.h"
|
||||
#include "src/handles.h"
|
||||
#include "src/wasm/wasm-opcodes.h"
|
||||
@ -188,7 +190,7 @@ struct WasmModule {
|
||||
// invalid-semaphore error in the compilation tasks.
|
||||
// TODO(wasm): Move this semaphore back to CompileInParallel when the try bots
|
||||
// switch to libc-2.21 or higher.
|
||||
base::SmartPointer<base::Semaphore> pending_tasks;
|
||||
std::unique_ptr<base::Semaphore> pending_tasks;
|
||||
|
||||
WasmModule() : WasmModule(nullptr) {}
|
||||
explicit WasmModule(byte* module_start);
|
||||
@ -243,6 +245,9 @@ struct WasmModule {
|
||||
DCHECK_LE(function_table.size(), UINT32_MAX);
|
||||
return static_cast<uint32_t>(function_table.size());
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(WasmModule);
|
||||
};
|
||||
|
||||
// An instantiated WASM module, including memory, function table, etc.
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <memory>
|
||||
|
||||
#include "src/base/compiler-specific.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
|
||||
#include "src/handles.h"
|
||||
#include "src/globals.h"
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "include/v8.h"
|
||||
|
||||
#include "src/base/logging.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/compiler.h"
|
||||
#include "src/runtime/runtime.h"
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "test/cctest/interpreter/bytecode-expectations-printer.h"
|
||||
@ -12,7 +13,6 @@
|
||||
#include "include/v8.h"
|
||||
|
||||
#include "src/base/logging.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/compiler.h"
|
||||
#include "src/interpreter/interpreter.h"
|
||||
|
||||
@ -102,8 +102,8 @@ class V8InitializationScope final {
|
||||
v8::Isolate* isolate() const { return isolate_; }
|
||||
|
||||
private:
|
||||
v8::base::SmartPointer<v8::Platform> platform_;
|
||||
v8::base::SmartPointer<v8::ArrayBuffer::Allocator> allocator_;
|
||||
std::unique_ptr<v8::Platform> platform_;
|
||||
std::unique_ptr<v8::ArrayBuffer::Allocator> allocator_;
|
||||
v8::Isolate* isolate_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(V8InitializationScope);
|
||||
@ -354,7 +354,7 @@ V8InitializationScope::V8InitializationScope(const char* exec_path)
|
||||
v8::V8::Initialize();
|
||||
|
||||
v8::Isolate::CreateParams create_params;
|
||||
allocator_.Reset(v8::ArrayBuffer::Allocator::NewDefaultAllocator());
|
||||
allocator_.reset(v8::ArrayBuffer::Allocator::NewDefaultAllocator());
|
||||
create_params.array_buffer_allocator = allocator_.get();
|
||||
|
||||
isolate_ = v8::Isolate::New(create_params);
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "src/api.h"
|
||||
#include "src/arguments.h"
|
||||
#include "src/base/platform/platform.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/code-stubs.h"
|
||||
#include "src/compilation-cache.h"
|
||||
#include "src/debug/debug.h"
|
||||
|
@ -2914,9 +2914,9 @@ TEST(SamplingHeapProfiler) {
|
||||
heap_profiler->StartSamplingHeapProfiler(1024);
|
||||
CompileRun(script_source);
|
||||
|
||||
v8::base::SmartPointer<v8::AllocationProfile> profile(
|
||||
std::unique_ptr<v8::AllocationProfile> profile(
|
||||
heap_profiler->GetAllocationProfile());
|
||||
CHECK(!profile.is_empty());
|
||||
CHECK(profile);
|
||||
|
||||
const char* names[] = {"", "foo", "bar"};
|
||||
auto node_bar = FindAllocationProfileNode(*profile, ArrayVector(names));
|
||||
@ -2941,9 +2941,9 @@ TEST(SamplingHeapProfiler) {
|
||||
heap_profiler->StartSamplingHeapProfiler(128);
|
||||
CompileRun(script_source);
|
||||
|
||||
v8::base::SmartPointer<v8::AllocationProfile> profile(
|
||||
std::unique_ptr<v8::AllocationProfile> profile(
|
||||
heap_profiler->GetAllocationProfile());
|
||||
CHECK(!profile.is_empty());
|
||||
CHECK(profile);
|
||||
|
||||
const char* names[] = {"", "foo", "bar"};
|
||||
auto node_bar = FindAllocationProfileNode(*profile, ArrayVector(names));
|
||||
@ -2975,9 +2975,9 @@ TEST(SamplingHeapProfiler) {
|
||||
heap_profiler->StartSamplingHeapProfiler(64);
|
||||
CompileRun(record_trace_tree_source);
|
||||
|
||||
v8::base::SmartPointer<v8::AllocationProfile> profile(
|
||||
std::unique_ptr<v8::AllocationProfile> profile(
|
||||
heap_profiler->GetAllocationProfile());
|
||||
CHECK(!profile.is_empty());
|
||||
CHECK(profile);
|
||||
|
||||
const char* names1[] = {"", "start", "f_0_0", "f_0_1", "f_0_2"};
|
||||
auto node1 = FindAllocationProfileNode(*profile, ArrayVector(names1));
|
||||
@ -3000,9 +3000,9 @@ TEST(SamplingHeapProfiler) {
|
||||
|
||||
CcTest::heap()->CollectAllGarbage();
|
||||
|
||||
v8::base::SmartPointer<v8::AllocationProfile> profile(
|
||||
std::unique_ptr<v8::AllocationProfile> profile(
|
||||
heap_profiler->GetAllocationProfile());
|
||||
CHECK(!profile.is_empty());
|
||||
CHECK(profile);
|
||||
|
||||
CheckNoZeroCountNodes(profile->GetRootNode());
|
||||
|
||||
@ -3023,9 +3023,9 @@ TEST(SamplingHeapProfilerApiAllocation) {
|
||||
|
||||
for (int i = 0; i < 8 * 1024; ++i) v8::Object::New(env->GetIsolate());
|
||||
|
||||
v8::base::SmartPointer<v8::AllocationProfile> profile(
|
||||
std::unique_ptr<v8::AllocationProfile> profile(
|
||||
heap_profiler->GetAllocationProfile());
|
||||
CHECK(!profile.is_empty());
|
||||
CHECK(profile);
|
||||
const char* names[] = {"(V8 API)"};
|
||||
auto node = FindAllocationProfileNode(*profile, ArrayVector(names));
|
||||
CHECK(node);
|
||||
|
@ -27,11 +27,12 @@
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/v8.h"
|
||||
|
||||
#include "src/api.h"
|
||||
#include "src/base/platform/platform.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/compilation-cache.h"
|
||||
#include "src/execution.h"
|
||||
#include "src/isolate.h"
|
||||
@ -100,7 +101,7 @@ TEST(KangarooIsolates) {
|
||||
v8::Isolate::CreateParams create_params;
|
||||
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
|
||||
v8::Isolate* isolate = v8::Isolate::New(create_params);
|
||||
v8::base::SmartPointer<KangarooThread> thread1;
|
||||
std::unique_ptr<KangarooThread> thread1;
|
||||
{
|
||||
v8::Locker locker(isolate);
|
||||
v8::Isolate::Scope isolate_scope(isolate);
|
||||
@ -109,7 +110,7 @@ TEST(KangarooIsolates) {
|
||||
v8::Context::Scope context_scope(context);
|
||||
CHECK_EQ(isolate, v8::Isolate::GetCurrent());
|
||||
CompileRun("function getValue() { return 30; }");
|
||||
thread1.Reset(new KangarooThread(isolate, context));
|
||||
thread1.reset(new KangarooThread(isolate, context));
|
||||
}
|
||||
thread1->Start();
|
||||
thread1->Join();
|
||||
@ -465,8 +466,7 @@ class LockAndUnlockDifferentIsolatesThread : public JoinableThread {
|
||||
}
|
||||
|
||||
virtual void Run() {
|
||||
v8::base::SmartPointer<LockIsolateAndCalculateFibSharedContextThread>
|
||||
thread;
|
||||
std::unique_ptr<LockIsolateAndCalculateFibSharedContextThread> thread;
|
||||
v8::Locker lock1(isolate1_);
|
||||
CHECK(v8::Locker::IsLocked(isolate1_));
|
||||
CHECK(!v8::Locker::IsLocked(isolate2_));
|
||||
@ -478,8 +478,8 @@ class LockAndUnlockDifferentIsolatesThread : public JoinableThread {
|
||||
v8::Context::Scope context_scope(context1);
|
||||
CalcFibAndCheck(context1);
|
||||
}
|
||||
thread.Reset(new LockIsolateAndCalculateFibSharedContextThread(
|
||||
isolate1_, context1));
|
||||
thread.reset(new LockIsolateAndCalculateFibSharedContextThread(isolate1_,
|
||||
context1));
|
||||
}
|
||||
v8::Locker lock2(isolate2_);
|
||||
CHECK(v8::Locker::IsLocked(isolate1_));
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/base/accounting-allocator.h"
|
||||
#include "src/base/utils/random-number-generator.h"
|
||||
|
||||
@ -540,7 +542,7 @@ class WasmFunctionCompiler : public HandleAndZoneScope,
|
||||
}
|
||||
CompilationInfo info(debug_name_, this->isolate(), this->zone(),
|
||||
Code::ComputeFlags(Code::WASM_FUNCTION));
|
||||
v8::base::SmartPointer<CompilationJob> job(Pipeline::NewWasmCompilationJob(
|
||||
std::unique_ptr<CompilationJob> job(Pipeline::NewWasmCompilationJob(
|
||||
&info, graph(), desc, &source_position_table_));
|
||||
if (job->OptimizeGraph() != CompilationJob::SUCCEEDED ||
|
||||
job->GenerateCode() != CompilationJob::SUCCEEDED)
|
||||
|
@ -55,7 +55,7 @@ InstructionSequenceTest::InstructionSequenceTest()
|
||||
|
||||
void InstructionSequenceTest::SetNumRegs(int num_general_registers,
|
||||
int num_double_registers) {
|
||||
CHECK(config_.is_empty());
|
||||
CHECK(!config_);
|
||||
CHECK(instructions_.empty());
|
||||
CHECK(instruction_blocks_.empty());
|
||||
num_general_registers_ = num_general_registers;
|
||||
@ -64,8 +64,8 @@ void InstructionSequenceTest::SetNumRegs(int num_general_registers,
|
||||
|
||||
|
||||
RegisterConfiguration* InstructionSequenceTest::config() {
|
||||
if (config_.is_empty()) {
|
||||
config_.Reset(new RegisterConfiguration(
|
||||
if (!config_) {
|
||||
config_.reset(new RegisterConfiguration(
|
||||
num_general_registers_, num_double_registers_, num_general_registers_,
|
||||
num_double_registers_, allocatable_codes, allocatable_double_codes,
|
||||
kSimpleFPAliasing ? RegisterConfiguration::OVERLAP
|
||||
|
@ -5,6 +5,8 @@
|
||||
#ifndef V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_
|
||||
#define V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/compiler/instruction.h"
|
||||
#include "test/unittests/test-utils.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
@ -229,7 +231,7 @@ class InstructionSequenceTest : public TestWithIsolateAndZone {
|
||||
typedef std::map<int, const Instruction*> Instructions;
|
||||
typedef std::vector<BlockCompletion> Completions;
|
||||
|
||||
base::SmartPointer<RegisterConfiguration> config_;
|
||||
std::unique_ptr<RegisterConfiguration> config_;
|
||||
InstructionSequence* sequence_;
|
||||
int num_general_registers_;
|
||||
int num_double_registers_;
|
||||
@ -241,6 +243,8 @@ class InstructionSequenceTest : public TestWithIsolateAndZone {
|
||||
LoopBlocks loop_blocks_;
|
||||
InstructionBlock* current_block_;
|
||||
bool block_returns_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(InstructionSequenceTest);
|
||||
};
|
||||
|
||||
} // namespace compiler
|
||||
|
@ -2,6 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "src/compiler/schedule.h"
|
||||
#include "src/compiler/scheduler.h"
|
||||
#include "test/unittests/compiler/compiler-test-utils.h"
|
||||
@ -135,7 +137,7 @@ TEST_F(SchedulerRPOTest, EntryLoop) {
|
||||
|
||||
TEST_F(SchedulerRPOTest, EndLoop) {
|
||||
Schedule schedule(zone());
|
||||
base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2));
|
||||
std::unique_ptr<TestLoop> loop1(CreateLoop(&schedule, 2));
|
||||
schedule.AddSuccessorForTesting(schedule.start(), loop1->header());
|
||||
BasicBlockVector* order = Scheduler::ComputeSpecialRPO(zone(), &schedule);
|
||||
CheckRPONumbers(order, 3, true);
|
||||
@ -144,7 +146,7 @@ TEST_F(SchedulerRPOTest, EndLoop) {
|
||||
|
||||
TEST_F(SchedulerRPOTest, EndLoopNested) {
|
||||
Schedule schedule(zone());
|
||||
base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2));
|
||||
std::unique_ptr<TestLoop> loop1(CreateLoop(&schedule, 2));
|
||||
schedule.AddSuccessorForTesting(schedule.start(), loop1->header());
|
||||
schedule.AddSuccessorForTesting(loop1->last(), schedule.start());
|
||||
BasicBlockVector* order = Scheduler::ComputeSpecialRPO(zone(), &schedule);
|
||||
@ -318,8 +320,8 @@ TEST_F(SchedulerRPOTest, LoopNest2) {
|
||||
TEST_F(SchedulerRPOTest, LoopFollow1) {
|
||||
Schedule schedule(zone());
|
||||
|
||||
base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1));
|
||||
base::SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1));
|
||||
std::unique_ptr<TestLoop> loop1(CreateLoop(&schedule, 1));
|
||||
std::unique_ptr<TestLoop> loop2(CreateLoop(&schedule, 1));
|
||||
|
||||
BasicBlock* A = schedule.start();
|
||||
BasicBlock* E = schedule.end();
|
||||
@ -338,8 +340,8 @@ TEST_F(SchedulerRPOTest, LoopFollow1) {
|
||||
TEST_F(SchedulerRPOTest, LoopFollow2) {
|
||||
Schedule schedule(zone());
|
||||
|
||||
base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1));
|
||||
base::SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1));
|
||||
std::unique_ptr<TestLoop> loop1(CreateLoop(&schedule, 1));
|
||||
std::unique_ptr<TestLoop> loop2(CreateLoop(&schedule, 1));
|
||||
|
||||
BasicBlock* A = schedule.start();
|
||||
BasicBlock* S = schedule.NewBasicBlock();
|
||||
@ -361,8 +363,8 @@ TEST_F(SchedulerRPOTest, LoopFollowN) {
|
||||
for (int size = 1; size < 5; size++) {
|
||||
for (int exit = 0; exit < size; exit++) {
|
||||
Schedule schedule(zone());
|
||||
base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
|
||||
base::SmartPointer<TestLoop> loop2(CreateLoop(&schedule, size));
|
||||
std::unique_ptr<TestLoop> loop1(CreateLoop(&schedule, size));
|
||||
std::unique_ptr<TestLoop> loop2(CreateLoop(&schedule, size));
|
||||
BasicBlock* A = schedule.start();
|
||||
BasicBlock* E = schedule.end();
|
||||
|
||||
@ -381,8 +383,8 @@ TEST_F(SchedulerRPOTest, LoopFollowN) {
|
||||
TEST_F(SchedulerRPOTest, NestedLoopFollow1) {
|
||||
Schedule schedule(zone());
|
||||
|
||||
base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1));
|
||||
base::SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1));
|
||||
std::unique_ptr<TestLoop> loop1(CreateLoop(&schedule, 1));
|
||||
std::unique_ptr<TestLoop> loop2(CreateLoop(&schedule, 1));
|
||||
|
||||
BasicBlock* A = schedule.start();
|
||||
BasicBlock* B = schedule.NewBasicBlock();
|
||||
@ -414,7 +416,7 @@ TEST_F(SchedulerRPOTest, LoopBackedges1) {
|
||||
BasicBlock* A = schedule.start();
|
||||
BasicBlock* E = schedule.end();
|
||||
|
||||
base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
|
||||
std::unique_ptr<TestLoop> loop1(CreateLoop(&schedule, size));
|
||||
schedule.AddSuccessorForTesting(A, loop1->header());
|
||||
schedule.AddSuccessorForTesting(loop1->last(), E);
|
||||
|
||||
@ -437,7 +439,7 @@ TEST_F(SchedulerRPOTest, LoopOutedges1) {
|
||||
BasicBlock* D = schedule.NewBasicBlock();
|
||||
BasicBlock* E = schedule.end();
|
||||
|
||||
base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
|
||||
std::unique_ptr<TestLoop> loop1(CreateLoop(&schedule, size));
|
||||
schedule.AddSuccessorForTesting(A, loop1->header());
|
||||
schedule.AddSuccessorForTesting(loop1->last(), E);
|
||||
|
||||
@ -459,7 +461,7 @@ TEST_F(SchedulerRPOTest, LoopOutedges2) {
|
||||
BasicBlock* A = schedule.start();
|
||||
BasicBlock* E = schedule.end();
|
||||
|
||||
base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
|
||||
std::unique_ptr<TestLoop> loop1(CreateLoop(&schedule, size));
|
||||
schedule.AddSuccessorForTesting(A, loop1->header());
|
||||
schedule.AddSuccessorForTesting(loop1->last(), E);
|
||||
|
||||
@ -481,7 +483,7 @@ TEST_F(SchedulerRPOTest, LoopOutloops1) {
|
||||
Schedule schedule(zone());
|
||||
BasicBlock* A = schedule.start();
|
||||
BasicBlock* E = schedule.end();
|
||||
base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
|
||||
std::unique_ptr<TestLoop> loop1(CreateLoop(&schedule, size));
|
||||
schedule.AddSuccessorForTesting(A, loop1->header());
|
||||
schedule.AddSuccessorForTesting(loop1->last(), E);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user