Skip to content

Commit d25646b

Browse files
targosjasnell
authored andcommittedOct 17, 2018
deps: patch V8 to 7.0.276.24
Refs: v8/v8@7.0.276.22...7.0.276.24 PR-URL: #23158 Refs: #23122 Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 6b9965a commit d25646b

File tree

5 files changed

+188
-4
lines changed

5 files changed

+188
-4
lines changed
 

‎deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 7
1212
#define V8_MINOR_VERSION 0
1313
#define V8_BUILD_NUMBER 276
14-
#define V8_PATCH_LEVEL 22
14+
#define V8_PATCH_LEVEL 24
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

‎deps/v8/include/v8.h

+55
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,10 @@ class V8_EXPORT PrimitiveArray {
11251125
int Length() const;
11261126
void Set(Isolate* isolate, int index, Local<Primitive> item);
11271127
Local<Primitive> Get(Isolate* isolate, int index);
1128+
1129+
V8_DEPRECATED("Use Isolate version",
1130+
void Set(int index, Local<Primitive> item));
1131+
V8_DEPRECATED("Use Isolate version", Local<Primitive> Get(int index));
11281132
};
11291133

11301134
/**
@@ -1829,6 +1833,8 @@ class V8_EXPORT StackTrace {
18291833
/**
18301834
* Returns a StackFrame at a particular index.
18311835
*/
1836+
V8_DEPRECATED("Use Isolate version",
1837+
Local<StackFrame> GetFrame(uint32_t index) const);
18321838
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
18331839

18341840
/**
@@ -2537,6 +2543,11 @@ class V8_EXPORT Value : public Data {
25372543
V8_DEPRECATE_SOON("Use maybe version",
25382544
Local<Int32> ToInt32(Isolate* isolate) const);
25392545

2546+
inline V8_DEPRECATED("Use maybe version", Local<Boolean> ToBoolean() const);
2547+
inline V8_DEPRECATED("Use maybe version", Local<String> ToString() const);
2548+
inline V8_DEPRECATED("Use maybe version", Local<Object> ToObject() const);
2549+
inline V8_DEPRECATED("Use maybe version", Local<Integer> ToInteger() const);
2550+
25402551
/**
25412552
* Attempts to convert a string to an array index.
25422553
* Returns an empty handle if the conversion fails.
@@ -2552,7 +2563,14 @@ class V8_EXPORT Value : public Data {
25522563
Local<Context> context) const;
25532564
V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
25542565

2566+
V8_DEPRECATED("Use maybe version", bool BooleanValue() const);
2567+
V8_DEPRECATED("Use maybe version", double NumberValue() const);
2568+
V8_DEPRECATED("Use maybe version", int64_t IntegerValue() const);
2569+
V8_DEPRECATED("Use maybe version", uint32_t Uint32Value() const);
2570+
V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
2571+
25552572
/** JS == */
2573+
V8_DEPRECATED("Use maybe version", bool Equals(Local<Value> that) const);
25562574
V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
25572575
Local<Value> that) const;
25582576
bool StrictEquals(Local<Value> that) const;
@@ -2659,6 +2677,8 @@ class V8_EXPORT String : public Name {
26592677
* Returns the number of bytes in the UTF-8 encoded
26602678
* representation of this string.
26612679
*/
2680+
V8_DEPRECATED("Use Isolate version instead", int Utf8Length() const);
2681+
26622682
int Utf8Length(Isolate* isolate) const;
26632683

26642684
/**
@@ -2715,12 +2735,23 @@ class V8_EXPORT String : public Name {
27152735
// 16-bit character codes.
27162736
int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1,
27172737
int options = NO_OPTIONS) const;
2738+
V8_DEPRECATED("Use Isolate* version",
2739+
int Write(uint16_t* buffer, int start = 0, int length = -1,
2740+
int options = NO_OPTIONS) const);
27182741
// One byte characters.
27192742
int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0,
27202743
int length = -1, int options = NO_OPTIONS) const;
2744+
V8_DEPRECATED("Use Isolate* version",
2745+
int WriteOneByte(uint8_t* buffer, int start = 0,
2746+
int length = -1, int options = NO_OPTIONS)
2747+
const);
27212748
// UTF-8 encoded characters.
27222749
int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
27232750
int* nchars_ref = NULL, int options = NO_OPTIONS) const;
2751+
V8_DEPRECATED("Use Isolate* version",
2752+
int WriteUtf8(char* buffer, int length = -1,
2753+
int* nchars_ref = NULL, int options = NO_OPTIONS)
2754+
const);
27242755

27252756
/**
27262757
* A zero length string.
@@ -2884,6 +2915,9 @@ class V8_EXPORT String : public Name {
28842915
*/
28852916
static Local<String> Concat(Isolate* isolate, Local<String> left,
28862917
Local<String> right);
2918+
static V8_DEPRECATED("Use Isolate* version",
2919+
Local<String> Concat(Local<String> left,
2920+
Local<String> right));
28872921

28882922
/**
28892923
* Creates a new external string using the data defined in the given
@@ -5217,6 +5251,8 @@ class V8_EXPORT BooleanObject : public Object {
52175251
class V8_EXPORT StringObject : public Object {
52185252
public:
52195253
static Local<Value> New(Isolate* isolate, Local<String> value);
5254+
static V8_DEPRECATED("Use Isolate* version",
5255+
Local<Value> New(Local<String> value));
52205256

52215257
Local<String> ValueOf() const;
52225258

@@ -10215,6 +10251,25 @@ template <class T> Value* Value::Cast(T* value) {
1021510251
return static_cast<Value*>(value);
1021610252
}
1021710253

10254+
Local<Boolean> Value::ToBoolean() const {
10255+
return ToBoolean(Isolate::GetCurrent()->GetCurrentContext())
10256+
.FromMaybe(Local<Boolean>());
10257+
}
10258+
10259+
Local<String> Value::ToString() const {
10260+
return ToString(Isolate::GetCurrent()->GetCurrentContext())
10261+
.FromMaybe(Local<String>());
10262+
}
10263+
10264+
Local<Object> Value::ToObject() const {
10265+
return ToObject(Isolate::GetCurrent()->GetCurrentContext())
10266+
.FromMaybe(Local<Object>());
10267+
}
10268+
10269+
Local<Integer> Value::ToInteger() const {
10270+
return ToInteger(Isolate::GetCurrent()->GetCurrentContext())
10271+
.FromMaybe(Local<Integer>());
10272+
}
1021810273

1021910274
Boolean* Boolean::Cast(v8::Value* value) {
1022010275
#ifdef V8_ENABLE_CHECKS

‎deps/v8/src/api.cc

+120
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,28 @@ Local<Context> ContextFromNeverReadOnlySpaceObject(
219219
return reinterpret_cast<v8::Isolate*>(obj->GetIsolate())->GetCurrentContext();
220220
}
221221

222+
// TODO(delphick): Remove this completely when the deprecated functions that use
223+
// it are removed.
224+
// DO NOT USE THIS IN NEW CODE!
225+
i::Isolate* UnsafeIsolateFromHeapObject(i::Handle<i::HeapObject> obj) {
226+
// Use MemoryChunk directly instead of Isolate::FromWritableHeapObject to
227+
// temporarily allow isolate access from read-only space objects.
228+
i::MemoryChunk* chunk = i::MemoryChunk::FromHeapObject(*obj);
229+
return chunk->heap()->isolate();
230+
}
231+
232+
// TODO(delphick): Remove this completely when the deprecated functions that use
233+
// it are removed.
234+
// DO NOT USE THIS IN NEW CODE!
235+
Local<Context> UnsafeContextFromHeapObject(i::Handle<i::Object> obj) {
236+
// Use MemoryChunk directly instead of Isolate::FromWritableHeapObject to
237+
// temporarily allow isolate access from read-only space objects.
238+
i::MemoryChunk* chunk =
239+
i::MemoryChunk::FromHeapObject(i::HeapObject::cast(*obj));
240+
return reinterpret_cast<Isolate*>(chunk->heap()->isolate())
241+
->GetCurrentContext();
242+
}
243+
222244
class InternalEscapableScope : public v8::EscapableHandleScope {
223245
public:
224246
explicit inline InternalEscapableScope(i::Isolate* isolate)
@@ -2170,6 +2192,12 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
21702192
array->set(index, *i_item);
21712193
}
21722194

2195+
void PrimitiveArray::Set(int index, Local<Primitive> item) {
2196+
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
2197+
i::Isolate* isolate = UnsafeIsolateFromHeapObject(array);
2198+
Set(reinterpret_cast<Isolate*>(isolate), index, item);
2199+
}
2200+
21732201
Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
21742202
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
21752203
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
@@ -2182,6 +2210,12 @@ Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
21822210
return ToApiHandle<Primitive>(i_item);
21832211
}
21842212

2213+
Local<Primitive> PrimitiveArray::Get(int index) {
2214+
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
2215+
i::Isolate* isolate = UnsafeIsolateFromHeapObject(array);
2216+
return Get(reinterpret_cast<Isolate*>(isolate), index);
2217+
}
2218+
21852219
Module::Status Module::GetStatus() const {
21862220
i::Handle<i::Module> self = Utils::OpenHandle(this);
21872221
switch (self->status()) {
@@ -2910,6 +2944,11 @@ Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
29102944
return scope.Escape(Utils::StackFrameToLocal(info));
29112945
}
29122946

2947+
Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
2948+
i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
2949+
return GetFrame(reinterpret_cast<Isolate*>(isolate), index);
2950+
}
2951+
29132952
int StackTrace::GetFrameCount() const {
29142953
return Utils::OpenHandle(this)->length();
29152954
}
@@ -3881,6 +3920,14 @@ Maybe<bool> Value::BooleanValue(Local<Context> context) const {
38813920
return Just(Utils::OpenHandle(this)->BooleanValue(isolate));
38823921
}
38833922

3923+
bool Value::BooleanValue() const {
3924+
auto obj = Utils::OpenHandle(this);
3925+
if (obj->IsSmi()) return *obj != i::Smi::kZero;
3926+
DCHECK(obj->IsHeapObject());
3927+
i::Isolate* isolate =
3928+
UnsafeIsolateFromHeapObject(i::Handle<i::HeapObject>::cast(obj));
3929+
return obj->BooleanValue(isolate);
3930+
}
38843931

38853932
Maybe<double> Value::NumberValue(Local<Context> context) const {
38863933
auto obj = Utils::OpenHandle(this);
@@ -3894,6 +3941,12 @@ Maybe<double> Value::NumberValue(Local<Context> context) const {
38943941
return Just(num->Number());
38953942
}
38963943

3944+
double Value::NumberValue() const {
3945+
auto obj = Utils::OpenHandle(this);
3946+
if (obj->IsNumber()) return obj->Number();
3947+
return NumberValue(UnsafeContextFromHeapObject(obj))
3948+
.FromMaybe(std::numeric_limits<double>::quiet_NaN());
3949+
}
38973950

38983951
Maybe<int64_t> Value::IntegerValue(Local<Context> context) const {
38993952
auto obj = Utils::OpenHandle(this);
@@ -3909,6 +3962,17 @@ Maybe<int64_t> Value::IntegerValue(Local<Context> context) const {
39093962
return Just(NumberToInt64(*num));
39103963
}
39113964

3965+
int64_t Value::IntegerValue() const {
3966+
auto obj = Utils::OpenHandle(this);
3967+
if (obj->IsNumber()) {
3968+
if (obj->IsSmi()) {
3969+
return i::Smi::ToInt(*obj);
3970+
} else {
3971+
return static_cast<int64_t>(obj->Number());
3972+
}
3973+
}
3974+
return IntegerValue(UnsafeContextFromHeapObject(obj)).FromMaybe(0);
3975+
}
39123976

39133977
Maybe<int32_t> Value::Int32Value(Local<Context> context) const {
39143978
auto obj = Utils::OpenHandle(this);
@@ -3923,6 +3987,11 @@ Maybe<int32_t> Value::Int32Value(Local<Context> context) const {
39233987
: static_cast<int32_t>(num->Number()));
39243988
}
39253989

3990+
int32_t Value::Int32Value() const {
3991+
auto obj = Utils::OpenHandle(this);
3992+
if (obj->IsNumber()) return NumberToInt32(*obj);
3993+
return Int32Value(UnsafeContextFromHeapObject(obj)).FromMaybe(0);
3994+
}
39263995

39273996
Maybe<uint32_t> Value::Uint32Value(Local<Context> context) const {
39283997
auto obj = Utils::OpenHandle(this);
@@ -3937,6 +4006,11 @@ Maybe<uint32_t> Value::Uint32Value(Local<Context> context) const {
39374006
: static_cast<uint32_t>(num->Number()));
39384007
}
39394008

4009+
uint32_t Value::Uint32Value() const {
4010+
auto obj = Utils::OpenHandle(this);
4011+
if (obj->IsNumber()) return NumberToUint32(*obj);
4012+
return Uint32Value(UnsafeContextFromHeapObject(obj)).FromMaybe(0);
4013+
}
39404014

39414015
MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
39424016
auto self = Utils::OpenHandle(this);
@@ -3971,6 +4045,19 @@ Maybe<bool> Value::Equals(Local<Context> context, Local<Value> that) const {
39714045
return i::Object::Equals(isolate, self, other);
39724046
}
39734047

4048+
bool Value::Equals(Local<Value> that) const {
4049+
auto self = Utils::OpenHandle(this);
4050+
auto other = Utils::OpenHandle(*that);
4051+
if (self->IsSmi() && other->IsSmi()) {
4052+
return self->Number() == other->Number();
4053+
}
4054+
if (self->IsJSObject() && other->IsJSObject()) {
4055+
return *self == *other;
4056+
}
4057+
auto heap_object = self->IsSmi() ? other : self;
4058+
auto context = UnsafeContextFromHeapObject(heap_object);
4059+
return Equals(context, that).FromMaybe(false);
4060+
}
39744061

39754062
bool Value::StrictEquals(Local<Value> that) const {
39764063
auto self = Utils::OpenHandle(this);
@@ -5295,6 +5382,11 @@ bool String::ContainsOnlyOneByte() const {
52955382
return helper.Check(*str);
52965383
}
52975384

5385+
int String::Utf8Length() const {
5386+
i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
5387+
return Utf8Length(reinterpret_cast<Isolate*>(isolate));
5388+
}
5389+
52985390
int String::Utf8Length(Isolate* isolate) const {
52995391
i::Handle<i::String> str = Utils::OpenHandle(this);
53005392
str = i::String::Flatten(reinterpret_cast<i::Isolate*>(isolate), str);
@@ -5563,6 +5655,14 @@ int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity,
55635655
return writer.CompleteWrite(write_null, nchars_ref);
55645656
}
55655657

5658+
int String::WriteUtf8(char* buffer, int capacity, int* nchars_ref,
5659+
int options) const {
5660+
i::Handle<i::String> str = Utils::OpenHandle(this);
5661+
i::Isolate* isolate = UnsafeIsolateFromHeapObject(str);
5662+
return WriteUtf8(reinterpret_cast<Isolate*>(isolate), buffer, capacity,
5663+
nchars_ref, options);
5664+
}
5665+
55665666
template <typename CharType>
55675667
static inline int WriteHelper(i::Isolate* isolate, const String* string,
55685668
CharType* buffer, int start, int length,
@@ -5584,13 +5684,22 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
55845684
return end - start;
55855685
}
55865686

5687+
int String::WriteOneByte(uint8_t* buffer, int start, int length,
5688+
int options) const {
5689+
i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
5690+
return WriteHelper(isolate, this, buffer, start, length, options);
5691+
}
55875692

55885693
int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start,
55895694
int length, int options) const {
55905695
return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer,
55915696
start, length, options);
55925697
}
55935698

5699+
int String::Write(uint16_t* buffer, int start, int length, int options) const {
5700+
i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
5701+
return WriteHelper(isolate, this, buffer, start, length, options);
5702+
}
55945703

55955704
int String::Write(Isolate* isolate, uint16_t* buffer, int start, int length,
55965705
int options) const {
@@ -6549,6 +6658,12 @@ Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left,
65496658
return Utils::ToLocal(result);
65506659
}
65516660

6661+
Local<String> v8::String::Concat(Local<String> left, Local<String> right) {
6662+
i::Handle<i::String> left_string = Utils::OpenHandle(*left);
6663+
i::Isolate* isolate = UnsafeIsolateFromHeapObject(left_string);
6664+
return Concat(reinterpret_cast<Isolate*>(isolate), left, right);
6665+
}
6666+
65526667
MaybeLocal<String> v8::String::NewExternalTwoByte(
65536668
Isolate* isolate, v8::String::ExternalStringResource* resource) {
65546669
CHECK(resource && resource->data());
@@ -6757,6 +6872,11 @@ bool v8::BooleanObject::ValueOf() const {
67576872
return jsvalue->value()->IsTrue(isolate);
67586873
}
67596874

6875+
Local<v8::Value> v8::StringObject::New(Local<String> value) {
6876+
i::Handle<i::String> string = Utils::OpenHandle(*value);
6877+
i::Isolate* isolate = UnsafeIsolateFromHeapObject(string);
6878+
return New(reinterpret_cast<Isolate*>(isolate), value);
6879+
}
67606880

67616881
Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate,
67626882
Local<String> value) {

‎deps/v8/src/wasm/module-compiler.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -2203,6 +2203,11 @@ std::shared_ptr<StreamingDecoder> AsyncCompileJob::CreateStreamingDecoder() {
22032203
AsyncCompileJob::~AsyncCompileJob() {
22042204
background_task_manager_.CancelAndWait();
22052205
if (native_module_) native_module_->compilation_state()->Abort();
2206+
// Tell the streaming decoder that the AsyncCompileJob is not available
2207+
// anymore.
2208+
// TODO(ahaas): Is this notification really necessary? Check
2209+
// https://crbug.com/888170.
2210+
if (stream_) stream_->NotifyCompilationEnded();
22062211
CancelPendingForegroundTask();
22072212
for (auto d : deferred_handles_) delete d;
22082213
}
@@ -2228,7 +2233,6 @@ void AsyncCompileJob::FinishCompile() {
22282233
}
22292234

22302235
void AsyncCompileJob::AsyncCompileFailed(Handle<Object> error_reason) {
2231-
if (stream_) stream_->NotifyError();
22322236
// {job} keeps the {this} pointer alive.
22332237
std::shared_ptr<AsyncCompileJob> job =
22342238
isolate_->wasm_engine()->RemoveCompileJob(this);

0 commit comments

Comments
 (0)