Skip to content

Commit eb87979

Browse files
author
Peter Marshall
committed
Patch V8 API to be ABI compatible with v5.9.
1 parent babb5e6 commit eb87979

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+77
-3575
lines changed

deps/v8/BUILD.gn

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,6 @@ v8_source_set("v8_base") {
887887

888888
### gcmole(all) ###
889889
"include/v8-debug.h",
890-
"include/v8-experimental.h",
891890
"include/v8-platform.h",
892891
"include/v8-profiler.h",
893892
"include/v8-testing.h",
@@ -905,8 +904,6 @@ v8_source_set("v8_base") {
905904
"src/api-arguments-inl.h",
906905
"src/api-arguments.cc",
907906
"src/api-arguments.h",
908-
"src/api-experimental.cc",
909-
"src/api-experimental.h",
910907
"src/api-natives.cc",
911908
"src/api-natives.h",
912909
"src/api.cc",
@@ -1386,8 +1383,6 @@ v8_source_set("v8_base") {
13861383
"src/external-reference-table.h",
13871384
"src/factory.cc",
13881385
"src/factory.h",
1389-
"src/fast-accessor-assembler.cc",
1390-
"src/fast-accessor-assembler.h",
13911386
"src/fast-dtoa.cc",
13921387
"src/fast-dtoa.h",
13931388
"src/feedback-vector-inl.h",

deps/v8/include/libplatform/libplatform.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
namespace v8 {
1313
namespace platform {
1414

15+
enum class IdleTaskSupport { kDisabled, kEnabled };
16+
1517
/**
1618
* Returns a new instance of the default v8::Platform implementation.
1719
*
@@ -21,7 +23,8 @@ namespace platform {
2123
* processors online will be chosen.
2224
*/
2325
V8_PLATFORM_EXPORT v8::Platform* CreateDefaultPlatform(
24-
int thread_pool_size = 0);
26+
int thread_pool_size = 0,
27+
IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled);
2528

2629
/**
2730
* Pumps the message loop for the given isolate.

deps/v8/include/v8-experimental.h

Lines changed: 0 additions & 58 deletions
This file was deleted.

deps/v8/include/v8-profiler.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -812,11 +812,6 @@ class V8_EXPORT HeapProfiler {
812812
/** Returns memory used for profiler internal data and snapshots. */
813813
size_t GetProfilerMemorySize();
814814

815-
/**
816-
* Sets a RetainedObjectInfo for an object group (see V8::SetObjectGroupId).
817-
*/
818-
void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);
819-
820815
private:
821816
HeapProfiler();
822817
~HeapProfiler();

deps/v8/include/v8.h

Lines changed: 19 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ template<class V, class T> class PersistentValueVector;
127127
template<class T, class P> class WeakCallbackObject;
128128
class FunctionTemplate;
129129
class ObjectTemplate;
130-
class Data;
131130
template<typename T> class FunctionCallbackInfo;
132131
template<typename T> class PropertyCallbackInfo;
133132
class StackTrace;
@@ -137,10 +136,6 @@ class CallHandlerHelper;
137136
class EscapableHandleScope;
138137
template<typename T> class ReturnValue;
139138

140-
namespace experimental {
141-
class FastAccessorBuilder;
142-
} // namespace experimental
143-
144139
namespace internal {
145140
class Arguments;
146141
class Heap;
@@ -155,30 +150,6 @@ class GlobalHandles;
155150
} // namespace internal
156151

157152

158-
/**
159-
* General purpose unique identifier.
160-
*/
161-
class UniqueId {
162-
public:
163-
explicit UniqueId(intptr_t data)
164-
: data_(data) {}
165-
166-
bool operator==(const UniqueId& other) const {
167-
return data_ == other.data_;
168-
}
169-
170-
bool operator!=(const UniqueId& other) const {
171-
return data_ != other.data_;
172-
}
173-
174-
bool operator<(const UniqueId& other) const {
175-
return data_ < other.data_;
176-
}
177-
178-
private:
179-
intptr_t data_;
180-
};
181-
182153
// --- Handles ---
183154

184155
#define TYPE_CHECK(T, S) \
@@ -388,19 +359,18 @@ class MaybeLocal {
388359
// Eternal handles are set-once handles that live for the life of the isolate.
389360
template <class T> class Eternal {
390361
public:
391-
V8_INLINE Eternal() : index_(kInitialValue) { }
392-
template<class S>
393-
V8_INLINE Eternal(Isolate* isolate, Local<S> handle) : index_(kInitialValue) {
362+
V8_INLINE Eternal() : val_(nullptr) {}
363+
template <class S>
364+
V8_INLINE Eternal(Isolate* isolate, Local<S> handle) : val_(nullptr) {
394365
Set(isolate, handle);
395366
}
396367
// Can only be safely called if already set.
397-
V8_INLINE Local<T> Get(Isolate* isolate);
398-
V8_INLINE bool IsEmpty() { return index_ == kInitialValue; }
368+
V8_INLINE Local<T> Get(Isolate* isolate) const;
369+
V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
399370
template<class S> V8_INLINE void Set(Isolate* isolate, Local<S> handle);
400371

401372
private:
402-
static const int kInitialValue = -1;
403-
int index_;
373+
T* val_;
404374
};
405375

406376

@@ -1922,7 +1892,7 @@ class V8_EXPORT NativeWeakMap : public Data {
19221892
public:
19231893
static Local<NativeWeakMap> New(Isolate* isolate);
19241894
void Set(Local<Value> key, Local<Value> value);
1925-
Local<Value> Get(Local<Value> key);
1895+
Local<Value> Get(Local<Value> key) const;
19261896
bool Has(Local<Value> key);
19271897
bool Delete(Local<Value> key);
19281898
};
@@ -5122,16 +5092,6 @@ class V8_EXPORT FunctionTemplate : public Template {
51225092
static MaybeLocal<FunctionTemplate> FromSnapshot(Isolate* isolate,
51235093
size_t index);
51245094

5125-
/**
5126-
* Creates a function template with a fast handler. If a fast handler is set,
5127-
* the callback cannot be null.
5128-
*/
5129-
static Local<FunctionTemplate> NewWithFastHandler(
5130-
Isolate* isolate, FunctionCallback callback,
5131-
experimental::FastAccessorBuilder* fast_handler = nullptr,
5132-
Local<Value> data = Local<Value>(),
5133-
Local<Signature> signature = Local<Signature>(), int length = 0);
5134-
51355095
/**
51365096
* Creates a function template backed/cached by a private property.
51375097
*/
@@ -5159,9 +5119,8 @@ class V8_EXPORT FunctionTemplate : public Template {
51595119
* callback is called whenever the function created from this
51605120
* FunctionTemplate is called.
51615121
*/
5162-
void SetCallHandler(
5163-
FunctionCallback callback, Local<Value> data = Local<Value>(),
5164-
experimental::FastAccessorBuilder* fast_handler = nullptr);
5122+
void SetCallHandler(FunctionCallback callback,
5123+
Local<Value> data = Local<Value>());
51655124

51665125
/** Set the predefined length property for the FunctionTemplate. */
51675126
void SetLength(int length);
@@ -6824,45 +6783,6 @@ class V8_EXPORT Isolate {
68246783
*/
68256784
Local<Value> ThrowException(Local<Value> exception);
68266785

6827-
/**
6828-
* Allows the host application to group objects together. If one
6829-
* object in the group is alive, all objects in the group are alive.
6830-
* After each garbage collection, object groups are removed. It is
6831-
* intended to be used in the before-garbage-collection callback
6832-
* function, for instance to simulate DOM tree connections among JS
6833-
* wrapper objects. Object groups for all dependent handles need to
6834-
* be provided for kGCTypeMarkSweepCompact collections, for all other
6835-
* garbage collection types it is sufficient to provide object groups
6836-
* for partially dependent handles only.
6837-
*/
6838-
template <typename T>
6839-
V8_DEPRECATED("Use EmbedderHeapTracer",
6840-
void SetObjectGroupId(const Persistent<T>& object,
6841-
UniqueId id));
6842-
6843-
/**
6844-
* Allows the host application to declare implicit references from an object
6845-
* group to an object. If the objects of the object group are alive, the child
6846-
* object is alive too. After each garbage collection, all implicit references
6847-
* are removed. It is intended to be used in the before-garbage-collection
6848-
* callback function.
6849-
*/
6850-
template <typename T>
6851-
V8_DEPRECATED("Use EmbedderHeapTracer",
6852-
void SetReferenceFromGroup(UniqueId id,
6853-
const Persistent<T>& child));
6854-
6855-
/**
6856-
* Allows the host application to declare implicit references from an object
6857-
* to another object. If the parent object is alive, the child object is alive
6858-
* too. After each garbage collection, all implicit references are removed. It
6859-
* is intended to be used in the before-garbage-collection callback function.
6860-
*/
6861-
template <typename T, typename S>
6862-
V8_DEPRECATED("Use EmbedderHeapTracer",
6863-
void SetReference(const Persistent<T>& parent,
6864-
const Persistent<S>& child));
6865-
68666786
typedef void (*GCCallback)(Isolate* isolate, GCType type,
68676787
GCCallbackFlags flags);
68686788

@@ -7223,16 +7143,6 @@ class V8_EXPORT Isolate {
72237143
void SetAllowCodeGenerationFromStringsCallback(
72247144
AllowCodeGenerationFromStringsCallback callback);
72257145

7226-
/**
7227-
* Set the callback to invoke to check if wasm compilation from
7228-
* the specified object is allowed. By default, wasm compilation
7229-
* is allowed.
7230-
*
7231-
* Similar for instantiate.
7232-
*/
7233-
void SetAllowWasmCompileCallback(AllowWasmCompileCallback callback);
7234-
void SetAllowWasmInstantiateCallback(AllowWasmInstantiateCallback callback);
7235-
72367146
/**
72377147
* Check if V8 is dead and therefore unusable. This is the case after
72387148
* fatal errors such as out-of-memory situations.
@@ -7328,9 +7238,6 @@ class V8_EXPORT Isolate {
73287238
template <class K, class V, class Traits>
73297239
friend class PersistentValueMapBase;
73307240

7331-
void SetObjectGroupId(internal::Object** object, UniqueId id);
7332-
void SetReferenceFromGroup(UniqueId id, internal::Object** object);
7333-
void SetReference(internal::Object** parent, internal::Object** child);
73347241
void ReportExternalAllocationLimitReached();
73357242
};
73367243

@@ -7709,10 +7616,7 @@ class V8_EXPORT V8 {
77097616
WeakCallbackInfo<void>::Callback weak_callback);
77107617
static void MakeWeak(internal::Object*** location_addr);
77117618
static void* ClearWeak(internal::Object** location);
7712-
static void Eternalize(Isolate* isolate,
7713-
Value* handle,
7714-
int* index);
7715-
static Local<Value> GetEternal(Isolate* isolate, int index);
7619+
static Value* Eternalize(Isolate* isolate, Value* handle);
77167620

77177621
static void RegisterExternallyReferencedObject(internal::Object** object,
77187622
internal::Isolate* isolate);
@@ -8531,8 +8435,8 @@ class Internals {
85318435
static const int kNodeIsIndependentShift = 3;
85328436
static const int kNodeIsActiveShift = 4;
85338437

8534-
static const int kJSApiObjectType = 0xb9;
8535-
static const int kJSObjectType = 0xba;
8438+
static const int kJSApiObjectType = 0xbb;
8439+
static const int kJSObjectType = 0xbc;
85368440
static const int kFirstNonstringType = 0x80;
85378441
static const int kOddballType = 0x82;
85388442
static const int kForeignType = 0x86;
@@ -8677,13 +8581,15 @@ template<class T>
86778581
template<class S>
86788582
void Eternal<T>::Set(Isolate* isolate, Local<S> handle) {
86798583
TYPE_CHECK(T, S);
8680-
V8::Eternalize(isolate, reinterpret_cast<Value*>(*handle), &this->index_);
8584+
val_ = reinterpret_cast<T*>(
8585+
V8::Eternalize(isolate, reinterpret_cast<Value*>(*handle)));
86818586
}
86828587

8683-
8684-
template<class T>
8685-
Local<T> Eternal<T>::Get(Isolate* isolate) {
8686-
return Local<T>(reinterpret_cast<T*>(*V8::GetEternal(isolate, index_)));
8588+
template <class T>
8589+
Local<T> Eternal<T>::Get(Isolate* isolate) const {
8590+
// The eternal handle will never go away, so as with the roots, we don't even
8591+
// need to open a handle.
8592+
return Local<T>(val_);
86878593
}
86888594

86898595

@@ -9740,33 +9646,6 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
97409646
return *external_memory;
97419647
}
97429648

9743-
9744-
template<typename T>
9745-
void Isolate::SetObjectGroupId(const Persistent<T>& object,
9746-
UniqueId id) {
9747-
TYPE_CHECK(Value, T);
9748-
SetObjectGroupId(reinterpret_cast<internal::Object**>(object.val_), id);
9749-
}
9750-
9751-
9752-
template<typename T>
9753-
void Isolate::SetReferenceFromGroup(UniqueId id,
9754-
const Persistent<T>& object) {
9755-
TYPE_CHECK(Value, T);
9756-
SetReferenceFromGroup(id, reinterpret_cast<internal::Object**>(object.val_));
9757-
}
9758-
9759-
9760-
template<typename T, typename S>
9761-
void Isolate::SetReference(const Persistent<T>& parent,
9762-
const Persistent<S>& child) {
9763-
TYPE_CHECK(Object, T);
9764-
TYPE_CHECK(Value, S);
9765-
SetReference(reinterpret_cast<internal::Object**>(parent.val_),
9766-
reinterpret_cast<internal::Object**>(child.val_));
9767-
}
9768-
9769-
97709649
Local<Value> Context::GetEmbedderData(int index) {
97719650
#ifndef V8_ENABLE_CHECKS
97729651
typedef internal::Object O;

0 commit comments

Comments
 (0)