"src/signature.h",
"src/simulator.h",
"src/small-pointer-list.h",
- "src/smart-pointers.h",
"src/snapshot/natives.h",
"src/snapshot/serialize.cc",
"src/snapshot/serialize.h",
"src/base/safe_conversions_impl.h",
"src/base/safe_math.h",
"src/base/safe_math_impl.h",
+ "src/hase/smart-pointers.h",
"src/base/sys-info.cc",
"src/base/sys-info.h",
"src/base/utils/random-number-generator.cc",
// 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.
- SmartPointer<CodePatcher> patcher(
- new CodePatcher(young_sequence_.start(),
- young_sequence_.length() / Assembler::kInstrSize,
- CodePatcher::DONT_FLUSH));
+ base::SmartPointer<CodePatcher> patcher(new CodePatcher(
+ young_sequence_.start(), young_sequence_.length() / Assembler::kInstrSize,
+ CodePatcher::DONT_FLUSH));
PredictableCodeSizeScope scope(patcher->masm(), young_sequence_.length());
patcher->masm()->PushFixedFrame(r1);
patcher->masm()->nop(ip.code());
#include "src/ast-value-factory.h"
#include "src/bailout-reason.h"
#include "src/base/flags.h"
+#include "src/base/smart-pointers.h"
#include "src/factory.h"
#include "src/isolate.h"
#include "src/jsregexp.h"
#include "src/modules.h"
#include "src/runtime/runtime.h"
#include "src/small-pointer-list.h"
-#include "src/smart-pointers.h"
#include "src/token.h"
#include "src/types.h"
#include "src/utils.h"
#include "src/base/platform/platform.h"
#include "src/base/platform/semaphore.h"
+#include "src/base/smart-pointers.h"
#include "src/compiler.h"
#include "src/parser.h"
-#include "src/smart-pointers.h"
namespace v8 {
namespace internal {
: source_stream(source_stream), encoding(encoding) {}
// Internal implementation of v8::ScriptCompiler::StreamedSource.
- SmartPointer<ScriptCompiler::ExternalSourceStream> source_stream;
+ base::SmartPointer<ScriptCompiler::ExternalSourceStream> source_stream;
ScriptCompiler::StreamedSource::Encoding encoding;
- SmartPointer<ScriptCompiler::CachedData> cached_data;
+ base::SmartPointer<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;
- SmartPointer<Zone> zone;
- SmartPointer<ParseInfo> info;
- SmartPointer<Parser> parser;
+ base::SmartPointer<Zone> zone;
+ base::SmartPointer<ParseInfo> info;
+ base::SmartPointer<Parser> parser;
private:
// Prevent copying. Not implemented.
--- /dev/null
+// 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_
+
+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_;
+};
+
+// A 'scoped array pointer' that calls DeleteArray on its pointer when the
+// destructor is called.
+
+template <typename T>
+struct ArrayDeallocator {
+ static void Delete(T* array) { delete[] array; }
+};
+
+
+template <typename T>
+class SmartArrayPointer : public SmartPointerBase<ArrayDeallocator<T>, T> {
+ public:
+ SmartArrayPointer() {}
+ explicit SmartArrayPointer(T* ptr)
+ : SmartPointerBase<ArrayDeallocator<T>, T>(ptr) {}
+ SmartArrayPointer(const SmartArrayPointer<T>& rhs)
+ : SmartPointerBase<ArrayDeallocator<T>, T>(rhs) {}
+};
+
+
+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_
HValue* BuildArrayNArgumentsConstructor(JSArrayBuilder* builder,
ElementsKind kind);
- SmartArrayPointer<HParameter*> parameters_;
+ base::SmartArrayPointer<HParameter*> parameters_;
HValue* arguments_length_;
CompilationInfo* info_;
CodeStubDescriptor descriptor_;
(info->IsOptimizing() && FLAG_print_opt_code));
if (print_code) {
const char* debug_name;
- SmartArrayPointer<char> debug_name_holder;
+ base::SmartArrayPointer<char> debug_name_holder;
if (info->IsStub()) {
CodeStub::Major major_key = info->code_stub()->MajorKey();
debug_name = CodeStub::MajorName(major_key, false);
return MaybeHandle<Code>();
}
- SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(function));
+ base::SmartPointer<CompilationInfo> info(
+ new CompilationInfoWithZone(function));
VMState<COMPILER> state(isolate);
DCHECK(!isolate->has_pending_exception());
PostponeInterruptsScope postpone(isolate);
Handle<Code> Compiler::GetConcurrentlyOptimizedCode(OptimizedCompileJob* job) {
// Take ownership of compilation info. Deleting compilation info
// also tears down the zone and the recompile job.
- SmartPointer<CompilationInfo> info(job->info());
+ base::SmartPointer<CompilationInfo> info(job->info());
Isolate* isolate = info->isolate();
VMState<COMPILER> state(isolate);
FILE* OpenVisualizerLogFile(CompilationInfo* info, const char* phase,
const char* suffix, const char* mode) {
EmbeddedVector<char, 256> filename(0);
- SmartArrayPointer<char> function_name;
+ base::SmartArrayPointer<char> function_name;
if (info->has_shared_info()) {
function_name = info->shared_info()->DebugName()->ToCString();
if (strlen(function_name.get()) > 0) {
if (!m.HasValue() || !m.Value().handle()->IsString()) {
return ChangeToUndefined(node);
}
- SmartArrayPointer<char> name =
+ base::SmartArrayPointer<char> name =
Handle<String>::cast(m.Value().handle())->ToCString();
StatsCounter counter(jsgraph()->isolate(), name.get());
if (!counter.Enabled()) return ChangeToUndefined(node);
phase_name_(NULL) {
if (info->has_shared_info()) {
source_size_ = static_cast<size_t>(info->shared_info()->SourceSize());
- SmartArrayPointer<char> name =
+ base::SmartArrayPointer<char> name =
info->shared_info()->DebugName()->ToCString();
function_name_ = name.get();
}
void End(PipelineStatistics* pipeline_stats,
CompilationStatistics::BasicStats* diff);
- SmartPointer<ZonePool::StatsScope> scope_;
+ base::SmartPointer<ZonePool::StatsScope> scope_;
base::ElapsedTimer timer_;
size_t outer_zone_initial_size_;
size_t allocated_bytes_at_start_;
Zone* graph_zone_;
Graph* graph_;
// TODO(dcarney): make this into a ZoneObject.
- SmartPointer<SourcePositionTable> source_positions_;
+ base::SmartPointer<SourcePositionTable> source_positions_;
LoopAssignmentAnalysis* loop_assignment_;
MachineOperatorBuilder* machine_;
CommonOperatorBuilder* common_;
}
-SmartArrayPointer<char> GetDebugName(CompilationInfo* info) {
+base::SmartArrayPointer<char> GetDebugName(CompilationInfo* info) {
if (info->code_stub() != NULL) {
CodeStub::Major major_key = info->code_stub()->MajorKey();
const char* major_name = CodeStub::MajorName(major_key, false);
size_t len = strlen(major_name) + 1;
- SmartArrayPointer<char> name(new char[len]);
+ base::SmartArrayPointer<char> name(new char[len]);
memcpy(name.get(), major_name, len);
return name;
} else {
}
ZonePool zone_pool;
- SmartPointer<PipelineStatistics> pipeline_statistics;
+ base::SmartPointer<PipelineStatistics> pipeline_statistics;
if (FLAG_turbo_stats) {
pipeline_statistics.Reset(new PipelineStatistics(info(), &zone_pool));
OFStream json_of(json_file);
Handle<Script> script = info()->script();
FunctionLiteral* function = info()->function();
- SmartArrayPointer<char> function_name =
+ base::SmartArrayPointer<char> function_name =
info()->shared_info()->DebugName()->ToCString();
int pos = info()->shared_info()->start_position();
json_of << "{\"function\":\"" << function_name.get()
// Bailout here in case target architecture is not supported.
if (!SupportedTarget()) return Handle<Code>::null();
- SmartPointer<Typer> typer;
+ base::SmartPointer<Typer> typer;
if (info()->is_typing_enabled()) {
// Type the graph.
typer.Reset(new Typer(isolate(), data.graph(), info()->function_type()));
// Construct a pipeline for scheduling and code generation.
ZonePool zone_pool;
PipelineData data(&zone_pool, info, graph, schedule);
- SmartPointer<PipelineStatistics> pipeline_statistics;
+ base::SmartPointer<PipelineStatistics> pipeline_statistics;
if (FLAG_turbo_stats) {
pipeline_statistics.Reset(new PipelineStatistics(info, &zone_pool));
pipeline_statistics->BeginPhaseKind("test codegen");
PipelineData* data = this->data_;
// Don't track usage for this zone in compiler stats.
- SmartPointer<Zone> verifier_zone;
+ base::SmartPointer<Zone> verifier_zone;
RegisterAllocatorVerifier* verifier = nullptr;
if (run_verifier) {
verifier_zone.Reset(new Zone());
verifier_zone.get(), config, data->sequence());
}
- SmartArrayPointer<char> debug_name;
+ base::SmartArrayPointer<char> debug_name;
#ifdef DEBUG
debug_name = GetDebugName(data->info());
#endif
#include "src/allocation.h"
#include "src/hashmap.h"
#include "src/list.h"
-#include "src/smart-pointers.h"
#include "src/v8.h"
#else
#include "include/v8.h"
SharedFunctionInfo::cast(literal_array->get(iterator->Next()));
int height = iterator->Next();
if (trace_file != nullptr) {
- SmartArrayPointer<char> name = shared_info->DebugName()->ToCString();
+ base::SmartArrayPointer<char> name =
+ shared_info->DebugName()->ToCString();
PrintF(trace_file, " reading input frame %s", name.get());
int arg_count = shared_info->internal_formal_parameter_count() + 1;
PrintF(trace_file, " => node=%d, args=%d, height=%d; inputs:\n",
SharedFunctionInfo::cast(literal_array->get(iterator->Next()));
int height = iterator->Next();
if (trace_file != nullptr) {
- SmartArrayPointer<char> name = shared_info->DebugName()->ToCString();
+ base::SmartArrayPointer<char> name =
+ shared_info->DebugName()->ToCString();
PrintF(trace_file, " reading arguments adaptor frame %s", name.get());
PrintF(trace_file, " => height=%d; inputs:\n", height);
}
SharedFunctionInfo::cast(literal_array->get(iterator->Next()));
int height = iterator->Next();
if (trace_file != nullptr) {
- SmartArrayPointer<char> name = shared_info->DebugName()->ToCString();
+ base::SmartArrayPointer<char> name =
+ shared_info->DebugName()->ToCString();
PrintF(trace_file, " reading construct stub frame %s", name.get());
PrintF(trace_file, " => height=%d; inputs:\n", height);
}
SharedFunctionInfo* shared_info =
SharedFunctionInfo::cast(literal_array->get(iterator->Next()));
if (trace_file != nullptr) {
- SmartArrayPointer<char> name = shared_info->DebugName()->ToCString();
+ base::SmartArrayPointer<char> name =
+ shared_info->DebugName()->ToCString();
PrintF(trace_file, " reading getter frame %s; inputs:\n", name.get());
}
return TranslatedFrame::AccessorFrame(TranslatedFrame::kGetter,
SharedFunctionInfo* shared_info =
SharedFunctionInfo::cast(literal_array->get(iterator->Next()));
if (trace_file != nullptr) {
- SmartArrayPointer<char> name = shared_info->DebugName()->ToCString();
+ base::SmartArrayPointer<char> name =
+ shared_info->DebugName()->ToCString();
PrintF(trace_file, " reading setter frame %s; inputs:\n", name.get());
}
return TranslatedFrame::AccessorFrame(TranslatedFrame::kSetter,
HeapStringAllocator allocator;
StringStream accumulator(&allocator);
relocinfo.target_object()->ShortPrint(&accumulator);
- SmartArrayPointer<const char> obj_name = accumulator.ToCString();
+ base::SmartArrayPointer<const char> obj_name = accumulator.ToCString();
out.AddFormatted(" ;; object: %s", obj_name.get());
} else if (rmode == RelocInfo::EXTERNAL_REFERENCE) {
const char* reference_name = ref_encoder.NameOfAddress(
if (space > 0) {
Handle<String> arg_str = Handle<String>::cast(
Object::GetElement(isolate(), args, i).ToHandleChecked());
- SmartArrayPointer<char> arg = arg_str->ToCString();
+ base::SmartArrayPointer<char> arg = arg_str->ToCString();
Vector<char> v2(p, static_cast<int>(space));
StrNCpy(v2, arg.get(), space);
space -= Min(space, strlen(arg.get()));
Object* script_name_raw = script->name();
if (script_name_raw->IsString()) {
String* script_name = String::cast(script->name());
- SmartArrayPointer<char> c_script_name =
+ base::SmartArrayPointer<char> c_script_name =
script_name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
PrintF(file, " at %s:%d", c_script_name.get(), line);
} else {
}
#endif
- SmartArrayPointer<char> GetFilename() {
+ base::SmartArrayPointer<char> GetFilename() {
return String::cast(script()->name())->ToCString();
}
#ifndef V8_HEAP_PROFILER_H_
#define V8_HEAP_PROFILER_H_
+#include "src/base/smart-pointers.h"
#include "src/heap-snapshot-generator-inl.h"
#include "src/isolate.h"
-#include "src/smart-pointers.h"
namespace v8 {
namespace internal {
Heap* heap() const { return ids_->heap(); }
// Mapping from HeapObject addresses to objects' uids.
- SmartPointer<HeapObjectsMap> ids_;
+ base::SmartPointer<HeapObjectsMap> ids_;
List<HeapSnapshot*> snapshots_;
- SmartPointer<StringsStorage> names_;
+ base::SmartPointer<StringsStorage> names_;
List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
- SmartPointer<AllocationTracker> allocation_tracker_;
+ base::SmartPointer<AllocationTracker> allocation_tracker_;
bool is_tracking_object_moves_;
};
List<Page*> evacuation_candidates_;
- SmartPointer<FreeList> free_list_old_space_;
+ base::SmartPointer<FreeList> free_list_old_space_;
friend class Heap;
};
bool try_inline = FLAG_polymorphic_inlining && !needs_wrapping;
if (FLAG_trace_inlining && try_inline) {
Handle<JSFunction> caller = current_info()->closure();
- SmartArrayPointer<char> caller_name =
+ base::SmartArrayPointer<char> caller_name =
caller->shared()->DebugName()->ToCString();
PrintF("Trying to inline the polymorphic call to %s from %s\n",
name->ToCString().get(),
Handle<JSFunction> caller,
const char* reason) {
if (FLAG_trace_inlining) {
- SmartArrayPointer<char> target_name =
+ base::SmartArrayPointer<char> target_name =
target->shared()->DebugName()->ToCString();
- SmartArrayPointer<char> caller_name =
+ base::SmartArrayPointer<char> caller_name =
caller->shared()->DebugName()->ToCString();
if (reason == NULL) {
PrintF("Inlined %s called from %s.\n", target_name.get(),
// InterfaceDescriptor, and freed on destruction. This is because static
// arrays of Registers cause creation of runtime static initializers
// which we don't want.
- SmartArrayPointer<Register> register_params_;
+ base::SmartArrayPointer<Register> register_params_;
// Specifies types for parameters and return
Type::FunctionType* function_type_;
if (required_registers > Isolate::kJSRegexpStaticOffsetsVectorSize) {
output_registers = NewArray<int32_t>(required_registers);
}
- SmartArrayPointer<int32_t> auto_release(output_registers);
+ base::SmartArrayPointer<int32_t> auto_release(output_registers);
if (output_registers == NULL) {
output_registers = isolate->jsregexp_static_offsets_vector();
}
DCHECK(name->IsName());
if (!log_->IsEnabled() || !FLAG_log_api) return;
String* class_name_obj = holder->class_name();
- SmartArrayPointer<char> class_name =
+ base::SmartArrayPointer<char> class_name =
class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
if (name->IsString()) {
- SmartArrayPointer<char> property_name =
+ base::SmartArrayPointer<char> property_name =
String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
ApiEvent("api,%s,\"%s\",\"%s\"", tag, class_name.get(),
property_name.get());
if (symbol->name()->IsUndefined()) {
ApiEvent("api,%s,\"%s\",symbol(hash %x)", tag, class_name.get(), hash);
} else {
- SmartArrayPointer<char> str = String::cast(symbol->name())->ToCString(
- DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
+ base::SmartArrayPointer<char> str =
+ String::cast(symbol->name())
+ ->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
ApiEvent("api,%s,\"%s\",symbol(\"%s\" hash %x)", tag, class_name.get(),
str.get(), hash);
}
uint32_t index) {
if (!log_->IsEnabled() || !FLAG_log_api) return;
String* class_name_obj = holder->class_name();
- SmartArrayPointer<char> class_name =
+ base::SmartArrayPointer<char> class_name =
class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
ApiEvent("api,%s,\"%s\",%u", tag, class_name.get(), index);
}
void Logger::ApiObjectAccess(const char* tag, JSObject* object) {
if (!log_->IsEnabled() || !FLAG_log_api) return;
String* class_name_obj = object->class_name();
- SmartArrayPointer<char> class_name =
+ base::SmartArrayPointer<char> class_name =
class_name_obj->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
ApiEvent("api,%s,\"%s\"", tag, class_name.get());
}
kLogEventsNames[CALLBACK_TAG]);
msg.AppendAddress(entry_point);
if (name->IsString()) {
- SmartArrayPointer<char> str =
+ base::SmartArrayPointer<char> str =
String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
msg.Append(",1,\"%s%s\"", prefix, str.get());
} else {
if (symbol->name()->IsUndefined()) {
msg.Append(",1,symbol(hash %x)", prefix, symbol->Hash());
} else {
- SmartArrayPointer<char> str = String::cast(symbol->name())->ToCString(
- DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
+ base::SmartArrayPointer<char> str =
+ String::cast(symbol->name())
+ ->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
msg.Append(",1,symbol(\"%s\" hash %x)", prefix, str.get(),
symbol->Hash());
}
Log::MessageBuilder msg(log_);
AppendCodeCreateHeader(&msg, tag, code);
if (name->IsString()) {
- SmartArrayPointer<char> str =
+ base::SmartArrayPointer<char> str =
String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
msg.Append("\"%s\"", str.get());
} else {
if (!FLAG_log_code || !log_->IsEnabled()) return;
Log::MessageBuilder msg(log_);
AppendCodeCreateHeader(&msg, tag, code);
- SmartArrayPointer<char> name =
+ base::SmartArrayPointer<char> name =
shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
msg.Append("\"%s ", name.get());
if (source->IsString()) {
- SmartArrayPointer<char> sourcestr =
- String::cast(source)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
+ base::SmartArrayPointer<char> sourcestr = String::cast(source)->ToCString(
+ DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
msg.Append("%s", sourcestr.get());
} else {
msg.AppendSymbolName(Symbol::cast(source));
if (!FLAG_log_code || !log_->IsEnabled()) return;
Log::MessageBuilder msg(log_);
msg.Append("%s,", kLogEventsNames[CODE_DISABLE_OPT_EVENT]);
- SmartArrayPointer<char> name =
+ base::SmartArrayPointer<char> name =
shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
msg.Append("\"%s\",", name.get());
msg.Append("\"%s\"", GetBailoutReason(shared->disable_optimization_reason()));
void MessageHandler::DefaultMessageReport(Isolate* isolate,
const MessageLocation* loc,
Handle<Object> message_obj) {
- SmartArrayPointer<char> str = GetLocalizedMessage(isolate, message_obj);
+ base::SmartArrayPointer<char> str = GetLocalizedMessage(isolate, message_obj);
if (loc == NULL) {
PrintF("%s\n", str.get());
} else {
HandleScope scope(isolate);
Handle<Object> data(loc->script()->name(), isolate);
- SmartArrayPointer<char> data_str;
+ base::SmartArrayPointer<char> data_str;
if (data->IsString())
data_str = Handle<String>::cast(data)->ToCString(DISALLOW_NULLS);
PrintF("%s:%i: %s\n", data_str.get() ? data_str.get() : "<unknown>",
}
-SmartArrayPointer<char> MessageHandler::GetLocalizedMessage(
- Isolate* isolate,
- Handle<Object> data) {
+base::SmartArrayPointer<char> MessageHandler::GetLocalizedMessage(
+ Isolate* isolate, Handle<Object> data) {
HandleScope scope(isolate);
return GetMessage(isolate, data)->ToCString(DISALLOW_NULLS);
}
static void DefaultMessageReport(Isolate* isolate, const MessageLocation* loc,
Handle<Object> message_obj);
static Handle<String> GetMessage(Isolate* isolate, Handle<Object> data);
- static SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate,
- Handle<Object> data);
+ static base::SmartArrayPointer<char> GetLocalizedMessage(Isolate* isolate,
+ Handle<Object> data);
};
} } // namespace v8::internal
// 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.
- SmartPointer<CodePatcher> patcher(
- new CodePatcher(young_sequence_.start(),
- young_sequence_.length() / Assembler::kInstrSize,
- CodePatcher::DONT_FLUSH));
+ base::SmartPointer<CodePatcher> patcher(new CodePatcher(
+ young_sequence_.start(), young_sequence_.length() / Assembler::kInstrSize,
+ CodePatcher::DONT_FLUSH));
PredictableCodeSizeScope scope(patcher->masm(), young_sequence_.length());
patcher->masm()->Push(ra, fp, cp, a1);
patcher->masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP);
// 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.
- SmartPointer<CodePatcher> patcher(
- new CodePatcher(young_sequence_.start(),
- young_sequence_.length() / Assembler::kInstrSize,
- CodePatcher::DONT_FLUSH));
+ base::SmartPointer<CodePatcher> patcher(new CodePatcher(
+ young_sequence_.start(), young_sequence_.length() / Assembler::kInstrSize,
+ CodePatcher::DONT_FLUSH));
PredictableCodeSizeScope scope(patcher->masm(), young_sequence_.length());
patcher->masm()->Push(ra, fp, cp, a1);
patcher->masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP);
String* source = String::cast(Script::cast(script())->source());
int start = start_position();
int length = end_position() - start;
- SmartArrayPointer<char> source_string =
- source->ToCString(DISALLOW_NULLS,
- FAST_STRING_TRAVERSAL,
- start, length, NULL);
+ base::SmartArrayPointer<char> source_string = source->ToCString(
+ DISALLOW_NULLS, FAST_STRING_TRAVERSAL, start, length, NULL);
os << source_string.get();
}
// Script files are often large, hard to read.
case SHARED_FUNCTION_INFO_TYPE: {
SharedFunctionInfo* shared = SharedFunctionInfo::cast(this);
- SmartArrayPointer<char> debug_name =
+ base::SmartArrayPointer<char> debug_name =
shared->DebugName()->ToCString();
if (debug_name[0] != 0) {
os << "<SharedFunctionInfo " << debug_name.get() << ">";
}
-SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls,
- RobustnessFlag robust_flag,
- int offset,
- int length,
- int* length_return) {
+base::SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls,
+ RobustnessFlag robust_flag,
+ int offset, int length,
+ int* length_return) {
if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) {
- return SmartArrayPointer<char>(NULL);
+ return base::SmartArrayPointer<char>(NULL);
}
// Negative length means the to the end of the string.
if (length < 0) length = kMaxInt - offset;
last = character;
}
result[utf8_byte_position] = 0;
- return SmartArrayPointer<char>(result);
+ return base::SmartArrayPointer<char>(result);
}
-SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls,
- RobustnessFlag robust_flag,
- int* length_return) {
+base::SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls,
+ RobustnessFlag robust_flag,
+ int* length_return) {
return ToCString(allow_nulls, robust_flag, 0, -1, length_return);
}
}
-SmartArrayPointer<uc16> String::ToWideCString(RobustnessFlag robust_flag) {
+base::SmartArrayPointer<uc16> String::ToWideCString(
+ RobustnessFlag robust_flag) {
if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) {
- return SmartArrayPointer<uc16>();
+ return base::SmartArrayPointer<uc16>();
}
StringCharacterStream stream(this);
result[i++] = character;
}
result[i] = 0;
- return SmartArrayPointer<uc16>(result);
+ return base::SmartArrayPointer<uc16>(result);
}
void JSFunction::PrintName(FILE* out) {
- SmartArrayPointer<char> name = shared()->DebugName()->ToCString();
+ base::SmartArrayPointer<char> name = shared()->DebugName()->ToCString();
PrintF(out, "%s", name.get());
}
#include "src/assert-scope.h"
#include "src/bailout-reason.h"
#include "src/base/bits.h"
+#include "src/base/smart-pointers.h"
#include "src/builtins.h"
#include "src/checks.h"
#include "src/elements-kind.h"
#include "src/flags.h"
#include "src/list.h"
#include "src/property-details.h"
-#include "src/smart-pointers.h"
#include "src/unicode-inl.h"
#include "src/unicode-decoder.h"
#include "src/zone.h"
// ROBUST_STRING_TRAVERSAL invokes behaviour that is robust This means it
// handles unexpected data without causing assert failures and it does not
// do any heap allocations. This is useful when printing stack traces.
- SmartArrayPointer<char> ToCString(AllowNullsFlag allow_nulls,
- RobustnessFlag robustness_flag,
- int offset,
- int length,
- int* length_output = 0);
- SmartArrayPointer<char> ToCString(
+ base::SmartArrayPointer<char> ToCString(AllowNullsFlag allow_nulls,
+ RobustnessFlag robustness_flag,
+ int offset, int length,
+ int* length_output = 0);
+ base::SmartArrayPointer<char> ToCString(
AllowNullsFlag allow_nulls = DISALLOW_NULLS,
RobustnessFlag robustness_flag = FAST_STRING_TRAVERSAL,
int* length_output = 0);
// ROBUST_STRING_TRAVERSAL invokes behaviour that is robust This means it
// handles unexpected data without causing assert failures and it does not
// do any heap allocations. This is useful when printing stack traces.
- SmartArrayPointer<uc16> ToWideCString(
+ base::SmartArrayPointer<uc16> ToWideCString(
RobustnessFlag robustness_flag = FAST_STRING_TRAVERSAL);
bool ComputeArrayIndex(uint32_t* index);
PrintF("[parsing eval");
} else if (info->script()->name()->IsString()) {
String* name = String::cast(info->script()->name());
- SmartArrayPointer<char> name_chars = name->ToCString();
+ base::SmartArrayPointer<char> name_chars = name->ToCString();
PrintF("[parsing script: %s", name_chars.get());
} else {
PrintF("[parsing script");
if (FLAG_trace_parse && result != NULL) {
double ms = timer.Elapsed().InMillisecondsF();
- SmartArrayPointer<char> name_chars = result->debug_name()->ToCString();
+ base::SmartArrayPointer<char> name_chars =
+ result->debug_name()->ToCString();
PrintF("[parsing function: %s - took %0.3f ms]\n", name_chars.get(), ms);
}
return result;
// 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.
- SmartPointer<CodePatcher> patcher(new CodePatcher(
+ base::SmartPointer<CodePatcher> patcher(new CodePatcher(
young_sequence_.start(), young_sequence_.length() / Assembler::kInstrSize,
CodePatcher::DONT_FLUSH));
PredictableCodeSizeScope scope(patcher->masm(), young_sequence_.length());
// Find the arguments of the JavaScript function invocation that called
// into C++ code. Collect these in a newly allocated array of handles (possibly
// prefixed by a number of empty handles).
-static SmartArrayPointer<Handle<Object> > GetCallerArguments(Isolate* isolate,
- int prefix_argc,
- int* total_argc) {
+static base::SmartArrayPointer<Handle<Object> > GetCallerArguments(
+ Isolate* isolate, int prefix_argc, int* total_argc) {
// Find frame containing arguments passed to the caller.
JavaScriptFrameIterator it(isolate);
JavaScriptFrame* frame = it.frame();
argument_count--;
*total_argc = prefix_argc + argument_count;
- SmartArrayPointer<Handle<Object> > param_data(
+ base::SmartArrayPointer<Handle<Object> > param_data(
NewArray<Handle<Object> >(*total_argc));
bool should_deoptimize = false;
for (int i = 0; i < argument_count; i++) {
int args_count = frame->ComputeParametersCount();
*total_argc = prefix_argc + args_count;
- SmartArrayPointer<Handle<Object> > param_data(
+ base::SmartArrayPointer<Handle<Object> > param_data(
NewArray<Handle<Object> >(*total_argc));
for (int i = 0; i < args_count; i++) {
Handle<Object> val = Handle<Object>(frame->GetParameter(i), isolate);
bound_function->shared()->set_inferred_name(isolate->heap()->empty_string());
// Get all arguments of calling function (Function.prototype.bind).
int argc = 0;
- SmartArrayPointer<Handle<Object> > arguments =
+ base::SmartArrayPointer<Handle<Object> > arguments =
GetCallerArguments(isolate, 0, &argc);
// Don't count the this-arg.
if (argc > 0) {
!Handle<JSFunction>::cast(bound_function)->shared()->bound());
int total_argc = 0;
- SmartArrayPointer<Handle<Object> > param_data =
+ base::SmartArrayPointer<Handle<Object> > param_data =
GetCallerArguments(isolate, bound_argc, &total_argc);
for (int i = 0; i < bound_argc; i++) {
param_data[i] = Handle<Object>(
// If there are too many arguments, allocate argv via malloc.
const int argv_small_size = 10;
Handle<Object> argv_small_buffer[argv_small_size];
- SmartArrayPointer<Handle<Object> > argv_large_buffer;
+ base::SmartArrayPointer<Handle<Object> > argv_large_buffer;
Handle<Object>* argv = argv_small_buffer;
if (argc > argv_small_size) {
argv = new Handle<Object>[argc];
if (argv == NULL) return isolate->StackOverflow();
- argv_large_buffer = SmartArrayPointer<Handle<Object> >(argv);
+ argv_large_buffer = base::SmartArrayPointer<Handle<Object> >(argv);
}
for (int i = 0; i < argc; ++i) {
// If there are too many arguments, allocate argv via malloc.
const int argv_small_size = 10;
Handle<Object> argv_small_buffer[argv_small_size];
- SmartArrayPointer<Handle<Object> > argv_large_buffer;
+ base::SmartArrayPointer<Handle<Object> > argv_large_buffer;
Handle<Object>* argv = argv_small_buffer;
if (argc > argv_small_size) {
argv = new Handle<Object>[argc];
if (argv == NULL) return isolate->StackOverflow();
- argv_large_buffer = SmartArrayPointer<Handle<Object> >(argv);
+ argv_large_buffer = base::SmartArrayPointer<Handle<Object> >(argv);
}
for (int i = 0; i < argc; ++i) {
if (location.start_pos() == -1) return isolate->heap()->empty_string();
Zone zone;
- SmartPointer<ParseInfo> info(location.function()->shared()->is_function()
- ? new ParseInfo(&zone, location.function())
- : new ParseInfo(&zone, location.script()));
+ base::SmartPointer<ParseInfo> info(
+ location.function()->shared()->is_function()
+ ? new ParseInfo(&zone, location.function())
+ : new ParseInfo(&zone, location.script()));
if (!Parser::ParseStatic(info.get())) {
isolate->clear_pending_exception();
SealHandleScope shs(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_CHECKED(String, arg, 0);
- SmartArrayPointer<char> flags =
+ base::SmartArrayPointer<char> flags =
arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
FlagList::SetFlagsFromString(flags.get(), StrLength(flags.get()));
return isolate->heap()->undefined_value();
+++ /dev/null
-// 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_SMART_POINTERS_H_
-#define V8_SMART_POINTERS_H_
-
-namespace v8 {
-namespace internal {
-
-
-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_;
-};
-
-// A 'scoped array pointer' that calls DeleteArray on its pointer when the
-// destructor is called.
-
-template<typename T>
-struct ArrayDeallocator {
- static void Delete(T* array) {
- DeleteArray(array);
- }
-};
-
-
-template<typename T>
-class SmartArrayPointer: public SmartPointerBase<ArrayDeallocator<T>, T> {
- public:
- SmartArrayPointer() { }
- explicit SmartArrayPointer(T* ptr)
- : SmartPointerBase<ArrayDeallocator<T>, T>(ptr) { }
- SmartArrayPointer(const SmartArrayPointer<T>& rhs)
- : SmartPointerBase<ArrayDeallocator<T>, T>(rhs) { }
-};
-
-
-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 v8::internal
-
-#endif // V8_SMART_POINTERS_H_
HandleScope scope(isolate);
- SmartPointer<SerializedCodeData> scd(
+ base::SmartPointer<SerializedCodeData> scd(
SerializedCodeData::FromCachedData(isolate, cached_data, *source));
if (scd.is_empty()) {
if (FLAG_profile_deserialization) PrintF("[Cached code failed check]\n");
}
-SmartArrayPointer<const char> StringStream::ToCString() const {
+base::SmartArrayPointer<const char> StringStream::ToCString() const {
char* str = NewArray<char>(length_ + 1);
MemCopy(str, buffer_, length_);
str[length_] = '\0';
- return SmartArrayPointer<const char>(str);
+ return base::SmartArrayPointer<const char>(str);
}
void OutputToStdOut() { OutputToFile(stdout); }
void Log(Isolate* isolate);
Handle<String> ToString(Isolate* isolate);
- SmartArrayPointer<const char> ToCString() const;
+ base::SmartArrayPointer<const char> ToCString() const;
int length() const { return length_; }
// Object printing support.
String* str = String::cast(name);
int length = Min(kMaxNameSize, str->length());
int actual_length = 0;
- SmartArrayPointer<char> data = str->ToCString(
+ base::SmartArrayPointer<char> data = str->ToCString(
DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL, 0, length, &actual_length);
return AddOrDisposeString(data.Detach(), actual_length);
} else if (name->IsSymbol()) {
}
-static SmartArrayPointer<const char> OperatorToString(Operator* op) {
+static v8::base::SmartArrayPointer<const char> OperatorToString(Operator* op) {
std::ostringstream os;
os << *op;
- return SmartArrayPointer<const char>(StrDup(os.str().c_str()));
+ return v8::base::SmartArrayPointer<const char>(StrDup(os.str().c_str()));
}
#include "src/execution.h"
#include "src/objects.h"
#include "src/parser.h"
-#include "src/smart-pointers.h"
#include "src/unicode-inl.h"
#include "src/utils.h"
#include "src/vm-state.h"
#include "src/api.h"
#include "src/arguments.h"
#include "src/base/platform/platform.h"
+#include "src/base/smart-pointers.h"
#include "src/compilation-cache.h"
#include "src/debug.h"
#include "src/execution.h"
#include "src/objects.h"
#include "src/parser.h"
-#include "src/smart-pointers.h"
#include "src/unicode-inl.h"
#include "src/utils.h"
#include "src/vm-state.h"
const int length = 512;
// Ensure word aligned assignment.
const int aligned_length = length*sizeof(uintptr_t)/sizeof(uint16_t);
- i::SmartArrayPointer<uintptr_t>
- aligned_contents(new uintptr_t[aligned_length]);
+ v8::base::SmartArrayPointer<uintptr_t> aligned_contents(
+ new uintptr_t[aligned_length]);
uint16_t* string_contents =
reinterpret_cast<uint16_t*>(aligned_contents.get());
// Set to contain only one byte.
#include "include/v8-profiler.h"
#include "src/base/platform/platform.h"
+#include "src/base/smart-pointers.h"
#include "src/cpu-profiler-inl.h"
#include "src/deoptimizer.h"
-#include "src/smart-pointers.h"
#include "src/utils.h"
#include "test/cctest/cctest.h"
#include "test/cctest/profiler-extension.h"
using i::ProfileNode;
using i::ProfilerEventsProcessor;
using i::ScopedVector;
-using i::SmartPointer;
using i::Vector;
+using v8::base::SmartPointer;
// Helper methods
#include "test/cctest/cctest.h"
+using ::v8::base::SmartArrayPointer;
using ::v8::internal::CStrVector;
using ::v8::internal::Factory;
using ::v8::internal::Handle;
using ::v8::internal::Object;
using ::v8::internal::Runtime;
using ::v8::internal::Script;
-using ::v8::internal::SmartArrayPointer;
using ::v8::internal::SharedFunctionInfo;
using ::v8::internal::String;
using ::v8::internal::Vector;
static int StringCmp(const char* ref, i::String* act) {
- i::SmartArrayPointer<char> s_act = act->ToCString();
+ v8::base::SmartArrayPointer<char> s_act = act->ToCString();
int result = strcmp(ref, s_act.get());
if (result != 0)
fprintf(stderr, "Expected: \"%s\", Actual: \"%s\"\n", ref, s_act.get());
#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"
#include "src/parser.h"
-#include "src/smart-pointers.h"
#include "src/unicode-inl.h"
#include "src/utils.h"
#include "test/cctest/cctest.h"
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
- i::SmartPointer<KangarooThread> thread1;
+ v8::base::SmartPointer<KangarooThread> thread1;
{
v8::Locker locker(isolate);
v8::Isolate::Scope isolate_scope(isolate);
}
virtual void Run() {
- i::SmartPointer<LockIsolateAndCalculateFibSharedContextThread> thread;
+ v8::base::SmartPointer<LockIsolateAndCalculateFibSharedContextThread>
+ thread;
v8::Locker lock1(isolate1_);
CHECK(v8::Locker::IsLocked(isolate1_));
CHECK(!v8::Locker::IsLocked(isolate2_));
#include "src/global-handles.h"
#include "src/ic/stub-cache.h"
#include "src/macro-assembler.h"
-#include "src/smart-pointers.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
i::GetCurrentStackPosition() - 128 * 1024);
size_t kProgramSize = 1024 * 1024;
- i::SmartArrayPointer<char> program(i::NewArray<char>(kProgramSize + 1));
+ v8::base::SmartArrayPointer<char> program(
+ i::NewArray<char>(kProgramSize + 1));
memset(program.get(), '(', kProgramSize);
program[kProgramSize] = '\0';
i::Isolate* isolate = CcTest::i_isolate();
i::Factory* factory = isolate->factory();
i::HandleScope test_scope(isolate);
- i::SmartArrayPointer<i::uc16> uc16_buffer(new i::uc16[length]);
+ v8::base::SmartArrayPointer<i::uc16> uc16_buffer(new i::uc16[length]);
for (unsigned i = 0; i < length; i++) {
uc16_buffer[i] = static_cast<i::uc16>(one_byte_source[i]);
}
CcTest::i_isolate(), &zone, &reader, false, false, &result));
CHECK(result.tree == NULL);
CHECK(!result.error.is_null());
- SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS);
+ v8::base::SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS);
CHECK_EQ(0, strcmp(expected, str.get()));
}
const int code_size = 10 * KB;
int relocation_info_size = 10 * KB;
const int buffer_size = code_size + relocation_info_size;
- SmartArrayPointer<byte> buffer(new byte[buffer_size]);
+ v8::base::SmartArrayPointer<byte> buffer(new byte[buffer_size]);
byte* pc = buffer.get();
byte* buffer_end = buffer.get() + buffer_size;
typedef std::map<int, const Instruction*> Instructions;
typedef std::vector<BlockCompletion> Completions;
- SmartPointer<RegisterConfiguration> config_;
+ base::SmartPointer<RegisterConfiguration> config_;
InstructionSequence* sequence_;
int num_general_registers_;
int num_double_registers_;
TEST_F(SchedulerRPOTest, EndLoop) {
Schedule schedule(zone());
- SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2));
+ base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2));
schedule.AddSuccessorForTesting(schedule.start(), loop1->header());
BasicBlockVector* order = Scheduler::ComputeSpecialRPO(zone(), &schedule);
CheckRPONumbers(order, 3, true);
TEST_F(SchedulerRPOTest, EndLoopNested) {
Schedule schedule(zone());
- SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2));
+ base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 2));
schedule.AddSuccessorForTesting(schedule.start(), loop1->header());
schedule.AddSuccessorForTesting(loop1->last(), schedule.start());
BasicBlockVector* order = Scheduler::ComputeSpecialRPO(zone(), &schedule);
TEST_F(SchedulerRPOTest, LoopFollow1) {
Schedule schedule(zone());
- SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1));
- SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1));
+ base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1));
+ base::SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1));
BasicBlock* A = schedule.start();
BasicBlock* E = schedule.end();
TEST_F(SchedulerRPOTest, LoopFollow2) {
Schedule schedule(zone());
- SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1));
- SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1));
+ base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1));
+ base::SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1));
BasicBlock* A = schedule.start();
BasicBlock* S = schedule.NewBasicBlock();
for (int size = 1; size < 5; size++) {
for (int exit = 0; exit < size; exit++) {
Schedule schedule(zone());
- SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
- SmartPointer<TestLoop> loop2(CreateLoop(&schedule, size));
+ base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
+ base::SmartPointer<TestLoop> loop2(CreateLoop(&schedule, size));
BasicBlock* A = schedule.start();
BasicBlock* E = schedule.end();
TEST_F(SchedulerRPOTest, NestedLoopFollow1) {
Schedule schedule(zone());
- SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1));
- SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1));
+ base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, 1));
+ base::SmartPointer<TestLoop> loop2(CreateLoop(&schedule, 1));
BasicBlock* A = schedule.start();
BasicBlock* B = schedule.NewBasicBlock();
BasicBlock* A = schedule.start();
BasicBlock* E = schedule.end();
- SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
+ base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
schedule.AddSuccessorForTesting(A, loop1->header());
schedule.AddSuccessorForTesting(loop1->last(), E);
BasicBlock* D = schedule.NewBasicBlock();
BasicBlock* E = schedule.end();
- SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
+ base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
schedule.AddSuccessorForTesting(A, loop1->header());
schedule.AddSuccessorForTesting(loop1->last(), E);
BasicBlock* A = schedule.start();
BasicBlock* E = schedule.end();
- SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
+ base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
schedule.AddSuccessorForTesting(A, loop1->header());
schedule.AddSuccessorForTesting(loop1->last(), E);
Schedule schedule(zone());
BasicBlock* A = schedule.start();
BasicBlock* E = schedule.end();
- SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
+ base::SmartPointer<TestLoop> loop1(CreateLoop(&schedule, size));
schedule.AddSuccessorForTesting(A, loop1->header());
schedule.AddSuccessorForTesting(loop1->last(), E);
} // namespace
TestWithRandomNumberGenerator::TestWithRandomNumberGenerator()
- : rng_(GetRandomSeedFromFlag(internal::FLAG_random_seed)) {}
+ : rng_(GetRandomSeedFromFlag(::v8::internal::FLAG_random_seed)) {}
TestWithRandomNumberGenerator::~TestWithRandomNumberGenerator() {}
'../../src/signature.h',
'../../src/simulator.h',
'../../src/small-pointer-list.h',
- '../../src/smart-pointers.h',
'../../src/snapshot/natives.h',
'../../src/snapshot/serialize.cc',
'../../src/snapshot/serialize.h',
'../../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',