Reland "Reland "[cleanup] Reland: Remove deprecated functions""

This is a reland of 957854dd60
Relanding now that pdfium has been fixed when non-standard flags are used.

Original change's description:
> Reland "[cleanup] Reland: Remove deprecated functions"
>
> This reverts commit 717b93852b.
>
> Reason for revert: Cast build is now fixed
>
> Original change's description:
> > Revert "[cleanup] Reland: Remove deprecated functions"
> >
> > This reverts commit c8376b0069.
> >
> > 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.
> > >
> > > Reviewed-on: https://chromium-review.googlesource.com/1172350

TBR=yangguo@chromium.org

Bug: v8:7786
Change-Id: Ic877155da3e4b280cc48e7dca9dc8dd78667a3d8
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/1177861
Reviewed-by: Dan Elphick <delphick@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55309}
This commit is contained in:
Dan Elphick 2018-08-15 09:10:41 +00:00 committed by Commit Bot
parent f53c984607
commit 5acf205512
4 changed files with 2 additions and 615 deletions

View File

@ -1125,10 +1125,6 @@ class V8_EXPORT PrimitiveArray {
int Length() const;
void Set(Isolate* isolate, int index, Local<Primitive> item);
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 {
/**
* 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(
Local<Context> context, Local<String> source,
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
* context in which it was created (ScriptCompiler::CompileBound or
* UnboundScript::BindToCurrentContext()).
*/
V8_DEPRECATED("Use maybe version", Local<Value> Run());
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Run(Local<Context> context);
/**
@ -1688,13 +1676,6 @@ class V8_EXPORT ScriptCompiler {
* It is possible to specify multiple context extensions (obj in the above
* 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(
Local<Context> context, Source* source, size_t arguments_count,
Local<String> arguments[], size_t context_extension_count,
@ -1717,10 +1698,6 @@ class V8_EXPORT ScriptCompiler {
static CachedData* CreateCodeCache(
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
* previously produced by CompileFunctionInContext.
@ -1729,10 +1706,6 @@ class V8_EXPORT ScriptCompiler {
*/
static CachedData* CreateCodeCacheForFunction(Local<Function> function);
V8_DEPRECATED("Source string is no longer required",
static CachedData* CreateCodeCacheForFunction(
Local<Function> function, Local<String> source));
private:
static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal(
Isolate* isolate, Source* source, CompileOptions options,
@ -1752,7 +1725,6 @@ class V8_EXPORT Message {
*/
Isolate* GetIsolate() const;
V8_DEPRECATED("Use maybe version", Local<String> GetSourceLine() const);
V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSourceLine(
Local<Context> context) const;
@ -1778,7 +1750,6 @@ class V8_EXPORT Message {
/**
* 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;
/**
@ -1858,8 +1829,6 @@ class V8_EXPORT StackTrace {
/**
* 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;
/**
@ -2568,13 +2537,6 @@ class V8_EXPORT Value : public Data {
V8_DEPRECATE_SOON("Use maybe version",
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.
* Returns an empty handle if the conversion fails.
@ -2590,14 +2552,7 @@ class V8_EXPORT Value : public Data {
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 == */
V8_DEPRECATE_SOON("Use maybe version", bool Equals(Local<Value> that) const);
V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
Local<Value> that) const;
bool StrictEquals(Local<Value> that) const;
@ -2704,8 +2659,6 @@ class V8_EXPORT String : public Name {
* Returns the number of bytes in the UTF-8 encoded
* representation of this string.
*/
V8_DEPRECATE_SOON("Use Isolate version instead", int Utf8Length() const);
int Utf8Length(Isolate* isolate) const;
/**
@ -2762,23 +2715,12 @@ class V8_EXPORT String : public Name {
// 16-bit character codes.
int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1,
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.
int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0,
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.
int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
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.
@ -2942,9 +2884,6 @@ class V8_EXPORT String : public Name {
*/
static Local<String> Concat(Isolate* isolate, Local<String> left,
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
@ -3013,8 +2952,6 @@ class V8_EXPORT String : public Name {
*/
class V8_EXPORT Utf8Value {
public:
V8_DEPRECATED("Use Isolate version",
explicit Utf8Value(Local<v8::Value> obj));
Utf8Value(Isolate* isolate, Local<v8::Value> obj);
~Utf8Value();
char* operator*() { return str_; }
@ -3038,7 +2975,6 @@ class V8_EXPORT String : public Name {
*/
class V8_EXPORT Value {
public:
V8_DEPRECATED("Use Isolate version", explicit Value(Local<v8::Value> obj));
Value(Isolate* isolate, Local<v8::Value> obj);
~Value();
uint16_t* operator*() { return str_; }
@ -4220,8 +4156,6 @@ class V8_EXPORT Promise : public Object {
/**
* 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(
Local<Context> context);
@ -4234,11 +4168,9 @@ class V8_EXPORT Promise : public Object {
* Resolve/reject the associated promise with a given value.
* 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,
Local<Value> value);
V8_DEPRECATED("Use maybe version", void Reject(Local<Value> value));
V8_WARN_UNUSED_RESULT Maybe<bool> Reject(Local<Context> context,
Local<Value> value);
@ -5259,8 +5191,6 @@ class V8_EXPORT BooleanObject : public Object {
class V8_EXPORT StringObject : public Object {
public:
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;
@ -5316,8 +5246,6 @@ class V8_EXPORT RegExp : public Object {
* static_cast<RegExp::Flags>(kGlobal | kMultiline))
* 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,
Local<String> pattern,
Flags flags);
@ -5461,57 +5389,8 @@ class V8_EXPORT Template : public Data {
friend class FunctionTemplate;
};
/**
* 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.
// TODO(dcarney): Replace GenericNamedPropertyFooCallback with just
// NamedPropertyFooCallback.
/**
* Interceptor for get requests on an object.
@ -6217,39 +6096,6 @@ class V8_EXPORT ObjectTemplate : public Template {
Local<AccessorSignature> signature = Local<AccessorSignature>(),
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.
*
@ -6632,7 +6478,6 @@ typedef void (*AddHistogramSampleCallback)(void* histogram, int sample);
// --- Enter/Leave Script Callback ---
typedef void (*BeforeCallEnteredCallback)(Isolate*);
typedef void (*CallCompletedCallback)(Isolate*);
typedef void (*DeprecatedCallCompletedCallback)();
/**
* HostImportModuleDynamicallyCallback is called when we require the
@ -7830,16 +7675,6 @@ class V8_EXPORT Isolate {
*/
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. */
Local<Context> GetEnteredContext();
@ -8091,17 +7926,11 @@ class V8_EXPORT Isolate {
* further callbacks.
*/
void AddCallCompletedCallback(CallCompletedCallback callback);
V8_DEPRECATED(
"Use callback with parameter",
void AddCallCompletedCallback(DeprecatedCallCompletedCallback callback));
/**
* Removes callback that was installed by AddCallCompletedCallback.
*/
void RemoveCallCompletedCallback(CallCompletedCallback callback);
V8_DEPRECATED("Use callback with parameter",
void RemoveCallCompletedCallback(
DeprecatedCallCompletedCallback callback));
/**
* Set the PromiseHook callback for various promise lifecycle
@ -8135,14 +7964,11 @@ class V8_EXPORT Isolate {
* Controls how Microtasks are invoked. See MicrotasksPolicy for details.
*/
void SetMicrotasksPolicy(MicrotasksPolicy policy);
V8_DEPRECATED("Use SetMicrotasksPolicy",
void SetAutorunMicrotasks(bool autorun));
/**
* Returns the policy controlling how Microtasks are invoked.
*/
MicrotasksPolicy GetMicrotasksPolicy() const;
V8_DEPRECATED("Use GetMicrotasksPolicy", bool WillAutorunMicrotasks() const);
/**
* Adds a callback to notify the host application after
@ -8531,28 +8357,6 @@ class V8_EXPORT V8 {
static void SetNativesDataBlob(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. */
static void SetDcheckErrorHandler(DcheckErrorCallback that);
@ -9020,7 +8824,6 @@ class V8_EXPORT TryCatch {
* Returns the .stack property of the thrown object. If no .stack
* property is present an empty handle is returned.
*/
V8_DEPRECATED("Use maybe version.", Local<Value> StackTrace() const);
V8_WARN_UNUSED_RESULT MaybeLocal<Value> StackTrace(
Local<Context> context) const;
@ -10385,30 +10188,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) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);

View File

@ -219,28 +219,6 @@ Local<Context> ContextFromNeverReadOnlySpaceObject(
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 {
public:
explicit inline InternalEscapableScope(i::Isolate* isolate)
@ -537,34 +515,6 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
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 {
explicit SnapshotCreatorData(Isolate* isolate)
: isolate_(isolate),
@ -887,77 +837,6 @@ StartupData SnapshotCreator::CreateBlob(
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) {
v8::base::SetDcheckFunction(that);
}
@ -1956,16 +1835,6 @@ static void ObjectTemplateSetNamedPropertyHandler(
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(
const NamedPropertyHandlerConfiguration& config) {
ObjectTemplateSetNamedPropertyHandler(
@ -2250,15 +2119,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() {
i::Handle<i::Script> obj = Utils::OpenHandle(this);
i::Isolate* isolate = obj->GetIsolate();
@ -2310,12 +2170,6 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
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) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
@ -2328,12 +2182,6 @@ Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
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 {
i::Handle<i::Module> self = Utils::OpenHandle(this);
switch (self->status()) {
@ -2679,17 +2527,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(
Isolate* v8_isolate, StreamedSource* source, CompileOptions options) {
if (!i::FLAG_script_streaming) {
@ -2742,11 +2579,6 @@ uint32_t ScriptCompiler::CachedDataVersionTag() {
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(
Local<UnboundScript> unbound_script) {
i::Handle<i::SharedFunctionInfo> shared =
@ -2766,11 +2598,6 @@ ScriptCompiler::CachedData* ScriptCompiler::CreateCodeCache(
return i::CodeSerializer::Serialize(shared);
}
ScriptCompiler::CachedData* ScriptCompiler::CreateCodeCacheForFunction(
Local<Function> function, Local<String> source) {
return CreateCodeCacheForFunction(function);
}
ScriptCompiler::CachedData* ScriptCompiler::CreateCodeCacheForFunction(
Local<Function> function) {
auto js_function =
@ -2792,23 +2619,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 ---
v8::TryCatch::TryCatch(v8::Isolate* isolate)
@ -2914,12 +2724,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 {
i::Object* message = reinterpret_cast<i::Object*>(message_obj_);
DCHECK(message->IsJSMessageObject() || message->IsTheHole(isolate_));
@ -3014,12 +2818,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 {
auto self = Utils::OpenHandle(this);
return self->start_position();
@ -3093,12 +2891,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) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
@ -3118,11 +2910,6 @@ Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
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 {
return Utils::OpenHandle(this)->length();
}
@ -4095,16 +3882,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 {
auto obj = Utils::OpenHandle(this);
if (obj->IsNumber()) return Just(obj->Number());
@ -4118,14 +3895,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 {
auto obj = Utils::OpenHandle(this);
if (obj->IsNumber()) {
@ -4141,19 +3910,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 {
auto obj = Utils::OpenHandle(this);
if (obj->IsNumber()) return Just(NumberToInt32(*obj));
@ -4168,13 +3924,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 {
auto obj = Utils::OpenHandle(this);
if (obj->IsNumber()) return Just(NumberToUint32(*obj));
@ -4189,13 +3938,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 {
auto self = Utils::OpenHandle(this);
if (self->IsSmi()) {
@ -4230,21 +3972,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 {
auto self = Utils::OpenHandle(this);
auto other = Utils::OpenHandle(*that);
@ -5568,11 +5295,6 @@ bool String::ContainsOnlyOneByte() const {
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 {
i::Handle<i::String> str = Utils::OpenHandle(this);
str = i::String::Flatten(reinterpret_cast<i::Isolate*>(isolate), str);
@ -5841,14 +5563,6 @@ int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity,
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>
static inline int WriteHelper(i::Isolate* isolate, const String* string,
CharType* buffer, int start, int length,
@ -5871,14 +5585,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 length, int options) const {
return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer,
@ -5886,14 +5592,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 options) const {
return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer,
@ -6851,12 +6549,6 @@ Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left,
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(
Isolate* isolate, v8::String::ExternalStringResource* resource) {
CHECK(resource && resource->data());
@ -7066,12 +6758,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<String> value) {
i::Handle<i::String> string = Utils::OpenHandle(*value);
@ -7176,14 +6862,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 {
i::Handle<i::JSRegExp> obj = Utils::OpenHandle(this);
return Utils::ToLocal(
@ -7474,12 +7152,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() {
i::Handle<i::JSReceiver> promise = Utils::OpenHandle(this);
return Local<Promise>::Cast(Utils::ToLocal(promise));
@ -7505,12 +7177,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,
Local<Value> value) {
auto isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
@ -7530,12 +7196,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,
Local<Function> handler) {
PREPARE_FOR_EXECUTION(context, Promise, Catch, Promise);
@ -8315,14 +7975,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() {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
i::Handle<i::Object> last =
@ -8820,18 +8472,6 @@ void Isolate::RemoveCallCompletedCallback(CallCompletedCallback 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() {
reinterpret_cast<i::AtomicsWaitWakeHandle*>(this)->Wake();
}
@ -8875,17 +8515,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) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
isolate->handle_scope_implementer()->set_microtasks_policy(policy);
@ -9255,9 +8884,6 @@ String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
str->WriteUtf8(isolate, str_);
}
String::Utf8Value::Utf8Value(v8::Local<v8::Value> obj)
: String::Utf8Value::Utf8Value(Isolate::GetCurrent(), obj) {}
String::Utf8Value::~Utf8Value() {
i::DeleteArray(str_);
}
@ -9277,9 +8903,6 @@ String::Value::Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
str->Write(isolate, str_);
}
String::Value::Value(v8::Local<v8::Value> obj)
: String::Value::Value(v8::Isolate::GetCurrent(), obj) {}
String::Value::~Value() {
i::DeleteArray(str_);
}

View File

@ -2224,14 +2224,6 @@ bool Isolate::AreWasmThreadsEnabled(Handle<Context> context) {
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() {
JavaScriptFrameIterator it(this);

View File

@ -958,10 +958,6 @@ class Isolate : private HiddenFactory {
inline Handle<Context> 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();
void RegisterTryCatchHandler(v8::TryCatch* that);
@ -1879,9 +1875,6 @@ class Isolate : private HiddenFactory {
friend class v8::Locker;
friend class v8::SnapshotCreator;
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);
};