From b57c3cc40f24277c9bab0a6811bddc79c83ad0ec Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Sep 2011 14:20:18 +1000 Subject: [PATCH] Update V8 Add a "NativeMode" to V8 script compilation. Change-Id: I73b087c9787ca7f961c2af89f45de2b8813ce1a5 Task-number: QTBUG-20344 Reviewed-on: http://codereview.qt-project.org/4500 Reviewed-by: Qt Sanity Bot Reviewed-by: Aaron Kennedy --- src/3rdparty/v8 | 2 +- ...shing-and-comparison-methods-to-v8-String.patch | 2 +- src/v8/0002-Add-a-bit-field-3-to-Map.patch | 2 +- ...back-mode-for-named-property-interceptors.patch | 2 +- ...0004-Generalize-external-object-resources.patch | 2 +- src/v8/0005-Introduce-a-QML-compilation-mode.patch | 2 +- ...6-Allow-access-to-the-calling-script-data.patch | 2 +- src/v8/0007-Fix-warnings.patch | 2 +- .../0008-Add-custom-object-compare-callback.patch | 2 +- ...unction-method-to-the-Object-class-in-the.patch | 2 +- ...allAsConstructor-method-for-Object-in-the.patch | 2 +- ...-Add-new-v8-api-to-check-if-a-value-is-an.patch | 2 +- ...d-IsCallable-method-for-Object-in-the-API.patch | 2 +- .../0013-Remove-execute-flag-from-v8-debug.h.patch | 2 +- src/v8/0014-Fix-deprecated-Python-code.patch | 2 +- ...15-Allow-a-script-to-be-flagged-as-native.patch | 46 ++++++++++++++++++++++ 16 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 src/v8/0015-Allow-a-script-to-be-flagged-as-native.patch diff --git a/src/3rdparty/v8 b/src/3rdparty/v8 index ed5cc90..523f03f 160000 --- a/src/3rdparty/v8 +++ b/src/3rdparty/v8 @@ -1 +1 @@ -Subproject commit ed5cc903d70f73780e5985e7d2de33f6b8d86402 +Subproject commit 523f03f03b1ac16d272a13389f8a5654d9ff12e6 diff --git a/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch b/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch index 2c24396..fefdd79 100644 --- a/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch +++ b/src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch @@ -1,7 +1,7 @@ From 3dff2e903674d8ab5310d44281b57de36db659c9 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 23 May 2011 15:47:20 +1000 -Subject: [PATCH 01/14] Add hashing and comparison methods to v8::String +Subject: [PATCH 01/15] Add hashing and comparison methods to v8::String This allows us to more rapidly search for a v8::String inside a hash of QStrings. diff --git a/src/v8/0002-Add-a-bit-field-3-to-Map.patch b/src/v8/0002-Add-a-bit-field-3-to-Map.patch index e1b0d09..7124021 100644 --- a/src/v8/0002-Add-a-bit-field-3-to-Map.patch +++ b/src/v8/0002-Add-a-bit-field-3-to-Map.patch @@ -1,7 +1,7 @@ From 01f7bd262fb1be893fe4bdc6b98a1b43c5a0bb7d Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 23 May 2011 15:55:26 +1000 -Subject: [PATCH 02/14] Add a bit field 3 to Map +Subject: [PATCH 02/15] Add a bit field 3 to Map Bit field 3 will be used to add QML specific map flags. --- diff --git a/src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch b/src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch index ee4410f..5c80fcf 100644 --- a/src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch +++ b/src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch @@ -1,7 +1,7 @@ From 530ded6ea634bccb96652cd3e0cf67725449ed63 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 23 May 2011 16:21:02 +1000 -Subject: [PATCH 03/14] Add a "fallback" mode for named property interceptors +Subject: [PATCH 03/15] Add a "fallback" mode for named property interceptors By default interceptors are called before the normal property resolution on objects. When an interceptor is installed as a diff --git a/src/v8/0004-Generalize-external-object-resources.patch b/src/v8/0004-Generalize-external-object-resources.patch index 3a232af..0043801 100644 --- a/src/v8/0004-Generalize-external-object-resources.patch +++ b/src/v8/0004-Generalize-external-object-resources.patch @@ -1,7 +1,7 @@ From f9368b52060c31e9532ef26f6cca1a2cb0283f51 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 23 May 2011 16:55:35 +1000 -Subject: [PATCH 04/14] Generalize external object resources +Subject: [PATCH 04/15] Generalize external object resources V8 was already able to manage and finalize an external string resource. This change generalizes that mechanism to handle a diff --git a/src/v8/0005-Introduce-a-QML-compilation-mode.patch b/src/v8/0005-Introduce-a-QML-compilation-mode.patch index d1b4d4d..4904969 100644 --- a/src/v8/0005-Introduce-a-QML-compilation-mode.patch +++ b/src/v8/0005-Introduce-a-QML-compilation-mode.patch @@ -1,7 +1,7 @@ From 60c1a26bf89d3b06bcdd8408fcee89a018120f32 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 23 May 2011 18:26:19 +1000 -Subject: [PATCH 05/14] Introduce a QML compilation mode +Subject: [PATCH 05/15] Introduce a QML compilation mode In QML mode, there is a second global object - known as the QML global object. During property resolution, if a property is not diff --git a/src/v8/0006-Allow-access-to-the-calling-script-data.patch b/src/v8/0006-Allow-access-to-the-calling-script-data.patch index 68b28ae..5c81fcf 100644 --- a/src/v8/0006-Allow-access-to-the-calling-script-data.patch +++ b/src/v8/0006-Allow-access-to-the-calling-script-data.patch @@ -1,7 +1,7 @@ From 1209b88e96f253cdc19aa4c95e011c84597844f0 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 25 May 2011 10:36:13 +1000 -Subject: [PATCH 06/14] Allow access to the calling script data +Subject: [PATCH 06/15] Allow access to the calling script data --- include/v8.h | 1 + diff --git a/src/v8/0007-Fix-warnings.patch b/src/v8/0007-Fix-warnings.patch index cd27a7b..56be7b8 100644 --- a/src/v8/0007-Fix-warnings.patch +++ b/src/v8/0007-Fix-warnings.patch @@ -1,7 +1,7 @@ From 2a5cf85d7fd7912e516138db03e4cda47cc2a1ab Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 27 May 2011 13:04:15 +1000 -Subject: [PATCH 07/14] Fix warnings +Subject: [PATCH 07/15] Fix warnings --- include/v8.h | 16 ++++++++-------- diff --git a/src/v8/0008-Add-custom-object-compare-callback.patch b/src/v8/0008-Add-custom-object-compare-callback.patch index f88e260..528af62 100644 --- a/src/v8/0008-Add-custom-object-compare-callback.patch +++ b/src/v8/0008-Add-custom-object-compare-callback.patch @@ -1,7 +1,7 @@ From a7c491e6e533110a17fe9f7d47cf92a1b2263180 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 27 Jun 2011 14:57:28 +1000 -Subject: [PATCH 08/14] Add custom object compare callback +Subject: [PATCH 08/15] Add custom object compare callback A global custom object comparison callback can be set with: V8::SetUserObjectComparisonCallbackFunction() diff --git a/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch b/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch index f9790f9..6886231 100644 --- a/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch +++ b/src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch @@ -1,7 +1,7 @@ From 15ce2909579aef8c8f6b0c2c07fdebbaf0f4d611 Mon Sep 17 00:00:00 2001 From: ager@chromium.org Date: Wed, 4 May 2011 13:03:08 +0000 -Subject: [PATCH 09/14] Add CallAsFunction method to the Object class in the +Subject: [PATCH 09/15] Add CallAsFunction method to the Object class in the API Patch by Peter Varga. diff --git a/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch b/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch index c550b20..7efc358 100644 --- a/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch +++ b/src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch @@ -1,7 +1,7 @@ From 3ba270e3b93d292dc53a675a21479bdb0b50bbbe Mon Sep 17 00:00:00 2001 From: ager@chromium.org Date: Fri, 6 May 2011 11:07:52 +0000 -Subject: [PATCH 10/14] Implement CallAsConstructor method for Object in the +Subject: [PATCH 10/15] Implement CallAsConstructor method for Object in the API Patch by Peter Varga. diff --git a/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch b/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch index 0a47bbb..fdec7a1 100644 --- a/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch +++ b/src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch @@ -1,7 +1,7 @@ From 5f3e5dd6901b54707ea4f868d8fa7317c4ab3852 Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Tue, 7 Dec 2010 11:56:42 +0100 -Subject: [PATCH 11/14] QtScript/V8: Add new v8 api to check if a value is an +Subject: [PATCH 11/15] QtScript/V8: Add new v8 api to check if a value is an error. New function v8::Value::IsError was created. diff --git a/src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch b/src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch index a73bfe3..b1cfa8e 100644 --- a/src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch +++ b/src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch @@ -1,7 +1,7 @@ From a338d96fe138fbffd4b45c7d13a54e068daa6e12 Mon Sep 17 00:00:00 2001 From: ager@chromium.org Date: Mon, 9 May 2011 15:24:48 +0000 -Subject: [PATCH 12/14] Add IsCallable method for Object in the API +Subject: [PATCH 12/15] Add IsCallable method for Object in the API Patch by Peter Varga. diff --git a/src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch b/src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch index b593f3c..24ff160 100644 --- a/src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch +++ b/src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch @@ -1,7 +1,7 @@ From c36be227e9d7952a1952caa529c78ecdc376bd55 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 25 Aug 2011 11:09:58 +1000 -Subject: [PATCH 13/14] Remove execute flag from v8-debug.h +Subject: [PATCH 13/15] Remove execute flag from v8-debug.h --- 0 files changed, 0 insertions(+), 0 deletions(-) diff --git a/src/v8/0014-Fix-deprecated-Python-code.patch b/src/v8/0014-Fix-deprecated-Python-code.patch index 1e0a0fc..b33e6f5 100644 --- a/src/v8/0014-Fix-deprecated-Python-code.patch +++ b/src/v8/0014-Fix-deprecated-Python-code.patch @@ -1,7 +1,7 @@ From ed5cc903d70f73780e5985e7d2de33f6b8d86402 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 2 Sep 2011 12:03:09 +0200 -Subject: [PATCH 14/14] Fix deprecated Python code +Subject: [PATCH 14/15] Fix deprecated Python code Needed to make the scripts run on Python 3, which is the default python interpreter on some newer distros. diff --git a/src/v8/0015-Allow-a-script-to-be-flagged-as-native.patch b/src/v8/0015-Allow-a-script-to-be-flagged-as-native.patch new file mode 100644 index 0000000..204aada --- /dev/null +++ b/src/v8/0015-Allow-a-script-to-be-flagged-as-native.patch @@ -0,0 +1,46 @@ +From 523f03f03b1ac16d272a13389f8a5654d9ff12e6 Mon Sep 17 00:00:00 2001 +From: Aaron Kennedy +Date: Fri, 9 Sep 2011 14:16:12 +1000 +Subject: [PATCH 15/15] Allow a script to be flagged as "native" + +Native scripts do not appear in backtraces, or in the source and +line number when exceptions are thrown from within them. This is +useful to be able to write code in JavaScript instead of C++ and +still have it appear sensibly to the user. +--- + include/v8.h | 5 +++-- + src/compiler.cc | 2 +- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/include/v8.h b/include/v8.h +index 5e1ce50..a2d61d1 100644 +--- a/include/v8.h ++++ b/include/v8.h +@@ -578,8 +578,9 @@ class ScriptOrigin { + class V8EXPORT Script { + public: + enum CompileFlags { +- Default = 0x00, +- QmlMode = 0x01 ++ Default = 0x00, ++ QmlMode = 0x01, ++ NativeMode = 0x02 + }; + + /** +diff --git a/src/compiler.cc b/src/compiler.cc +index d2191b9..873018c 100755 +--- a/src/compiler.cc ++++ b/src/compiler.cc +@@ -507,7 +507,7 @@ Handle Compiler::Compile(Handle source, + + // Create a script object describing the script to be compiled. + Handle