Commit e0d7f816 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[api] Remove methods deprecated in 7.5 and earlier

Removes:
  * ReturnValue::Set(Persistent)
  * String::NewFromUtf8/NewFromTwoByte/NewExternal overloads that
  returned Locals instead of MaybeLocal
  * String::NewStringType

Now that the old String overloads are gone, the new ones can now have
a default parameter for NewStringType matching the old overloads.

Bug: v8:7289, v8:7281, v8:9183
Change-Id: If66e6d587ac778e015c281b376a9b4d6093f6ec3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1591605Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61373}
parent f2e65226
......@@ -122,7 +122,6 @@ class ExternalString;
class Isolate;
class LocalEmbedderHeapTracer;
class MicrotaskQueue;
class NeverReadOnlySpaceObject;
struct ScriptStreamingData;
template<typename T> class CustomArguments;
class PropertyCallbackArguments;
......@@ -2838,43 +2837,23 @@ class V8_EXPORT String : public Name {
V8_INLINE static String* Cast(v8::Value* obj);
// TODO(dcarney): remove with deprecation of New functions.
enum NewStringType {
kNormalString = static_cast<int>(v8::NewStringType::kNormal),
kInternalizedString = static_cast<int>(v8::NewStringType::kInternalized)
};
/** Allocates a new string from UTF-8 data.*/
static V8_DEPRECATED(
"Use maybe version",
Local<String> NewFromUtf8(Isolate* isolate, const char* data,
NewStringType type = kNormalString,
int length = -1));
/** Allocates a new string from UTF-8 data. Only returns an empty value when
* length > kMaxLength. **/
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromUtf8(
Isolate* isolate, const char* data, v8::NewStringType type,
int length = -1);
Isolate* isolate, const char* data,
NewStringType type = NewStringType::kNormal, int length = -1);
/** Allocates a new string from Latin-1 data. Only returns an empty value
* when length > kMaxLength. **/
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromOneByte(
Isolate* isolate, const uint8_t* data, v8::NewStringType type,
int length = -1);
/** Allocates a new string from UTF-16 data.*/
static V8_DEPRECATED(
"Use maybe version",
Local<String> NewFromTwoByte(Isolate* isolate, const uint16_t* data,
NewStringType type = kNormalString,
int length = -1));
Isolate* isolate, const uint8_t* data,
NewStringType type = NewStringType::kNormal, int length = -1);
/** Allocates a new string from UTF-16 data. Only returns an empty value when
* length > kMaxLength. **/
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromTwoByte(
Isolate* isolate, const uint16_t* data, v8::NewStringType type,
int length = -1);
Isolate* isolate, const uint16_t* data,
NewStringType type = NewStringType::kNormal, int length = -1);
/**
* Creates a new string by concatenating the left and the right strings
......@@ -2913,10 +2892,6 @@ class V8_EXPORT String : public Name {
* should the underlying buffer be deallocated or modified except through the
* destructor of the external string resource.
*/
static V8_DEPRECATED(
"Use maybe version",
Local<String> NewExternal(Isolate* isolate,
ExternalOneByteStringResource* resource));
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalOneByte(
Isolate* isolate, ExternalOneByteStringResource* resource);
......@@ -3855,9 +3830,6 @@ class ReturnValue {
}
// Local setters
template <typename S>
V8_INLINE V8_DEPRECATED("Use Global<> instead",
void Set(const Persistent<S>& handle));
template <typename S>
V8_INLINE void Set(const Global<S>& handle);
template <typename S>
V8_INLINE void Set(const TracedGlobal<S>& handle);
......@@ -5245,38 +5217,6 @@ class V8_EXPORT Date : public Object {
V8_INLINE static Date* Cast(Value* obj);
/**
* Time zone redetection indicator for
* DateTimeConfigurationChangeNotification.
*
* kSkip indicates V8 that the notification should not trigger redetecting
* host time zone. kRedetect indicates V8 that host time zone should be
* redetected, and used to set the default time zone.
*
* The host time zone detection may require file system access or similar
* operations unlikely to be available inside a sandbox. If v8 is run inside a
* sandbox, the host time zone has to be detected outside the sandbox before
* calling DateTimeConfigurationChangeNotification function.
*/
enum class TimeZoneDetection { kSkip, kRedetect };
/**
* Notification that the embedder has changed the time zone,
* daylight savings time, or other date / time configuration
* parameters. V8 keeps a cache of various values used for
* date / time computation. This notification will reset
* those cached values for the current context so that date /
* time configuration changes would be reflected in the Date
* object.
*
* This API should not be called more than needed as it will
* negatively impact the performance of date operations.
*/
V8_DEPRECATED("Use Isolate::DateTimeConfigurationChangeNotification",
static void DateTimeConfigurationChangeNotification(
Isolate* isolate, TimeZoneDetection time_zone_detection =
TimeZoneDetection::kSkip));
private:
static void CheckCast(Value* obj);
};
......@@ -9950,17 +9890,6 @@ void TracedGlobal<T>::SetFinalizationCallback(
template <typename T>
ReturnValue<T>::ReturnValue(internal::Address* slot) : value_(slot) {}
template<typename T>
template<typename S>
void ReturnValue<T>::Set(const Persistent<S>& handle) {
TYPE_CHECK(T, S);
if (V8_UNLIKELY(handle.IsEmpty())) {
*value_ = GetDefaultValue();
} else {
*value_ = *reinterpret_cast<internal::Address*>(*handle);
}
}
template <typename T>
template <typename S>
void ReturnValue<T>::Set(const Global<S>& handle) {
......
......@@ -6310,9 +6310,9 @@ inline int StringLength(const uint16_t* string) {
V8_WARN_UNUSED_RESULT
inline i::MaybeHandle<i::String> NewString(i::Factory* factory,
v8::NewStringType type,
NewStringType type,
i::Vector<const char> string) {
if (type == v8::NewStringType::kInternalized) {
if (type == NewStringType::kInternalized) {
return factory->InternalizeUtf8String(string);
}
return factory->NewStringFromUtf8(string);
......@@ -6320,9 +6320,9 @@ inline i::MaybeHandle<i::String> NewString(i::Factory* factory,
V8_WARN_UNUSED_RESULT
inline i::MaybeHandle<i::String> NewString(i::Factory* factory,
v8::NewStringType type,
NewStringType type,
i::Vector<const uint8_t> string) {
if (type == v8::NewStringType::kInternalized) {
if (type == NewStringType::kInternalized) {
return factory->InternalizeOneByteString(string);
}
return factory->NewStringFromOneByte(string);
......@@ -6330,15 +6330,14 @@ inline i::MaybeHandle<i::String> NewString(i::Factory* factory,
V8_WARN_UNUSED_RESULT
inline i::MaybeHandle<i::String> NewString(i::Factory* factory,
v8::NewStringType type,
NewStringType type,
i::Vector<const uint16_t> string) {
if (type == v8::NewStringType::kInternalized) {
if (type == NewStringType::kInternalized) {
return factory->InternalizeTwoByteString(string);
}
return factory->NewStringFromTwoByte(string);
}
STATIC_ASSERT(v8::String::kMaxLength == i::String::kMaxLength);
} // anonymous namespace
......@@ -6363,43 +6362,21 @@ STATIC_ASSERT(v8::String::kMaxLength == i::String::kMaxLength);
result = Utils::ToLocal(handle_result); \
}
Local<String> String::NewFromUtf8(Isolate* isolate,
const char* data,
NewStringType type,
int length) {
NEW_STRING(isolate, String, NewFromUtf8, char, data,
static_cast<v8::NewStringType>(type), length);
RETURN_TO_LOCAL_UNCHECKED(result, String);
}
MaybeLocal<String> String::NewFromUtf8(Isolate* isolate, const char* data,
v8::NewStringType type, int length) {
NewStringType type, int length) {
NEW_STRING(isolate, String, NewFromUtf8, char, data, type, length);
return result;
}
MaybeLocal<String> String::NewFromOneByte(Isolate* isolate, const uint8_t* data,
v8::NewStringType type, int length) {
NewStringType type, int length) {
NEW_STRING(isolate, String, NewFromOneByte, uint8_t, data, type, length);
return result;
}
Local<String> String::NewFromTwoByte(Isolate* isolate,
const uint16_t* data,
NewStringType type,
int length) {
NEW_STRING(isolate, String, NewFromTwoByte, uint16_t, data,
static_cast<v8::NewStringType>(type), length);
RETURN_TO_LOCAL_UNCHECKED(result, String);
}
MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
const uint16_t* data,
v8::NewStringType type, int length) {
NewStringType type, int length) {
NEW_STRING(isolate, String, NewFromTwoByte, uint16_t, data, type, length);
return result;
}
......@@ -6466,13 +6443,6 @@ MaybeLocal<String> v8::String::NewExternalOneByte(
}
}
Local<String> v8::String::NewExternal(
Isolate* isolate, v8::String::ExternalOneByteStringResource* resource) {
RETURN_TO_LOCAL_UNCHECKED(NewExternalOneByte(isolate, resource), String);
}
bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
i::DisallowHeapAllocation no_allocation;
......@@ -6753,23 +6723,14 @@ double v8::Date::ValueOf() const {
// Assert that the static TimeZoneDetection cast in
// DateTimeConfigurationChangeNotification is valid.
#define TIME_ZONE_DETECTION_ASSERT_EQ(value) \
STATIC_ASSERT( \
static_cast<int>(v8::Isolate::TimeZoneDetection::value) == \
static_cast<int>(base::TimezoneCache::TimeZoneDetection::value)); \
STATIC_ASSERT(static_cast<int>(v8::Isolate::TimeZoneDetection::value) == \
static_cast<int>(v8::Date::TimeZoneDetection::value));
#define TIME_ZONE_DETECTION_ASSERT_EQ(value) \
STATIC_ASSERT( \
static_cast<int>(v8::Isolate::TimeZoneDetection::value) == \
static_cast<int>(base::TimezoneCache::TimeZoneDetection::value));
TIME_ZONE_DETECTION_ASSERT_EQ(kSkip)
TIME_ZONE_DETECTION_ASSERT_EQ(kRedetect)
#undef TIME_ZONE_DETECTION_ASSERT_EQ
// static
void v8::Date::DateTimeConfigurationChangeNotification(
Isolate* isolate, TimeZoneDetection time_zone_detection) {
isolate->DateTimeConfigurationChangeNotification(
static_cast<v8::Isolate::TimeZoneDetection>(time_zone_detection));
}
MaybeLocal<v8::RegExp> v8::RegExp::New(Local<Context> context,
Local<String> pattern, Flags flags) {
PREPARE_FOR_EXECUTION(context, RegExp, New, RegExp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment