Update V8
authorAaron Kennedy <aaron.kennedy@nokia.com>
Fri, 9 Sep 2011 04:20:18 +0000 (14:20 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 9 Sep 2011 06:18:56 +0000 (08:18 +0200)
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 <qt_sanity_bot@ovi.com>
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
16 files changed:
src/3rdparty/v8
src/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch
src/v8/0002-Add-a-bit-field-3-to-Map.patch
src/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch
src/v8/0004-Generalize-external-object-resources.patch
src/v8/0005-Introduce-a-QML-compilation-mode.patch
src/v8/0006-Allow-access-to-the-calling-script-data.patch
src/v8/0007-Fix-warnings.patch
src/v8/0008-Add-custom-object-compare-callback.patch
src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch
src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch
src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch
src/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch
src/v8/0013-Remove-execute-flag-from-v8-debug.h.patch
src/v8/0014-Fix-deprecated-Python-code.patch
src/v8/0015-Allow-a-script-to-be-flagged-as-native.patch [new file with mode: 0644]

index ed5cc90..523f03f 160000 (submodule)
@@ -1 +1 @@
-Subproject commit ed5cc903d70f73780e5985e7d2de33f6b8d86402
+Subproject commit 523f03f03b1ac16d272a13389f8a5654d9ff12e6
index 2c24396..fefdd79 100644 (file)
@@ -1,7 +1,7 @@
 From 3dff2e903674d8ab5310d44281b57de36db659c9 Mon Sep 17 00:00:00 2001
 From: Aaron Kennedy <aaron.kennedy@nokia.com>
 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.
index e1b0d09..7124021 100644 (file)
@@ -1,7 +1,7 @@
 From 01f7bd262fb1be893fe4bdc6b98a1b43c5a0bb7d Mon Sep 17 00:00:00 2001
 From: Aaron Kennedy <aaron.kennedy@nokia.com>
 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.
 ---
index ee4410f..5c80fcf 100644 (file)
@@ -1,7 +1,7 @@
 From 530ded6ea634bccb96652cd3e0cf67725449ed63 Mon Sep 17 00:00:00 2001
 From: Aaron Kennedy <aaron.kennedy@nokia.com>
 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
index 3a232af..0043801 100644 (file)
@@ -1,7 +1,7 @@
 From f9368b52060c31e9532ef26f6cca1a2cb0283f51 Mon Sep 17 00:00:00 2001
 From: Aaron Kennedy <aaron.kennedy@nokia.com>
 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
index d1b4d4d..4904969 100644 (file)
@@ -1,7 +1,7 @@
 From 60c1a26bf89d3b06bcdd8408fcee89a018120f32 Mon Sep 17 00:00:00 2001
 From: Aaron Kennedy <aaron.kennedy@nokia.com>
 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
index 68b28ae..5c81fcf 100644 (file)
@@ -1,7 +1,7 @@
 From 1209b88e96f253cdc19aa4c95e011c84597844f0 Mon Sep 17 00:00:00 2001
 From: Aaron Kennedy <aaron.kennedy@nokia.com>
 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 +
index cd27a7b..56be7b8 100644 (file)
@@ -1,7 +1,7 @@
 From 2a5cf85d7fd7912e516138db03e4cda47cc2a1ab Mon Sep 17 00:00:00 2001
 From: Aaron Kennedy <aaron.kennedy@nokia.com>
 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 ++++++++--------
index f88e260..528af62 100644 (file)
@@ -1,7 +1,7 @@
 From a7c491e6e533110a17fe9f7d47cf92a1b2263180 Mon Sep 17 00:00:00 2001
 From: Aaron Kennedy <aaron.kennedy@nokia.com>
 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()
index f9790f9..6886231 100644 (file)
@@ -1,7 +1,7 @@
 From 15ce2909579aef8c8f6b0c2c07fdebbaf0f4d611 Mon Sep 17 00:00:00 2001
 From: ager@chromium.org <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.
index c550b20..7efc358 100644 (file)
@@ -1,7 +1,7 @@
 From 3ba270e3b93d292dc53a675a21479bdb0b50bbbe Mon Sep 17 00:00:00 2001
 From: ager@chromium.org <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.
index 0a47bbb..fdec7a1 100644 (file)
@@ -1,7 +1,7 @@
 From 5f3e5dd6901b54707ea4f868d8fa7317c4ab3852 Mon Sep 17 00:00:00 2001
 From: Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
 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.
index a73bfe3..b1cfa8e 100644 (file)
@@ -1,7 +1,7 @@
 From a338d96fe138fbffd4b45c7d13a54e068daa6e12 Mon Sep 17 00:00:00 2001
 From: ager@chromium.org <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
 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.
 
index b593f3c..24ff160 100644 (file)
@@ -1,7 +1,7 @@
 From c36be227e9d7952a1952caa529c78ecdc376bd55 Mon Sep 17 00:00:00 2001
 From: Aaron Kennedy <aaron.kennedy@nokia.com>
 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(-)
index 1e0a0fc..b33e6f5 100644 (file)
@@ -1,7 +1,7 @@
 From ed5cc903d70f73780e5985e7d2de33f6b8d86402 Mon Sep 17 00:00:00 2001
 From: Kent Hansen <kent.hansen@nokia.com>
 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 (file)
index 0000000..204aada
--- /dev/null
@@ -0,0 +1,46 @@
+From 523f03f03b1ac16d272a13389f8a5654d9ff12e6 Mon Sep 17 00:00:00 2001
+From: Aaron Kennedy <aaron.kennedy@nokia.com>
+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<SharedFunctionInfo> Compiler::Compile(Handle<String> source,
+     // Create a script object describing the script to be compiled.
+     Handle<Script> script = FACTORY->NewScript(source);
+-    if (natives == NATIVES_CODE) {
++    if (natives == NATIVES_CODE || compile_flags & v8::Script::NativeMode) {
+       script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
+     }
+     if (!script_name.is_null()) {
+-- 
+1.7.4.4
+