change of V8_DEPRECATED to be enabled behind a gyp flag

also add a deprecation message for newer gcc versions

R=danno@chromium.org
BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17006 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
dcarney@chromium.org 2013-09-30 13:28:23 +00:00
parent f482c054dd
commit 6dd72b6416
7 changed files with 37 additions and 136 deletions

View File

@ -129,6 +129,10 @@ ifeq ($(i18nsupport), off)
GYPFLAGS += -Dv8_enable_i18n_support=0
TESTFLAGS += --noi18n
endif
# deprecation_warnings=on
ifeq ($(deprecationwarnings), on)
GYPFLAGS += -Dv8_deprecation_warnings=1
endif
# arm specific flags.
# armv7=false/true
ifeq ($(armv7), false)

View File

@ -55,6 +55,9 @@
# Enable ECMAScript Internationalization API. Enabling this feature will
# add a dependency on the ICU library.
'v8_enable_i18n_support%': 1,
# Enable compiler warnings when using V8_DEPRECATED apis.
'v8_deprecation_warnings%': 0,
},
'target_defaults': {
'conditions': [
@ -76,6 +79,9 @@
['v8_interpreted_regexp==1', {
'defines': ['V8_INTERPRETED_REGEXP',],
}],
['v8_deprecation_warnings==1', {
'defines': ['V8_DEPRECATION_WARNINGS',],
}],
['v8_enable_i18n_support==1', {
'defines': ['V8_I18N_SUPPORT',],
}],

View File

@ -62,11 +62,6 @@ class V8_EXPORT CpuProfileNode {
*/
const char* GetBailoutReason() const;
/** DEPRECATED. Please use GetHitCount instead.
* Returns the count of samples where function was currently executing.
*/
V8_DEPRECATED(double GetSelfSamplesCount() const);
/**
* Returns the count of samples where the function was currently executing.
*/

View File

@ -586,7 +586,6 @@ template <class T, class M> class Persistent {
V8_INLINE void Reset(Isolate* isolate, const Persistent<S, M2>& other);
// TODO(dcarney): deprecate
V8_INLINE void Dispose() { Reset(); }
V8_DEPRECATED(V8_INLINE void Dispose(Isolate* isolate)) { Reset(); }
V8_INLINE bool IsEmpty() const { return val_ == 0; }
@ -656,8 +655,6 @@ template <class T, class M> class Persistent {
V8_INLINE void ClearWeak();
V8_DEPRECATED(V8_INLINE void ClearWeak(Isolate* isolate)) { ClearWeak(); }
/**
* Marks the reference to this object independent. Garbage collector is free
* to ignore any object groups containing this object. Weak callback for an
@ -666,10 +663,6 @@ template <class T, class M> class Persistent {
*/
V8_INLINE void MarkIndependent();
V8_DEPRECATED(V8_INLINE void MarkIndependent(Isolate* isolate)) {
MarkIndependent();
}
/**
* Marks the reference to this object partially dependent. Partially dependent
* handles only depend on other partially dependent handles and these
@ -680,51 +673,26 @@ template <class T, class M> class Persistent {
*/
V8_INLINE void MarkPartiallyDependent();
V8_DEPRECATED(V8_INLINE void MarkPartiallyDependent(Isolate* isolate)) {
MarkPartiallyDependent();
}
V8_INLINE bool IsIndependent() const;
V8_DEPRECATED(V8_INLINE bool IsIndependent(Isolate* isolate) const) {
return IsIndependent();
}
/** Checks if the handle holds the only reference to an object. */
V8_INLINE bool IsNearDeath() const;
V8_DEPRECATED(V8_INLINE bool IsNearDeath(Isolate* isolate) const) {
return IsNearDeath();
}
/** Returns true if the handle's reference is weak. */
V8_INLINE bool IsWeak() const;
V8_DEPRECATED(V8_INLINE bool IsWeak(Isolate* isolate) const) {
return IsWeak();
}
/**
* Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface
* description in v8-profiler.h for details.
*/
V8_INLINE void SetWrapperClassId(uint16_t class_id);
V8_DEPRECATED(
V8_INLINE void SetWrapperClassId(Isolate * isolate, uint16_t class_id)) {
SetWrapperClassId(class_id);
}
/**
* Returns the class ID previously assigned to this handle or 0 if no class ID
* was previously assigned.
*/
V8_INLINE uint16_t WrapperClassId() const;
V8_DEPRECATED(V8_INLINE uint16_t WrapperClassId(Isolate* isolate) const) {
return WrapperClassId();
}
// TODO(dcarney): remove
V8_INLINE T* ClearAndLeak();
@ -1572,11 +1540,6 @@ class V8_EXPORT String : public Primitive {
*/
int Utf8Length() const;
/**
* This function is no longer useful.
*/
V8_DEPRECATED(V8_INLINE bool MayContainNonAscii() const) { return true; }
/**
* Returns whether this string is known to contain only one byte data.
* Does not read the string.
@ -1627,11 +1590,6 @@ class V8_EXPORT String : public Primitive {
int start = 0,
int length = -1,
int options = NO_OPTIONS) const;
// ASCII characters.
V8_DEPRECATED(int WriteAscii(char* buffer,
int start = 0,
int length = -1,
int options = NO_OPTIONS) const);
// One byte characters.
int WriteOneByte(uint8_t* buffer,
int start = 0,
@ -1762,24 +1720,29 @@ class V8_EXPORT String : public Primitive {
V8_INLINE static String* Cast(v8::Value* obj);
// TODO(dcarney): deprecate
/**
* Allocates a new string from either UTF-8 encoded or ASCII data.
* The second parameter 'length' gives the buffer length. If omitted,
* the function calls 'strlen' to determine the buffer length.
*/
V8_INLINE static Local<String> New(const char* data, int length = -1);
V8_DEPRECATED(
"Use NewFromOneByte instead",
V8_INLINE static Local<String> New(const char* data, int length = -1));
// TODO(dcarney): deprecate
/** Allocates a new string from 16-bit character codes.*/
V8_INLINE static Local<String> New(const uint16_t* data, int length = -1);
V8_DEPRECATED(
"Use NewFromTwoByte instead",
V8_INLINE static Local<String> New(
const uint16_t* data, int length = -1));
// TODO(dcarney): deprecate
/**
* Creates an internalized string (historically called a "symbol",
* not to be confused with ES6 symbols). Returns one if it exists already.
*/
V8_INLINE static Local<String> NewSymbol(const char* data, int length = -1);
V8_DEPRECATED(
"Use NewFromUtf8 instead",
V8_INLINE static Local<String> NewSymbol(
const char* data, int length = -1));
enum NewStringType {
kNormalString, kInternalizedString, kUndetectableString
@ -4585,11 +4548,6 @@ class V8_EXPORT V8 {
static void SetReturnAddressLocationResolver(
ReturnAddressLocationResolver return_address_resolver);
/**
* Deprecated, use the variant with the Isolate parameter below instead.
*/
V8_DEPRECATED(static bool SetFunctionEntryHook(FunctionEntryHook entry_hook));
/**
* Allows the host application to provide the address of a function that's
* invoked on entry to every V8-generated function.
@ -4687,9 +4645,6 @@ class V8_EXPORT V8 {
*/
static bool Dispose();
/** Deprecated. Use Isolate::GetHeapStatistics instead. */
V8_DEPRECATED(static void GetHeapStatistics(HeapStatistics* heap_statistics));
/**
* Iterates through all external resources referenced from current isolate
* heap. GC is not invoked prior to iterating, therefore there is no
@ -4987,17 +4942,14 @@ class V8_EXPORT Context {
Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(),
Handle<Value> global_object = Handle<Value>());
// TODO(dcarney): Remove this function.
/** Deprecated. Use Isolate::GetEnteredContext */
static Local<Context> GetEntered();
V8_DEPRECATED("Use Isolate::GetEnteredContext instead",
static Local<Context> GetEntered());
// TODO(dcarney) Remove this function.
/** Deprecated. Use Isolate::GetCurrentContext instead. */
static Local<Context> GetCurrent();
V8_DEPRECATED("Use Isolate::GetCurrentContext instead",
static Local<Context> GetCurrent());
// TODO(dcarney) Remove this function.
/** Deprecated. Use Isolate::GetCallingContext instead. */
static Local<Context> GetCalling();
V8_DEPRECATED("Use Isolate::GetCallingContext instead",
static Local<Context> GetCalling());
/**
* Sets the security token for the context. To access an object in

View File

@ -245,6 +245,7 @@
// older compilers.
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
# define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0))
# define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
# define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
@ -320,12 +321,16 @@
// A macro to mark classes or functions as deprecated.
#if !V8_DISABLE_DEPRECATIONS && V8_HAS_ATTRIBUTE_DEPRECATED
# define V8_DEPRECATED(declarator) declarator __attribute__((deprecated))
#elif !V8_DISABLE_DEPRECATIONS && V8_HAS_DECLSPEC_DEPRECATED
# define V8_DEPRECATED(declarator) __declspec(deprecated) declarator
#if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
# define V8_DEPRECATED(message, declarator) \
declarator __attribute__((deprecated(message)))
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
# define V8_DEPRECATED(message, declarator) \
declarator __attribute__((deprecated))
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
# define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
#else
# define V8_DEPRECATED(declarator) declarator
# define V8_DEPRECATED(message, declarator) declarator
#endif

View File

@ -4709,39 +4709,6 @@ int String::WriteUtf8(char* buffer,
}
int String::WriteAscii(char* buffer,
int start,
int length,
int options) const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
LOG_API(isolate, "String::WriteAscii");
ENTER_V8(isolate);
ASSERT(start >= 0 && length >= -1);
i::Handle<i::String> str = Utils::OpenHandle(this);
isolate->string_tracker()->RecordWrite(str);
if (options & HINT_MANY_WRITES_EXPECTED) {
FlattenString(str); // Flatten the string for efficiency.
}
int end = length;
if ((length == -1) || (length > str->length() - start)) {
end = str->length() - start;
}
if (end < 0) return 0;
i::StringCharacterStream write_stream(*str, isolate->write_iterator(), start);
int i;
for (i = 0; i < end; i++) {
char c = static_cast<char>(write_stream.GetNext());
if (c == '\0' && !(options & PRESERVE_ASCII_NULL)) c = ' ';
buffer[i] = c;
}
if (!(options & NO_NULL_TERMINATION) && (length == -1 || i < length)) {
buffer[i] = '\0';
}
return i;
}
template<typename CharType>
static inline int WriteHelper(const String* string,
CharType* buffer,
@ -4983,11 +4950,6 @@ void v8::V8::SetReturnAddressLocationResolver(
}
bool v8::V8::SetFunctionEntryHook(FunctionEntryHook entry_hook) {
return SetFunctionEntryHook(Isolate::GetCurrent(), entry_hook);
}
bool v8::V8::SetFunctionEntryHook(Isolate* ext_isolate,
FunctionEntryHook entry_hook) {
ASSERT(ext_isolate != NULL);
@ -5048,22 +5010,6 @@ HeapStatistics::HeapStatistics(): total_heap_size_(0),
heap_size_limit_(0) { }
void v8::V8::GetHeapStatistics(HeapStatistics* heap_statistics) {
i::Isolate* isolate = i::Isolate::UncheckedCurrent();
if (isolate == NULL || !isolate->IsInitialized()) {
// Isolate is unitialized thus heap is not configured yet.
heap_statistics->total_heap_size_ = 0;
heap_statistics->total_heap_size_executable_ = 0;
heap_statistics->total_physical_size_ = 0;
heap_statistics->used_heap_size_ = 0;
heap_statistics->heap_size_limit_ = 0;
return;
}
Isolate* ext_isolate = reinterpret_cast<Isolate*>(isolate);
return ext_isolate->GetHeapStatistics(heap_statistics);
}
void v8::V8::VisitExternalResources(ExternalResourceVisitor* visitor) {
i::Isolate* isolate = i::Isolate::Current();
isolate->heap()->VisitExternalResources(visitor);
@ -6967,11 +6913,6 @@ const char* CpuProfileNode::GetBailoutReason() const {
}
double CpuProfileNode::GetSelfSamplesCount() const {
return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks();
}
unsigned CpuProfileNode::GetHitCount() const {
return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks();
}

View File

@ -29,7 +29,6 @@
#include <stdlib.h>
#define V8_DISABLE_DEPRECATIONS 1
#include "v8.h"
#include "api.h"
@ -43,7 +42,6 @@
#include "platform/socket.h"
#include "stub-cache.h"
#include "utils.h"
#undef V8_DISABLE_DEPRECATIONS
using ::v8::internal::Mutex;