From c1da40c08dbd746287fa150c172daf03d06793dc Mon Sep 17 00:00:00 2001 From: "jochen@chromium.org" Date: Thu, 28 Nov 2013 08:21:26 +0000 Subject: [PATCH] Mark deprecated APIs with relatively little use as deprecated BUG=none R=svenpanne@chromium.org LOG=n Review URL: https://codereview.chromium.org/91503002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18114 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- include/v8.h | 86 +++--- src/bootstrapper.cc | 5 +- src/d8-posix.cc | 2 +- src/d8.cc | 2 +- .../externalize-string-extension.cc | 6 +- src/extensions/externalize-string-extension.h | 3 +- src/extensions/free-buffer-extension.cc | 3 +- src/extensions/free-buffer-extension.h | 3 +- src/extensions/gc-extension.cc | 3 +- src/extensions/gc-extension.h | 3 +- src/extensions/statistics-extension.cc | 3 +- src/extensions/statistics-extension.h | 3 +- test/cctest/test-accessors.cc | 4 +- test/cctest/test-api.cc | 251 +++++++++--------- test/cctest/test-assembler-ia32.cc | 2 +- test/cctest/test-assembler-x64.cc | 2 +- test/cctest/test-compiler.cc | 6 +- test/cctest/test-cpu-profiler.cc | 6 +- test/cctest/test-debug.cc | 11 +- test/cctest/test-heap-profiler.cc | 16 +- test/cctest/test-heap.cc | 3 +- test/cctest/test-log-stack-tracer.cc | 17 +- test/cctest/test-log.cc | 6 +- test/cctest/test-object-observe.cc | 7 +- test/cctest/test-parsing.cc | 6 +- test/cctest/test-profile-generator.cc | 13 +- test/cctest/test-strings.cc | 8 +- test/cctest/test-weaktypedarrays.cc | 9 +- 28 files changed, 261 insertions(+), 228 deletions(-) diff --git a/include/v8.h b/include/v8.h index 2d0256208..28b656722 100644 --- a/include/v8.h +++ b/include/v8.h @@ -1240,8 +1240,8 @@ class V8_EXPORT Message { // TODO(1245381): Print to a string instead of on a FILE. static void PrintCurrentStackTrace(Isolate* isolate, FILE* out); - // Will be deprecated soon. - static void PrintCurrentStackTrace(FILE* out); + V8_DEPRECATED("Will be removed", + static void PrintCurrentStackTrace(FILE* out)); static const int kNoLineNumberInfo = 0; static const int kNoColumnInfo = 0; @@ -1299,10 +1299,9 @@ class V8_EXPORT StackTrace { Isolate* isolate, int frame_limit, StackTraceOptions options = kOverview); - // Will be deprecated soon. - static Local CurrentStackTrace( - int frame_limit, - StackTraceOptions options = kOverview); + V8_DEPRECATED("Will be removed", + static Local CurrentStackTrace( + int frame_limit, StackTraceOptions options = kOverview)); }; @@ -1634,8 +1633,8 @@ class V8_EXPORT Boolean : public Primitive { public: bool Value() const; V8_INLINE static Handle New(Isolate* isolate, bool value); - // Will be deprecated soon. - V8_INLINE static Handle New(bool value); + V8_DEPRECATED("Will be removed", + V8_INLINE static Handle New(bool value)); }; @@ -1905,8 +1904,8 @@ class V8_EXPORT String : public Primitive { */ static Local NewExternal(Isolate* isolate, ExternalStringResource* resource); - // Will be deprecated soon. - static Local NewExternal(ExternalStringResource* resource); + V8_DEPRECATED("Will be removed", static Local NewExternal( + ExternalStringResource* resource)); /** * Associate an external string resource with this string by transforming it @@ -1929,8 +1928,8 @@ class V8_EXPORT String : public Primitive { */ static Local NewExternal(Isolate* isolate, ExternalAsciiStringResource* resource); - // Will be deprecated soon. - static Local NewExternal(ExternalAsciiStringResource* resource); + V8_DEPRECATED("Will be removed", static Local NewExternal( + ExternalAsciiStringResource* resource)); /** * Associate an external string resource with this string by transforming it @@ -2488,8 +2487,7 @@ class V8_EXPORT Array : public Object { * is negative the returned array will have length 0. */ static Local New(Isolate* isolate, int length = 0); - // Will be deprecated soon. - static Local New(int length = 0); + V8_DEPRECATED("Will be removed", static Local New(int length = 0)); V8_INLINE static Array* Cast(Value* obj); private: @@ -2753,8 +2751,8 @@ class V8_EXPORT ArrayBuffer : public Object { * unless the object is externalized. */ static Local New(Isolate* isolate, size_t byte_length); - // Will be deprecated soon. - static Local New(size_t byte_length); + V8_DEPRECATED("Will be removed", + static Local New(size_t byte_length)); /** * Create a new ArrayBuffer over an existing memory block. @@ -2764,8 +2762,8 @@ class V8_EXPORT ArrayBuffer : public Object { */ static Local New(Isolate* isolate, void* data, size_t byte_length); - // Will be deprecated soon. - static Local New(void* data, size_t byte_length); + V8_DEPRECATED("Will be removed", + static Local New(void* data, size_t byte_length)); /** * Returns true if ArrayBuffer is extrenalized, that is, does not @@ -3026,8 +3024,7 @@ class V8_EXPORT DataView : public ArrayBufferView { class V8_EXPORT Date : public Object { public: static Local New(Isolate* isolate, double time); - // Will be deprecated soon. - static Local New(double time); + V8_DEPRECATED("Will be removed", static Local New(double time)); V8_DEPRECATED( "Use ValueOf instead", @@ -3054,8 +3051,8 @@ class V8_EXPORT Date : public Object { * negatively impact the performance of date operations. */ static void DateTimeConfigurationChangeNotification(Isolate* isolate); - // Will be deprecated soon. - static void DateTimeConfigurationChangeNotification(); + V8_DEPRECATED("Will be removed", + static void DateTimeConfigurationChangeNotification()); private: static void CheckCast(v8::Value* obj); @@ -3068,8 +3065,7 @@ class V8_EXPORT Date : public Object { class V8_EXPORT NumberObject : public Object { public: static Local New(Isolate* isolate, double value); - // Will be deprecated soon. - static Local New(double value); + V8_DEPRECATED("Will be removed", static Local New(double value)); V8_DEPRECATED( "Use ValueOf instead", @@ -3231,8 +3227,8 @@ class V8_EXPORT Template : public Data { void Set(Handle name, Handle value, PropertyAttribute attributes = None); V8_INLINE void Set(Isolate* isolate, const char* name, Handle value); - // Will be deprecated soon. - V8_INLINE void Set(const char* name, Handle value); + V8_DEPRECATED("Will be removed", + V8_INLINE void Set(const char* name, Handle value)); void SetAccessorProperty( Local name, @@ -3768,11 +3764,13 @@ class V8_EXPORT Signature : public Data { Handle(), int argc = 0, Handle argv[] = 0); - // Will be deprecated soon. - static Local New(Handle receiver = - Handle(), - int argc = 0, - Handle argv[] = 0); + V8_DEPRECATED("Will be removed", + static Local New(Handle receiver = + Handle(), + int argc = 0, + Handle argv[] = + 0)); + private: Signature(); }; @@ -3787,9 +3785,9 @@ class V8_EXPORT AccessorSignature : public Data { static Local New(Isolate* isolate, Handle receiver = Handle()); - // Will be deprecated soon. - static Local New(Handle receiver = - Handle()); + V8_DEPRECATED("Will be removed", static Local New( + Handle receiver = + Handle())); private: AccessorSignature(); @@ -3896,11 +3894,16 @@ class V8_EXPORT Extension { // NOLINT virtual ~Extension() { } virtual v8::Handle GetNativeFunctionTemplate( v8::Isolate* isolate, v8::Handle name) { +#if defined(V8_DEPRECATION_WARNINGS) + return v8::Handle(); +#else return GetNativeFunction(name); +#endif } - // Will be deprecated soon. - virtual v8::Handle - GetNativeFunction(v8::Handle name) { + + V8_DEPRECATED("Will be removed", + virtual v8::Handle GetNativeFunction( + v8::Handle name)) { return v8::Handle(); } @@ -3948,11 +3951,10 @@ V8_INLINE Handle Null(Isolate* isolate); V8_INLINE Handle True(Isolate* isolate); V8_INLINE Handle False(Isolate* isolate); -// Will be removed soon. -Handle V8_EXPORT Undefined(); -Handle V8_EXPORT Null(); -Handle V8_EXPORT True(); -Handle V8_EXPORT False(); +V8_DEPRECATED("Will be removed", Handle V8_EXPORT Undefined()); +V8_DEPRECATED("Will be removed", Handle V8_EXPORT Null()); +V8_DEPRECATED("Will be removed", Handle V8_EXPORT True()); +V8_DEPRECATED("Will be removed", Handle V8_EXPORT False()); /** diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index b9f796e43..4d69f8407 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -2627,7 +2627,8 @@ Genesis::Genesis(Isolate* isolate, isolate->random_number_generator()->NextBytes(state, num_bytes); } while (state[0] == 0 || state[1] == 0); - v8::Local buffer = v8::ArrayBuffer::New(state, num_bytes); + v8::Local buffer = v8::ArrayBuffer::New( + reinterpret_cast(isolate), state, num_bytes); Utils::OpenHandle(*buffer)->set_should_be_freed(true); v8::Local ta = v8::Uint32Array::New(buffer, 0, num_elems); Handle builtins(native_context()->builtins()); @@ -2640,8 +2641,10 @@ Genesis::Genesis(Isolate* isolate, // Initialize trigonometric lookup tables and constants. const int table_num_bytes = TrigonometricLookupTable::table_num_bytes(); v8::Local sin_buffer = v8::ArrayBuffer::New( + reinterpret_cast(isolate), TrigonometricLookupTable::sin_table(), table_num_bytes); v8::Local cos_buffer = v8::ArrayBuffer::New( + reinterpret_cast(isolate), TrigonometricLookupTable::cos_x_interval_table(), table_num_bytes); v8::Local sin_table = v8::Float64Array::New( sin_buffer, 0, TrigonometricLookupTable::table_size()); diff --git a/src/d8-posix.cc b/src/d8-posix.cc index dc60d0cc7..25f79a4be 100644 --- a/src/d8-posix.cc +++ b/src/d8-posix.cc @@ -470,7 +470,7 @@ void Shell::System(const v8::FunctionCallbackInfo& args) { } command_args = Handle::Cast(args[1]); } else { - command_args = Array::New(0); + command_args = Array::New(args.GetIsolate(), 0); } if (command_args->Length() > ExecArgs::kMaxArgs) { args.GetIsolate()->ThrowException(String::NewFromUtf8( diff --git a/src/d8.cc b/src/d8.cc index d0ca5504c..7c5df463d 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -1126,7 +1126,7 @@ void Shell::ReadBuffer(const v8::FunctionCallbackInfo& args) { Throw(args.GetIsolate(), "Error reading file"); return; } - Handle buffer = ArrayBuffer::New(data, length); + Handle buffer = ArrayBuffer::New(isolate, data, length); v8::Persistent weak_handle(isolate, buffer); weak_handle.MakeWeak(data, ReadBufferWeakCallback); weak_handle.MarkIndependent(); diff --git a/src/extensions/externalize-string-extension.cc b/src/extensions/externalize-string-extension.cc index a86ec66bf..edc7dd805 100644 --- a/src/extensions/externalize-string-extension.cc +++ b/src/extensions/externalize-string-extension.cc @@ -60,9 +60,9 @@ const char* const ExternalizeStringExtension::kSource = "native function externalizeString();" "native function isAsciiString();"; - -v8::Handle ExternalizeStringExtension::GetNativeFunction( - v8::Handle str) { +v8::Handle +ExternalizeStringExtension::GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Handle str) { if (strcmp(*v8::String::Utf8Value(str), "externalizeString") == 0) { return v8::FunctionTemplate::New(ExternalizeStringExtension::Externalize); } else { diff --git a/src/extensions/externalize-string-extension.h b/src/extensions/externalize-string-extension.h index ecbc1cf44..3d1e438f7 100644 --- a/src/extensions/externalize-string-extension.h +++ b/src/extensions/externalize-string-extension.h @@ -36,7 +36,8 @@ namespace internal { class ExternalizeStringExtension : public v8::Extension { public: ExternalizeStringExtension() : v8::Extension("v8/externalize", kSource) {} - virtual v8::Handle GetNativeFunction( + virtual v8::Handle GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Handle name); static void Externalize(const v8::FunctionCallbackInfo& args); static void IsAscii(const v8::FunctionCallbackInfo& args); diff --git a/src/extensions/free-buffer-extension.cc b/src/extensions/free-buffer-extension.cc index 4040c90bf..5cf2b6814 100644 --- a/src/extensions/free-buffer-extension.cc +++ b/src/extensions/free-buffer-extension.cc @@ -33,7 +33,8 @@ namespace v8 { namespace internal { -v8::Handle FreeBufferExtension::GetNativeFunction( +v8::Handle FreeBufferExtension::GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Handle str) { return v8::FunctionTemplate::New(FreeBufferExtension::FreeBuffer); } diff --git a/src/extensions/free-buffer-extension.h b/src/extensions/free-buffer-extension.h index 29ffbc014..22d466f61 100644 --- a/src/extensions/free-buffer-extension.h +++ b/src/extensions/free-buffer-extension.h @@ -37,7 +37,8 @@ class FreeBufferExtension : public v8::Extension { public: explicit FreeBufferExtension(const char* source) : v8::Extension("v8/free-buffer", source) {} - virtual v8::Handle GetNativeFunction( + virtual v8::Handle GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Handle name); static void FreeBuffer(const v8::FunctionCallbackInfo& args); static void Register(); diff --git a/src/extensions/gc-extension.cc b/src/extensions/gc-extension.cc index 308879115..b8442c1bf 100644 --- a/src/extensions/gc-extension.cc +++ b/src/extensions/gc-extension.cc @@ -32,7 +32,8 @@ namespace v8 { namespace internal { -v8::Handle GCExtension::GetNativeFunction( +v8::Handle GCExtension::GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Handle str) { return v8::FunctionTemplate::New(GCExtension::GC); } diff --git a/src/extensions/gc-extension.h b/src/extensions/gc-extension.h index e412b92a4..8c25e7d84 100644 --- a/src/extensions/gc-extension.h +++ b/src/extensions/gc-extension.h @@ -36,7 +36,8 @@ namespace internal { class GCExtension : public v8::Extension { public: explicit GCExtension(const char* source) : v8::Extension("v8/gc", source) {} - virtual v8::Handle GetNativeFunction( + virtual v8::Handle GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Handle name); static void GC(const v8::FunctionCallbackInfo& args); static void Register(); diff --git a/src/extensions/statistics-extension.cc b/src/extensions/statistics-extension.cc index 431a15638..92d152d0d 100644 --- a/src/extensions/statistics-extension.cc +++ b/src/extensions/statistics-extension.cc @@ -34,7 +34,8 @@ const char* const StatisticsExtension::kSource = "native function getV8Statistics();"; -v8::Handle StatisticsExtension::GetNativeFunction( +v8::Handle StatisticsExtension::GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Handle str) { ASSERT(strcmp(*v8::String::Utf8Value(str), "getV8Statistics") == 0); return v8::FunctionTemplate::New(StatisticsExtension::GetCounters); diff --git a/src/extensions/statistics-extension.h b/src/extensions/statistics-extension.h index bfd9c4134..f05e7689e 100644 --- a/src/extensions/statistics-extension.h +++ b/src/extensions/statistics-extension.h @@ -36,7 +36,8 @@ namespace internal { class StatisticsExtension : public v8::Extension { public: StatisticsExtension() : v8::Extension("v8/statistics", kSource) {} - virtual v8::Handle GetNativeFunction( + virtual v8::Handle GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Handle name); static void GetCounters(const v8::FunctionCallbackInfo& args); static void Register(); diff --git a/test/cctest/test-accessors.cc b/test/cctest/test-accessors.cc index 0dbac3fa6..142687b30 100644 --- a/test/cctest/test-accessors.cc +++ b/test/cctest/test-accessors.cc @@ -460,7 +460,7 @@ THREADED_TEST(Regress1054726) { static void AllocGetter(Local name, const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); - info.GetReturnValue().Set(v8::Array::New(1000)); + info.GetReturnValue().Set(v8::Array::New(info.GetIsolate(), 1000)); } @@ -543,7 +543,7 @@ THREADED_TEST(HandleScopeSegment) { void JSONStringifyEnumerator(const v8::PropertyCallbackInfo& info) { - v8::Handle array = v8::Array::New(1); + v8::Handle array = v8::Array::New(info.GetIsolate(), 1); array->Set(0, v8_str("regress")); info.GetReturnValue().Set(array); } diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 94b397f24..2e457d0e8 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -150,7 +150,8 @@ static void IncrementingSignatureCallback( signature_callback_count++; CHECK_EQ(signature_expected_receiver, args.Holder()); CHECK_EQ(signature_expected_receiver, args.This()); - v8::Handle result = v8::Array::New(args.Length()); + v8::Handle result = + v8::Array::New(args.GetIsolate(), args.Length()); for (int i = 0; i < args.Length(); i++) result->Set(v8::Integer::New(i), args[i]); args.GetReturnValue().Set(result); @@ -160,7 +161,8 @@ static void IncrementingSignatureCallback( static void SignatureCallback( const v8::FunctionCallbackInfo& args) { ApiTestFuzzer::Fuzz(); - v8::Handle result = v8::Array::New(args.Length()); + v8::Handle result = + v8::Array::New(args.GetIsolate(), args.Length()); for (int i = 0; i < args.Length(); i++) { result->Set(v8::Integer::New(i), args[i]); } @@ -253,7 +255,7 @@ THREADED_TEST(ReceiverSignature) { v8::HandleScope scope(env->GetIsolate()); // Setup templates. v8::Handle fun = v8::FunctionTemplate::New(); - v8::Handle sig = v8::Signature::New(fun); + v8::Handle sig = v8::Signature::New(env->GetIsolate(), fun); v8::Handle callback_sig = v8::FunctionTemplate::New( IncrementingSignatureCallback, Local(), sig); @@ -326,8 +328,8 @@ THREADED_TEST(ArgumentSignature) { v8::HandleScope scope(env->GetIsolate()); v8::Handle cons = v8::FunctionTemplate::New(); cons->SetClassName(v8_str("Cons")); - v8::Handle sig = - v8::Signature::New(v8::Handle(), 1, &cons); + v8::Handle sig = v8::Signature::New( + env->GetIsolate(), v8::Handle(), 1, &cons); v8::Handle fun = v8::FunctionTemplate::New(SignatureCallback, v8::Handle(), sig); env->Global()->Set(v8_str("Cons"), cons->GetFunction()); @@ -350,8 +352,8 @@ THREADED_TEST(ArgumentSignature) { cons3->SetClassName(v8_str("Cons3")); v8::Handle args[3] = { cons1, cons2, cons3 }; - v8::Handle wsig = - v8::Signature::New(v8::Handle(), 3, args); + v8::Handle wsig = v8::Signature::New( + env->GetIsolate(), v8::Handle(), 3, args); v8::Handle fun2 = v8::FunctionTemplate::New(SignatureCallback, v8::Handle(), wsig); @@ -507,7 +509,7 @@ THREADED_TEST(ScriptUsingStringResource) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); TestResource* resource = new TestResource(two_byte_source, &dispose_count); - Local source = String::NewExternal(resource); + Local source = String::NewExternal(env->GetIsolate(), resource); Local