Skip to content

Commit e0d7f81

Browse files
danelphickCommit Bot
authored andcommitted
[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/+/1591605 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Dan Elphick <delphick@chromium.org> Cr-Commit-Position: refs/heads/master@{#61373}
1 parent f2e6522 commit e0d7f81

2 files changed

Lines changed: 19 additions & 129 deletions

File tree

‎include/v8.h‎

Lines changed: 6 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ class ExternalString;
122122
class Isolate;
123123
class LocalEmbedderHeapTracer;
124124
class MicrotaskQueue;
125-
class NeverReadOnlySpaceObject;
126125
struct ScriptStreamingData;
127126
template<typename T> class CustomArguments;
128127
class PropertyCallbackArguments;
@@ -2838,43 +2837,23 @@ class V8_EXPORT String : public Name {
28382837

28392838
V8_INLINE static String* Cast(v8::Value* obj);
28402839

2841-
// TODO(dcarney): remove with deprecation of New functions.
2842-
enum NewStringType {
2843-
kNormalString = static_cast<int>(v8::NewStringType::kNormal),
2844-
kInternalizedString = static_cast<int>(v8::NewStringType::kInternalized)
2845-
};
2846-
2847-
/** Allocates a new string from UTF-8 data.*/
2848-
static V8_DEPRECATED(
2849-
"Use maybe version",
2850-
Local<String> NewFromUtf8(Isolate* isolate, const char* data,
2851-
NewStringType type = kNormalString,
2852-
int length = -1));
2853-
28542840
/** Allocates a new string from UTF-8 data. Only returns an empty value when
28552841
* length > kMaxLength. **/
28562842
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromUtf8(
2857-
Isolate* isolate, const char* data, v8::NewStringType type,
2858-
int length = -1);
2843+
Isolate* isolate, const char* data,
2844+
NewStringType type = NewStringType::kNormal, int length = -1);
28592845

28602846
/** Allocates a new string from Latin-1 data. Only returns an empty value
28612847
* when length > kMaxLength. **/
28622848
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromOneByte(
2863-
Isolate* isolate, const uint8_t* data, v8::NewStringType type,
2864-
int length = -1);
2865-
2866-
/** Allocates a new string from UTF-16 data.*/
2867-
static V8_DEPRECATED(
2868-
"Use maybe version",
2869-
Local<String> NewFromTwoByte(Isolate* isolate, const uint16_t* data,
2870-
NewStringType type = kNormalString,
2871-
int length = -1));
2849+
Isolate* isolate, const uint8_t* data,
2850+
NewStringType type = NewStringType::kNormal, int length = -1);
28722851

28732852
/** Allocates a new string from UTF-16 data. Only returns an empty value when
28742853
* length > kMaxLength. **/
28752854
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromTwoByte(
2876-
Isolate* isolate, const uint16_t* data, v8::NewStringType type,
2877-
int length = -1);
2855+
Isolate* isolate, const uint16_t* data,
2856+
NewStringType type = NewStringType::kNormal, int length = -1);
28782857

28792858
/**
28802859
* Creates a new string by concatenating the left and the right strings
@@ -2913,10 +2892,6 @@ class V8_EXPORT String : public Name {
29132892
* should the underlying buffer be deallocated or modified except through the
29142893
* destructor of the external string resource.
29152894
*/
2916-
static V8_DEPRECATED(
2917-
"Use maybe version",
2918-
Local<String> NewExternal(Isolate* isolate,
2919-
ExternalOneByteStringResource* resource));
29202895
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalOneByte(
29212896
Isolate* isolate, ExternalOneByteStringResource* resource);
29222897

@@ -3855,9 +3830,6 @@ class ReturnValue {
38553830
}
38563831
// Local setters
38573832
template <typename S>
3858-
V8_INLINE V8_DEPRECATED("Use Global<> instead",
3859-
void Set(const Persistent<S>& handle));
3860-
template <typename S>
38613833
V8_INLINE void Set(const Global<S>& handle);
38623834
template <typename S>
38633835
V8_INLINE void Set(const TracedGlobal<S>& handle);
@@ -5245,38 +5217,6 @@ class V8_EXPORT Date : public Object {
52455217

52465218
V8_INLINE static Date* Cast(Value* obj);
52475219

5248-
/**
5249-
* Time zone redetection indicator for
5250-
* DateTimeConfigurationChangeNotification.
5251-
*
5252-
* kSkip indicates V8 that the notification should not trigger redetecting
5253-
* host time zone. kRedetect indicates V8 that host time zone should be
5254-
* redetected, and used to set the default time zone.
5255-
*
5256-
* The host time zone detection may require file system access or similar
5257-
* operations unlikely to be available inside a sandbox. If v8 is run inside a
5258-
* sandbox, the host time zone has to be detected outside the sandbox before
5259-
* calling DateTimeConfigurationChangeNotification function.
5260-
*/
5261-
enum class TimeZoneDetection { kSkip, kRedetect };
5262-
5263-
/**
5264-
* Notification that the embedder has changed the time zone,
5265-
* daylight savings time, or other date / time configuration
5266-
* parameters. V8 keeps a cache of various values used for
5267-
* date / time computation. This notification will reset
5268-
* those cached values for the current context so that date /
5269-
* time configuration changes would be reflected in the Date
5270-
* object.
5271-
*
5272-
* This API should not be called more than needed as it will
5273-
* negatively impact the performance of date operations.
5274-
*/
5275-
V8_DEPRECATED("Use Isolate::DateTimeConfigurationChangeNotification",
5276-
static void DateTimeConfigurationChangeNotification(
5277-
Isolate* isolate, TimeZoneDetection time_zone_detection =
5278-
TimeZoneDetection::kSkip));
5279-
52805220
private:
52815221
static void CheckCast(Value* obj);
52825222
};
@@ -9950,17 +9890,6 @@ void TracedGlobal<T>::SetFinalizationCallback(
99509890
template <typename T>
99519891
ReturnValue<T>::ReturnValue(internal::Address* slot) : value_(slot) {}
99529892

9953-
template<typename T>
9954-
template<typename S>
9955-
void ReturnValue<T>::Set(const Persistent<S>& handle) {
9956-
TYPE_CHECK(T, S);
9957-
if (V8_UNLIKELY(handle.IsEmpty())) {
9958-
*value_ = GetDefaultValue();
9959-
} else {
9960-
*value_ = *reinterpret_cast<internal::Address*>(*handle);
9961-
}
9962-
}
9963-
99649893
template <typename T>
99659894
template <typename S>
99669895
void ReturnValue<T>::Set(const Global<S>& handle) {

‎src/api.cc‎

Lines changed: 13 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6310,35 +6310,34 @@ inline int StringLength(const uint16_t* string) {
63106310

63116311
V8_WARN_UNUSED_RESULT
63126312
inline i::MaybeHandle<i::String> NewString(i::Factory* factory,
6313-
v8::NewStringType type,
6313+
NewStringType type,
63146314
i::Vector<const char> string) {
6315-
if (type == v8::NewStringType::kInternalized) {
6315+
if (type == NewStringType::kInternalized) {
63166316
return factory->InternalizeUtf8String(string);
63176317
}
63186318
return factory->NewStringFromUtf8(string);
63196319
}
63206320

63216321
V8_WARN_UNUSED_RESULT
63226322
inline i::MaybeHandle<i::String> NewString(i::Factory* factory,
6323-
v8::NewStringType type,
6323+
NewStringType type,
63246324
i::Vector<const uint8_t> string) {
6325-
if (type == v8::NewStringType::kInternalized) {
6325+
if (type == NewStringType::kInternalized) {
63266326
return factory->InternalizeOneByteString(string);
63276327
}
63286328
return factory->NewStringFromOneByte(string);
63296329
}
63306330

63316331
V8_WARN_UNUSED_RESULT
63326332
inline i::MaybeHandle<i::String> NewString(i::Factory* factory,
6333-
v8::NewStringType type,
6333+
NewStringType type,
63346334
i::Vector<const uint16_t> string) {
6335-
if (type == v8::NewStringType::kInternalized) {
6335+
if (type == NewStringType::kInternalized) {
63366336
return factory->InternalizeTwoByteString(string);
63376337
}
63386338
return factory->NewStringFromTwoByte(string);
63396339
}
63406340

6341-
63426341
STATIC_ASSERT(v8::String::kMaxLength == i::String::kMaxLength);
63436342

63446343
} // anonymous namespace
@@ -6363,43 +6362,21 @@ STATIC_ASSERT(v8::String::kMaxLength == i::String::kMaxLength);
63636362
result = Utils::ToLocal(handle_result); \
63646363
}
63656364

6366-
Local<String> String::NewFromUtf8(Isolate* isolate,
6367-
const char* data,
6368-
NewStringType type,
6369-
int length) {
6370-
NEW_STRING(isolate, String, NewFromUtf8, char, data,
6371-
static_cast<v8::NewStringType>(type), length);
6372-
RETURN_TO_LOCAL_UNCHECKED(result, String);
6373-
}
6374-
6375-
63766365
MaybeLocal<String> String::NewFromUtf8(Isolate* isolate, const char* data,
6377-
v8::NewStringType type, int length) {
6366+
NewStringType type, int length) {
63786367
NEW_STRING(isolate, String, NewFromUtf8, char, data, type, length);
63796368
return result;
63806369
}
63816370

6382-
63836371
MaybeLocal<String> String::NewFromOneByte(Isolate* isolate, const uint8_t* data,
6384-
v8::NewStringType type, int length) {
6372+
NewStringType type, int length) {
63856373
NEW_STRING(isolate, String, NewFromOneByte, uint8_t, data, type, length);
63866374
return result;
63876375
}
63886376

6389-
6390-
Local<String> String::NewFromTwoByte(Isolate* isolate,
6391-
const uint16_t* data,
6392-
NewStringType type,
6393-
int length) {
6394-
NEW_STRING(isolate, String, NewFromTwoByte, uint16_t, data,
6395-
static_cast<v8::NewStringType>(type), length);
6396-
RETURN_TO_LOCAL_UNCHECKED(result, String);
6397-
}
6398-
6399-
64006377
MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
64016378
const uint16_t* data,
6402-
v8::NewStringType type, int length) {
6379+
NewStringType type, int length) {
64036380
NEW_STRING(isolate, String, NewFromTwoByte, uint16_t, data, type, length);
64046381
return result;
64056382
}
@@ -6466,13 +6443,6 @@ MaybeLocal<String> v8::String::NewExternalOneByte(
64666443
}
64676444
}
64686445

6469-
6470-
Local<String> v8::String::NewExternal(
6471-
Isolate* isolate, v8::String::ExternalOneByteStringResource* resource) {
6472-
RETURN_TO_LOCAL_UNCHECKED(NewExternalOneByte(isolate, resource), String);
6473-
}
6474-
6475-
64766446
bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
64776447
i::DisallowHeapAllocation no_allocation;
64786448

@@ -6753,23 +6723,14 @@ double v8::Date::ValueOf() const {
67536723

67546724
// Assert that the static TimeZoneDetection cast in
67556725
// DateTimeConfigurationChangeNotification is valid.
6756-
#define TIME_ZONE_DETECTION_ASSERT_EQ(value) \
6757-
STATIC_ASSERT( \
6758-
static_cast<int>(v8::Isolate::TimeZoneDetection::value) == \
6759-
static_cast<int>(base::TimezoneCache::TimeZoneDetection::value)); \
6760-
STATIC_ASSERT(static_cast<int>(v8::Isolate::TimeZoneDetection::value) == \
6761-
static_cast<int>(v8::Date::TimeZoneDetection::value));
6726+
#define TIME_ZONE_DETECTION_ASSERT_EQ(value) \
6727+
STATIC_ASSERT( \
6728+
static_cast<int>(v8::Isolate::TimeZoneDetection::value) == \
6729+
static_cast<int>(base::TimezoneCache::TimeZoneDetection::value));
67626730
TIME_ZONE_DETECTION_ASSERT_EQ(kSkip)
67636731
TIME_ZONE_DETECTION_ASSERT_EQ(kRedetect)
67646732
#undef TIME_ZONE_DETECTION_ASSERT_EQ
67656733

6766-
// static
6767-
void v8::Date::DateTimeConfigurationChangeNotification(
6768-
Isolate* isolate, TimeZoneDetection time_zone_detection) {
6769-
isolate->DateTimeConfigurationChangeNotification(
6770-
static_cast<v8::Isolate::TimeZoneDetection>(time_zone_detection));
6771-
}
6772-
67736734
MaybeLocal<v8::RegExp> v8::RegExp::New(Local<Context> context,
67746735
Local<String> pattern, Flags flags) {
67756736
PREPARE_FOR_EXECUTION(context, RegExp, New, RegExp);

0 commit comments

Comments
 (0)