Update v8
authorAaron Kennedy <aaron.kennedy@nokia.com>
Thu, 25 Aug 2011 01:15:02 +0000 (11:15 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 25 Aug 2011 01:22:39 +0000 (03:22 +0200)
Change-Id: I576fb2215345aa6599cfb75c6a27544260b2c145
Reviewed-on: http://codereview.qt.nokia.com/3536
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
14 files changed:
src/3rdparty/v8
src/declarative/v8/0001-Add-hashing-and-comparison-methods-to-v8-String.patch
src/declarative/v8/0002-Add-a-bit-field-3-to-Map.patch
src/declarative/v8/0003-Add-a-fallback-mode-for-named-property-interceptors.patch
src/declarative/v8/0004-Generalize-external-object-resources.patch
src/declarative/v8/0005-Introduce-a-QML-compilation-mode.patch
src/declarative/v8/0006-Allow-access-to-the-calling-script-data.patch
src/declarative/v8/0007-Fix-warnings.patch
src/declarative/v8/0008-Add-custom-object-compare-callback.patch
src/declarative/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch [moved from src/v8/0009-Add-CallAsFunction-method-to-the-Object-class-in-the.patch with 94% similarity]
src/declarative/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch [moved from src/v8/0010-Implement-CallAsConstructor-method-for-Object-in-the.patch with 93% similarity]
src/declarative/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch [moved from src/v8/0011-QtScript-V8-Add-new-v8-api-to-check-if-a-value-is-an.patch with 89% similarity]
src/declarative/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch [new file with mode: 0644]
src/declarative/v8/0013-Remove-execute-flag-from-v8-debug.h.patch [new file with mode: 0644]

index 472c04c..dc2cad4 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 472c04c9e7a64e8734c76d2cf97a7cc5b773b788
+Subproject commit dc2cad4f8fc88c52fcea09b8d0262d35cd32dc44
index 4596202..1fb3b90 100644 (file)
@@ -1,7 +1,7 @@
 From e13ce09287a56c920d5ffdc5d4662d49f1838f16 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 1/8] Add hashing and comparison methods to v8::String
+Subject: [PATCH 01/13] 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 cb578c0..daf8b35 100644 (file)
@@ -1,7 +1,7 @@
 From 7c9cfff80b7864d5687432d424074e51712c4a07 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 2/8] Add a bit field 3 to Map
+Subject: [PATCH 02/13] Add a bit field 3 to Map
 
 Bit field 3 will be used to add QML specific map flags.
 ---
index daa2250..1c81b2a 100644 (file)
@@ -1,7 +1,7 @@
 From ae8688b53d67044f2c9b0cce25fc282b078610c1 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 3/8] Add a "fallback" mode for named property interceptors
+Subject: [PATCH 03/13] 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 56e5e37..6b85666 100644 (file)
@@ -1,7 +1,7 @@
 From 4827116b12c50f6662794017c5a662b5dbb2da0b 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 4/8] Generalize external object resources
+Subject: [PATCH 04/13] 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 7ec10e9..2dfd3d9 100644 (file)
@@ -1,7 +1,7 @@
 From fd7d475e298e5b63cd6383c78cc900635c82aa38 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 5/8] Introduce a QML compilation mode
+Subject: [PATCH 05/13] 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 7af81c3..b9c4465 100644 (file)
@@ -1,7 +1,7 @@
 From f890f0d1a1e5bd62711815489c87755a4f382436 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 6/8] Allow access to the calling script data
+Subject: [PATCH 06/13] Allow access to the calling script data
 
 ---
  include/v8.h |    1 +
index 2efc833..60fb24c 100644 (file)
@@ -1,7 +1,7 @@
 From dac5d9db84cf20564621c679937ca7b9c6a8e880 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 7/8] Fix warnings
+Subject: [PATCH 07/13] Fix warnings
 
 ---
  include/v8.h |   16 ++++++++--------
index 659cf4c..fdb0895 100644 (file)
@@ -1,7 +1,7 @@
 From bec11b8b7f89d135e7d9a823ac4fe98c70d017cf 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 8/8] Add custom object compare callback
+Subject: [PATCH 08/13] Add custom object compare callback
 
 A global custom object comparison callback can be set with:
     V8::SetUserObjectComparisonCallbackFunction()
@@ -1,7 +1,7 @@
-From 5719ba59309e85f3ca47da6b64df66e710f3016f Mon Sep 17 00:00:00 2001
-From: "ager@chromium.org" <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
+From 4183b973ed3bd603784c798dfa63ba48f6b68003 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] Add CallAsFunction method to the Object class in the API
+Subject: [PATCH 09/13] Add CallAsFunction method to the Object class in the API
 
 Patch by Peter Varga.
 
@@ -20,10 +20,10 @@ git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@7781 ce2b1a6d-e
  5 files changed, 163 insertions(+), 37 deletions(-)
 
 diff --git a/include/v8.h b/include/v8.h
-index 4dcbf28..78ee7e6 100644
+index d5d6972..8a8e1cd 100644
 --- a/include/v8.h
 +++ b/include/v8.h
-@@ -1606,6 +1606,14 @@ class Object : public Value {
+@@ -1757,6 +1757,14 @@ class Object : public Value {
    V8EXPORT ExternalArrayType GetIndexedPropertiesExternalArrayDataType();
    V8EXPORT int GetIndexedPropertiesExternalArrayDataLength();
  
@@ -39,10 +39,10 @@ index 4dcbf28..78ee7e6 100644
    static inline Object* Cast(Value* obj);
   private:
 diff --git a/src/api.cc b/src/api.cc
-index 792e488..c72857d 100644
+index 2436031..e412e51 100644
 --- a/src/api.cc
 +++ b/src/api.cc
-@@ -3255,6 +3255,37 @@ int v8::Object::GetIndexedPropertiesExternalArrayDataLength() {
+@@ -3259,6 +3259,37 @@ int v8::Object::GetIndexedPropertiesExternalArrayDataLength() {
  }
  
  
@@ -81,10 +81,10 @@ index 792e488..c72857d 100644
    return NewInstance(0, NULL);
  }
 diff --git a/src/execution.cc b/src/execution.cc
-index eb26438..850dec5 100644
+index 1632076..894d741 100644
 --- a/src/execution.cc
 +++ b/src/execution.cc
-@@ -234,6 +234,30 @@ Handle<Object> Execution::GetFunctionDelegate(Handle<Object> object) {
+@@ -254,6 +254,30 @@ Handle<Object> Execution::GetFunctionDelegate(Handle<Object> object) {
  }
  
  
@@ -116,10 +116,10 @@ index eb26438..850dec5 100644
    ASSERT(!object->IsJSFunction());
    Isolate* isolate = Isolate::Current();
 diff --git a/src/execution.h b/src/execution.h
-index d4b80d2..e89d6ba 100644
+index a476eb4..0a0be51 100644
 --- a/src/execution.h
 +++ b/src/execution.h
-@@ -138,6 +138,8 @@ class Execution : public AllStatic {
+@@ -144,6 +144,8 @@ class Execution : public AllStatic {
    // Get a function delegate (or undefined) for the given non-function
    // object. Used for support calling objects as functions.
    static Handle<Object> GetFunctionDelegate(Handle<Object> object);
@@ -129,7 +129,7 @@ index d4b80d2..e89d6ba 100644
    // Get a function delegate (or undefined) for the given non-function
    // object. Used for support calling objects as constructors.
 diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
-index e2a7fb1..c6affe5 100644
+index d7621d1..693d51e 100644
 --- a/test/cctest/test-api.cc
 +++ b/test/cctest/test-api.cc
 @@ -6962,50 +6962,111 @@ THREADED_TEST(CallAsFunction) {
@@ -282,5 +282,5 @@ index e2a7fb1..c6affe5 100644
  
  
 -- 
-1.7.5.4
+1.7.2.3
 
@@ -1,7 +1,7 @@
-From fd2cc52576e8c89f3dffc2b4b5a9cc9c48a96f32 Mon Sep 17 00:00:00 2001
-From: "ager@chromium.org" <ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
+From 3d6d4249878f7960eac4c9c94e0f2529f9a58c4a 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] Implement CallAsConstructor method for Object in the API
+Subject: [PATCH 10/13] Implement CallAsConstructor method for Object in the API
 
 Patch by Peter Varga.
 
@@ -20,10 +20,10 @@ git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@7803 ce2b1a6d-e
  5 files changed, 276 insertions(+), 8 deletions(-)
 
 diff --git a/include/v8.h b/include/v8.h
-index 4921823..5fc8059 100644
+index 8a8e1cd..84462b5 100644
 --- a/include/v8.h
 +++ b/include/v8.h
-@@ -1614,6 +1614,14 @@ class Object : public Value {
+@@ -1765,6 +1765,14 @@ class Object : public Value {
                                         int argc,
                                         Handle<Value> argv[]);
  
@@ -39,10 +39,10 @@ index 4921823..5fc8059 100644
    static inline Object* Cast(Value* obj);
   private:
 diff --git a/src/api.cc b/src/api.cc
-index c5c66a7..9194641 100644
+index e412e51..1a585d6 100644
 --- a/src/api.cc
 +++ b/src/api.cc
-@@ -3262,7 +3262,7 @@ Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc,
+@@ -3266,7 +3266,7 @@ Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc,
               return Local<v8::Value>());
    LOG_API(isolate, "Object::CallAsFunction");
    ENTER_V8(isolate);
@@ -51,7 +51,7 @@ index c5c66a7..9194641 100644
    i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
    i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv);
    STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**));
-@@ -3282,7 +3282,44 @@ Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc,
+@@ -3286,7 +3286,44 @@ Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc,
    i::Handle<i::Object> returned =
        i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception);
    EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
@@ -98,10 +98,10 @@ index c5c66a7..9194641 100644
  
  
 diff --git a/src/execution.cc b/src/execution.cc
-index 4ab3e78..db74492 100644
+index 894d741..afb352c 100644
 --- a/src/execution.cc
 +++ b/src/execution.cc
-@@ -277,6 +277,34 @@ Handle<Object> Execution::GetConstructorDelegate(Handle<Object> object) {
+@@ -297,6 +297,34 @@ Handle<Object> Execution::GetConstructorDelegate(Handle<Object> object) {
  }
  
  
@@ -137,10 +137,10 @@ index 4ab3e78..db74492 100644
    ExecutionAccess access(isolate_);
    return (thread_local_.jslimit_ != kInterruptLimit &&
 diff --git a/src/execution.h b/src/execution.h
-index 74189a2..7b6a48c 100644
+index 0a0be51..ec2a195 100644
 --- a/src/execution.h
 +++ b/src/execution.h
-@@ -146,6 +146,8 @@ class Execution : public AllStatic {
+@@ -150,6 +150,8 @@ class Execution : public AllStatic {
    // Get a function delegate (or undefined) for the given non-function
    // object. Used for support calling objects as constructors.
    static Handle<Object> GetConstructorDelegate(Handle<Object> object);
@@ -150,10 +150,10 @@ index 74189a2..7b6a48c 100644
  
  
 diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
-index 1bcc232..f48d5b4 100644
+index 693d51e..1334f63 100644
 --- a/test/cctest/test-api.cc
 +++ b/test/cctest/test-api.cc
-@@ -6747,6 +6747,200 @@ THREADED_TEST(Constructor) {
+@@ -6746,6 +6746,200 @@ THREADED_TEST(Constructor) {
    CHECK(value->BooleanValue());
  }
  
@@ -354,7 +354,7 @@ index 1bcc232..f48d5b4 100644
  THREADED_TEST(FunctionDescriptorException) {
    v8::HandleScope handle_scope;
    LocalContext context;
-@@ -7029,9 +7223,8 @@ THREADED_TEST(CallAsFunction) {
+@@ -7028,9 +7222,8 @@ THREADED_TEST(CallAsFunction) {
      CHECK(value.IsEmpty());
      CHECK(try_catch.HasCaught());
      String::AsciiValue exception_value1(try_catch.Exception());
@@ -366,7 +366,7 @@ index 1bcc232..f48d5b4 100644
      try_catch.Reset();
  
      // Call an object without call-as-function handler through the API
-@@ -7041,7 +7234,7 @@ THREADED_TEST(CallAsFunction) {
+@@ -7040,7 +7233,7 @@ THREADED_TEST(CallAsFunction) {
      CHECK(value.IsEmpty());
      CHECK(try_catch.HasCaught());
      String::AsciiValue exception_value2(try_catch.Exception());
@@ -375,7 +375,7 @@ index 1bcc232..f48d5b4 100644
      try_catch.Reset();
    }
  
-@@ -7058,14 +7251,14 @@ THREADED_TEST(CallAsFunction) {
+@@ -7057,14 +7250,14 @@ THREADED_TEST(CallAsFunction) {
      value = CompileRun("obj3(22)");
      CHECK(try_catch.HasCaught());
      String::AsciiValue exception_value1(try_catch.Exception());
@@ -393,5 +393,5 @@ index 1bcc232..f48d5b4 100644
    }
  }
 -- 
-1.7.5.4
+1.7.2.3
 
@@ -1,7 +1,7 @@
-From 859c452847317efe1131e337fcd51514de616ea2 Mon Sep 17 00:00:00 2001
+From f22d0312faeb93ced8747d9aae8c6d77e11b4aba 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] QtScript/V8: Add new v8 api to check if a value is an error.
+Subject: [PATCH 11/13] QtScript/V8: Add new v8 api to check if a value is an error.
 
 New function v8::Value::IsError was created.
 
@@ -14,7 +14,7 @@ research.
  3 files changed, 12 insertions(+), 0 deletions(-)
 
 diff --git a/include/v8.h b/include/v8.h
-index 303cb7a..f992cb2 100644
+index 84462b5..08b0ec2 100644
 --- a/include/v8.h
 +++ b/include/v8.h
 @@ -937,6 +937,11 @@ class Value : public Data {
@@ -30,7 +30,7 @@ index 303cb7a..f992cb2 100644
    V8EXPORT Local<Number> ToNumber() const;
    V8EXPORT Local<String> ToString() const;
 diff --git a/src/api.cc b/src/api.cc
-index fd4a76b..5ada246 100644
+index 1a585d6..bd435eb 100644
 --- a/src/api.cc
 +++ b/src/api.cc
 @@ -2108,6 +2108,12 @@ bool Value::IsRegExp() const {
@@ -59,5 +59,5 @@ index 8cbf378..db90bb9 100644
    V(to_string_symbol, "toString")                                        \
    V(char_at_symbol, "CharAt")                                            \
 -- 
-1.7.4.15.g7811d
+1.7.2.3
 
diff --git a/src/declarative/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch b/src/declarative/v8/0012-Add-IsCallable-method-for-Object-in-the-API.patch
new file mode 100644 (file)
index 0000000..e4c46b0
--- /dev/null
@@ -0,0 +1,116 @@
+From 472c04c9e7a64e8734c76d2cf97a7cc5b773b788 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/13] Add IsCallable method for Object in the API
+
+Patch by Peter Varga.
+
+BUG=none
+TEST=cctest/test-api/CallableObject
+
+Review URL: http://codereview.chromium.org/6964005
+
+git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@7828 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
+---
+ include/v8.h            |    7 +++++++
+ src/api.cc              |   11 +++++++++++
+ test/cctest/test-api.cc |   43 +++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 61 insertions(+), 0 deletions(-)
+
+diff --git a/include/v8.h b/include/v8.h
+index 08b0ec2..4194d4a 100644
+--- a/include/v8.h
++++ b/include/v8.h
+@@ -1763,6 +1763,13 @@ class Object : public Value {
+   V8EXPORT int GetIndexedPropertiesExternalArrayDataLength();
+   /**
++   * Checks whether a callback is set by the
++   * ObjectTemplate::SetCallAsFunctionHandler method.
++   * When an Object is callable this method returns true.
++   */
++  V8EXPORT bool IsCallable();
++
++  /**
+    * Call an Object as a function if a callback is set by the 
+    * ObjectTemplate::SetCallAsFunctionHandler method.
+    */
+diff --git a/src/api.cc b/src/api.cc
+index bd435eb..a5a637f 100644
+--- a/src/api.cc
++++ b/src/api.cc
+@@ -3265,6 +3265,17 @@ int v8::Object::GetIndexedPropertiesExternalArrayDataLength() {
+ }
++bool v8::Object::IsCallable() {
++  i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
++  ON_BAILOUT(isolate, "v8::Object::IsCallable()", return false);
++  ENTER_V8(isolate);
++  i::HandleScope scope(isolate);
++  i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
++  if (obj->IsJSFunction()) return true;
++  return i::Execution::GetFunctionDelegate(obj)->IsJSFunction();
++}
++
++
+ Local<v8::Value> Object::CallAsFunction(v8::Handle<v8::Object> recv, int argc,
+                                         v8::Handle<v8::Value> argv[]) {
+   i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
+index 1334f63..45db5a1 100644
+--- a/test/cctest/test-api.cc
++++ b/test/cctest/test-api.cc
+@@ -7263,6 +7263,49 @@ THREADED_TEST(CallAsFunction) {
+ }
++// Check whether a non-function object is callable.
++THREADED_TEST(CallableObject) {
++  v8::HandleScope scope;
++  LocalContext context;
++
++  { Local<ObjectTemplate> instance_template = ObjectTemplate::New();
++    instance_template->SetCallAsFunctionHandler(call_as_function);
++    Local<Object> instance = instance_template->NewInstance();
++    v8::TryCatch try_catch;
++
++    CHECK(instance->IsCallable());
++    CHECK(!try_catch.HasCaught());
++  }
++
++  { Local<ObjectTemplate> instance_template = ObjectTemplate::New();
++    Local<Object> instance = instance_template->NewInstance();
++    v8::TryCatch try_catch;
++
++    CHECK(!instance->IsCallable());
++    CHECK(!try_catch.HasCaught());
++  }
++
++  { Local<FunctionTemplate> function_template =
++        FunctionTemplate::New(call_as_function);
++    Local<Function> function = function_template->GetFunction();
++    Local<Object> instance = function;
++    v8::TryCatch try_catch;
++
++    CHECK(instance->IsCallable());
++    CHECK(!try_catch.HasCaught());
++  }
++
++  { Local<FunctionTemplate> function_template = FunctionTemplate::New();
++    Local<Function> function = function_template->GetFunction();
++    Local<Object> instance = function;
++    v8::TryCatch try_catch;
++
++    CHECK(instance->IsCallable());
++    CHECK(!try_catch.HasCaught());
++  }
++}
++
++
+ static int CountHandles() {
+   return v8::HandleScope::NumberOfHandles();
+ }
+-- 
+1.7.2.3
+
diff --git a/src/declarative/v8/0013-Remove-execute-flag-from-v8-debug.h.patch b/src/declarative/v8/0013-Remove-execute-flag-from-v8-debug.h.patch
new file mode 100644 (file)
index 0000000..0a76992
--- /dev/null
@@ -0,0 +1,15 @@
+From dc2cad4f8fc88c52fcea09b8d0262d35cd32dc44 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/13] Remove execute flag from v8-debug.h
+
+---
+ 0 files changed, 0 insertions(+), 0 deletions(-)
+ mode change 100755 => 100644 include/v8-debug.h
+
+diff --git a/include/v8-debug.h b/include/v8-debug.h
+old mode 100755
+new mode 100644
+-- 
+1.7.2.3
+