Skip to content

Commit 2847dda

Browse files
author
Vasil Hristov
authored
Merge pull request #1440 from NativeScript/darind/v8-7.6.303.28
Update V8 to 7.6.303.28
2 parents 397cf61 + 7ba2cdf commit 2847dda

File tree

146 files changed

+49061
-52646
lines changed

Some content is hidden

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

146 files changed

+49061
-52646
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
env:
22
global:
33
- NODE_VERSION=10
4-
- NDK_VERSION=r19c
4+
- NDK_VERSION=r20
55
- DATE=$(date +%Y-%m-%d)
66
- PACKAGE_VERSION=next-$DATE-$TRAVIS_BUILD_NUMBER
77
- EMULATOR_API_LEVEL=21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"v8Version": "7.5.288.22",
2+
"v8Version": "7.6.303.28",
33
"mksnapshotParams": "--profile_deserialization --turbo_instruction_scheduling --target_os=android --no-native-code-counters"
44
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"version": "5.1.1",
1414
"android": "3.4.2"
1515
},
16-
"android_ndk_version": "19c"
16+
"android_ndk_version": "20"
1717
}
Binary file not shown.
Binary file not shown.
Binary file not shown.

test-app/runtime/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ endif (CCACHE_FOUND AND (USE_CCACHE))
1616
# "-DANDROID_STL=c++_static" is just not enough for clang++ to find some libraries in the ndk
1717
MESSAGE(STATUS "## ANDROID_NDK_ROOT: " ${ANDROID_NDK_ROOT})
1818

19-
set(COMMON_CMAKE_ARGUMENTS "-std=c++11 -Werror -Wno-unused-result -mstackrealign -fexceptions -fno-builtin-stpcpy -fno-rtti -D_LIBCPP_ABI_VERSION=Cr -D_LIBCPP_ENABLE_NODISCARD -D_LIBCPP_ABI_UNSTABLE")
19+
set(COMMON_CMAKE_ARGUMENTS "-nostdinc++ -std=c++14 -Werror -Wno-unused-result -mstackrealign -fexceptions -fno-builtin-stpcpy -fno-rtti -D_LIBCPP_ABI_VERSION=Cr -D_LIBCPP_ENABLE_NODISCARD -D_LIBCPP_ABI_UNSTABLE")
2020

2121
# AOSP has switched to using LLD by default and the NDK will use it by default in the next release.
2222
# BFD and Gold will be removed once LLD has been through a release cycle with no major unresolved issues (estimated r21)
@@ -89,6 +89,7 @@ if (NOT OPTIMIZED_BUILD OR OPTIMIZED_WITH_INSPECTOR_BUILD)
8989
src/main/cpp/v8_inspector/src/inspector/v8-overlay-agent-impl.cpp
9090
src/main/cpp/v8_inspector/src/inspector/v8-page-agent-impl.cpp
9191

92+
src/main/cpp/v8_inspector/third_party/inspector_protocol/encoding/encoding.cc
9293
src/main/cpp/v8_inspector/src/inspector/custom-preview.cc
9394
src/main/cpp/v8_inspector/src/inspector/injected-script.cc
9495
src/main/cpp/v8_inspector/src/inspector/inspected-context.cc
@@ -104,12 +105,14 @@ if (NOT OPTIMIZED_BUILD OR OPTIMIZED_WITH_INSPECTOR_BUILD)
104105
src/main/cpp/v8_inspector/src/inspector/v8-debugger-script.cc
105106
src/main/cpp/v8_inspector/src/inspector/v8-heap-profiler-agent-impl.cc
106107
src/main/cpp/v8_inspector/src/inspector/v8-inspector-impl.cc
108+
src/main/cpp/v8_inspector/src/inspector/v8-inspector-protocol-encoding.cc
107109
src/main/cpp/v8_inspector/src/inspector/v8-inspector-session-impl.cc
108110
src/main/cpp/v8_inspector/src/inspector/v8-profiler-agent-impl.cc
109111
src/main/cpp/v8_inspector/src/inspector/v8-regex.cc
110112
src/main/cpp/v8_inspector/src/inspector/v8-runtime-agent-impl.cc
111113
src/main/cpp/v8_inspector/src/inspector/v8-schema-agent-impl.cc
112114
src/main/cpp/v8_inspector/src/inspector/v8-stack-trace-impl.cc
115+
src/main/cpp/v8_inspector/src/inspector/v8-string-conversions.cc
113116
src/main/cpp/v8_inspector/src/inspector/v8-value-utils.cc
114117
src/main/cpp/v8_inspector/src/inspector/value-mirror.cc
115118
src/main/cpp/v8_inspector/src/inspector/wasm-translation.cc

test-app/runtime/src/main/cpp/ArgConverter.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ int64_t ArgConverter::ConvertToJavaLong(Isolate* isolate, const Local<Value>& va
218218

219219
assert(!valueProp.IsEmpty());
220220

221-
string num = ConvertToString(valueProp->ToString(isolate));
221+
Local<Context> context = isolate->GetCurrentContext();
222+
string num = ConvertToString(valueProp->ToString(context).ToLocalChecked());
222223

223224
int64_t longValue = atoll(num.c_str());
224225

@@ -268,7 +269,7 @@ jstring ArgConverter::ConvertToJavaString(const Local<Value>& value) {
268269
}
269270

270271
Local<String> ArgConverter::ConvertToV8String(Isolate* isolate, const jchar* data, int length) {
271-
return String::NewFromTwoByte(isolate, (const uint16_t*) data, String::kNormalString, length);
272+
return String::NewFromTwoByte(isolate, (const uint16_t*) data, NewStringType::kNormal, length).ToLocalChecked();
272273
}
273274

274275
Local<String> ArgConverter::ConvertToV8String(Isolate* isolate, const string& s) {
@@ -277,11 +278,11 @@ Local<String> ArgConverter::ConvertToV8String(Isolate* isolate, const string& s)
277278
}
278279

279280
Local<String> ArgConverter::ConvertToV8String(Isolate* isolate, const char* data, int length) {
280-
return String::NewFromUtf8(isolate, (const char*) data, String::kNormalString, length);
281+
return String::NewFromUtf8(isolate, (const char*) data, NewStringType::kNormal, length).ToLocalChecked();
281282
}
282283

283284
Local<String> ArgConverter::ConvertToV8UTF16String(Isolate* isolate, const u16string& utf16string) {
284-
return String::NewFromTwoByte(isolate, ((const uint16_t*) utf16string.data()));
285+
return String::NewFromTwoByte(isolate, ((const uint16_t*) utf16string.data())).ToLocalChecked();
285286
}
286287

287288
std::map<Isolate*, ArgConverter::TypeLongOperationsCache*> ArgConverter::s_type_long_operations_cache;

test-app/runtime/src/main/cpp/ArrayElementAccessor.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ void ArrayElementAccessor::SetArrayElement(Isolate* isolate, const Local<Object>
9595
jboolean isCopy = false;
9696

9797
if (elementSignature == "Z") { //bool
98-
jboolean boolElementValue = (jboolean) value->BooleanValue(context).ToChecked();
98+
jboolean boolElementValue = (jboolean) value->BooleanValue(isolate);
9999
jbooleanArray boolArr = static_cast<jbooleanArray>(arr);
100100
env.SetBooleanArrayRegion(boolArr, index, 1, &boolElementValue);
101101
} else if (elementSignature == "B") { //byte
102102
jbyte byteElementValue = (jbyte) value->Int32Value(context).ToChecked();
103103
jbyteArray byteArr = static_cast<jbyteArray>(arr);
104104
env.SetByteArrayRegion(byteArr, index, 1, &byteElementValue);
105105
} else if (elementSignature == "C") { //char
106-
String::Utf8Value utf8(isolate, value->ToString(isolate));
106+
String::Utf8Value utf8(isolate, value->ToString(context).ToLocalChecked());
107107
JniLocalRef s(env.NewString((jchar*) *utf8, 1));
108108
const char* singleChar = env.GetStringUTFChars(s, &isCopy);
109109
jchar charElementValue = *singleChar;

test-app/runtime/src/main/cpp/CallbackHandlers.cpp

+12-10
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,11 @@ CallbackHandlers::GetImplementedInterfaces(JEnv& env, const Local<Object>& imple
571571
v8::String::Utf8Value propName(isolate, name);
572572
std::string arrNameC = std::string(*propName);
573573
if (arrNameC == "interfaces") {
574-
auto interfacesArr = prop->ToObject(isolate);
574+
auto interfacesArr = prop->ToObject(context).ToLocalChecked();
575575

576576
auto context = isolate->GetCurrentContext();
577577
int length = interfacesArr->Get(
578-
v8::String::NewFromUtf8(isolate, "length"))->ToObject(isolate)->Uint32Value(
578+
v8::String::NewFromUtf8(isolate, "length").ToLocalChecked())->ToObject(context).ToLocalChecked()->Uint32Value(
579579
context).ToChecked();
580580

581581
if (length > 0) {
@@ -651,7 +651,8 @@ void CallbackHandlers::LogMethodCallback(const v8::FunctionCallbackInfo<v8::Valu
651651
try {
652652
if ((args.Length() > 0) && args[0]->IsString()) {
653653
auto isolate = args.GetIsolate();
654-
String::Utf8Value message(isolate, args[0]->ToString(isolate));
654+
auto context = isolate->GetCurrentContext();
655+
String::Utf8Value message(isolate, args[0]->ToString(context).ToLocalChecked());
655656
DEBUG_WRITE("%s", *message);
656657
}
657658
} catch (NativeScriptException& e) {
@@ -937,7 +938,8 @@ void CallbackHandlers::NewThreadCallback(const v8::FunctionCallbackInfo<v8::Valu
937938
currentDir = currentDir.substr(fileSchema.length());
938939
}
939940

940-
auto workerPath = ArgConverter::ConvertToString(args[0]->ToString(isolate));
941+
auto context = isolate->GetCurrentContext();
942+
auto workerPath = ArgConverter::ConvertToString(args[0]->ToString(context).ToLocalChecked());
941943

942944
// Will throw if path is invalid or doesn't exist
943945
ModuleInternal::CheckFileExists(isolate, workerPath, currentDir);
@@ -1202,7 +1204,7 @@ CallbackHandlers::WorkerObjectTerminateCallback(const v8::FunctionCallbackInfo<v
12021204
V8GetPrivateValue(isolate, thiz, ArgConverter::ConvertToV8String(isolate, "isTerminated"),
12031205
isTerminated);
12041206

1205-
if (!isTerminated.IsEmpty() && isTerminated->BooleanValue(context).ToChecked()) {
1207+
if (!isTerminated.IsEmpty() && isTerminated->BooleanValue(isolate)) {
12061208
DEBUG_WRITE(
12071209
"Main: WorkerObjectTerminateCallback - Worker(id=%d)'s terminate has already been called.",
12081210
id);
@@ -1247,7 +1249,7 @@ void CallbackHandlers::WorkerGlobalCloseCallback(const v8::FunctionCallbackInfo<
12471249
auto isTerminating = globalObject->Get(
12481250
ArgConverter::ConvertToV8String(isolate, "isTerminating"));
12491251

1250-
if (!isTerminating.IsEmpty() && isTerminating->BooleanValue(context).ToChecked()) {
1252+
if (!isTerminating.IsEmpty() && isTerminating->BooleanValue(isolate)) {
12511253
DEBUG_WRITE("WORKER: WorkerThreadCloseCallback - Worker is currently terminating...");
12521254
return;
12531255
}
@@ -1317,7 +1319,7 @@ void CallbackHandlers::CallWorkerScopeOnErrorHandle(Isolate* isolate, TryCatch&
13171319
func->Call(context, Undefined(isolate), 1, args1).ToLocal(&result);
13181320

13191321
// return 'true'-like value, don't bubble up to main Worker.onerror
1320-
if (!result.IsEmpty() && result->BooleanValue(context).ToChecked()) {
1322+
if (!result.IsEmpty() && result->BooleanValue(isolate)) {
13211323
// Do nothing, exception has been handled
13221324
return;
13231325
}
@@ -1332,7 +1334,7 @@ void CallbackHandlers::CallWorkerScopeOnErrorHandle(Isolate* isolate, TryCatch&
13321334
if (!outStackTrace.IsEmpty()) {
13331335
stackTrace = outStackTrace->ToDetailString(context).FromMaybe(Local<String>());
13341336
}
1335-
auto source = innerTc.Message()->GetScriptResourceName()->ToString(isolate);
1337+
auto source = innerTc.Message()->GetScriptResourceName()->ToString(context).ToLocalChecked();
13361338

13371339
auto runtime = Runtime::GetRuntime(isolate);
13381340
runtime->PassUncaughtExceptionFromWorkerToMainHandler(msg, stackTrace, source, lno);
@@ -1341,7 +1343,7 @@ void CallbackHandlers::CallWorkerScopeOnErrorHandle(Isolate* isolate, TryCatch&
13411343
// throw so that it may bubble up to main
13421344
auto lno = tc.Message()->GetLineNumber(context).ToChecked();
13431345
auto msg = tc.Message()->Get();
1344-
auto source = tc.Message()->GetScriptResourceName()->ToString(isolate);
1346+
auto source = tc.Message()->GetScriptResourceName()->ToString(context).ToLocalChecked();
13451347
Local<Value> outStackTrace = tc.StackTrace(context).FromMaybe(Local<Value>());
13461348
Local<String> stackTrace;
13471349
if (!outStackTrace.IsEmpty()) {
@@ -1414,7 +1416,7 @@ CallbackHandlers::CallWorkerObjectOnErrorHandle(Isolate* isolate, jint workerId,
14141416
// Handle exceptions thrown in onmessage with the worker.onerror handler, if present
14151417
Local<Value> result;
14161418
func->Call(context, Undefined(isolate), 1, args1).ToLocal(&result);
1417-
if (!result.IsEmpty() && result->BooleanValue(context).ToChecked()) {
1419+
if (!result.IsEmpty() && result->BooleanValue(isolate)) {
14181420
// Do nothing, exception is handled and does not need to be raised to application level
14191421
return;
14201422
}

test-app/runtime/src/main/cpp/DOMDomainCallbackHandlers.cpp

+14-14
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ void DOMDomainCallbackHandlers::ChildNodeInsertedCallback(const v8::FunctionCall
3535
throw NativeScriptException("Calling ChildNodeInserted with invalid arguments. Required params: parentId: number, lastId: number, node: JSON String");
3636
}
3737

38-
auto parentId = args[0]->ToNumber(isolate);
39-
auto lastId = args[1]->ToNumber(isolate);
40-
auto node = args[2]->ToString(isolate);
38+
auto context = isolate->GetCurrentContext();
39+
auto parentId = args[0]->ToNumber(context).ToLocalChecked();
40+
auto lastId = args[1]->ToNumber(context).ToLocalChecked();
41+
auto node = args[2]->ToString(context).ToLocalChecked();
4142

4243
auto resultString = V8DOMAgentImpl::AddBackendNodeIdProperty(isolate, node);
4344
auto resultUtf16Data = resultString.data();
@@ -54,7 +55,6 @@ void DOMDomainCallbackHandlers::ChildNodeInsertedCallback(const v8::FunctionCall
5455
return;
5556
}
5657

57-
auto context = isolate->GetCurrentContext();
5858
domAgentInstance->m_frontend.childNodeInserted(parentId->Int32Value(context).ToChecked(), lastId->Int32Value(context).ToChecked(), std::move(domNode));
5959
} catch (NativeScriptException& e) {
6060
e.ReThrowToV8();
@@ -85,10 +85,10 @@ void DOMDomainCallbackHandlers::ChildNodeRemovedCallback(const v8::FunctionCallb
8585
throw NativeScriptException("Calling ChildNodeRemoved with invalid arguments. Required params: parentId: number, nodeId: number");
8686
}
8787

88-
auto parentId = args[0]->ToNumber(isolate);
89-
auto nodeId = args[1]->ToNumber(isolate);
90-
9188
auto context = isolate->GetCurrentContext();
89+
auto parentId = args[0]->ToNumber(context).ToLocalChecked();
90+
auto nodeId = args[1]->ToNumber(context).ToLocalChecked();
91+
9292
domAgentInstance->m_frontend.childNodeRemoved(parentId->Int32Value(context).ToChecked(), nodeId->Int32Value(context).ToChecked());
9393
} catch (NativeScriptException& e) {
9494
e.ReThrowToV8();
@@ -119,11 +119,11 @@ void DOMDomainCallbackHandlers::AttributeModifiedCallback(const v8::FunctionCall
119119
throw NativeScriptException("Calling AttributeModified with invalid arguments. Required params: nodeId: number, name: string, value: string");
120120
}
121121

122-
auto nodeId = args[0]->ToNumber(isolate);
123-
auto attributeName = args[1]->ToString(isolate);
124-
auto attributeValue = args[2]->ToString(isolate);
125-
126122
auto context = isolate->GetCurrentContext();
123+
auto nodeId = args[0]->ToNumber(context).ToLocalChecked();
124+
auto attributeName = args[1]->ToString(context).ToLocalChecked();
125+
auto attributeValue = args[2]->ToString(context).ToLocalChecked();
126+
127127
domAgentInstance->m_frontend.attributeModified(nodeId->Int32Value(context).ToChecked(),
128128
v8_inspector::toProtocolString(isolate, attributeName),
129129
v8_inspector::toProtocolString(isolate, attributeValue));
@@ -155,10 +155,10 @@ void DOMDomainCallbackHandlers::AttributeRemovedCallback(const v8::FunctionCallb
155155
throw NativeScriptException("Calling AttributeRemoved with invalid arguments. Required params: nodeId: number, name: string");
156156
}
157157

158-
auto nodeId = args[0]->ToNumber(isolate);
159-
auto attributeName = args[1]->ToString(isolate);
160-
161158
auto context = isolate->GetCurrentContext();
159+
auto nodeId = args[0]->ToNumber(context).ToLocalChecked();
160+
auto attributeName = args[1]->ToString(context).ToLocalChecked();
161+
162162
domAgentInstance->m_frontend.attributeRemoved(nodeId->Int32Value(context).ToChecked(),
163163
v8_inspector::toProtocolString(isolate, attributeName));
164164
} catch (NativeScriptException& e) {

test-app/runtime/src/main/cpp/FieldAccessor.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ void FieldAccessor::SetJavaField(Isolate* isolate, const Local<Object>& target,
239239
case 'Z': { //bool
240240
//TODO: validate value is a boolean before calling
241241
if (isStatic) {
242-
env.SetStaticBooleanField(clazz, fieldId, value->BooleanValue(context).ToChecked());
242+
env.SetStaticBooleanField(clazz, fieldId, value->BooleanValue(isolate));
243243
} else {
244-
env.SetBooleanField(targetJavaObject, fieldId, value->BooleanValue(context).ToChecked());
244+
env.SetBooleanField(targetJavaObject, fieldId, value->BooleanValue(isolate));
245245
}
246246
break;
247247
}
@@ -256,7 +256,7 @@ void FieldAccessor::SetJavaField(Isolate* isolate, const Local<Object>& target,
256256
}
257257
case 'C': { //char
258258
//TODO: validate value is a single char
259-
String::Utf8Value stringValue(isolate, value->ToString(isolate));
259+
String::Utf8Value stringValue(isolate, value->ToString(context).ToLocalChecked());
260260
JniLocalRef strValue(env.NewStringUTF(*stringValue));
261261
const char* chars = env.GetStringUTFChars(strValue, 0);
262262

@@ -327,7 +327,8 @@ void FieldAccessor::SetJavaField(Isolate* isolate, const Local<Object>& target,
327327
//TODO: validate valie is a string;
328328
result = ArgConverter::ConvertToJavaString(value);
329329
} else {
330-
auto objectWithHiddenID = value->ToObject(isolate);
330+
auto context = isolate->GetCurrentContext();
331+
auto objectWithHiddenID = value->ToObject(context).ToLocalChecked();
331332
result = objectManager->GetJavaObjectByJsObject(objectWithHiddenID);
332333
}
333334
}

0 commit comments

Comments
 (0)