Update V8

This fixes a few bugs in QML mode name resolution and simplifies
our V8 patchset a little by folding some patches together.

Change-Id: Ia528a43ac8ccad95ac81bcdff5d05aaeab4b48b2
Reviewed-on: http://codereview.qt.nokia.com/4294
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
This commit is contained in:
Aaron Kennedy 2011-09-07 10:51:39 +10:00 committed by Qt by Nokia
parent 846c5c9459
commit bc2eac1ef3
21 changed files with 722 additions and 641 deletions

2
src/3rdparty/v8 vendored

@ -1 +1 @@
Subproject commit 97cb46d421faebd2b139570bcf9aaf2d5eadc333
Subproject commit ed5cc903d70f73780e5985e7d2de33f6b8d86402

View File

@ -1,25 +1,25 @@
From e13ce09287a56c920d5ffdc5d4662d49f1838f16 Mon Sep 17 00:00:00 2001
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/16] Add hashing and comparison methods to v8::String
Subject: [PATCH 01/14] Add hashing and comparison methods to v8::String
This allows us to more rapidly search for a v8::String inside
a hash of QStrings.
---
include/v8.h | 44 ++++++++++++++++++++++++++++++
include/v8.h | 45 +++++++++++++++++++++++++++++++
src/api.cc | 43 +++++++++++++++++++++++++++++
src/heap-inl.h | 2 +
src/heap.cc | 3 ++
src/objects-inl.h | 1 +
src/objects.cc | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
src/objects.h | 15 +++++++++-
7 files changed, 182 insertions(+), 3 deletions(-)
7 files changed, 183 insertions(+), 3 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index d15d024..bbd29e9 100644
index d15d024..be1ee71 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -994,6 +994,48 @@ class String : public Primitive {
@@ -994,6 +994,49 @@ class String : public Primitive {
V8EXPORT int Utf8Length() const;
/**
@ -63,12 +63,13 @@ index d15d024..bbd29e9 100644
+ */
+ V8EXPORT bool Equals(uint16_t *string, int length);
+ V8EXPORT bool Equals(char *string, int length);
+ inline bool Equals(Handle<Value> that) const { return v8::Value::Equals(that); }
+
+ /**
* Write the contents of the string to an external buffer.
* If no arguments are given, expects the buffer to be large
* enough to hold the entire string and NULL terminator. Copies
@@ -1023,6 +1065,8 @@ class String : public Primitive {
@@ -1023,6 +1066,8 @@ class String : public Primitive {
HINT_MANY_WRITES_EXPECTED = 1
};
@ -339,5 +340,5 @@ index e966b3d..6e26f57 100644
// Maximal memory usage for a single sequential two-byte string.
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From 7c9cfff80b7864d5687432d424074e51712c4a07 Mon Sep 17 00:00:00 2001
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/16] Add a bit field 3 to Map
Subject: [PATCH 02/14] Add a bit field 3 to Map
Bit field 3 will be used to add QML specific map flags.
---
@ -114,5 +114,5 @@ index 6e26f57..07e1089 100644
static const int kCodeCacheEntrySize = 2;
static const int kCodeCacheEntryNameOffset = 0;
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From ae8688b53d67044f2c9b0cce25fc282b078610c1 Mon Sep 17 00:00:00 2001
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/16] Add a "fallback" mode for named property interceptors
Subject: [PATCH 03/14] 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
@ -24,10 +24,10 @@ declarations.
9 files changed, 99 insertions(+), 18 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index bbd29e9..85452aa 100644
index be1ee71..bb31ea0 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -2169,6 +2169,7 @@ class V8EXPORT FunctionTemplate : public Template {
@@ -2170,6 +2170,7 @@ class V8EXPORT FunctionTemplate : public Template {
NamedPropertyQuery query,
NamedPropertyDeleter remover,
NamedPropertyEnumerator enumerator,
@ -35,7 +35,7 @@ index bbd29e9..85452aa 100644
Handle<Value> data);
void SetIndexedInstancePropertyHandler(IndexedPropertyGetter getter,
IndexedPropertySetter setter,
@@ -2253,6 +2254,13 @@ class V8EXPORT ObjectTemplate : public Template {
@@ -2254,6 +2255,13 @@ class V8EXPORT ObjectTemplate : public Template {
NamedPropertyEnumerator enumerator = 0,
Handle<Value> data = Handle<Value>());
@ -360,5 +360,5 @@ index 7335da8..660352c 100644
return isolate->heap()->undefined_value();
}
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From 4827116b12c50f6662794017c5a662b5dbb2da0b Mon Sep 17 00:00:00 2001
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/16] Generalize external object resources
Subject: [PATCH 04/14] Generalize external object resources
V8 was already able to manage and finalize an external string
resource. This change generalizes that mechanism to handle a
@ -31,10 +31,10 @@ object space.
11 files changed, 280 insertions(+), 115 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 85452aa..7f06ae7 100644
index bb31ea0..205e856 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1630,6 +1630,25 @@ class Object : public Value {
@@ -1631,6 +1631,25 @@ class Object : public Value {
/** Sets a native pointer in an internal field. */
V8EXPORT void SetPointerInInternalField(int index, void* value);
@ -60,7 +60,7 @@ index 85452aa..7f06ae7 100644
// Testers for local properties.
V8EXPORT bool HasRealNamedProperty(Handle<String> key);
V8EXPORT bool HasRealIndexedProperty(uint32_t index);
@@ -2331,6 +2350,12 @@ class V8EXPORT ObjectTemplate : public Template {
@@ -2332,6 +2351,12 @@ class V8EXPORT ObjectTemplate : public Template {
*/
void SetInternalFieldCount(int value);
@ -685,7 +685,7 @@ index 5795a6b..8866e58 100644
} else {
delete resource;
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 68a5062..1b1e361 100644
index 68a5062..775f787 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -163,7 +163,7 @@ void MarkCompactCollector::Finish() {
@ -704,7 +704,7 @@ index 68a5062..1b1e361 100644
- if ((*p)->IsExternalString()) {
- heap_->FinalizeExternalString(String::cast(*p));
+ if ((*p)->IsExternalString() ||
+ (*p)->IsHeapObject() && HeapObject::cast(*p)->map()->has_external_resource()) {
+ ((*p)->IsHeapObject() && HeapObject::cast(*p)->map()->has_external_resource())) {
+ heap_->FinalizeExternalString(HeapObject::cast(*p));
}
// Set the entry to null_value (as deleted).
@ -890,5 +890,5 @@ index a209cd0..1bdb5c7 100644
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From fd7d475e298e5b63cd6383c78cc900635c82aa38 Mon Sep 17 00:00:00 2001
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/16] Introduce a QML compilation mode
Subject: [PATCH 05/14] 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
@ -15,8 +15,8 @@ closures etc. created during the run will retain a reference to this
object, so different objects can be passed in different script
runs.
---
include/v8.h | 18 ++++++++--
src/api.cc | 52 ++++++++++++++++++++++++-----
include/v8.h | 18 +++++++--
src/api.cc | 52 ++++++++++++++++++++++-----
src/arm/code-stubs-arm.cc | 4 ++
src/arm/full-codegen-arm.cc | 26 ++++++++------
src/arm/lithium-arm.cc | 2 +-
@ -27,10 +27,10 @@ runs.
src/ast.h | 1 +
src/code-stubs.h | 2 +-
src/compiler.cc | 15 +++++++-
src/compiler.h | 22 ++++++++++--
src/contexts.cc | 23 +++++++++++++
src/compiler.h | 22 +++++++++--
src/contexts.cc | 35 ++++++++++++++++++
src/contexts.h | 4 ++
src/execution.cc | 28 +++++++++++++--
src/execution.cc | 28 ++++++++++++--
src/execution.h | 6 +++
src/full-codegen.cc | 3 +-
src/full-codegen.h | 1 +
@ -43,14 +43,14 @@ runs.
src/ia32/lithium-ia32.cc | 2 +-
src/ia32/lithium-ia32.h | 6 +++-
src/ia32/macro-assembler-ia32.h | 5 +++
src/objects-inl.h | 12 +++++++
src/objects-inl.h | 12 ++++++
src/objects.h | 5 +++
src/parser.cc | 27 +++++++++++++--
src/parser.cc | 27 ++++++++++++--
src/parser.h | 4 ++-
src/prettyprinter.cc | 3 ++
src/runtime.cc | 68 ++++++++++++++++++++++++-------------
src/runtime.cc | 72 ++++++++++++++++++++++++-------------
src/runtime.h | 8 ++--
src/scopes.cc | 10 +++++
src/scopes.cc | 59 +++++++++++++++++++++++++++++++
src/scopes.h | 7 ++++
src/variables.cc | 3 +-
src/variables.h | 5 +++
@ -60,10 +60,10 @@ runs.
src/x64/lithium-x64.cc | 2 +-
src/x64/lithium-x64.h | 6 +++
src/x64/macro-assembler-x64.h | 5 +++
45 files changed, 391 insertions(+), 108 deletions(-)
45 files changed, 455 insertions(+), 109 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 7f06ae7..a858eae 100644
index 205e856..d78ab1f 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -577,6 +577,10 @@ class ScriptOrigin {
@ -125,7 +125,7 @@ index 7f06ae7..a858eae 100644
/**
* Returns the script id value.
@@ -3326,6 +3335,7 @@ class V8EXPORT Context {
@@ -3327,6 +3336,7 @@ class V8EXPORT Context {
* JavaScript frames an empty handle is returned.
*/
static Local<Context> GetCalling();
@ -608,47 +608,59 @@ index e75e869..17cd369 100644
// Compile from function info (used for lazy compilation). Returns true on
// success and false if the compilation resulted in a stack overflow.
diff --git a/src/contexts.cc b/src/contexts.cc
index 520f3dd..da5cacb 100644
index 520f3dd..035ac3b 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -89,6 +89,8 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
@@ -89,6 +89,9 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
PrintF(")\n");
}
+ Handle<JSObject> qml_global;
+ Handle<JSObject> qml_global_global;
+
do {
if (FLAG_trace_contexts) {
PrintF(" - looking in context %p", reinterpret_cast<void*>(*context));
@@ -119,6 +121,10 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
@@ -119,6 +122,11 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
}
}
+ if (qml_global.is_null() && !context->qml_global()->IsUndefined()) {
+ qml_global = Handle<JSObject>(context->qml_global(), isolate);
+ qml_global_global = Handle<JSObject>(context->global(), isolate);
+ }
+
if (context->is_function_context()) {
// we have context-local slots
@@ -198,6 +204,23 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
@@ -198,6 +206,33 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
}
} while (follow_context_chain);
+ if (!qml_global.is_null()) {
+ if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0) {
+ *attributes = qml_global->GetLocalPropertyAttribute(*name);
+ *attributes = qml_global_global->GetLocalPropertyAttribute(*name);
+ } else {
+ *attributes = qml_global->GetPropertyAttribute(*name);
+ *attributes = qml_global_global->GetPropertyAttribute(*name);
+ }
+
+ if (*attributes != ABSENT) {
+ // property found
+ if (FLAG_trace_contexts) {
+ PrintF("=> found property in qml global object %p\n",
+ reinterpret_cast<void*>(*qml_global));
+ *attributes = ABSENT;
+ } else {
+ if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0) {
+ *attributes = qml_global->GetLocalPropertyAttribute(*name);
+ } else {
+ *attributes = qml_global->GetPropertyAttribute(*name);
+ }
+
+ if (*attributes != ABSENT) {
+ // property found
+ if (FLAG_trace_contexts) {
+ PrintF("=> found property in qml global object %p\n",
+ reinterpret_cast<void*>(*qml_global));
+ }
+ return qml_global;
+ }
+ return qml_global;
+ }
+ }
+
@ -1234,7 +1246,7 @@ index c777ab4..1964e02 100644
PrintLiteralIndented(buf.start(), value, true);
}
diff --git a/src/runtime.cc b/src/runtime.cc
index 660352c..827d954 100644
index 660352c..c13f92d 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1065,8 +1065,6 @@ static Failure* ThrowRedeclarationError(Isolate* isolate,
@ -1441,17 +1453,35 @@ index 660352c..827d954 100644
}
@@ -10633,7 +10652,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
@@ -10570,6 +10589,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
Handle<JSFunction> function(JSFunction::cast(frame->function()));
Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info());
ScopeInfo<> sinfo(*scope_info);
+ bool qml_mode = function->shared()->qml_mode();
// Traverse the saved contexts chain to find the active context for the
// selected frame.
@@ -10633,7 +10653,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
Compiler::CompileEval(function_source,
context,
context->IsGlobalContext(),
- kNonStrictMode);
+ kNonStrictMode,
+ false);
+ qml_mode);
if (shared.is_null()) return Failure::Exception();
Handle<JSFunction> compiled_function =
isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context);
@@ -10722,7 +10742,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) {
@@ -10656,7 +10677,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
Handle<Object>::cast(source).location() };
Handle<Object> result =
Execution::Call(Handle<JSFunction>::cast(evaluation_function), receiver,
- argc, argv, &has_pending_exception);
+ argc, argv, &has_pending_exception,
+ Handle<Object>(function->context()->qml_global()));
if (has_pending_exception) return Failure::Exception();
// Skip the global proxy as it has no properties and always delegates to the
@@ -10722,7 +10744,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) {
// Currently, the eval code will be executed in non-strict mode,
// even in the strict code context.
Handle<SharedFunctionInfo> shared =
@ -1487,7 +1517,7 @@ index bf1ba68..5e97173 100644
F(OptimizeObjectForAddingMultipleProperties, 2, 1) \
\
diff --git a/src/scopes.cc b/src/scopes.cc
index 8df93c5..734a217 100644
index 8df93c5..b5d7ff3 100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -198,6 +198,7 @@ void Scope::SetDefaults(Type type,
@ -1498,33 +1528,82 @@ index 8df93c5..734a217 100644
outer_scope_calls_eval_ = false;
inner_scope_calls_eval_ = false;
outer_scope_is_eval_scope_ = false;
@@ -796,6 +797,10 @@ void Scope::ResolveVariable(Scope* global_scope,
@@ -796,6 +797,25 @@ void Scope::ResolveVariable(Scope* global_scope,
ASSERT(global_scope != NULL);
var = global_scope->DeclareGlobal(proxy->name());
+ if (qml_mode_ && !Isolate::Current()->global()->HasProperty(*(proxy->name()))) {
+ var->set_is_qml_global(true);
+ if (qml_mode_) {
+ Handle<GlobalObject> global = Isolate::Current()->global();
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+ if (Isolate::Current()->debug()->IsLoaded() && Isolate::Current()->debug()->InDebugger()) {
+ //Get the context before the debugger was entered.
+ SaveContext *save = Isolate::Current()->save_context();
+ while (save != NULL && *save->context() == *Isolate::Current()->debug()->debug_context())
+ save = save->prev();
+
+ global = Handle<GlobalObject>(save->context()->global());
+ }
+#endif
+
+ if (!global->HasProperty(*(proxy->name()))) {
+ var->set_is_qml_global(true);
+ }
+ }
+
} else if (scope_inside_with_) {
// If we are inside a with statement we give up and look up
// the variable at runtime.
@@ -816,6 +821,8 @@ void Scope::ResolveVariable(Scope* global_scope,
// variables.
@@ -817,6 +837,25 @@ void Scope::ResolveVariable(Scope* global_scope,
if (context->GlobalIfNotShadowedByEval(proxy->name())) {
var = NonLocal(proxy->name(), Variable::DYNAMIC_GLOBAL);
+ if (qml_mode_ && !Isolate::Current()->global()->HasProperty(*(proxy->name())))
+ var->set_is_qml_global(true);
+ if (qml_mode_) {
+ Handle<GlobalObject> global = Isolate::Current()->global();
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+ if (Isolate::Current()->debug()->IsLoaded() && Isolate::Current()->debug()->InDebugger()) {
+ //Get the context before the debugger was entered.
+ SaveContext *save = Isolate::Current()->save_context();
+ while (save != NULL && *save->context() == *Isolate::Current()->debug()->debug_context())
+ save = save->prev();
+
+ global = Handle<GlobalObject>(save->context()->global());
+ }
+#endif
+
+ if (qml_mode_ && !global->HasProperty(*(proxy->name()))) {
+ var->set_is_qml_global(true);
+ }
+ }
+
} else {
var = NonLocal(proxy->name(), Variable::DYNAMIC);
@@ -827,6 +834,9 @@ void Scope::ResolveVariable(Scope* global_scope,
}
@@ -827,6 +866,26 @@ void Scope::ResolveVariable(Scope* global_scope,
// variable is global unless it is shadowed by eval-introduced
// variables.
var = NonLocal(proxy->name(), Variable::DYNAMIC_GLOBAL);
+
+ if (qml_mode_ && !Isolate::Current()->global()->HasProperty(*(proxy->name())))
+ var->set_is_qml_global(true);
+ if (qml_mode_) {
+ Handle<GlobalObject> global = Isolate::Current()->global();
+
+#ifdef ENABLE_DEBUGGER_SUPPORT
+ if (Isolate::Current()->debug()->IsLoaded() && Isolate::Current()->debug()->InDebugger()) {
+ //Get the context before the debugger was entered.
+ SaveContext *save = Isolate::Current()->save_context();
+ while (save != NULL && *save->context() == *Isolate::Current()->debug()->debug_context())
+ save = save->prev();
+
+ global = Handle<GlobalObject>(save->context()->global());
+ }
+#endif
+
+ if (qml_mode_ && !global->HasProperty(*(proxy->name()))) {
+ var->set_is_qml_global(true);
+ }
+ }
+
}
}
}
@ -1773,5 +1852,5 @@ index 4c17720..aa284ed 100644
static inline Operand StackSpaceOperand(int index) {
#ifdef _WIN64
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From f890f0d1a1e5bd62711815489c87755a4f382436 Mon Sep 17 00:00:00 2001
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/16] Allow access to the calling script data
Subject: [PATCH 06/14] Allow access to the calling script data
---
include/v8.h | 1 +
@ -9,10 +9,10 @@ Subject: [PATCH 06/16] Allow access to the calling script data
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index a858eae..9aba4a8 100644
index d78ab1f..2bc0ed1 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -3336,6 +3336,7 @@ class V8EXPORT Context {
@@ -3337,6 +3337,7 @@ class V8EXPORT Context {
*/
static Local<Context> GetCalling();
static Local<Object> GetCallingQmlGlobal();
@ -44,5 +44,5 @@ index 39767f4..ff74efb 100644
v8::Local<v8::Object> Context::Global() {
if (IsDeadCheck(i::Isolate::Current(), "v8::Context::Global()")) {
--
1.7.6
1.7.4.4

View File

@ -1,17 +1,17 @@
From dac5d9db84cf20564621c679937ca7b9c6a8e880 Mon Sep 17 00:00:00 2001
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/16] Fix warnings
Subject: [PATCH 07/14] Fix warnings
---
include/v8.h | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 9aba4a8..8891dab 100644
index 2bc0ed1..99f4b9a 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -2415,7 +2415,7 @@ class V8EXPORT Extension { // NOLINT
@@ -2416,7 +2416,7 @@ class V8EXPORT Extension { // NOLINT
const char** deps = 0);
virtual ~Extension() { }
virtual v8::Handle<v8::FunctionTemplate>
@ -20,7 +20,7 @@ index 9aba4a8..8891dab 100644
return v8::Handle<v8::FunctionTemplate>();
}
@@ -3721,13 +3721,13 @@ class Internals {
@@ -3722,13 +3722,13 @@ class Internals {
return *reinterpret_cast<T*>(addr);
}
@ -42,5 +42,5 @@ index 9aba4a8..8891dab 100644
} // namespace internal
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From bec11b8b7f89d135e7d9a823ac4fe98c70d017cf Mon Sep 17 00:00:00 2001
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/16] Add custom object compare callback
Subject: [PATCH 08/14] Add custom object compare callback
A global custom object comparison callback can be set with:
V8::SetUserObjectComparisonCallbackFunction()
@ -28,10 +28,10 @@ instances.
12 files changed, 218 insertions(+), 3 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 8891dab..d5d6972 100644
index 99f4b9a..7544deb 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -2365,6 +2365,12 @@ class V8EXPORT ObjectTemplate : public Template {
@@ -2366,6 +2366,12 @@ class V8EXPORT ObjectTemplate : public Template {
bool HasExternalResource();
void SetHasExternalResource(bool value);
@ -44,7 +44,7 @@ index 8891dab..d5d6972 100644
private:
ObjectTemplate();
static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor);
@@ -2565,6 +2571,10 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
@@ -2566,6 +2572,10 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
AccessType type,
Local<Value> data);
@ -55,7 +55,7 @@ index 8891dab..d5d6972 100644
// --- G a r b a g e C o l l e c t i o n C a l l b a c k s
/**
@@ -2815,6 +2825,9 @@ class V8EXPORT V8 {
@@ -2816,6 +2826,9 @@ class V8EXPORT V8 {
/** Callback function for reporting failed access checks.*/
static void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback);
@ -359,7 +359,7 @@ index edbc47a..e75e9f1 100644
diff --git a/src/runtime.cc b/src/runtime.cc
index 827d954..d552ddb 100644
index c13f92d..b50de80 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -6279,6 +6279,29 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringEquals) {
@ -485,5 +485,5 @@ index d923494..10b9b56 100644
ASSERT(GetCondition() == equal);
__ subq(rax, rdx);
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From 4183b973ed3bd603784c798dfa63ba48f6b68003 Mon Sep 17 00:00:00 2001
From: "ager@chromium.org" <ager@chromium.org>
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/16] Add CallAsFunction method to the Object class in the
Subject: [PATCH 09/14] Add CallAsFunction method to the Object class in the
API
Patch by Peter Varga.
@ -21,10 +21,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 d5d6972..8a8e1cd 100644
index 7544deb..277153e 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1757,6 +1757,14 @@ class Object : public Value {
@@ -1758,6 +1758,14 @@ class Object : public Value {
V8EXPORT ExternalArrayType GetIndexedPropertiesExternalArrayDataType();
V8EXPORT int GetIndexedPropertiesExternalArrayDataLength();
@ -283,5 +283,5 @@ index d7621d1..693d51e 100644
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From 3d6d4249878f7960eac4c9c94e0f2529f9a58c4a Mon Sep 17 00:00:00 2001
From: "ager@chromium.org" <ager@chromium.org>
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/16] Implement CallAsConstructor method for Object in the
Subject: [PATCH 10/14] Implement CallAsConstructor method for Object in the
API
Patch by Peter Varga.
@ -21,10 +21,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 8a8e1cd..84462b5 100644
index 277153e..18527e1 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1765,6 +1765,14 @@ class Object : public Value {
@@ -1766,6 +1766,14 @@ class Object : public Value {
int argc,
Handle<Value> argv[]);
@ -394,5 +394,5 @@ index 693d51e..1334f63 100644
}
}
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From f22d0312faeb93ced8747d9aae8c6d77e11b4aba Mon Sep 17 00:00:00 2001
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/16] QtScript/V8: Add new v8 api to check if a value is an
Subject: [PATCH 11/14] QtScript/V8: Add new v8 api to check if a value is an
error.
New function v8::Value::IsError was created.
@ -15,7 +15,7 @@ research.
3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 84462b5..08b0ec2 100644
index 18527e1..43e00f5 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -937,6 +937,11 @@ class Value : public Data {
@ -60,5 +60,5 @@ index 8cbf378..db90bb9 100644
V(to_string_symbol, "toString") \
V(char_at_symbol, "CharAt") \
--
1.7.6
1.7.4.4

View File

@ -1,8 +1,7 @@
From 472c04c9e7a64e8734c76d2cf97a7cc5b773b788 Mon Sep 17 00:00:00 2001
From: "ager@chromium.org"
<ager@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
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/16] Add IsCallable method for Object in the API
Subject: [PATCH 12/14] Add IsCallable method for Object in the API
Patch by Peter Varga.
@ -19,10 +18,10 @@ git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@7828 ce2b1a6d-e
3 files changed, 61 insertions(+), 0 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 08b0ec2..4194d4a 100644
index 43e00f5..5e1ce50 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1763,6 +1763,13 @@ class Object : public Value {
@@ -1764,6 +1764,13 @@ class Object : public Value {
V8EXPORT int GetIndexedPropertiesExternalArrayDataLength();
/**
@ -113,5 +112,5 @@ index 1334f63..45db5a1 100644
return v8::HandleScope::NumberOfHandles();
}
--
1.7.6
1.7.4.4

View File

@ -1,7 +1,7 @@
From dc2cad4f8fc88c52fcea09b8d0262d35cd32dc44 Mon Sep 17 00:00:00 2001
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/16] Remove execute flag from v8-debug.h
Subject: [PATCH 13/14] Remove execute flag from v8-debug.h
---
0 files changed, 0 insertions(+), 0 deletions(-)
@ -11,5 +11,5 @@ diff --git a/include/v8-debug.h b/include/v8-debug.h
old mode 100755
new mode 100644
--
1.7.6
1.7.4.4

View File

@ -1,25 +0,0 @@
From d7e876decc00c611d327185bf890a7efecb2cf7e Mon Sep 17 00:00:00 2001
From: Kent Hansen <kent.hansen@nokia.com>
Date: Mon, 29 Aug 2011 13:26:13 +0200
Subject: [PATCH 14/16] Fix build error: "suggest parentheses around '&&'
within '||'"
---
src/mark-compact.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 1b1e361..775f787 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -1020,7 +1020,7 @@ class SymbolTableCleaner : public ObjectVisitor {
// Since no objects have yet been moved we can safely access the map of
// the object.
if ((*p)->IsExternalString() ||
- (*p)->IsHeapObject() && HeapObject::cast(*p)->map()->has_external_resource()) {
+ ((*p)->IsHeapObject() && HeapObject::cast(*p)->map()->has_external_resource())) {
heap_->FinalizeExternalString(HeapObject::cast(*p));
}
// Set the entry to null_value (as deleted).
--
1.7.6

View File

@ -1,7 +1,7 @@
From 97cb46d421faebd2b139570bcf9aaf2d5eadc333 Mon Sep 17 00:00:00 2001
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 16/16] Fix deprecated Python code
Subject: [PATCH 14/14] Fix deprecated Python code
Needed to make the scripts run on Python 3, which is the
default python interpreter on some newer distros.
@ -47,4 +47,5 @@ index 646bf14..395441b 100644
if identifier_second_char != 0:
new_identifier = (
--
1.7.6
1.7.4.4

View File

@ -1,25 +0,0 @@
From 0af1e15a3d6b28923c262a02a5ace35812c8f5d6 Mon Sep 17 00:00:00 2001
From: Simon Hausmann <simon.hausmann@nokia.com>
Date: Thu, 4 Aug 2011 21:28:38 +0200
Subject: [PATCH 15/16] Fix source compatibility where the String::Equals
overloads would shadow the Value::Equals function,
breaking the build.
---
include/v8.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index 4194d4a..5e1ce50 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1048,6 +1048,7 @@ class String : public Primitive {
*/
V8EXPORT bool Equals(uint16_t *string, int length);
V8EXPORT bool Equals(char *string, int length);
+ inline bool Equals(Handle<Value> that) const { return v8::Value::Equals(that); }
/**
* Write the contents of the string to an external buffer.
--
1.7.6

View File

@ -55,6 +55,7 @@ private slots:
void cleanupTestCase() {}
void eval();
void evalwithinwith();
void userobjectcompare();
};
@ -63,6 +64,11 @@ void tst_v8::eval()
QVERIFY(v8test_eval());
}
void tst_v8::evalwithinwith()
{
QVERIFY(v8test_evalwithinwith());
}
void tst_v8::userobjectcompare()
{
QVERIFY(v8test_userobjectcompare());

View File

@ -11,6 +11,7 @@ int main(int argc, char *argv[])
v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
RUN_TEST(eval);
RUN_TEST(evalwithinwith);
RUN_TEST(userobjectcompare);
return -1;

View File

@ -81,6 +81,49 @@ cleanup:
ENDTEST();
}
bool v8test_evalwithinwith()
{
BEGINTEST();
HandleScope handle_scope;
Persistent<Context> context = Context::New();
Context::Scope context_scope(context);
Local<Object> qmlglobal = Object::New();
qmlglobal->Set(String::New("a"), Integer::New(1922));
// There was a bug that the "eval" lookup would incorrectly resolve
// to the QML global object
qmlglobal->Set(String::New("eval"), Integer::New(1922));
#define SOURCE \
"(function() { " \
" var b = { c: 10 }; " \
" with (b) { " \
" return eval(\"a\"); " \
" } " \
"})"
Local<Script> script = Script::Compile(String::New(SOURCE), NULL, NULL,
Handle<String>(), Script::QmlMode);
#undef SOURCE
TryCatch tc;
Local<Value> result = script->Run(qmlglobal);
VERIFY(!tc.HasCaught());
VERIFY(result->IsFunction());
{
Local<Value> fresult = Handle<Function>::Cast(result)->Call(context->Global(), 0, 0);
VERIFY(!tc.HasCaught());
VERIFY(fresult->Int32Value() == 1922);
}
cleanup:
context.Dispose();
ENDTEST();
}
static int userObjectComparisonCalled = 0;
static bool userObjectComparisonReturn = false;
static Local<Object> expectedLhs;

View File

@ -49,6 +49,7 @@
#endif
bool v8test_eval();
bool v8test_evalwithinwith();
bool v8test_userobjectcompare();
#endif // V8TEST_H