Commit 957854dd authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

Reland "[cleanup] Reland: Remove deprecated functions"

This reverts commit 717b9385.

Reason for revert: Cast build is now fixed

Original change's description:
> Revert "[cleanup] Reland: Remove deprecated functions"
> 
> This reverts commit c8376b00.
> 
> Reason for revert: Still borked: https://ci.chromium.org/p/chromium/builders/luci.chromium.try/cast_shell_linux/114796
> 
> Original change's description:
> > [cleanup] Reland: Remove deprecated functions
> > 
> > This is reland of https://chromium-review.googlesource.com/c/v8/v8/+/1154915
> > with no changes since the break in chromium for ChromeOS is now fixed.
> > 
> > Removes all V8_DEPRECATED functions that weren't recently marked as well
> > any V8_DEPRECATE_SOON function that relied on using using the address of
> > an object to get hold of the Isolate.
> > 
> > Bug: v8:7786
> > Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.chromium.try:linux-chromeos-dbg;luci.chromium.try:linux-chromeos-rel
> > Change-Id: Ib62d38b9201fd0dab719948cb5ae5a0a164f7013
> > Reviewed-on: https://chromium-review.googlesource.com/1172350
> > Reviewed-by: Yang Guo <yangguo@chromium.org>
> > Commit-Queue: Dan Elphick <delphick@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#55119}
> 
> TBR=yangguo@chromium.org,delphick@chromium.org
> 
> Change-Id: Id1308a694092acfc90a3e7183d66c002feb63999
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: v8:7786
> Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.chromium.try:linux-chromeos-dbg;luci.chromium.try:linux-chromeos-rel
> Reviewed-on: https://chromium-review.googlesource.com/1174751
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Commit-Queue: Leszek Swirski <leszeks@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#55127}

TBR=yangguo@chromium.org,leszeks@chromium.org,delphick@chromium.org

Change-Id: Id65dae1abdad6f854afec9eb59ed2bddd9246f79
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:7786
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.chromium.try:linux-chromeos-dbg;luci.chromium.try:linux-chromeos-rel
Reviewed-on: https://chromium-review.googlesource.com/1175721Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55136}
parent 77e00433
...@@ -1125,10 +1125,6 @@ class V8_EXPORT PrimitiveArray { ...@@ -1125,10 +1125,6 @@ class V8_EXPORT PrimitiveArray {
int Length() const; int Length() const;
void Set(Isolate* isolate, int index, Local<Primitive> item); void Set(Isolate* isolate, int index, Local<Primitive> item);
Local<Primitive> Get(Isolate* isolate, int index); Local<Primitive> Get(Isolate* isolate, int index);
V8_DEPRECATE_SOON("Use Isolate version",
void Set(int index, Local<Primitive> item));
V8_DEPRECATE_SOON("Use Isolate version", Local<Primitive> Get(int index));
}; };
/** /**
...@@ -1356,23 +1352,15 @@ class V8_EXPORT Script { ...@@ -1356,23 +1352,15 @@ class V8_EXPORT Script {
/** /**
* A shorthand for ScriptCompiler::Compile(). * A shorthand for ScriptCompiler::Compile().
*/ */
static V8_DEPRECATED("Use maybe version",
Local<Script> Compile(Local<String> source,
ScriptOrigin* origin = nullptr));
static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile( static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
Local<Context> context, Local<String> source, Local<Context> context, Local<String> source,
ScriptOrigin* origin = nullptr); ScriptOrigin* origin = nullptr);
static Local<Script> V8_DEPRECATED("Use maybe version",
Compile(Local<String> source,
Local<String> file_name));
/** /**
* Runs the script returning the resulting value. It will be run in the * Runs the script returning the resulting value. It will be run in the
* context in which it was created (ScriptCompiler::CompileBound or * context in which it was created (ScriptCompiler::CompileBound or
* UnboundScript::BindToCurrentContext()). * UnboundScript::BindToCurrentContext()).
*/ */
V8_DEPRECATED("Use maybe version", Local<Value> Run());
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Run(Local<Context> context); V8_WARN_UNUSED_RESULT MaybeLocal<Value> Run(Local<Context> context);
/** /**
...@@ -1688,13 +1676,6 @@ class V8_EXPORT ScriptCompiler { ...@@ -1688,13 +1676,6 @@ class V8_EXPORT ScriptCompiler {
* It is possible to specify multiple context extensions (obj in the above * It is possible to specify multiple context extensions (obj in the above
* example). * example).
*/ */
static V8_DEPRECATED("Use maybe version",
Local<Function> CompileFunctionInContext(
Isolate* isolate, Source* source,
Local<Context> context, size_t arguments_count,
Local<String> arguments[],
size_t context_extension_count,
Local<Object> context_extensions[]));
static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInContext( static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInContext(
Local<Context> context, Source* source, size_t arguments_count, Local<Context> context, Source* source, size_t arguments_count,
Local<String> arguments[], size_t context_extension_count, Local<String> arguments[], size_t context_extension_count,
...@@ -1717,10 +1698,6 @@ class V8_EXPORT ScriptCompiler { ...@@ -1717,10 +1698,6 @@ class V8_EXPORT ScriptCompiler {
static CachedData* CreateCodeCache( static CachedData* CreateCodeCache(
Local<UnboundModuleScript> unbound_module_script); Local<UnboundModuleScript> unbound_module_script);
V8_DEPRECATED("Source string is no longer required",
static CachedData* CreateCodeCache(
Local<UnboundScript> unbound_script, Local<String> source));
/** /**
* Creates and returns code cache for the specified function that was * Creates and returns code cache for the specified function that was
* previously produced by CompileFunctionInContext. * previously produced by CompileFunctionInContext.
...@@ -1729,10 +1706,6 @@ class V8_EXPORT ScriptCompiler { ...@@ -1729,10 +1706,6 @@ class V8_EXPORT ScriptCompiler {
*/ */
static CachedData* CreateCodeCacheForFunction(Local<Function> function); static CachedData* CreateCodeCacheForFunction(Local<Function> function);
V8_DEPRECATED("Source string is no longer required",
static CachedData* CreateCodeCacheForFunction(
Local<Function> function, Local<String> source));
private: private:
static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal( static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal(
Isolate* isolate, Source* source, CompileOptions options, Isolate* isolate, Source* source, CompileOptions options,
...@@ -1752,7 +1725,6 @@ class V8_EXPORT Message { ...@@ -1752,7 +1725,6 @@ class V8_EXPORT Message {
*/ */
Isolate* GetIsolate() const; Isolate* GetIsolate() const;
V8_DEPRECATED("Use maybe version", Local<String> GetSourceLine() const);
V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSourceLine( V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSourceLine(
Local<Context> context) const; Local<Context> context) const;
...@@ -1778,7 +1750,6 @@ class V8_EXPORT Message { ...@@ -1778,7 +1750,6 @@ class V8_EXPORT Message {
/** /**
* Returns the number, 1-based, of the line where the error occurred. * Returns the number, 1-based, of the line where the error occurred.
*/ */
V8_DEPRECATED("Use maybe version", int GetLineNumber() const);
V8_WARN_UNUSED_RESULT Maybe<int> GetLineNumber(Local<Context> context) const; V8_WARN_UNUSED_RESULT Maybe<int> GetLineNumber(Local<Context> context) const;
/** /**
...@@ -1858,8 +1829,6 @@ class V8_EXPORT StackTrace { ...@@ -1858,8 +1829,6 @@ class V8_EXPORT StackTrace {
/** /**
* Returns a StackFrame at a particular index. * Returns a StackFrame at a particular index.
*/ */
V8_DEPRECATE_SOON("Use Isolate version",
Local<StackFrame> GetFrame(uint32_t index) const);
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const; Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
/** /**
...@@ -2568,13 +2537,6 @@ class V8_EXPORT Value : public Data { ...@@ -2568,13 +2537,6 @@ class V8_EXPORT Value : public Data {
V8_DEPRECATE_SOON("Use maybe version", V8_DEPRECATE_SOON("Use maybe version",
Local<Int32> ToInt32(Isolate* isolate) const); Local<Int32> ToInt32(Isolate* isolate) const);
inline V8_DEPRECATE_SOON("Use maybe version",
Local<Boolean> ToBoolean() const);
inline V8_DEPRECATE_SOON("Use maybe version", Local<String> ToString() const);
inline V8_DEPRECATE_SOON("Use maybe version", Local<Object> ToObject() const);
inline V8_DEPRECATE_SOON("Use maybe version",
Local<Integer> ToInteger() const);
/** /**
* Attempts to convert a string to an array index. * Attempts to convert a string to an array index.
* Returns an empty handle if the conversion fails. * Returns an empty handle if the conversion fails.
...@@ -2590,14 +2552,7 @@ class V8_EXPORT Value : public Data { ...@@ -2590,14 +2552,7 @@ class V8_EXPORT Value : public Data {
Local<Context> context) const; Local<Context> context) const;
V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const; V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
V8_DEPRECATE_SOON("Use maybe version", bool BooleanValue() const);
V8_DEPRECATE_SOON("Use maybe version", double NumberValue() const);
V8_DEPRECATE_SOON("Use maybe version", int64_t IntegerValue() const);
V8_DEPRECATE_SOON("Use maybe version", uint32_t Uint32Value() const);
V8_DEPRECATE_SOON("Use maybe version", int32_t Int32Value() const);
/** JS == */ /** JS == */
V8_DEPRECATE_SOON("Use maybe version", bool Equals(Local<Value> that) const);
V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context, V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
Local<Value> that) const; Local<Value> that) const;
bool StrictEquals(Local<Value> that) const; bool StrictEquals(Local<Value> that) const;
...@@ -2704,8 +2659,6 @@ class V8_EXPORT String : public Name { ...@@ -2704,8 +2659,6 @@ class V8_EXPORT String : public Name {
* Returns the number of bytes in the UTF-8 encoded * Returns the number of bytes in the UTF-8 encoded
* representation of this string. * representation of this string.
*/ */
V8_DEPRECATE_SOON("Use Isolate version instead", int Utf8Length() const);
int Utf8Length(Isolate* isolate) const; int Utf8Length(Isolate* isolate) const;
/** /**
...@@ -2762,23 +2715,12 @@ class V8_EXPORT String : public Name { ...@@ -2762,23 +2715,12 @@ class V8_EXPORT String : public Name {
// 16-bit character codes. // 16-bit character codes.
int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1, int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1,
int options = NO_OPTIONS) const; int options = NO_OPTIONS) const;
V8_DEPRECATE_SOON("Use Isolate* version",
int Write(uint16_t* buffer, int start = 0, int length = -1,
int options = NO_OPTIONS) const);
// One byte characters. // One byte characters.
int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0, int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0,
int length = -1, int options = NO_OPTIONS) const; int length = -1, int options = NO_OPTIONS) const;
V8_DEPRECATE_SOON("Use Isolate* version",
int WriteOneByte(uint8_t* buffer, int start = 0,
int length = -1, int options = NO_OPTIONS)
const);
// UTF-8 encoded characters. // UTF-8 encoded characters.
int WriteUtf8(Isolate* isolate, char* buffer, int length = -1, int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
int* nchars_ref = NULL, int options = NO_OPTIONS) const; int* nchars_ref = NULL, int options = NO_OPTIONS) const;
V8_DEPRECATE_SOON("Use Isolate* version",
int WriteUtf8(char* buffer, int length = -1,
int* nchars_ref = NULL,
int options = NO_OPTIONS) const);
/** /**
* A zero length string. * A zero length string.
...@@ -2942,9 +2884,6 @@ class V8_EXPORT String : public Name { ...@@ -2942,9 +2884,6 @@ class V8_EXPORT String : public Name {
*/ */
static Local<String> Concat(Isolate* isolate, Local<String> left, static Local<String> Concat(Isolate* isolate, Local<String> left,
Local<String> right); Local<String> right);
static V8_DEPRECATE_SOON("Use Isolate* version",
Local<String> Concat(Local<String> left,
Local<String> right));
/** /**
* Creates a new external string using the data defined in the given * Creates a new external string using the data defined in the given
...@@ -3013,8 +2952,6 @@ class V8_EXPORT String : public Name { ...@@ -3013,8 +2952,6 @@ class V8_EXPORT String : public Name {
*/ */
class V8_EXPORT Utf8Value { class V8_EXPORT Utf8Value {
public: public:
V8_DEPRECATED("Use Isolate version",
explicit Utf8Value(Local<v8::Value> obj));
Utf8Value(Isolate* isolate, Local<v8::Value> obj); Utf8Value(Isolate* isolate, Local<v8::Value> obj);
~Utf8Value(); ~Utf8Value();
char* operator*() { return str_; } char* operator*() { return str_; }
...@@ -3038,7 +2975,6 @@ class V8_EXPORT String : public Name { ...@@ -3038,7 +2975,6 @@ class V8_EXPORT String : public Name {
*/ */
class V8_EXPORT Value { class V8_EXPORT Value {
public: public:
V8_DEPRECATED("Use Isolate version", explicit Value(Local<v8::Value> obj));
Value(Isolate* isolate, Local<v8::Value> obj); Value(Isolate* isolate, Local<v8::Value> obj);
~Value(); ~Value();
uint16_t* operator*() { return str_; } uint16_t* operator*() { return str_; }
...@@ -4220,8 +4156,6 @@ class V8_EXPORT Promise : public Object { ...@@ -4220,8 +4156,6 @@ class V8_EXPORT Promise : public Object {
/** /**
* Create a new resolver, along with an associated promise in pending state. * Create a new resolver, along with an associated promise in pending state.
*/ */
static V8_DEPRECATED("Use maybe version",
Local<Resolver> New(Isolate* isolate));
static V8_WARN_UNUSED_RESULT MaybeLocal<Resolver> New( static V8_WARN_UNUSED_RESULT MaybeLocal<Resolver> New(
Local<Context> context); Local<Context> context);
...@@ -4234,11 +4168,9 @@ class V8_EXPORT Promise : public Object { ...@@ -4234,11 +4168,9 @@ class V8_EXPORT Promise : public Object {
* Resolve/reject the associated promise with a given value. * Resolve/reject the associated promise with a given value.
* Ignored if the promise is no longer pending. * Ignored if the promise is no longer pending.
*/ */
V8_DEPRECATED("Use maybe version", void Resolve(Local<Value> value));
V8_WARN_UNUSED_RESULT Maybe<bool> Resolve(Local<Context> context, V8_WARN_UNUSED_RESULT Maybe<bool> Resolve(Local<Context> context,
Local<Value> value); Local<Value> value);
V8_DEPRECATED("Use maybe version", void Reject(Local<Value> value));
V8_WARN_UNUSED_RESULT Maybe<bool> Reject(Local<Context> context, V8_WARN_UNUSED_RESULT Maybe<bool> Reject(Local<Context> context,
Local<Value> value); Local<Value> value);
...@@ -5259,8 +5191,6 @@ class V8_EXPORT BooleanObject : public Object { ...@@ -5259,8 +5191,6 @@ class V8_EXPORT BooleanObject : public Object {
class V8_EXPORT StringObject : public Object { class V8_EXPORT StringObject : public Object {
public: public:
static Local<Value> New(Isolate* isolate, Local<String> value); static Local<Value> New(Isolate* isolate, Local<String> value);
static V8_DEPRECATE_SOON("Use Isolate* version",
Local<Value> New(Local<String> value));
Local<String> ValueOf() const; Local<String> ValueOf() const;
...@@ -5316,8 +5246,6 @@ class V8_EXPORT RegExp : public Object { ...@@ -5316,8 +5246,6 @@ class V8_EXPORT RegExp : public Object {
* static_cast<RegExp::Flags>(kGlobal | kMultiline)) * static_cast<RegExp::Flags>(kGlobal | kMultiline))
* is equivalent to evaluating "/foo/gm". * is equivalent to evaluating "/foo/gm".
*/ */
static V8_DEPRECATED("Use maybe version",
Local<RegExp> New(Local<String> pattern, Flags flags));
static V8_WARN_UNUSED_RESULT MaybeLocal<RegExp> New(Local<Context> context, static V8_WARN_UNUSED_RESULT MaybeLocal<RegExp> New(Local<Context> context,
Local<String> pattern, Local<String> pattern,
Flags flags); Flags flags);
...@@ -5461,57 +5389,8 @@ class V8_EXPORT Template : public Data { ...@@ -5461,57 +5389,8 @@ class V8_EXPORT Template : public Data {
friend class FunctionTemplate; friend class FunctionTemplate;
}; };
// TODO(dcarney): Replace GenericNamedPropertyFooCallback with just
/** // NamedPropertyFooCallback.
* NamedProperty[Getter|Setter] are used as interceptors on object.
* See ObjectTemplate::SetNamedPropertyHandler.
*/
typedef void (*NamedPropertyGetterCallback)(
Local<String> property,
const PropertyCallbackInfo<Value>& info);
/**
* Returns the value if the setter intercepts the request.
* Otherwise, returns an empty handle.
*/
typedef void (*NamedPropertySetterCallback)(
Local<String> property,
Local<Value> value,
const PropertyCallbackInfo<Value>& info);
/**
* Returns a non-empty handle if the interceptor intercepts the request.
* The result is an integer encoding property attributes (like v8::None,
* v8::DontEnum, etc.)
*/
typedef void (*NamedPropertyQueryCallback)(
Local<String> property,
const PropertyCallbackInfo<Integer>& info);
/**
* Returns a non-empty handle if the deleter intercepts the request.
* The return value is true if the property could be deleted and false
* otherwise.
*/
typedef void (*NamedPropertyDeleterCallback)(
Local<String> property,
const PropertyCallbackInfo<Boolean>& info);
/**
* Returns an array containing the names of the properties the named
* property getter intercepts.
*
* Note: The values in the array must be of type v8::Name.
*/
typedef void (*NamedPropertyEnumeratorCallback)(
const PropertyCallbackInfo<Array>& info);
// TODO(dcarney): Deprecate and remove previous typedefs, and replace
// GenericNamedPropertyFooCallback with just NamedPropertyFooCallback.
/** /**
* Interceptor for get requests on an object. * Interceptor for get requests on an object.
...@@ -6178,39 +6057,6 @@ class V8_EXPORT ObjectTemplate : public Template { ...@@ -6178,39 +6057,6 @@ class V8_EXPORT ObjectTemplate : public Template {
Local<AccessorSignature> signature = Local<AccessorSignature>(), Local<AccessorSignature> signature = Local<AccessorSignature>(),
SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect); SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect);
/**
* Sets a named property handler on the object template.
*
* Whenever a property whose name is a string is accessed on objects created
* from this object template, the provided callback is invoked instead of
* accessing the property directly on the JavaScript object.
*
* SetNamedPropertyHandler() is different from SetHandler(), in
* that the latter can intercept symbol-named properties as well as
* string-named properties when called with a
* NamedPropertyHandlerConfiguration. New code should use SetHandler().
*
* \param getter The callback to invoke when getting a property.
* \param setter The callback to invoke when setting a property.
* \param query The callback to invoke to check if a property is present,
* and if present, get its attributes.
* \param deleter The callback to invoke when deleting a property.
* \param enumerator The callback to invoke to enumerate all the named
* properties of an object.
* \param data A piece of data that will be passed to the callbacks
* whenever they are invoked.
*/
V8_DEPRECATED(
"Use SetHandler(const NamedPropertyHandlerConfiguration) "
"with the kOnlyInterceptStrings flag set.",
void SetNamedPropertyHandler(
NamedPropertyGetterCallback getter,
NamedPropertySetterCallback setter = 0,
NamedPropertyQueryCallback query = 0,
NamedPropertyDeleterCallback deleter = 0,
NamedPropertyEnumeratorCallback enumerator = 0,
Local<Value> data = Local<Value>()));
/** /**
* Sets a named property handler on the object template. * Sets a named property handler on the object template.
* *
...@@ -6593,7 +6439,6 @@ typedef void (*AddHistogramSampleCallback)(void* histogram, int sample); ...@@ -6593,7 +6439,6 @@ typedef void (*AddHistogramSampleCallback)(void* histogram, int sample);
// --- Enter/Leave Script Callback --- // --- Enter/Leave Script Callback ---
typedef void (*BeforeCallEnteredCallback)(Isolate*); typedef void (*BeforeCallEnteredCallback)(Isolate*);
typedef void (*CallCompletedCallback)(Isolate*); typedef void (*CallCompletedCallback)(Isolate*);
typedef void (*DeprecatedCallCompletedCallback)();
/** /**
* HostImportModuleDynamicallyCallback is called when we require the * HostImportModuleDynamicallyCallback is called when we require the
...@@ -7766,16 +7611,6 @@ class V8_EXPORT Isolate { ...@@ -7766,16 +7611,6 @@ class V8_EXPORT Isolate {
*/ */
Local<Context> GetCurrentContext(); Local<Context> GetCurrentContext();
/**
* Returns the context of the calling JavaScript code. That is the
* context of the top-most JavaScript frame. If there are no
* JavaScript frames an empty handle is returned.
*/
V8_DEPRECATED(
"Calling context concept is not compatible with tail calls, and will be "
"removed.",
Local<Context> GetCallingContext());
/** Returns the last context entered through V8's C++ API. */ /** Returns the last context entered through V8's C++ API. */
Local<Context> GetEnteredContext(); Local<Context> GetEnteredContext();
...@@ -8027,17 +7862,11 @@ class V8_EXPORT Isolate { ...@@ -8027,17 +7862,11 @@ class V8_EXPORT Isolate {
* further callbacks. * further callbacks.
*/ */
void AddCallCompletedCallback(CallCompletedCallback callback); void AddCallCompletedCallback(CallCompletedCallback callback);
V8_DEPRECATED(
"Use callback with parameter",
void AddCallCompletedCallback(DeprecatedCallCompletedCallback callback));
/** /**
* Removes callback that was installed by AddCallCompletedCallback. * Removes callback that was installed by AddCallCompletedCallback.
*/ */
void RemoveCallCompletedCallback(CallCompletedCallback callback); void RemoveCallCompletedCallback(CallCompletedCallback callback);
V8_DEPRECATED("Use callback with parameter",
void RemoveCallCompletedCallback(
DeprecatedCallCompletedCallback callback));
/** /**
* Set the PromiseHook callback for various promise lifecycle * Set the PromiseHook callback for various promise lifecycle
...@@ -8071,14 +7900,11 @@ class V8_EXPORT Isolate { ...@@ -8071,14 +7900,11 @@ class V8_EXPORT Isolate {
* Controls how Microtasks are invoked. See MicrotasksPolicy for details. * Controls how Microtasks are invoked. See MicrotasksPolicy for details.
*/ */
void SetMicrotasksPolicy(MicrotasksPolicy policy); void SetMicrotasksPolicy(MicrotasksPolicy policy);
V8_DEPRECATED("Use SetMicrotasksPolicy",
void SetAutorunMicrotasks(bool autorun));
/** /**
* Returns the policy controlling how Microtasks are invoked. * Returns the policy controlling how Microtasks are invoked.
*/ */
MicrotasksPolicy GetMicrotasksPolicy() const; MicrotasksPolicy GetMicrotasksPolicy() const;
V8_DEPRECATED("Use GetMicrotasksPolicy", bool WillAutorunMicrotasks() const);
/** /**
* Adds a callback to notify the host application after * Adds a callback to notify the host application after
...@@ -8467,28 +8293,6 @@ class V8_EXPORT V8 { ...@@ -8467,28 +8293,6 @@ class V8_EXPORT V8 {
static void SetNativesDataBlob(StartupData* startup_blob); static void SetNativesDataBlob(StartupData* startup_blob);
static void SetSnapshotDataBlob(StartupData* startup_blob); static void SetSnapshotDataBlob(StartupData* startup_blob);
/**
* Bootstrap an isolate and a context from scratch to create a startup
* snapshot. Include the side-effects of running the optional script.
* Returns { NULL, 0 } on failure.
* The caller acquires ownership of the data array in the return value.
*/
V8_DEPRECATED("Use SnapshotCreator",
static StartupData CreateSnapshotDataBlob(
const char* embedded_source = NULL));
/**
* Bootstrap an isolate and a context from the cold startup blob, run the
* warm-up script to trigger code compilation. The side effects are then
* discarded. The resulting startup snapshot will include compiled code.
* Returns { NULL, 0 } on failure.
* The caller acquires ownership of the data array in the return value.
* The argument startup blob is untouched.
*/
V8_DEPRECATED("Use SnapshotCreator",
static StartupData WarmUpSnapshotDataBlob(
StartupData cold_startup_blob, const char* warmup_source));
/** Set the callback to invoke in case of Dcheck failures. */ /** Set the callback to invoke in case of Dcheck failures. */
static void SetDcheckErrorHandler(DcheckErrorCallback that); static void SetDcheckErrorHandler(DcheckErrorCallback that);
...@@ -8956,7 +8760,6 @@ class V8_EXPORT TryCatch { ...@@ -8956,7 +8760,6 @@ class V8_EXPORT TryCatch {
* Returns the .stack property of the thrown object. If no .stack * Returns the .stack property of the thrown object. If no .stack
* property is present an empty handle is returned. * property is present an empty handle is returned.
*/ */
V8_DEPRECATED("Use maybe version.", Local<Value> StackTrace() const);
V8_WARN_UNUSED_RESULT MaybeLocal<Value> StackTrace( V8_WARN_UNUSED_RESULT MaybeLocal<Value> StackTrace(
Local<Context> context) const; Local<Context> context) const;
...@@ -10321,30 +10124,6 @@ template <class T> Value* Value::Cast(T* value) { ...@@ -10321,30 +10124,6 @@ template <class T> Value* Value::Cast(T* value) {
} }
Local<Boolean> Value::ToBoolean() const {
return ToBoolean(Isolate::GetCurrent()->GetCurrentContext())
.FromMaybe(Local<Boolean>());
}
Local<String> Value::ToString() const {
return ToString(Isolate::GetCurrent()->GetCurrentContext())
.FromMaybe(Local<String>());
}
Local<Object> Value::ToObject() const {
return ToObject(Isolate::GetCurrent()->GetCurrentContext())
.FromMaybe(Local<Object>());
}
Local<Integer> Value::ToInteger() const {
return ToInteger(Isolate::GetCurrent()->GetCurrentContext())
.FromMaybe(Local<Integer>());
}
Boolean* Boolean::Cast(v8::Value* value) { Boolean* Boolean::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS #ifdef V8_ENABLE_CHECKS
CheckCast(value); CheckCast(value);
......
...@@ -218,28 +218,6 @@ Local<Context> ContextFromNeverReadOnlySpaceObject( ...@@ -218,28 +218,6 @@ Local<Context> ContextFromNeverReadOnlySpaceObject(
return reinterpret_cast<v8::Isolate*>(obj->GetIsolate())->GetCurrentContext(); return reinterpret_cast<v8::Isolate*>(obj->GetIsolate())->GetCurrentContext();
} }
// TODO(delphick): Remove this completely when the deprecated functions that use
// it are removed.
// DO NOT USE THIS IN NEW CODE!
i::Isolate* UnsafeIsolateFromHeapObject(i::Handle<i::HeapObject> obj) {
// Use MemoryChunk directly instead of Isolate::FromWritableHeapObject to
// temporarily allow isolate access from read-only space objects.
i::MemoryChunk* chunk = i::MemoryChunk::FromHeapObject(*obj);
return chunk->heap()->isolate();
}
// TODO(delphick): Remove this completely when the deprecated functions that use
// it are removed.
// DO NOT USE THIS IN NEW CODE!
Local<Context> UnsafeContextFromHeapObject(i::Handle<i::Object> obj) {
// Use MemoryChunk directly instead of Isolate::FromWritableHeapObject to
// temporarily allow isolate access from read-only space objects.
i::MemoryChunk* chunk =
i::MemoryChunk::FromHeapObject(i::HeapObject::cast(*obj));
return reinterpret_cast<Isolate*>(chunk->heap()->isolate())
->GetCurrentContext();
}
class InternalEscapableScope : public v8::EscapableHandleScope { class InternalEscapableScope : public v8::EscapableHandleScope {
public: public:
explicit inline InternalEscapableScope(i::Isolate* isolate) explicit inline InternalEscapableScope(i::Isolate* isolate)
...@@ -536,34 +514,6 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { ...@@ -536,34 +514,6 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
void Free(void* data, size_t) override { free(data); } void Free(void* data, size_t) override { free(data); }
}; };
bool RunExtraCode(Isolate* isolate, Local<Context> context,
const char* utf8_source, const char* name) {
base::ElapsedTimer timer;
timer.Start();
Context::Scope context_scope(context);
TryCatch try_catch(isolate);
Local<String> source_string;
if (!String::NewFromUtf8(isolate, utf8_source, NewStringType::kNormal)
.ToLocal(&source_string)) {
return false;
}
Local<String> resource_name =
String::NewFromUtf8(isolate, name, NewStringType::kNormal)
.ToLocalChecked();
ScriptOrigin origin(resource_name);
ScriptCompiler::Source source(source_string, origin);
Local<Script> script;
if (!ScriptCompiler::Compile(context, &source).ToLocal(&script)) return false;
if (script->Run(context).IsEmpty()) return false;
if (i::FLAG_profile_deserialization) {
i::PrintF("Executing custom snapshot script %s took %0.3f ms\n", name,
timer.Elapsed().InMillisecondsF());
}
timer.Stop();
CHECK(!try_catch.HasCaught());
return true;
}
struct SnapshotCreatorData { struct SnapshotCreatorData {
explicit SnapshotCreatorData(Isolate* isolate) explicit SnapshotCreatorData(Isolate* isolate)
: isolate_(isolate), : isolate_(isolate),
...@@ -886,77 +836,6 @@ StartupData SnapshotCreator::CreateBlob( ...@@ -886,77 +836,6 @@ StartupData SnapshotCreator::CreateBlob(
return result; return result;
} }
StartupData V8::CreateSnapshotDataBlob(const char* embedded_source) {
// Create a new isolate and a new context from scratch, optionally run
// a script to embed, and serialize to create a snapshot blob.
StartupData result = {nullptr, 0};
base::ElapsedTimer timer;
timer.Start();
{
SnapshotCreator snapshot_creator;
Isolate* isolate = snapshot_creator.GetIsolate();
{
HandleScope scope(isolate);
Local<Context> context = Context::New(isolate);
if (embedded_source != nullptr &&
!RunExtraCode(isolate, context, embedded_source, "<embedded>")) {
return result;
}
snapshot_creator.SetDefaultContext(context);
}
result = snapshot_creator.CreateBlob(
SnapshotCreator::FunctionCodeHandling::kClear);
}
if (i::FLAG_profile_deserialization) {
i::PrintF("Creating snapshot took %0.3f ms\n",
timer.Elapsed().InMillisecondsF());
}
timer.Stop();
return result;
}
StartupData V8::WarmUpSnapshotDataBlob(StartupData cold_snapshot_blob,
const char* warmup_source) {
CHECK(cold_snapshot_blob.raw_size > 0 && cold_snapshot_blob.data != nullptr);
CHECK_NOT_NULL(warmup_source);
// Use following steps to create a warmed up snapshot blob from a cold one:
// - Create a new isolate from the cold snapshot.
// - Create a new context to run the warmup script. This will trigger
// compilation of executed functions.
// - Create a new context. This context will be unpolluted.
// - Serialize the isolate and the second context into a new snapshot blob.
StartupData result = {nullptr, 0};
base::ElapsedTimer timer;
timer.Start();
{
SnapshotCreator snapshot_creator(nullptr, &cold_snapshot_blob);
Isolate* isolate = snapshot_creator.GetIsolate();
{
HandleScope scope(isolate);
Local<Context> context = Context::New(isolate);
if (!RunExtraCode(isolate, context, warmup_source, "<warm-up>")) {
return result;
}
}
{
HandleScope handle_scope(isolate);
isolate->ContextDisposedNotification(false);
Local<Context> context = Context::New(isolate);
snapshot_creator.SetDefaultContext(context);
}
result = snapshot_creator.CreateBlob(
SnapshotCreator::FunctionCodeHandling::kKeep);
}
if (i::FLAG_profile_deserialization) {
i::PrintF("Warming up snapshot took %0.3f ms\n",
timer.Elapsed().InMillisecondsF());
}
timer.Stop();
return result;
}
void V8::SetDcheckErrorHandler(DcheckErrorCallback that) { void V8::SetDcheckErrorHandler(DcheckErrorCallback that) {
v8::base::SetDcheckFunction(that); v8::base::SetDcheckFunction(that);
} }
...@@ -1959,16 +1838,6 @@ static void ObjectTemplateSetNamedPropertyHandler( ...@@ -1959,16 +1838,6 @@ static void ObjectTemplateSetNamedPropertyHandler(
cons->set_named_property_handler(*obj); cons->set_named_property_handler(*obj);
} }
// TODO(cbruni) deprecate.
void ObjectTemplate::SetNamedPropertyHandler(
NamedPropertyGetterCallback getter, NamedPropertySetterCallback setter,
NamedPropertyQueryCallback query, NamedPropertyDeleterCallback remover,
NamedPropertyEnumeratorCallback enumerator, Local<Value> data) {
ObjectTemplateSetNamedPropertyHandler(
this, getter, setter, query, nullptr, remover, enumerator, nullptr, data,
PropertyHandlerFlags::kOnlyInterceptStrings);
}
void ObjectTemplate::SetHandler( void ObjectTemplate::SetHandler(
const NamedPropertyHandlerConfiguration& config) { const NamedPropertyHandlerConfiguration& config) {
ObjectTemplateSetNamedPropertyHandler( ObjectTemplateSetNamedPropertyHandler(
...@@ -2253,15 +2122,6 @@ MaybeLocal<Value> Script::Run(Local<Context> context) { ...@@ -2253,15 +2122,6 @@ MaybeLocal<Value> Script::Run(Local<Context> context) {
} }
Local<Value> Script::Run() {
auto self = Utils::OpenHandle(this, true);
// If execution is terminating, Compile(..)->Run() requires this
// check.
if (self.is_null()) return Local<Value>();
auto context = ContextFromNeverReadOnlySpaceObject(self);
RETURN_TO_LOCAL_UNCHECKED(Run(context), Value);
}
Local<Value> ScriptOrModule::GetResourceName() { Local<Value> ScriptOrModule::GetResourceName() {
i::Handle<i::Script> obj = Utils::OpenHandle(this); i::Handle<i::Script> obj = Utils::OpenHandle(this);
i::Isolate* isolate = obj->GetIsolate(); i::Isolate* isolate = obj->GetIsolate();
...@@ -2313,12 +2173,6 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index, ...@@ -2313,12 +2173,6 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
array->set(index, *i_item); array->set(index, *i_item);
} }
void PrimitiveArray::Set(int index, Local<Primitive> item) {
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
i::Isolate* isolate = UnsafeIsolateFromHeapObject(array);
Set(reinterpret_cast<Isolate*>(isolate), index, item);
}
Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) { Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
i::Handle<i::FixedArray> array = Utils::OpenHandle(this); i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
...@@ -2331,12 +2185,6 @@ Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) { ...@@ -2331,12 +2185,6 @@ Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
return ToApiHandle<Primitive>(i_item); return ToApiHandle<Primitive>(i_item);
} }
Local<Primitive> PrimitiveArray::Get(int index) {
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
i::Isolate* isolate = UnsafeIsolateFromHeapObject(array);
return Get(reinterpret_cast<Isolate*>(isolate), index);
}
Module::Status Module::GetStatus() const { Module::Status Module::GetStatus() const {
i::Handle<i::Module> self = Utils::OpenHandle(this); i::Handle<i::Module> self = Utils::OpenHandle(this);
switch (self->status()) { switch (self->status()) {
...@@ -2682,17 +2530,6 @@ MaybeLocal<Function> ScriptCompiler::CompileFunctionInContext( ...@@ -2682,17 +2530,6 @@ MaybeLocal<Function> ScriptCompiler::CompileFunctionInContext(
} }
Local<Function> ScriptCompiler::CompileFunctionInContext(
Isolate* v8_isolate, Source* source, Local<Context> v8_context,
size_t arguments_count, Local<String> arguments[],
size_t context_extension_count, Local<Object> context_extensions[]) {
RETURN_TO_LOCAL_UNCHECKED(
CompileFunctionInContext(v8_context, source, arguments_count, arguments,
context_extension_count, context_extensions),
Function);
}
ScriptCompiler::ScriptStreamingTask* ScriptCompiler::StartStreamingScript( ScriptCompiler::ScriptStreamingTask* ScriptCompiler::StartStreamingScript(
Isolate* v8_isolate, StreamedSource* source, CompileOptions options) { Isolate* v8_isolate, StreamedSource* source, CompileOptions options) {
if (!i::FLAG_script_streaming) { if (!i::FLAG_script_streaming) {
...@@ -2745,11 +2582,6 @@ uint32_t ScriptCompiler::CachedDataVersionTag() { ...@@ -2745,11 +2582,6 @@ uint32_t ScriptCompiler::CachedDataVersionTag() {
static_cast<uint32_t>(internal::CpuFeatures::SupportedFeatures()))); static_cast<uint32_t>(internal::CpuFeatures::SupportedFeatures())));
} }
ScriptCompiler::CachedData* ScriptCompiler::CreateCodeCache(
Local<UnboundScript> unbound_script, Local<String> source) {
return CreateCodeCache(unbound_script);
}
ScriptCompiler::CachedData* ScriptCompiler::CreateCodeCache( ScriptCompiler::CachedData* ScriptCompiler::CreateCodeCache(
Local<UnboundScript> unbound_script) { Local<UnboundScript> unbound_script) {
i::Handle<i::SharedFunctionInfo> shared = i::Handle<i::SharedFunctionInfo> shared =
...@@ -2769,11 +2601,6 @@ ScriptCompiler::CachedData* ScriptCompiler::CreateCodeCache( ...@@ -2769,11 +2601,6 @@ ScriptCompiler::CachedData* ScriptCompiler::CreateCodeCache(
return i::CodeSerializer::Serialize(shared); return i::CodeSerializer::Serialize(shared);
} }
ScriptCompiler::CachedData* ScriptCompiler::CreateCodeCacheForFunction(
Local<Function> function, Local<String> source) {
return CreateCodeCacheForFunction(function);
}
ScriptCompiler::CachedData* ScriptCompiler::CreateCodeCacheForFunction( ScriptCompiler::CachedData* ScriptCompiler::CreateCodeCacheForFunction(
Local<Function> function) { Local<Function> function) {
auto js_function = auto js_function =
...@@ -2795,23 +2622,6 @@ MaybeLocal<Script> Script::Compile(Local<Context> context, Local<String> source, ...@@ -2795,23 +2622,6 @@ MaybeLocal<Script> Script::Compile(Local<Context> context, Local<String> source,
} }
Local<Script> Script::Compile(v8::Local<String> source,
v8::ScriptOrigin* origin) {
auto str = Utils::OpenHandle(*source);
auto context = UnsafeContextFromHeapObject(str);
RETURN_TO_LOCAL_UNCHECKED(Compile(context, source, origin), Script);
}
Local<Script> Script::Compile(v8::Local<String> source,
v8::Local<String> file_name) {
auto str = Utils::OpenHandle(*source);
auto context = UnsafeContextFromHeapObject(str);
ScriptOrigin origin(file_name);
return Compile(context, source, &origin).FromMaybe(Local<Script>());
}
// --- E x c e p t i o n s --- // --- E x c e p t i o n s ---
v8::TryCatch::TryCatch(v8::Isolate* isolate) v8::TryCatch::TryCatch(v8::Isolate* isolate)
...@@ -2917,12 +2727,6 @@ MaybeLocal<Value> v8::TryCatch::StackTrace(Local<Context> context) const { ...@@ -2917,12 +2727,6 @@ MaybeLocal<Value> v8::TryCatch::StackTrace(Local<Context> context) const {
} }
v8::Local<Value> v8::TryCatch::StackTrace() const {
auto context = reinterpret_cast<v8::Isolate*>(isolate_)->GetCurrentContext();
RETURN_TO_LOCAL_UNCHECKED(StackTrace(context), Value);
}
v8::Local<v8::Message> v8::TryCatch::Message() const { v8::Local<v8::Message> v8::TryCatch::Message() const {
i::Object* message = reinterpret_cast<i::Object*>(message_obj_); i::Object* message = reinterpret_cast<i::Object*>(message_obj_);
DCHECK(message->IsJSMessageObject() || message->IsTheHole(isolate_)); DCHECK(message->IsJSMessageObject() || message->IsTheHole(isolate_));
...@@ -3017,12 +2821,6 @@ Maybe<int> Message::GetLineNumber(Local<Context> context) const { ...@@ -3017,12 +2821,6 @@ Maybe<int> Message::GetLineNumber(Local<Context> context) const {
} }
int Message::GetLineNumber() const {
auto context = ContextFromNeverReadOnlySpaceObject(Utils::OpenHandle(this));
return GetLineNumber(context).FromMaybe(0);
}
int Message::GetStartPosition() const { int Message::GetStartPosition() const {
auto self = Utils::OpenHandle(this); auto self = Utils::OpenHandle(this);
return self->start_position(); return self->start_position();
...@@ -3096,12 +2894,6 @@ MaybeLocal<String> Message::GetSourceLine(Local<Context> context) const { ...@@ -3096,12 +2894,6 @@ MaybeLocal<String> Message::GetSourceLine(Local<Context> context) const {
} }
Local<String> Message::GetSourceLine() const {
auto context = ContextFromNeverReadOnlySpaceObject(Utils::OpenHandle(this));
RETURN_TO_LOCAL_UNCHECKED(GetSourceLine(context), String)
}
void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) { void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate); ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
...@@ -3121,11 +2913,6 @@ Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate, ...@@ -3121,11 +2913,6 @@ Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
return scope.Escape(Utils::StackFrameToLocal(info)); return scope.Escape(Utils::StackFrameToLocal(info));
} }
Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
return GetFrame(reinterpret_cast<Isolate*>(isolate), index);
}
int StackTrace::GetFrameCount() const { int StackTrace::GetFrameCount() const {
return Utils::OpenHandle(this)->length(); return Utils::OpenHandle(this)->length();
} }
...@@ -4105,16 +3892,6 @@ Maybe<bool> Value::BooleanValue(Local<Context> context) const { ...@@ -4105,16 +3892,6 @@ Maybe<bool> Value::BooleanValue(Local<Context> context) const {
} }
bool Value::BooleanValue() const {
auto obj = Utils::OpenHandle(this);
if (obj->IsSmi()) return *obj != i::Smi::kZero;
DCHECK(obj->IsHeapObject());
i::Isolate* isolate =
UnsafeIsolateFromHeapObject(i::Handle<i::HeapObject>::cast(obj));
return obj->BooleanValue(isolate);
}
Maybe<double> Value::NumberValue(Local<Context> context) const { Maybe<double> Value::NumberValue(Local<Context> context) const {
auto obj = Utils::OpenHandle(this); auto obj = Utils::OpenHandle(this);
if (obj->IsNumber()) return Just(obj->Number()); if (obj->IsNumber()) return Just(obj->Number());
...@@ -4128,14 +3905,6 @@ Maybe<double> Value::NumberValue(Local<Context> context) const { ...@@ -4128,14 +3905,6 @@ Maybe<double> Value::NumberValue(Local<Context> context) const {
} }
double Value::NumberValue() const {
auto obj = Utils::OpenHandle(this);
if (obj->IsNumber()) return obj->Number();
return NumberValue(UnsafeContextFromHeapObject(obj))
.FromMaybe(std::numeric_limits<double>::quiet_NaN());
}
Maybe<int64_t> Value::IntegerValue(Local<Context> context) const { Maybe<int64_t> Value::IntegerValue(Local<Context> context) const {
auto obj = Utils::OpenHandle(this); auto obj = Utils::OpenHandle(this);
if (obj->IsNumber()) { if (obj->IsNumber()) {
...@@ -4151,19 +3920,6 @@ Maybe<int64_t> Value::IntegerValue(Local<Context> context) const { ...@@ -4151,19 +3920,6 @@ Maybe<int64_t> Value::IntegerValue(Local<Context> context) const {
} }
int64_t Value::IntegerValue() const {
auto obj = Utils::OpenHandle(this);
if (obj->IsNumber()) {
if (obj->IsSmi()) {
return i::Smi::ToInt(*obj);
} else {
return static_cast<int64_t>(obj->Number());
}
}
return IntegerValue(UnsafeContextFromHeapObject(obj)).FromMaybe(0);
}
Maybe<int32_t> Value::Int32Value(Local<Context> context) const { Maybe<int32_t> Value::Int32Value(Local<Context> context) const {
auto obj = Utils::OpenHandle(this); auto obj = Utils::OpenHandle(this);
if (obj->IsNumber()) return Just(NumberToInt32(*obj)); if (obj->IsNumber()) return Just(NumberToInt32(*obj));
...@@ -4178,13 +3934,6 @@ Maybe<int32_t> Value::Int32Value(Local<Context> context) const { ...@@ -4178,13 +3934,6 @@ Maybe<int32_t> Value::Int32Value(Local<Context> context) const {
} }
int32_t Value::Int32Value() const {
auto obj = Utils::OpenHandle(this);
if (obj->IsNumber()) return NumberToInt32(*obj);
return Int32Value(UnsafeContextFromHeapObject(obj)).FromMaybe(0);
}
Maybe<uint32_t> Value::Uint32Value(Local<Context> context) const { Maybe<uint32_t> Value::Uint32Value(Local<Context> context) const {
auto obj = Utils::OpenHandle(this); auto obj = Utils::OpenHandle(this);
if (obj->IsNumber()) return Just(NumberToUint32(*obj)); if (obj->IsNumber()) return Just(NumberToUint32(*obj));
...@@ -4199,13 +3948,6 @@ Maybe<uint32_t> Value::Uint32Value(Local<Context> context) const { ...@@ -4199,13 +3948,6 @@ Maybe<uint32_t> Value::Uint32Value(Local<Context> context) const {
} }
uint32_t Value::Uint32Value() const {
auto obj = Utils::OpenHandle(this);
if (obj->IsNumber()) return NumberToUint32(*obj);
return Uint32Value(UnsafeContextFromHeapObject(obj)).FromMaybe(0);
}
MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const { MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
auto self = Utils::OpenHandle(this); auto self = Utils::OpenHandle(this);
if (self->IsSmi()) { if (self->IsSmi()) {
...@@ -4240,21 +3982,6 @@ Maybe<bool> Value::Equals(Local<Context> context, Local<Value> that) const { ...@@ -4240,21 +3982,6 @@ Maybe<bool> Value::Equals(Local<Context> context, Local<Value> that) const {
} }
bool Value::Equals(Local<Value> that) const {
auto self = Utils::OpenHandle(this);
auto other = Utils::OpenHandle(*that);
if (self->IsSmi() && other->IsSmi()) {
return self->Number() == other->Number();
}
if (self->IsJSObject() && other->IsJSObject()) {
return *self == *other;
}
auto heap_object = self->IsSmi() ? other : self;
auto context = UnsafeContextFromHeapObject(heap_object);
return Equals(context, that).FromMaybe(false);
}
bool Value::StrictEquals(Local<Value> that) const { bool Value::StrictEquals(Local<Value> that) const {
auto self = Utils::OpenHandle(this); auto self = Utils::OpenHandle(this);
auto other = Utils::OpenHandle(*that); auto other = Utils::OpenHandle(*that);
...@@ -5578,11 +5305,6 @@ bool String::ContainsOnlyOneByte() const { ...@@ -5578,11 +5305,6 @@ bool String::ContainsOnlyOneByte() const {
return helper.Check(*str); return helper.Check(*str);
} }
int String::Utf8Length() const {
i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
return Utf8Length(reinterpret_cast<Isolate*>(isolate));
}
int String::Utf8Length(Isolate* isolate) const { int String::Utf8Length(Isolate* isolate) const {
i::Handle<i::String> str = Utils::OpenHandle(this); i::Handle<i::String> str = Utils::OpenHandle(this);
str = i::String::Flatten(reinterpret_cast<i::Isolate*>(isolate), str); str = i::String::Flatten(reinterpret_cast<i::Isolate*>(isolate), str);
...@@ -5851,14 +5573,6 @@ int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity, ...@@ -5851,14 +5573,6 @@ int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity,
return writer.CompleteWrite(write_null, nchars_ref); return writer.CompleteWrite(write_null, nchars_ref);
} }
int String::WriteUtf8(char* buffer, int capacity, int* nchars_ref,
int options) const {
i::Handle<i::String> str = Utils::OpenHandle(this);
i::Isolate* isolate = UnsafeIsolateFromHeapObject(str);
return WriteUtf8(reinterpret_cast<Isolate*>(isolate), buffer, capacity,
nchars_ref, options);
}
template <typename CharType> template <typename CharType>
static inline int WriteHelper(i::Isolate* isolate, const String* string, static inline int WriteHelper(i::Isolate* isolate, const String* string,
CharType* buffer, int start, int length, CharType* buffer, int start, int length,
...@@ -5881,14 +5595,6 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string, ...@@ -5881,14 +5595,6 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
} }
int String::WriteOneByte(uint8_t* buffer,
int start,
int length,
int options) const {
i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
return WriteHelper(isolate, this, buffer, start, length, options);
}
int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start, int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start,
int length, int options) const { int length, int options) const {
return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer, return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer,
...@@ -5896,14 +5602,6 @@ int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start, ...@@ -5896,14 +5602,6 @@ int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start,
} }
int String::Write(uint16_t* buffer,
int start,
int length,
int options) const {
i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
return WriteHelper(isolate, this, buffer, start, length, options);
}
int String::Write(Isolate* isolate, uint16_t* buffer, int start, int length, int String::Write(Isolate* isolate, uint16_t* buffer, int start, int length,
int options) const { int options) const {
return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer, return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer,
...@@ -6861,12 +6559,6 @@ Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left, ...@@ -6861,12 +6559,6 @@ Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left,
return Utils::ToLocal(result); return Utils::ToLocal(result);
} }
Local<String> v8::String::Concat(Local<String> left, Local<String> right) {
i::Handle<i::String> left_string = Utils::OpenHandle(*left);
i::Isolate* isolate = UnsafeIsolateFromHeapObject(left_string);
return Concat(reinterpret_cast<Isolate*>(isolate), left, right);
}
MaybeLocal<String> v8::String::NewExternalTwoByte( MaybeLocal<String> v8::String::NewExternalTwoByte(
Isolate* isolate, v8::String::ExternalStringResource* resource) { Isolate* isolate, v8::String::ExternalStringResource* resource) {
CHECK(resource && resource->data()); CHECK(resource && resource->data());
...@@ -7076,12 +6768,6 @@ bool v8::BooleanObject::ValueOf() const { ...@@ -7076,12 +6768,6 @@ bool v8::BooleanObject::ValueOf() const {
} }
Local<v8::Value> v8::StringObject::New(Local<String> value) {
i::Handle<i::String> string = Utils::OpenHandle(*value);
i::Isolate* isolate = UnsafeIsolateFromHeapObject(string);
return New(reinterpret_cast<Isolate*>(isolate), value);
}
Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate, Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate,
Local<String> value) { Local<String> value) {
i::Handle<i::String> string = Utils::OpenHandle(*value); i::Handle<i::String> string = Utils::OpenHandle(*value);
...@@ -7186,14 +6872,6 @@ MaybeLocal<v8::RegExp> v8::RegExp::New(Local<Context> context, ...@@ -7186,14 +6872,6 @@ MaybeLocal<v8::RegExp> v8::RegExp::New(Local<Context> context,
} }
Local<v8::RegExp> v8::RegExp::New(Local<String> pattern, Flags flags) {
auto* isolate = reinterpret_cast<Isolate*>(
UnsafeIsolateFromHeapObject(Utils::OpenHandle(*pattern)));
auto context = isolate->GetCurrentContext();
RETURN_TO_LOCAL_UNCHECKED(New(context, pattern, flags), RegExp);
}
Local<v8::String> v8::RegExp::GetSource() const { Local<v8::String> v8::RegExp::GetSource() const {
i::Handle<i::JSRegExp> obj = Utils::OpenHandle(this); i::Handle<i::JSRegExp> obj = Utils::OpenHandle(this);
return Utils::ToLocal( return Utils::ToLocal(
...@@ -7484,12 +7162,6 @@ MaybeLocal<Promise::Resolver> Promise::Resolver::New(Local<Context> context) { ...@@ -7484,12 +7162,6 @@ MaybeLocal<Promise::Resolver> Promise::Resolver::New(Local<Context> context) {
} }
Local<Promise::Resolver> Promise::Resolver::New(Isolate* isolate) {
RETURN_TO_LOCAL_UNCHECKED(New(isolate->GetCurrentContext()),
Promise::Resolver);
}
Local<Promise> Promise::Resolver::GetPromise() { Local<Promise> Promise::Resolver::GetPromise() {
i::Handle<i::JSReceiver> promise = Utils::OpenHandle(this); i::Handle<i::JSReceiver> promise = Utils::OpenHandle(this);
return Local<Promise>::Cast(Utils::ToLocal(promise)); return Local<Promise>::Cast(Utils::ToLocal(promise));
...@@ -7515,12 +7187,6 @@ Maybe<bool> Promise::Resolver::Resolve(Local<Context> context, ...@@ -7515,12 +7187,6 @@ Maybe<bool> Promise::Resolver::Resolve(Local<Context> context,
} }
void Promise::Resolver::Resolve(Local<Value> value) {
auto context = ContextFromNeverReadOnlySpaceObject(Utils::OpenHandle(this));
USE(Resolve(context, value));
}
Maybe<bool> Promise::Resolver::Reject(Local<Context> context, Maybe<bool> Promise::Resolver::Reject(Local<Context> context,
Local<Value> value) { Local<Value> value) {
auto isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate()); auto isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
...@@ -7540,12 +7206,6 @@ Maybe<bool> Promise::Resolver::Reject(Local<Context> context, ...@@ -7540,12 +7206,6 @@ Maybe<bool> Promise::Resolver::Reject(Local<Context> context,
} }
void Promise::Resolver::Reject(Local<Value> value) {
auto context = ContextFromNeverReadOnlySpaceObject(Utils::OpenHandle(this));
USE(Reject(context, value));
}
MaybeLocal<Promise> Promise::Catch(Local<Context> context, MaybeLocal<Promise> Promise::Catch(Local<Context> context,
Local<Function> handler) { Local<Function> handler) {
PREPARE_FOR_EXECUTION(context, Promise, Catch, Promise); PREPARE_FOR_EXECUTION(context, Promise, Catch, Promise);
...@@ -8325,14 +7985,6 @@ v8::Local<v8::Context> Isolate::GetCurrentContext() { ...@@ -8325,14 +7985,6 @@ v8::Local<v8::Context> Isolate::GetCurrentContext() {
} }
v8::Local<v8::Context> Isolate::GetCallingContext() {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
i::Handle<i::Object> calling = isolate->GetCallingNativeContext();
if (calling.is_null()) return Local<Context>();
return Utils::ToLocal(i::Handle<i::Context>::cast(calling));
}
v8::Local<v8::Context> Isolate::GetEnteredContext() { v8::Local<v8::Context> Isolate::GetEnteredContext() {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
i::Handle<i::Object> last = i::Handle<i::Object> last =
...@@ -8830,18 +8482,6 @@ void Isolate::RemoveCallCompletedCallback(CallCompletedCallback callback) { ...@@ -8830,18 +8482,6 @@ void Isolate::RemoveCallCompletedCallback(CallCompletedCallback callback) {
isolate->RemoveCallCompletedCallback(callback); isolate->RemoveCallCompletedCallback(callback);
} }
void Isolate::AddCallCompletedCallback(
DeprecatedCallCompletedCallback callback) {
AddCallCompletedCallback(reinterpret_cast<CallCompletedCallback>(callback));
}
void Isolate::RemoveCallCompletedCallback(
DeprecatedCallCompletedCallback callback) {
RemoveCallCompletedCallback(
reinterpret_cast<CallCompletedCallback>(callback));
}
void Isolate::AtomicsWaitWakeHandle::Wake() { void Isolate::AtomicsWaitWakeHandle::Wake() {
reinterpret_cast<i::AtomicsWaitWakeHandle*>(this)->Wake(); reinterpret_cast<i::AtomicsWaitWakeHandle*>(this)->Wake();
} }
...@@ -8885,17 +8525,6 @@ void Isolate::EnqueueMicrotask(MicrotaskCallback callback, void* data) { ...@@ -8885,17 +8525,6 @@ void Isolate::EnqueueMicrotask(MicrotaskCallback callback, void* data) {
} }
void Isolate::SetAutorunMicrotasks(bool autorun) {
SetMicrotasksPolicy(
autorun ? MicrotasksPolicy::kAuto : MicrotasksPolicy::kExplicit);
}
bool Isolate::WillAutorunMicrotasks() const {
return GetMicrotasksPolicy() == MicrotasksPolicy::kAuto;
}
void Isolate::SetMicrotasksPolicy(MicrotasksPolicy policy) { void Isolate::SetMicrotasksPolicy(MicrotasksPolicy policy) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
isolate->handle_scope_implementer()->set_microtasks_policy(policy); isolate->handle_scope_implementer()->set_microtasks_policy(policy);
...@@ -9265,9 +8894,6 @@ String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> obj) ...@@ -9265,9 +8894,6 @@ String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
str->WriteUtf8(isolate, str_); str->WriteUtf8(isolate, str_);
} }
String::Utf8Value::Utf8Value(v8::Local<v8::Value> obj)
: String::Utf8Value::Utf8Value(Isolate::GetCurrent(), obj) {}
String::Utf8Value::~Utf8Value() { String::Utf8Value::~Utf8Value() {
i::DeleteArray(str_); i::DeleteArray(str_);
} }
...@@ -9287,9 +8913,6 @@ String::Value::Value(v8::Isolate* isolate, v8::Local<v8::Value> obj) ...@@ -9287,9 +8913,6 @@ String::Value::Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
str->Write(isolate, str_); str->Write(isolate, str_);
} }
String::Value::Value(v8::Local<v8::Value> obj)
: String::Value::Value(v8::Isolate::GetCurrent(), obj) {}
String::Value::~Value() { String::Value::~Value() {
i::DeleteArray(str_); i::DeleteArray(str_);
} }
......
...@@ -2223,14 +2223,6 @@ bool Isolate::AreWasmThreadsEnabled(Handle<Context> context) { ...@@ -2223,14 +2223,6 @@ bool Isolate::AreWasmThreadsEnabled(Handle<Context> context) {
return FLAG_experimental_wasm_threads; return FLAG_experimental_wasm_threads;
} }
Handle<Context> Isolate::GetCallingNativeContext() {
JavaScriptFrameIterator it(this);
if (it.done()) return Handle<Context>::null();
JavaScriptFrame* frame = it.frame();
Context* context = Context::cast(frame->context());
return Handle<Context>(context->native_context(), this);
}
Handle<Context> Isolate::GetIncumbentContext() { Handle<Context> Isolate::GetIncumbentContext() {
JavaScriptFrameIterator it(this); JavaScriptFrameIterator it(this);
......
...@@ -958,10 +958,6 @@ class Isolate : private HiddenFactory { ...@@ -958,10 +958,6 @@ class Isolate : private HiddenFactory {
inline Handle<Context> native_context(); inline Handle<Context> native_context();
inline Context* raw_native_context(); inline Context* raw_native_context();
// Returns the native context of the calling JavaScript code. That
// is, the native context of the top-most JavaScript frame.
Handle<Context> GetCallingNativeContext();
Handle<Context> GetIncumbentContext(); Handle<Context> GetIncumbentContext();
void RegisterTryCatchHandler(v8::TryCatch* that); void RegisterTryCatchHandler(v8::TryCatch* that);
...@@ -1877,9 +1873,6 @@ class Isolate : private HiddenFactory { ...@@ -1877,9 +1873,6 @@ class Isolate : private HiddenFactory {
friend class v8::Locker; friend class v8::Locker;
friend class v8::SnapshotCreator; friend class v8::SnapshotCreator;
friend class v8::Unlocker; friend class v8::Unlocker;
friend v8::StartupData v8::V8::CreateSnapshotDataBlob(const char*);
friend v8::StartupData v8::V8::WarmUpSnapshotDataBlob(v8::StartupData,
const char*);
DISALLOW_COPY_AND_ASSIGN(Isolate); DISALLOW_COPY_AND_ASSIGN(Isolate);
}; };
......
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