Move SmartPointer to base.
authorrmcilroy <rmcilroy@chromium.org>
Mon, 13 Jul 2015 12:38:06 +0000 (05:38 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 13 Jul 2015 12:38:17 +0000 (12:38 +0000)
Review URL: https://codereview.chromium.org/1221433021

Cr-Commit-Position: refs/heads/master@{#29604}

57 files changed:
BUILD.gn
src/arm/codegen-arm.cc
src/ast.h
src/background-parsing-task.h
src/base/smart-pointers.h [new file with mode: 0644]
src/code-stubs-hydrogen.cc
src/codegen.cc
src/compiler.cc
src/compiler/graph-visualizer.cc
src/compiler/js-intrinsic-lowering.cc
src/compiler/pipeline-statistics.cc
src/compiler/pipeline-statistics.h
src/compiler/pipeline.cc
src/d8.h
src/deoptimizer.cc
src/disassembler.cc
src/factory.cc
src/frames.cc
src/gdb-jit.cc
src/heap-profiler.h
src/heap/mark-compact.h
src/hydrogen.cc
src/interface-descriptors.h
src/jsregexp.cc
src/log.cc
src/messages.cc
src/messages.h
src/mips/codegen-mips.cc
src/mips64/codegen-mips64.cc
src/objects-printer.cc
src/objects.cc
src/objects.h
src/parser.cc
src/ppc/codegen-ppc.cc
src/runtime/runtime-function.cc
src/runtime/runtime-internal.cc
src/runtime/runtime-test.cc
src/smart-pointers.h [deleted file]
src/snapshot/serialize.cc
src/string-stream.cc
src/string-stream.h
src/strings-storage.cc
test/cctest/compiler/test-operator.cc
test/cctest/test-api-interceptors.cc
test/cctest/test-api.cc
test/cctest/test-cpu-profiler.cc
test/cctest/test-func-name-inference.cc
test/cctest/test-heap-profiler.cc
test/cctest/test-lockers.cc
test/cctest/test-migrations.cc
test/cctest/test-parsing.cc
test/cctest/test-regexp.cc
test/cctest/test-reloc-info.cc
test/unittests/compiler/instruction-sequence-unittest.h
test/unittests/compiler/scheduler-unittest.cc
test/unittests/test-utils.cc
tools/gyp/v8.gyp

index 8ff286ae1749af80ec17adecc51710525112342e..fd9d4f46d55319338c293c28c77fccc0fdd03dce 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1110,7 +1110,6 @@ source_set("v8_base") {
     "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",
@@ -1520,6 +1519,7 @@ source_set("v8_libbase") {
     "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",
index a456996a270e86474020fa5f77298cba7ef5d9a0..f433a0e36d42ed401181634be4be6c4c7f86c0e1 100644 (file)
@@ -888,10 +888,9 @@ CodeAgingHelper::CodeAgingHelper() {
   // 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());
index 2e2f4ca1e1512f0f90e8e9f236aa7807caec4c7b..3a51982ec8bd2014ded90c86d8e13c2f27137823 100644 (file)
--- a/src/ast.h
+++ b/src/ast.h
@@ -11,6 +11,7 @@
 #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"
@@ -18,7 +19,6 @@
 #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"
index 80e1e271d2c8e1e67c0130e4f85ce97e9484c376..e99916169cfc81e2bf2ab81064d288d674c399ed 100644 (file)
@@ -7,9 +7,9 @@
 
 #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 {
@@ -23,17 +23,17 @@ struct StreamedSource {
       : 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.
diff --git a/src/base/smart-pointers.h b/src/base/smart-pointers.h
new file mode 100644 (file)
index 0000000..6528fca
--- /dev/null
@@ -0,0 +1,122 @@
+// 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_
index 154811c55e441bf349b90a33ea148749095d8873..2ccf78c88b5671ae2fd5d3d3b9acc1c0e01b2fd6 100644 (file)
@@ -118,7 +118,7 @@ class CodeStubGraphBuilderBase : public HGraphBuilder {
   HValue* BuildArrayNArgumentsConstructor(JSArrayBuilder* builder,
                                           ElementsKind kind);
 
-  SmartArrayPointer<HParameter*> parameters_;
+  base::SmartArrayPointer<HParameter*> parameters_;
   HValue* arguments_length_;
   CompilationInfo* info_;
   CodeStubDescriptor descriptor_;
index f25ce4df22404f0cacea02404a513d14a60a9ca9..3e1b93d3810e6a688263e9a10334d01bf47b370e 100644 (file)
@@ -183,7 +183,7 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) {
          (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);
index c4c3b4f106cfc1ce3307666a88be8a4bcdf507c9..147adb0511342564bffbe76341409bcf9f7e2741 100644 (file)
@@ -1515,7 +1515,8 @@ MaybeHandle<Code> Compiler::GetOptimizedCode(Handle<JSFunction> function,
     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);
@@ -1540,7 +1541,7 @@ MaybeHandle<Code> Compiler::GetOptimizedCode(Handle<JSFunction> function,
 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);
index 313edb9b653a84adba88cd40b940cb09df56a404..7610e60a9119f50a25f9bc03b38826e3fb26e4b4 100644 (file)
@@ -28,7 +28,7 @@ namespace compiler {
 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) {
index 8f04fc1bcd5f362122389acf70cbda08cad8c4ca..06ade91dd40f7545da876ed952b445c30cce9d99 100644 (file)
@@ -178,7 +178,7 @@ Reduction JSIntrinsicLowering::ReduceIncrementStatsCounter(Node* node) {
   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);
index 5e8d1272cf62867d67d89d1691be82e1616314ac..ba705ba1d8f8cc34df52a46aa3156ec800ecbae7 100644 (file)
@@ -52,7 +52,7 @@ PipelineStatistics::PipelineStatistics(CompilationInfo* info,
       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();
   }
index 01cc9de9d13c64d3a025c55a352b6659e23ad1db..988327d1bb86d74209ab370f98795e45cda8d362 100644 (file)
@@ -36,7 +36,7 @@ class PipelineStatistics : public Malloced {
     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_;
index b8dc459e0e30ab8dabf3fea0c7ae4f89d6680f33..04301c8c1d13d8d2f6345075a41400acd286ade5 100644 (file)
@@ -281,7 +281,7 @@ class PipelineData {
   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_;
@@ -340,12 +340,12 @@ void TraceSchedule(CompilationInfo* info, Schedule* schedule) {
 }
 
 
-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 {
@@ -980,7 +980,7 @@ Handle<Code> Pipeline::GenerateCode() {
   }
 
   ZonePool zone_pool;
-  SmartPointer<PipelineStatistics> pipeline_statistics;
+  base::SmartPointer<PipelineStatistics> pipeline_statistics;
 
   if (FLAG_turbo_stats) {
     pipeline_statistics.Reset(new PipelineStatistics(info(), &zone_pool));
@@ -993,7 +993,7 @@ Handle<Code> Pipeline::GenerateCode() {
       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()
@@ -1064,7 +1064,7 @@ Handle<Code> Pipeline::GenerateCode() {
   // 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()));
@@ -1152,7 +1152,7 @@ Handle<Code> Pipeline::GenerateCodeForTesting(CompilationInfo* info,
   // 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");
@@ -1286,7 +1286,7 @@ void Pipeline::AllocateRegisters(const RegisterConfiguration* config,
   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());
@@ -1294,7 +1294,7 @@ void Pipeline::AllocateRegisters(const RegisterConfiguration* config,
         verifier_zone.get(), config, data->sequence());
   }
 
-  SmartArrayPointer<char> debug_name;
+  base::SmartArrayPointer<char> debug_name;
 #ifdef DEBUG
   debug_name = GetDebugName(data->info());
 #endif
index 4d723473ea385c2c66b65c6ee65fd40e872592b8..ae9c4f222cee1bbb549a7e3dc9fe0ad08d019686 100644 (file)
--- a/src/d8.h
+++ b/src/d8.h
@@ -9,7 +9,6 @@
 #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"
index 84b0f9011a2ba7af6fa84f8cd809d3cc83812dd7..c6e6baa942fcdbaf3750c6e1e0fc8162c088ba86 100644 (file)
@@ -2688,7 +2688,8 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
           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",
@@ -2702,7 +2703,8 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
           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);
       }
@@ -2714,7 +2716,8 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
           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);
       }
@@ -2725,7 +2728,8 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
       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,
@@ -2736,7 +2740,8 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
       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,
index 06eb2397eb8d0ecf6278634f5448206c854055a2..84a0ff9e7e71666e67be3e0cccd3970b2c17a61a 100644 (file)
@@ -182,7 +182,7 @@ static int DecodeIt(Isolate* isolate, std::ostream* os,
         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(
index f8154180f0cbacccc32a3917b7e16fba7e4552e6..fa5d83f1e27d01f0d68088224db71e7311579ee8 100644 (file)
@@ -1150,7 +1150,7 @@ Handle<String> Factory::EmergencyNewError(const char* message,
       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()));
index 723db4ae13c3c6e8da7a173578bd545c6e0ced7b..5dea8484c96ea1318fa15e4bee21f98287e15a5f 100644 (file)
@@ -819,7 +819,7 @@ void JavaScriptFrame::PrintFunctionAndOffset(JSFunction* function, Code* code,
       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 {
index 2de4e66b4950cb4d7d464db98246001def2deb98..2746806e925fe3d1acd65daf97092a4513be9846 100644 (file)
@@ -993,7 +993,7 @@ class CodeDescription BASE_EMBEDDED {
   }
 #endif
 
-  SmartArrayPointer<char> GetFilename() {
+  base::SmartArrayPointer<char> GetFilename() {
     return String::cast(script()->name())->ToCString();
   }
 
index 68e13656c66b05296f26d452048f6267a69b0e45..718c39c86e3690708450459da9b27f846356f76f 100644 (file)
@@ -5,9 +5,9 @@
 #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 {
@@ -66,11 +66,11 @@ class HeapProfiler {
   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_;
 };
 
index 9892e0e42c89c4d67d675b4b465d4893df05a33e..ff93c57196170c1f1d068c034804dc4b89dd15aa 100644 (file)
@@ -969,7 +969,7 @@ class MarkCompactCollector {
 
   List<Page*> evacuation_candidates_;
 
-  SmartPointer<FreeList> free_list_old_space_;
+  base::SmartPointer<FreeList> free_list_old_space_;
 
   friend class Heap;
 };
index d747cfb52d2b5106a322b7eaad59758ab7df3a3e..eae94420fac0cf13f1ca16ef280b6ad6a83b18f2 100644 (file)
@@ -7927,7 +7927,7 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(Call* expr,
     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(),
@@ -8009,9 +8009,9 @@ void HOptimizedGraphBuilder::TraceInline(Handle<JSFunction> target,
                                          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(),
index 56cbad219f3a38ecd1bc6ecf915de34bd9fca461..75e2a6b1981407654b628d7757795429e81374ce 100644 (file)
@@ -113,7 +113,7 @@ class CallInterfaceDescriptorData {
   // 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_;
index a02141d77a057fde6411e39b6734a4cd695dee46..27bb690977714c3af5cb2b2a87950e7372e81331 100644 (file)
@@ -596,7 +596,7 @@ MaybeHandle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> regexp,
   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();
   }
index 8f47e81f0eccce5316360c995e398bfb3e40a82b..b0bebe8fa8b952961a5bc28af27cf67732448f01 100644 (file)
@@ -1016,10 +1016,10 @@ void Logger::ApiNamedPropertyAccess(const char* tag,
   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());
@@ -1029,8 +1029,9 @@ void Logger::ApiNamedPropertyAccess(const char* tag,
     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);
     }
@@ -1042,7 +1043,7 @@ void Logger::ApiIndexedPropertyAccess(const char* tag,
                                       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);
 }
@@ -1051,7 +1052,7 @@ void Logger::ApiIndexedPropertyAccess(const char* tag,
 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());
 }
@@ -1089,7 +1090,7 @@ void Logger::CallbackEventInternal(const char* prefix, Name* name,
              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 {
@@ -1097,8 +1098,9 @@ void Logger::CallbackEventInternal(const char* prefix, Name* name,
     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());
     }
@@ -1192,7 +1194,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
   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 {
@@ -1222,12 +1224,12 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag,
   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));
@@ -1265,7 +1267,7 @@ void Logger::CodeDisableOptEvent(Code* code,
   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()));
index 7193392d9d1c30a196efb43407327c6d369e0348..ebec3532fe2a4ca9b1505af9e0bc35281dd95a88 100644 (file)
@@ -19,13 +19,13 @@ namespace internal {
 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>",
@@ -133,9 +133,8 @@ Handle<String> MessageHandler::GetMessage(Isolate* isolate,
 }
 
 
-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);
 }
index 4072300bf6a0a4cfb05e40ce10d85fedd5675750..bf0e970247652bda0c69109b6e46c6d2879fb482 100644 (file)
@@ -455,8 +455,8 @@ class MessageHandler {
   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
 
index 23780d8b2597679c747b7eefa78bbcd34e4685de..0d93b0b94bf4ceeff0b034bbde04b8caaf43aec7 100644 (file)
@@ -1193,10 +1193,9 @@ CodeAgingHelper::CodeAgingHelper() {
   // 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);
index 4f45b08018a7be42c9f9fa8bc75969efa8308746..1602ed25b5a5ddc4ce7a3f600c23763e5c38f002 100644 (file)
@@ -1082,10 +1082,9 @@ CodeAgingHelper::CodeAgingHelper() {
   // 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);
index 838a1a90755cc6e52a10bdf387c4aed58fee8527..c10414c194c75292748da4243a4f30f0f77bde1d 100644 (file)
@@ -746,10 +746,8 @@ void SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) {  // NOLINT
     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.
index d16bd828b43bf310e290840e3a5f9ee1175ef422..e883e1dd529315c88873536ec38151e4a6b9a96f 100644 (file)
@@ -1268,7 +1268,7 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) {  // NOLINT
 
     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() << ">";
@@ -8455,13 +8455,12 @@ String::FlatContent String::GetFlatContent() {
 }
 
 
-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;
@@ -8498,13 +8497,13 @@ SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls,
     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);
 }
 
@@ -8530,9 +8529,10 @@ const uc16* String::GetTwoByteData(unsigned start) {
 }
 
 
-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);
 
@@ -8544,7 +8544,7 @@ SmartArrayPointer<uc16> String::ToWideCString(RobustnessFlag robust_flag) {
     result[i++] = character;
   }
   result[i] = 0;
-  return SmartArrayPointer<uc16>(result);
+  return base::SmartArrayPointer<uc16>(result);
 }
 
 
@@ -10219,7 +10219,7 @@ void JSFunction::SetInstanceClassName(String* name) {
 
 
 void JSFunction::PrintName(FILE* out) {
-  SmartArrayPointer<char> name = shared()->DebugName()->ToCString();
+  base::SmartArrayPointer<char> name = shared()->DebugName()->ToCString();
   PrintF(out, "%s", name.get());
 }
 
index bb8f5ddce559ad51ee252ec45a2e036d779198bb..fe97c66ef15c63516a9836ad073c83badfa2da98 100644 (file)
@@ -11,6 +11,7 @@
 #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"
@@ -18,7 +19,6 @@
 #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"
@@ -8855,12 +8855,11 @@ class String: public Name {
   // 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);
@@ -8871,7 +8870,7 @@ class String: public Name {
   // 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);
index bf12fa4135b4dafd6d0028ce3dcf79eb7469ec7d..1b177080bb3c0f7c50c983bd4a22f441faef33b6 100644 (file)
@@ -986,7 +986,7 @@ FunctionLiteral* Parser::ParseProgram(Isolate* isolate, ParseInfo* info) {
       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");
@@ -1127,7 +1127,8 @@ FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) {
 
   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;
index aae38f4724fa8ae57e19ccc094e515bf74a15f82..08dacc4f0e9dcfcf26ce3aa8e18bd65706376e15 100644 (file)
@@ -613,7 +613,7 @@ CodeAgingHelper::CodeAgingHelper() {
   // 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());
index 3903c04e951430a38d3423643d9faadba8108d6e..cb9dd3299eb0a32c93b4070305db953c34288b87 100644 (file)
@@ -328,9 +328,8 @@ RUNTIME_FUNCTION(Runtime_SetForceInlineFlag) {
 // 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();
@@ -355,7 +354,7 @@ static SmartArrayPointer<Handle<Object> > GetCallerArguments(Isolate* isolate,
     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++) {
@@ -376,7 +375,7 @@ static SmartArrayPointer<Handle<Object> > GetCallerArguments(Isolate* isolate,
     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);
@@ -401,7 +400,7 @@ RUNTIME_FUNCTION(Runtime_FunctionBindArguments) {
   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) {
@@ -503,7 +502,7 @@ RUNTIME_FUNCTION(Runtime_NewObjectFromBound) {
          !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>(
@@ -535,12 +534,12 @@ RUNTIME_FUNCTION(Runtime_Call) {
   // 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) {
@@ -574,12 +573,12 @@ RUNTIME_FUNCTION(Runtime_Apply) {
   // 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) {
index ae07172d005c1c104cd8bf02b5fede8582973c9c..c58266ab6f34e4db260cd3aca2d4beb88b434c48 100644 (file)
@@ -222,9 +222,10 @@ RUNTIME_FUNCTION(Runtime_RenderCallSite) {
   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();
index 0738e0db5ad3d879a2f8f17543ef1738a167452c..93bb51588069cc5727a0e3e41b8a276e57a8202d 100644 (file)
@@ -342,7 +342,7 @@ RUNTIME_FUNCTION(Runtime_SetFlags) {
   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();
diff --git a/src/smart-pointers.h b/src/smart-pointers.h
deleted file mode 100644 (file)
index c4bbd0b..0000000
+++ /dev/null
@@ -1,130 +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_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_
index 7152ebd13b33a346cc84cde867dc5f9f68ebc2a2..a426ccee8068d843a4aba121dd3b18e9a04e2b7c 100644 (file)
@@ -2526,7 +2526,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
 
   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");
index 5f61e0da1d2357004ae3deaca38a33b7110da390..92fff27683581784d8627f001daf8c937e1af31e 100644 (file)
@@ -250,11 +250,11 @@ void StringStream::Add(const char* format, FmtElm arg0, FmtElm arg1,
 }
 
 
-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);
 }
 
 
index cc50bb7150eb9f605340456448eefd63bdf35dd4..7aa5fd7db3d3e293e4d20a4c3a514f53dcf20615 100644 (file)
@@ -129,7 +129,7 @@ class StringStream final {
   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.
index 533fa8959cd80e6670cddd7834ff7fd4d04e00f1..8ddf291fcc3112aef8bcf59f4f09b0f0b4a60d15 100644 (file)
@@ -80,7 +80,7 @@ const char* StringsStorage::GetName(Name* name) {
     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()) {
index e635da797d2b4cf99c846b958818b3d1d535677f..0ac33637dac7e40e46e4e79611e82bea0de1e20a 100644 (file)
@@ -69,10 +69,10 @@ TEST(TestOperator_Equals) {
 }
 
 
-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()));
 }
 
 
index 2e9bc74a9239b70f28356b80fa45e7440fa33337..c0a8a287aed006513a9bb06200bd2840971e1dae 100644 (file)
@@ -14,7 +14,6 @@
 #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"
index 3ec4e1b10e38bd04742f7976c742ef61100a6c80..3d94b443e031c4ecec0de383d196986cb4137be8 100644 (file)
 #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"
@@ -16717,8 +16717,8 @@ TEST(ContainsOnlyOneByte) {
   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.
index e24f6f905029df079fd4e031cef3b7a650cdf08b..17eec0737631cfb5d04f95bffdc96284a0db44f3 100644 (file)
@@ -31,9 +31,9 @@
 
 #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"
@@ -46,8 +46,8 @@ using i::ProfileGenerator;
 using i::ProfileNode;
 using i::ProfilerEventsProcessor;
 using i::ScopedVector;
-using i::SmartPointer;
 using i::Vector;
+using v8::base::SmartPointer;
 
 
 // Helper methods
index ae8e77d745b14f07b30028fb49d352f336c4aa4e..76f1172b1ecd888d37869b7fae45b29388e13255 100644 (file)
@@ -34,6 +34,7 @@
 #include "test/cctest/cctest.h"
 
 
+using ::v8::base::SmartArrayPointer;
 using ::v8::internal::CStrVector;
 using ::v8::internal::Factory;
 using ::v8::internal::Handle;
@@ -43,7 +44,6 @@ using ::v8::internal::JSFunction;
 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;
index da9f4512a0457b58ad958ef38b75736a942e2075..6fa8ede57bd8d6537832ac3445026c230bb8cfff 100644 (file)
@@ -1769,7 +1769,7 @@ TEST(GetHeapValueForDeletedObject) {
 
 
 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());
index c86a9d67dcd3ecb9b45649691fa70ef376f48bff..f1dc5a28b4655f0b39c98b7785d572a74ac1d7b7 100644 (file)
 
 #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"
@@ -101,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);
-  i::SmartPointer<KangarooThread> thread1;
+  v8::base::SmartPointer<KangarooThread> thread1;
   {
     v8::Locker locker(isolate);
     v8::Isolate::Scope isolate_scope(isolate);
@@ -464,7 +464,8 @@ class LockAndUnlockDifferentIsolatesThread : public JoinableThread {
   }
 
   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_));
index 0cefd54cebd5d21dd81fb4e33262627994abe863..3ace0488f85cc92081772c32685a714ea1265811 100644 (file)
@@ -14,7 +14,6 @@
 #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;
index a28ba2a0759954c311873132275a6b1ec7e23429..43737cb8ea56f2518bbb93f6577580c81a06dde1 100644 (file)
@@ -506,7 +506,8 @@ TEST(PreParseOverflow) {
       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';
 
@@ -560,7 +561,7 @@ void TestCharacterStream(const char* one_byte_source, unsigned length,
   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]);
   }
index e7fcbd10e0bfc0687397d78b8ad3501f1050d204..13de44c9150749e562402f81cc996d1dc166071c 100644 (file)
@@ -413,7 +413,7 @@ static void ExpectError(const char* input,
             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()));
 }
 
index 829fd24f4dfcfb82814bbcc440a04e70a7e47791..e4d9fed7ec3f23be17e88aed262c40b7083c6611 100644 (file)
@@ -45,7 +45,7 @@ TEST(Positions) {
   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;
index 2d75da7e47f9272e53ee3417d710949976b24ab5..eaab0d32429deb6ad60a6fc17ea60b9339924b0e 100644 (file)
@@ -223,7 +223,7 @@ class InstructionSequenceTest : public TestWithIsolateAndZone {
   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_;
index 45c636b27a7e9d2b1b09679110f6d181b1c0e115..954541b721474b305f5f850bd325ebe0bb193ab4 100644 (file)
@@ -215,7 +215,7 @@ TEST_F(SchedulerRPOTest, EntryLoop) {
 
 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);
@@ -225,7 +225,7 @@ TEST_F(SchedulerRPOTest, EndLoop) {
 
 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);
@@ -406,8 +406,8 @@ TEST_F(SchedulerRPOTest, LoopNest2) {
 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();
@@ -427,8 +427,8 @@ TEST_F(SchedulerRPOTest, LoopFollow1) {
 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();
@@ -451,8 +451,8 @@ TEST_F(SchedulerRPOTest, LoopFollowN) {
   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();
 
@@ -472,8 +472,8 @@ TEST_F(SchedulerRPOTest, LoopFollowN) {
 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();
@@ -506,7 +506,7 @@ TEST_F(SchedulerRPOTest, LoopBackedges1) {
       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);
 
@@ -530,7 +530,7 @@ TEST_F(SchedulerRPOTest, LoopOutedges1) {
       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);
 
@@ -553,7 +553,7 @@ TEST_F(SchedulerRPOTest, LoopOutedges2) {
     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);
 
@@ -576,7 +576,7 @@ TEST_F(SchedulerRPOTest, LoopOutloops1) {
     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);
 
index fd52a4b21dcf388aeae81df6c682e3e6c2bc93b5..522ee1293046cdb50863a498cff6fcf2fb27a846 100644 (file)
@@ -75,7 +75,7 @@ inline int64_t GetRandomSeedFromFlag(int random_seed) {
 }  // namespace
 
 TestWithRandomNumberGenerator::TestWithRandomNumberGenerator()
-    : rng_(GetRandomSeedFromFlag(internal::FLAG_random_seed)) {}
+    : rng_(GetRandomSeedFromFlag(::v8::internal::FLAG_random_seed)) {}
 
 
 TestWithRandomNumberGenerator::~TestWithRandomNumberGenerator() {}
index c0fce39384e7425baeeec25b351f3e209efcdde4..e52cfcc84400f83aa6995cd224a7e00a3138b21a 100644 (file)
         '../../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',