Revision: 19344
Author: [email protected]
Date: Wed Feb 12 22:04:19 2014 UTC
Log: V8 Microtask Queue & API
This patch generalizes Object.observe callbacks and promise resolution into
a FIFO queue called a "microtask queue".
It also exposes new V8 API which exposes the microtask queue to the
embedder. In particular, it allows the embedder to
-schedule a microtask (EnqueueExternalMicrotask)
-run the microtask queue (RunMicrotasks)
-control whether the microtask queue is run automatically within V8 when
the last script exits (SetAutorunMicrotasks).
[email protected], [email protected], dcarney, rossberg, svenpanne
BUG=
Review URL: https://codereview.chromium.org/154283002
http://code.google.com/p/v8/source/detail?r=19344
Added:
/branches/bleeding_edge/test/cctest/test-microtask-delivery.cc
/branches/bleeding_edge/test/mjsunit/harmony/microtask-delivery.js
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/bootstrapper.cc
/branches/bleeding_edge/src/contexts.h
/branches/bleeding_edge/src/execution.cc
/branches/bleeding_edge/src/execution.h
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/heap.h
/branches/bleeding_edge/src/isolate.h
/branches/bleeding_edge/src/object-observe.js
/branches/bleeding_edge/src/promise.js
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/src/runtime.h
/branches/bleeding_edge/src/v8.cc
/branches/bleeding_edge/src/v8.h
/branches/bleeding_edge/src/v8natives.js
/branches/bleeding_edge/test/cctest/cctest.gyp
/branches/bleeding_edge/test/cctest/test-api.cc
/branches/bleeding_edge/test/mjsunit/fuzz-natives-part3.js
/branches/bleeding_edge/tools/v8heapconst.py
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/cctest/test-microtask-delivery.cc Wed Feb
12 22:04:19 2014 UTC
@@ -0,0 +1,137 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "v8.h"
+
+#include "cctest.h"
+
+using namespace v8;
+namespace i = v8::internal;
+
+namespace {
+class HarmonyIsolate {
+ public:
+ HarmonyIsolate() {
+ i::FLAG_harmony_observation = true;
+ i::FLAG_harmony_promises = true;
+ isolate_ = Isolate::New();
+ isolate_->Enter();
+ }
+
+ ~HarmonyIsolate() {
+ isolate_->Exit();
+ isolate_->Dispose();
+ }
+
+ Isolate* GetIsolate() const { return isolate_; }
+
+ private:
+ Isolate* isolate_;
+};
+}
+
+
+TEST(MicrotaskDeliverySimple) {
+ HarmonyIsolate isolate;
+ HandleScope scope(isolate.GetIsolate());
+ LocalContext context(isolate.GetIsolate());
+ CompileRun(
+ "var ordering = [];"
+ "var resolver = {};"
+ "function handler(resolve) { resolver.resolve = resolve; }"
+ "var obj = {};"
+ "var observeOrders = [1, 4];"
+ "function observer() {"
+ "ordering.push(observeOrders.shift());"
+ "resolver.resolve();"
+ "}"
+ "var p = new Promise(handler);"
+ "p.then(function() {"
+ "ordering.push(2);"
+ "}).then(function() {"
+ "ordering.push(3);"
+ "obj.id++;"
+ "return new Promise(handler);"
+ "}).then(function() {"
+ "ordering.push(5);"
+ "}).then(function() {"
+ "ordering.push(6);"
+ "});"
+ "Object.observe(obj, observer);"
+ "obj.id = 1;");
+ CHECK_EQ(6, CompileRun("ordering.length")->Int32Value());
+ CHECK_EQ(1, CompileRun("ordering[0]")->Int32Value());
+ CHECK_EQ(2, CompileRun("ordering[1]")->Int32Value());
+ CHECK_EQ(3, CompileRun("ordering[2]")->Int32Value());
+ CHECK_EQ(4, CompileRun("ordering[3]")->Int32Value());
+ CHECK_EQ(5, CompileRun("ordering[4]")->Int32Value());
+ CHECK_EQ(6, CompileRun("ordering[5]")->Int32Value());
+}
+
+
+TEST(MicrotaskPerIsolateState) {
+ HarmonyIsolate isolate;
+ HandleScope scope(isolate.GetIsolate());
+ LocalContext context1(isolate.GetIsolate());
+ V8::SetAutorunMicrotasks(isolate.GetIsolate(), false);
+ CompileRun(
+ "var obj = { calls: 0 };");
+ Handle<Value> obj = CompileRun("obj");
+ {
+ LocalContext context2(isolate.GetIsolate());
+
context2->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"),
+ obj);
+ CompileRun(
+ "var resolver = {};"
+ "new Promise(function(resolve) {"
+ "resolver.resolve = resolve;"
+ "}).then(function() {"
+ "obj.calls++;"
+ "});"
+ "(function() {"
+ "resolver.resolve();"
+ "})();");
+ }
+ {
+ LocalContext context3(isolate.GetIsolate());
+
context3->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"),
+ obj);
+ CompileRun(
+ "var foo = { id: 1 };"
+ "Object.observe(foo, function() {"
+ "obj.calls++;"
+ "});"
+ "foo.id++;");
+ }
+ {
+ LocalContext context4(isolate.GetIsolate());
+
context4->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"),
+ obj);
+ V8::RunMicrotasks(isolate.GetIsolate());
+ CHECK_EQ(2, CompileRun("obj.calls")->Int32Value());
+ }
+}
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/harmony/microtask-delivery.js Wed
Feb 12 22:04:19 2014 UTC
@@ -0,0 +1,168 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --harmony-observation --harmony-promises --allow-natives-syntax
+
+var ordering = [];
+function reset() {
+ ordering = [];
+}
+
+function assertArrayValues(expected, actual) {
+ assertEquals(expected.length, actual.length);
+ for (var i = 0; i < expected.length; i++) {
+ assertEquals(expected[i], actual[i]);
+ }
+}
+
+function assertOrdering(expected) {
+ %RunMicrotasks();
+ assertArrayValues(expected, ordering);
+}
+
+function newPromise(id, fn) {
+ var r;
+ var t = 1;
+ var promise = new Promise(function(resolve) {
+ r = resolve;
+ if (fn) fn();
+ });
+
+ var next = promise.then(function(value) {
+ ordering.push('p' + id);
+ return value;
+ });
+
+ return {
+ resolve: r,
+ then: function(fn) {
+ next = next.then(function(value) {
+ ordering.push('p' + id + ':' + t++);
+ return fn ? fn(value) : value;
+ });
+
+ return this;
+ }
+ };
+}
+
+function newObserver(id, fn, obj) {
+ var observer = {
+ value: 1,
+ recordCounts: []
+ };
+
+ Object.observe(observer, function(records) {
+ ordering.push('o' + id);
+ observer.recordCounts.push(records.length);
+ if (fn) fn();
+ });
+
+ return observer;
+}
+
+
+(function PromiseThens() {
+ reset();
+
+ var p1 = newPromise(1).then();
+ var p2 = newPromise(2).then();
+
+ p1.resolve();
+ p2.resolve();
+
+ assertOrdering(['p1', 'p2', 'p1:1', 'p2:1']);
+})();
+
+
+(function ObserversBatch() {
+ reset();
+
+ var p1 = newPromise(1);
+ var p2 = newPromise(2);
+ var p3 = newPromise(3);
+
+ var ob1 = newObserver(1);
+ var ob2 = newObserver(2, function() {
+ ob3.value++;
+ p3.resolve();
+ ob1.value++;
+ });
+ var ob3 = newObserver(3);
+
+ p1.resolve();
+ ob1.value++;
+ p2.resolve();
+ ob2.value++;
+
+ assertOrdering(['p1', 'o1', 'o2', 'p2', 'o1', 'o3', 'p3']);
+ assertArrayValues([1, 1], ob1.recordCounts);
+ assertArrayValues([1], ob2.recordCounts);
+ assertArrayValues([1], ob3.recordCounts);
+})();
+
+
+(function ObserversGetAllRecords() {
+ reset();
+
+ var p1 = newPromise(1);
+ var p2 = newPromise(2);
+ var ob1 = newObserver(1, function() {
+ ob2.value++;
+ });
+ var ob2 = newObserver(2);
+
+ p1.resolve();
+ ob1.value++;
+ p2.resolve();
+ ob2.value++;
+
+ assertOrdering(['p1', 'o1', 'o2', 'p2']);
+ assertArrayValues([1], ob1.recordCounts);
+ assertArrayValues([2], ob2.recordCounts);
+})();
+
+
+(function NewObserverDeliveryGetsNewMicrotask() {
+ reset();
+
+ var p1 = newPromise(1);
+ var p2 = newPromise(2);
+ var ob1 = newObserver(1);
+ var ob2 = newObserver(2, function() {
+ ob1.value++;
+ });
+
+ p1.resolve();
+ ob1.value++;
+ p2.resolve();
+ ob2.value++;
+
+ assertOrdering(['p1', 'o1', 'o2', 'p2', 'o1']);
+ assertArrayValues([1, 1], ob1.recordCounts);
+ assertArrayValues([1], ob2.recordCounts);
+})();
=======================================
--- /branches/bleeding_edge/include/v8.h Fri Feb 7 09:54:52 2014 UTC
+++ /branches/bleeding_edge/include/v8.h Wed Feb 12 22:04:19 2014 UTC
@@ -4578,6 +4578,22 @@
*/
static void RemoveCallCompletedCallback(CallCompletedCallback callback);
+ /**
+ * Experimental: Runs the Microtask Work Queue until empty
+ */
+ static void RunMicrotasks(Isolate* isolate);
+
+ /**
+ * Experimental: Enqueues the callback to the Microtask Work Queue
+ */
+ static void EnqueueMicrotask(Isolate* isolate, Handle<Function>
microtask);
+
+ /**
+ * Experimental: Controls whether the Microtask Work Queue is
automatically
+ * run when the script call depth decrements to zero.
+ */
+ static void SetAutorunMicrotasks(Isolate *source, bool autorun);
+
/**
* Initializes from snapshot if possible. Otherwise, attempts to
* initialize from scratch. This function is called implicitly if
@@ -5398,7 +5414,7 @@
static const int kNullValueRootIndex = 7;
static const int kTrueValueRootIndex = 8;
static const int kFalseValueRootIndex = 9;
- static const int kEmptyStringRootIndex = 147;
+ static const int kEmptyStringRootIndex = 148;
static const int kNodeClassIdOffset = 1 * kApiPointerSize;
static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
=======================================
--- /branches/bleeding_edge/src/api.cc Wed Feb 5 09:29:04 2014 UTC
+++ /branches/bleeding_edge/src/api.cc Wed Feb 12 22:04:19 2014 UTC
@@ -6291,6 +6291,25 @@
if (callback == NULL) return;
i::V8::AddCallCompletedCallback(callback);
}
+
+
+void V8::RunMicrotasks(Isolate* isolate) {
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ i::HandleScope scope(i_isolate);
+ i::V8::RunMicrotasks(i_isolate);
+}
+
+
+void V8::EnqueueMicrotask(Isolate* isolate, Handle<Function> microtask) {
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ ENTER_V8(i_isolate);
+ i::Execution::EnqueueMicrotask(i_isolate, Utils::OpenHandle(*microtask));
+}
+
+
+void V8::SetAutorunMicrotasks(Isolate* isolate, bool autorun) {
+ reinterpret_cast<i::Isolate*>(isolate)->set_autorun_microtasks(autorun);
+}
void V8::RemoveCallCompletedCallback(CallCompletedCallback callback) {
=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Wed Feb 12 13:27:13 2014 UTC
+++ /branches/bleeding_edge/src/bootstrapper.cc Wed Feb 12 22:04:19 2014 UTC
@@ -1582,6 +1582,9 @@
void Genesis::InstallExperimentalNativeFunctions() {
INSTALL_NATIVE(JSFunction, "RunMicrotasks", run_microtasks);
+ INSTALL_NATIVE(JSFunction, "EnqueueExternalMicrotask",
+ enqueue_external_microtask);
+
if (FLAG_harmony_proxies) {
INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap);
INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap);
=======================================
--- /branches/bleeding_edge/src/contexts.h Fri Jan 24 16:01:15 2014 UTC
+++ /branches/bleeding_edge/src/contexts.h Wed Feb 12 22:04:19 2014 UTC
@@ -167,6 +167,7 @@
V(ERROR_MESSAGE_FOR_CODE_GEN_FROM_STRINGS_INDEX, Object, \
error_message_for_code_gen_from_strings) \
V(RUN_MICROTASKS_INDEX, JSFunction, run_microtasks) \
+ V(ENQUEUE_EXTERNAL_MICROTASK_INDEX, JSFunction,
enqueue_external_microtask) \
V(TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX, JSFunction, \
to_complete_property_descriptor) \
V(DERIVED_HAS_TRAP_INDEX, JSFunction, derived_has_trap) \
@@ -318,6 +319,7 @@
ALLOW_CODE_GEN_FROM_STRINGS_INDEX,
ERROR_MESSAGE_FOR_CODE_GEN_FROM_STRINGS_INDEX,
RUN_MICROTASKS_INDEX,
+ ENQUEUE_EXTERNAL_MICROTASK_INDEX,
TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX,
DERIVED_HAS_TRAP_INDEX,
DERIVED_GET_TRAP_INDEX,
=======================================
--- /branches/bleeding_edge/src/execution.cc Thu Jan 16 11:54:12 2014 UTC
+++ /branches/bleeding_edge/src/execution.cc Wed Feb 12 22:04:19 2014 UTC
@@ -366,6 +366,20 @@
&threw);
ASSERT(!threw);
}
+
+
+void Execution::EnqueueMicrotask(Isolate* isolate, Handle<Object>
microtask) {
+ bool threw = false;
+ Handle<Object> args[] = { microtask };
+ Execution::Call(
+ isolate,
+ isolate->enqueue_external_microtask(),
+ isolate->factory()->undefined_value(),
+ 1,
+ args,
+ &threw);
+ ASSERT(!threw);
+}
bool StackGuard::IsStackOverflow() {
=======================================
--- /branches/bleeding_edge/src/execution.h Wed Feb 12 09:19:30 2014 UTC
+++ /branches/bleeding_edge/src/execution.h Wed Feb 12 22:04:19 2014 UTC
@@ -175,6 +175,7 @@
bool*
has_pending_exception);
static void RunMicrotasks(Isolate* isolate);
+ static void EnqueueMicrotask(Isolate* isolate, Handle<Object> microtask);
};
=======================================
--- /branches/bleeding_edge/src/heap.cc Wed Feb 12 09:19:30 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Wed Feb 12 22:04:19 2014 UTC
@@ -3274,6 +3274,15 @@
}
set_observation_state(JSObject::cast(obj));
+ // Allocate object to hold object microtask state.
+ { MaybeObject* maybe_obj = AllocateMap(JS_OBJECT_TYPE,
JSObject::kHeaderSize);
+ if (!maybe_obj->ToObject(&obj)) return false;
+ }
+ { MaybeObject* maybe_obj = AllocateJSObjectFromMap(Map::cast(obj));
+ if (!maybe_obj->ToObject(&obj)) return false;
+ }
+ set_microtask_state(JSObject::cast(obj));
+
{ MaybeObject* maybe_obj = AllocateSymbol();
if (!maybe_obj->ToObject(&obj)) return false;
}
=======================================
--- /branches/bleeding_edge/src/heap.h Tue Feb 11 09:29:51 2014 UTC
+++ /branches/bleeding_edge/src/heap.h Wed Feb 12 22:04:19 2014 UTC
@@ -203,7 +203,8 @@
EmptySlowElementDictionary) \
V(Symbol, observed_symbol,
ObservedSymbol) \
V(FixedArray, materialized_objects,
MaterializedObjects) \
- V(FixedArray, allocation_sites_scratchpad, AllocationSitesScratchpad)
+ V(FixedArray, allocation_sites_scratchpad,
AllocationSitesScratchpad) \
+ V(JSObject, microtask_state, MicrotaskState)
#define ROOT_LIST(V) \
STRONG_ROOT_LIST(V) \
=======================================
--- /branches/bleeding_edge/src/isolate.h Wed Feb 12 09:19:30 2014 UTC
+++ /branches/bleeding_edge/src/isolate.h Wed Feb 12 22:04:19 2014 UTC
@@ -359,7 +359,8 @@
/* AstNode state.
*/ \
V(int, ast_node_id,
0) \
V(unsigned, ast_node_count,
0) \
- V(bool, microtask_pending,
false) \
+ V(bool, microtask_pending,
false) \
+ V(bool, autorun_microtasks,
true) \
V(HStatistics*, hstatistics,
NULL) \
V(HTracer*, htracer,
NULL) \
V(CodeTracer*, code_tracer,
NULL) \
=======================================
--- /branches/bleeding_edge/src/object-observe.js Fri Feb 7 01:08:50 2014
UTC
+++ /branches/bleeding_edge/src/object-observe.js Wed Feb 12 22:04:19 2014
UTC
@@ -390,11 +390,13 @@
}
var callbackInfo = CallbackInfoNormalize(callback);
- if (!observationState.pendingObservers)
+ if (IS_NULL(observationState.pendingObservers)) {
observationState.pendingObservers = nullProtoObject();
+ GetMicrotaskQueue().push(ObserveMicrotaskRunner);
+ %SetMicrotaskPending(true);
+ }
observationState.pendingObservers[callbackInfo.priority] = callback;
callbackInfo.push(changeRecord);
- %SetMicrotaskPending(true);
}
function ObjectInfoEnqueueExternalChangeRecord(objectInfo, changeRecord,
type) {
@@ -583,7 +585,6 @@
}
}
}
-RunMicrotasks.runners.push(ObserveMicrotaskRunner);
function SetupObjectObserve() {
%CheckIsBootstrapping();
=======================================
--- /branches/bleeding_edge/src/promise.js Fri Feb 7 01:08:50 2014 UTC
+++ /branches/bleeding_edge/src/promise.js Wed Feb 12 22:04:19 2014 UTC
@@ -173,37 +173,29 @@
}
function PromiseEnqueue(value, tasks) {
- promiseEvents.push(value, tasks);
+ GetMicrotaskQueue().push(function() {
+ for (var i = 0; i < tasks.length; i += 2) {
+ PromiseHandle(value, tasks[i], tasks[i + 1])
+ }
+ });
+
%SetMicrotaskPending(true);
}
-function PromiseMicrotaskRunner() {
- var events = promiseEvents;
- if (events.length > 0) {
- promiseEvents = new InternalArray;
- for (var i = 0; i < events.length; i += 2) {
- var value = events[i];
- var tasks = events[i + 1];
- for (var j = 0; j < tasks.length; j += 2) {
- var handler = tasks[j];
- var deferred = tasks[j + 1];
- try {
- var result = handler(value);
- if (result === deferred.promise)
- throw MakeTypeError('promise_cyclic', [result]);
- else if (IsPromise(result))
- result.chain(deferred.resolve, deferred.reject);
- else
- deferred.resolve(result);
- } catch(e) {
- // TODO(rossberg): perhaps log uncaught exceptions below.
- try { deferred.reject(e) } catch(e) {}
- }
- }
- }
+function PromiseHandle(value, handler, deferred) {
+ try {
+ var result = handler(value);
+ if (result === deferred.promise)
+ throw MakeTypeError('promise_cyclic', [result]);
+ else if (IsPromise(result))
+ result.chain(deferred.resolve, deferred.reject);
+ else
+ deferred.resolve(result);
+ } catch(e) {
+ // TODO(rossberg): perhaps log uncaught exceptions below.
+ try { deferred.reject(e) } catch(e) {}
}
}
-RunMicrotasks.runners.push(PromiseMicrotaskRunner);
// Multi-unwrapped chaining with thenable coercion.
=======================================
--- /branches/bleeding_edge/src/runtime.cc Mon Feb 10 21:38:17 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc Wed Feb 12 22:04:19 2014 UTC
@@ -14594,6 +14594,21 @@
isolate->set_microtask_pending(new_state);
return isolate->heap()->ToBoolean(old_state);
}
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_RunMicrotasks) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 0);
+ Execution::RunMicrotasks(isolate);
+ return isolate->heap()->undefined_value();
+}
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_GetMicrotaskState) {
+ SealHandleScope shs(isolate);
+ ASSERT(args.length() == 0);
+ return isolate->heap()->microtask_state();
+}
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetObservationState) {
=======================================
--- /branches/bleeding_edge/src/runtime.h Fri Feb 7 01:08:50 2014 UTC
+++ /branches/bleeding_edge/src/runtime.h Wed Feb 12 22:04:19 2014 UTC
@@ -308,6 +308,9 @@
/* ES5 */ \
F(ObjectFreeze, 1, 1) \
\
+ /* Harmony Microtasks */ \
+ F(GetMicrotaskState, 0, 1) \
+ \
/* Harmony modules */ \
F(IsJSModule, 1, 1) \
\
@@ -351,6 +354,7 @@
\
/* Harmony events */ \
F(SetMicrotaskPending, 1, 1) \
+ F(RunMicrotasks, 0, 1) \
\
/* Harmony observe */ \
F(IsObserved, 1, 1) \
=======================================
--- /branches/bleeding_edge/src/v8.cc Fri Jan 17 10:52:00 2014 UTC
+++ /branches/bleeding_edge/src/v8.cc Wed Feb 12 22:04:19 2014 UTC
@@ -148,15 +148,16 @@
void V8::FireCallCompletedCallback(Isolate* isolate) {
bool has_call_completed_callbacks = call_completed_callbacks_ != NULL;
- bool microtask_pending = isolate->microtask_pending();
- if (!has_call_completed_callbacks && !microtask_pending) return;
+ bool run_microtasks = isolate->autorun_microtasks() &&
+ isolate->microtask_pending();
+ if (!has_call_completed_callbacks && !run_microtasks) return;
HandleScopeImplementer* handle_scope_implementer =
isolate->handle_scope_implementer();
if (!handle_scope_implementer->CallDepthIsZero()) return;
// Fire callbacks. Increase call depth to prevent recursive callbacks.
handle_scope_implementer->IncrementCallDepth();
- if (microtask_pending) Execution::RunMicrotasks(isolate);
+ if (run_microtasks) Execution::RunMicrotasks(isolate);
if (has_call_completed_callbacks) {
for (int i = 0; i < call_completed_callbacks_->length(); i++) {
call_completed_callbacks_->at(i)();
@@ -164,6 +165,21 @@
}
handle_scope_implementer->DecrementCallDepth();
}
+
+
+void V8::RunMicrotasks(Isolate* isolate) {
+ if (!isolate->microtask_pending())
+ return;
+
+ HandleScopeImplementer* handle_scope_implementer =
+ isolate->handle_scope_implementer();
+ ASSERT(handle_scope_implementer->CallDepthIsZero());
+
+ // Increase call depth to prevent recursive callbacks.
+ handle_scope_implementer->IncrementCallDepth();
+ Execution::RunMicrotasks(isolate);
+ handle_scope_implementer->DecrementCallDepth();
+}
void V8::InitializeOncePerProcessImpl() {
=======================================
--- /branches/bleeding_edge/src/v8.h Fri Nov 22 11:35:39 2013 UTC
+++ /branches/bleeding_edge/src/v8.h Wed Feb 12 22:04:19 2014 UTC
@@ -101,6 +101,8 @@
static void RemoveCallCompletedCallback(CallCompletedCallback callback);
static void FireCallCompletedCallback(Isolate* isolate);
+ static void RunMicrotasks(Isolate* isolate);
+
static v8::ArrayBuffer::Allocator* ArrayBufferAllocator() {
return array_buffer_allocator_;
}
=======================================
--- /branches/bleeding_edge/src/v8natives.js Fri Feb 7 01:08:50 2014 UTC
+++ /branches/bleeding_edge/src/v8natives.js Wed Feb 12 22:04:19 2014 UTC
@@ -1889,10 +1889,30 @@
// Eventually, we should move to a real event queue that allows to maintain
// relative ordering of different kinds of tasks.
-RunMicrotasks.runners = new InternalArray;
+function GetMicrotaskQueue() {
+ var microtaskState = %GetMicrotaskState();
+ if (IS_UNDEFINED(microtaskState.queue)) {
+ microtaskState.queue = new InternalArray;
+ }
+ return microtaskState.queue;
+}
function RunMicrotasks() {
while (%SetMicrotaskPending(false)) {
- for (var i in RunMicrotasks.runners) RunMicrotasks.runners[i]();
+ var microtaskState = %GetMicrotaskState();
+ if (IS_UNDEFINED(microtaskState.queue))
+ return;
+
+ var microtasks = microtaskState.queue;
+ microtaskState.queue = new InternalArray;
+
+ for (var i = 0; i < microtasks.length; i++) {
+ microtasks[i]();
+ }
}
}
+
+function EnqueueExternalMicrotask(fn) {
+ GetMicrotaskQueue().push(fn);
+ %SetMicrotaskPending(true);
+}
=======================================
--- /branches/bleeding_edge/test/cctest/cctest.gyp Wed Feb 12 09:19:30 2014
UTC
+++ /branches/bleeding_edge/test/cctest/cctest.gyp Wed Feb 12 22:04:19 2014
UTC
@@ -88,6 +88,7 @@
'test-liveedit.cc',
'test-lockers.cc',
'test-log.cc',
+ 'test-microtask-delivery.cc',
'test-mark-compact.cc',
'test-mementos.cc',
'test-mutex.cc',
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Wed Feb 12 15:50:23
2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-api.cc Wed Feb 12 22:04:19
2014 UTC
@@ -20512,6 +20512,102 @@
v8::V8::AddCallCompletedCallback(CallCompletedCallbackException);
CompileRun("throw 'first exception';");
}
+
+
+static void MicrotaskOne(const v8::FunctionCallbackInfo<Value>& info) {
+ v8::HandleScope scope(info.GetIsolate());
+ CompileRun("ext1Calls++;");
+}
+
+
+static void MicrotaskTwo(const v8::FunctionCallbackInfo<Value>& info) {
+ v8::HandleScope scope(info.GetIsolate());
+ CompileRun("ext2Calls++;");
+}
+
+
+TEST(EnqueueMicrotask) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ CompileRun(
+ "var ext1Calls = 0;"
+ "var ext2Calls = 0;");
+ CompileRun("1+1;");
+ CHECK_EQ(0, CompileRun("ext1Calls")->Int32Value());
+ CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value());
+
+ v8::V8::EnqueueMicrotask(env->GetIsolate(),
+ Function::New(env->GetIsolate(), MicrotaskOne));
+ CompileRun("1+1;");
+ CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value());
+ CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value());
+
+ v8::V8::EnqueueMicrotask(env->GetIsolate(),
+ Function::New(env->GetIsolate(), MicrotaskOne));
+ v8::V8::EnqueueMicrotask(env->GetIsolate(),
+ Function::New(env->GetIsolate(), MicrotaskTwo));
+ CompileRun("1+1;");
+ CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
+ CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value());
+
+ v8::V8::EnqueueMicrotask(env->GetIsolate(),
+ Function::New(env->GetIsolate(), MicrotaskTwo));
+ CompileRun("1+1;");
+ CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
+ CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value());
+
+ CompileRun("1+1;");
+ CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
+ CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value());
+}
+
+
+TEST(SetAutorunMicrotasks) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ CompileRun(
+ "var ext1Calls = 0;"
+ "var ext2Calls = 0;");
+ CompileRun("1+1;");
+ CHECK_EQ(0, CompileRun("ext1Calls")->Int32Value());
+ CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value());
+
+ v8::V8::EnqueueMicrotask(env->GetIsolate(),
+ Function::New(env->GetIsolate(), MicrotaskOne));
+ CompileRun("1+1;");
+ CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value());
+ CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value());
+
+ V8::SetAutorunMicrotasks(env->GetIsolate(), false);
+ v8::V8::EnqueueMicrotask(env->GetIsolate(),
+ Function::New(env->GetIsolate(), MicrotaskOne));
+ v8::V8::EnqueueMicrotask(env->GetIsolate(),
+ Function::New(env->GetIsolate(), MicrotaskTwo));
+ CompileRun("1+1;");
+ CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value());
+ CHECK_EQ(0, CompileRun("ext2Calls")->Int32Value());
+
+ V8::RunMicrotasks(env->GetIsolate());
+ CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
+ CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value());
+
+ v8::V8::EnqueueMicrotask(env->GetIsolate(),
+ Function::New(env->GetIsolate(), MicrotaskTwo));
+ CompileRun("1+1;");
+ CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
+ CHECK_EQ(1, CompileRun("ext2Calls")->Int32Value());
+
+ V8::RunMicrotasks(env->GetIsolate());
+ CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
+ CHECK_EQ(2, CompileRun("ext2Calls")->Int32Value());
+
+ V8::SetAutorunMicrotasks(env->GetIsolate(), true);
+ v8::V8::EnqueueMicrotask(env->GetIsolate(),
+ Function::New(env->GetIsolate(), MicrotaskTwo));
+ CompileRun("1+1;");
+ CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value());
+ CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value());
+}
static int probes_counter = 0;
=======================================
--- /branches/bleeding_edge/test/mjsunit/fuzz-natives-part3.js Fri Feb 7
01:08:50 2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/fuzz-natives-part3.js Wed Feb 12
22:04:19 2014 UTC
@@ -216,7 +216,10 @@
"DataViewInitialize":true,
"DataViewGetBuffer": true,
"DataViewGetByteLength": true,
- "DataViewGetByteOffset": true
+ "DataViewGetByteOffset": true,
+
+ // Only ever called internally.
+ "RunMicrotasks": true
};
var currentlyUncallable = {
=======================================
--- /branches/bleeding_edge/tools/v8heapconst.py Wed Jan 15 11:42:19 2014
UTC
+++ /branches/bleeding_edge/tools/v8heapconst.py Wed Feb 12 22:04:19 2014
UTC
@@ -62,63 +62,72 @@
135: "FOREIGN_TYPE",
136: "BYTE_ARRAY_TYPE",
137: "FREE_SPACE_TYPE",
- 138: "EXTERNAL_BYTE_ARRAY_TYPE",
- 139: "EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE",
- 140: "EXTERNAL_SHORT_ARRAY_TYPE",
- 141: "EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE",
- 142: "EXTERNAL_INT_ARRAY_TYPE",
- 143: "EXTERNAL_UNSIGNED_INT_ARRAY_TYPE",
- 144: "EXTERNAL_FLOAT_ARRAY_TYPE",
- 145: "EXTERNAL_DOUBLE_ARRAY_TYPE",
- 146: "EXTERNAL_PIXEL_ARRAY_TYPE",
- 149: "FILLER_TYPE",
- 150: "DECLARED_ACCESSOR_DESCRIPTOR_TYPE",
- 151: "DECLARED_ACCESSOR_INFO_TYPE",
- 152: "EXECUTABLE_ACCESSOR_INFO_TYPE",
- 153: "ACCESSOR_PAIR_TYPE",
- 154: "ACCESS_CHECK_INFO_TYPE",
- 155: "INTERCEPTOR_INFO_TYPE",
- 156: "CALL_HANDLER_INFO_TYPE",
- 157: "FUNCTION_TEMPLATE_INFO_TYPE",
- 158: "OBJECT_TEMPLATE_INFO_TYPE",
- 159: "SIGNATURE_INFO_TYPE",
- 160: "TYPE_SWITCH_INFO_TYPE",
- 162: "ALLOCATION_MEMENTO_TYPE",
- 161: "ALLOCATION_SITE_TYPE",
- 163: "SCRIPT_TYPE",
- 164: "CODE_CACHE_TYPE",
- 165: "POLYMORPHIC_CODE_CACHE_TYPE",
- 166: "TYPE_FEEDBACK_INFO_TYPE",
- 167: "ALIASED_ARGUMENTS_ENTRY_TYPE",
- 168: "BOX_TYPE",
- 171: "FIXED_ARRAY_TYPE",
- 147: "FIXED_DOUBLE_ARRAY_TYPE",
- 148: "CONSTANT_POOL_ARRAY_TYPE",
- 172: "SHARED_FUNCTION_INFO_TYPE",
- 173: "JS_MESSAGE_OBJECT_TYPE",
- 176: "JS_VALUE_TYPE",
- 177: "JS_DATE_TYPE",
- 178: "JS_OBJECT_TYPE",
- 179: "JS_CONTEXT_EXTENSION_OBJECT_TYPE",
- 180: "JS_GENERATOR_OBJECT_TYPE",
- 181: "JS_MODULE_TYPE",
- 182: "JS_GLOBAL_OBJECT_TYPE",
- 183: "JS_BUILTINS_OBJECT_TYPE",
- 184: "JS_GLOBAL_PROXY_TYPE",
- 185: "JS_ARRAY_TYPE",
- 186: "JS_ARRAY_BUFFER_TYPE",
- 187: "JS_TYPED_ARRAY_TYPE",
- 188: "JS_DATA_VIEW_TYPE",
- 175: "JS_PROXY_TYPE",
- 189: "JS_SET_TYPE",
- 190: "JS_MAP_TYPE",
- 191: "JS_WEAK_MAP_TYPE",
- 192: "JS_WEAK_SET_TYPE",
- 193: "JS_REGEXP_TYPE",
- 194: "JS_FUNCTION_TYPE",
- 174: "JS_FUNCTION_PROXY_TYPE",
- 169: "DEBUG_INFO_TYPE",
- 170: "BREAK_POINT_INFO_TYPE",
+ 138: "EXTERNAL_INT8_ARRAY_TYPE",
+ 139: "EXTERNAL_UINT8_ARRAY_TYPE",
+ 140: "EXTERNAL_INT16_ARRAY_TYPE",
+ 141: "EXTERNAL_UINT16_ARRAY_TYPE",
+ 142: "EXTERNAL_INT32_ARRAY_TYPE",
+ 143: "EXTERNAL_UINT32_ARRAY_TYPE",
+ 144: "EXTERNAL_FLOAT32_ARRAY_TYPE",
+ 145: "EXTERNAL_FLOAT64_ARRAY_TYPE",
+ 146: "EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE",
+ 147: "FIXED_INT8_ARRAY_TYPE",
+ 148: "FIXED_UINT8_ARRAY_TYPE",
+ 149: "FIXED_INT16_ARRAY_TYPE",
+ 150: "FIXED_UINT16_ARRAY_TYPE",
+ 151: "FIXED_INT32_ARRAY_TYPE",
+ 152: "FIXED_UINT32_ARRAY_TYPE",
+ 153: "FIXED_FLOAT32_ARRAY_TYPE",
+ 154: "FIXED_FLOAT64_ARRAY_TYPE",
+ 155: "FIXED_UINT8_CLAMPED_ARRAY_TYPE",
+ 157: "FILLER_TYPE",
+ 158: "DECLARED_ACCESSOR_DESCRIPTOR_TYPE",
+ 159: "DECLARED_ACCESSOR_INFO_TYPE",
+ 160: "EXECUTABLE_ACCESSOR_INFO_TYPE",
+ 161: "ACCESSOR_PAIR_TYPE",
+ 162: "ACCESS_CHECK_INFO_TYPE",
+ 163: "INTERCEPTOR_INFO_TYPE",
+ 164: "CALL_HANDLER_INFO_TYPE",
+ 165: "FUNCTION_TEMPLATE_INFO_TYPE",
+ 166: "OBJECT_TEMPLATE_INFO_TYPE",
+ 167: "SIGNATURE_INFO_TYPE",
+ 168: "TYPE_SWITCH_INFO_TYPE",
+ 170: "ALLOCATION_MEMENTO_TYPE",
+ 169: "ALLOCATION_SITE_TYPE",
+ 171: "SCRIPT_TYPE",
+ 172: "CODE_CACHE_TYPE",
+ 173: "POLYMORPHIC_CODE_CACHE_TYPE",
+ 174: "TYPE_FEEDBACK_INFO_TYPE",
+ 175: "ALIASED_ARGUMENTS_ENTRY_TYPE",
+ 176: "BOX_TYPE",
+ 179: "FIXED_ARRAY_TYPE",
+ 156: "FIXED_DOUBLE_ARRAY_TYPE",
+ 180: "CONSTANT_POOL_ARRAY_TYPE",
+ 181: "SHARED_FUNCTION_INFO_TYPE",
+ 182: "JS_MESSAGE_OBJECT_TYPE",
+ 185: "JS_VALUE_TYPE",
+ 186: "JS_DATE_TYPE",
+ 187: "JS_OBJECT_TYPE",
+ 188: "JS_CONTEXT_EXTENSION_OBJECT_TYPE",
+ 189: "JS_GENERATOR_OBJECT_TYPE",
+ 190: "JS_MODULE_TYPE",
+ 191: "JS_GLOBAL_OBJECT_TYPE",
+ 192: "JS_BUILTINS_OBJECT_TYPE",
+ 193: "JS_GLOBAL_PROXY_TYPE",
+ 194: "JS_ARRAY_TYPE",
+ 195: "JS_ARRAY_BUFFER_TYPE",
+ 196: "JS_TYPED_ARRAY_TYPE",
+ 197: "JS_DATA_VIEW_TYPE",
+ 184: "JS_PROXY_TYPE",
+ 198: "JS_SET_TYPE",
+ 199: "JS_MAP_TYPE",
+ 200: "JS_WEAK_MAP_TYPE",
+ 201: "JS_WEAK_SET_TYPE",
+ 202: "JS_REGEXP_TYPE",
+ 203: "JS_FUNCTION_TYPE",
+ 183: "JS_FUNCTION_PROXY_TYPE",
+ 177: "DEBUG_INFO_TYPE",
+ 178: "BREAK_POINT_INFO_TYPE",
}
# List of known V8 maps.
@@ -127,21 +136,21 @@
0x080a9: (129, "MetaMap"),
0x080d1: (131, "OddballMap"),
0x080f9: (4, "AsciiInternalizedStringMap"),
- 0x08121: (171, "FixedArrayMap"),
+ 0x08121: (179, "FixedArrayMap"),
0x08149: (134, "HeapNumberMap"),
- 0x08171: (137, "FreeSpaceMap"),
- 0x08199: (149, "OnePointerFillerMap"),
- 0x081c1: (149, "TwoPointerFillerMap"),
- 0x081e9: (132, "CellMap"),
- 0x08211: (133, "GlobalPropertyCellMap"),
- 0x08239: (172, "SharedFunctionInfoMap"),
- 0x08261: (171, "NativeContextMap"),
- 0x08289: (130, "CodeMap"),
- 0x082b1: (171, "ScopeInfoMap"),
- 0x082d9: (171, "FixedCOWArrayMap"),
- 0x08301: (147, "FixedDoubleArrayMap"),
- 0x08329: (148, "ConstantPoolArrayMap"),
- 0x08351: (171, "HashTableMap"),
+ 0x08171: (130, "CodeMap"),
+ 0x08199: (180, "ConstantPoolArrayMap"),
+ 0x081c1: (137, "FreeSpaceMap"),
+ 0x081e9: (157, "OnePointerFillerMap"),
+ 0x08211: (157, "TwoPointerFillerMap"),
+ 0x08239: (132, "CellMap"),
+ 0x08261: (133, "GlobalPropertyCellMap"),
+ 0x08289: (181, "SharedFunctionInfoMap"),
+ 0x082b1: (179, "NativeContextMap"),
+ 0x082d9: (179, "ScopeInfoMap"),
+ 0x08301: (179, "FixedCOWArrayMap"),
+ 0x08329: (156, "FixedDoubleArrayMap"),
+ 0x08351: (179, "HashTableMap"),
0x08379: (128, "SymbolMap"),
0x083a1: (64, "StringMap"),
0x083c9: (68, "AsciiStringMap"),
@@ -166,92 +175,104 @@
0x086c1: (86, "ShortExternalAsciiStringMap"),
0x086e9: (64, "UndetectableStringMap"),
0x08711: (68, "UndetectableAsciiStringMap"),
- 0x08739: (138, "ExternalByteArrayMap"),
- 0x08761: (139, "ExternalUnsignedByteArrayMap"),
- 0x08789: (140, "ExternalShortArrayMap"),
- 0x087b1: (141, "ExternalUnsignedShortArrayMap"),
- 0x087d9: (142, "ExternalIntArrayMap"),
- 0x08801: (143, "ExternalUnsignedIntArrayMap"),
- 0x08829: (144, "ExternalFloatArrayMap"),
- 0x08851: (145, "ExternalDoubleArrayMap"),
- 0x08879: (146, "ExternalPixelArrayMap"),
- 0x088a1: (171, "NonStrictArgumentsElementsMap"),
- 0x088c9: (171, "FunctionContextMap"),
- 0x088f1: (171, "CatchContextMap"),
- 0x08919: (171, "WithContextMap"),
- 0x08941: (171, "BlockContextMap"),
- 0x08969: (171, "ModuleContextMap"),
- 0x08991: (171, "GlobalContextMap"),
- 0x089b9: (173, "JSMessageObjectMap"),
- 0x089e1: (135, "ForeignMap"),
- 0x08a09: (178, "NeanderMap"),
- 0x08a31: (162, "AllocationMementoMap"),
- 0x08a59: (161, "AllocationSiteMap"),
- 0x08a81: (165, "PolymorphicCodeCacheMap"),
- 0x08aa9: (163, "ScriptMap"),
- 0x08af9: (178, "ExternalMap"),
- 0x08b21: (168, "BoxMap"),
- 0x08b49: (150, "DeclaredAccessorDescriptorMap"),
- 0x08b71: (151, "DeclaredAccessorInfoMap"),
- 0x08b99: (152, "ExecutableAccessorInfoMap"),
- 0x08bc1: (153, "AccessorPairMap"),
- 0x08be9: (154, "AccessCheckInfoMap"),
- 0x08c11: (155, "InterceptorInfoMap"),
- 0x08c39: (156, "CallHandlerInfoMap"),
- 0x08c61: (157, "FunctionTemplateInfoMap"),
- 0x08c89: (158, "ObjectTemplateInfoMap"),
- 0x08cb1: (159, "SignatureInfoMap"),
- 0x08cd9: (160, "TypeSwitchInfoMap"),
- 0x08d01: (164, "CodeCacheMap"),
- 0x08d29: (166, "TypeFeedbackInfoMap"),
- 0x08d51: (167, "AliasedArgumentsEntryMap"),
- 0x08d79: (169, "DebugInfoMap"),
- 0x08da1: (170, "BreakPointInfoMap"),
+ 0x08739: (138, "ExternalInt8ArrayMap"),
+ 0x08761: (139, "ExternalUint8ArrayMap"),
+ 0x08789: (140, "ExternalInt16ArrayMap"),
+ 0x087b1: (141, "ExternalUint16ArrayMap"),
+ 0x087d9: (142, "ExternalInt32ArrayMap"),
+ 0x08801: (143, "ExternalUint32ArrayMap"),
+ 0x08829: (144, "ExternalFloat32ArrayMap"),
+ 0x08851: (145, "ExternalFloat64ArrayMap"),
+ 0x08879: (146, "ExternalUint8ClampedArrayMap"),
+ 0x088a1: (148, "FixedUint8ArrayMap"),
+ 0x088c9: (147, "FixedInt8ArrayMap"),
+ 0x088f1: (150, "FixedUint16ArrayMap"),
+ 0x08919: (149, "FixedInt16ArrayMap"),
+ 0x08941: (152, "FixedUint32ArrayMap"),
+ 0x08969: (151, "FixedInt32ArrayMap"),
+ 0x08991: (153, "FixedFloat32ArrayMap"),
+ 0x089b9: (154, "FixedFloat64ArrayMap"),
+ 0x089e1: (155, "FixedUint8ClampedArrayMap"),
+ 0x08a09: (179, "NonStrictArgumentsElementsMap"),
+ 0x08a31: (179, "FunctionContextMap"),
+ 0x08a59: (179, "CatchContextMap"),
+ 0x08a81: (179, "WithContextMap"),
+ 0x08aa9: (179, "BlockContextMap"),
+ 0x08ad1: (179, "ModuleContextMap"),
+ 0x08af9: (179, "GlobalContextMap"),
+ 0x08b21: (182, "JSMessageObjectMap"),
+ 0x08b49: (135, "ForeignMap"),
+ 0x08b71: (187, "NeanderMap"),
+ 0x08b99: (170, "AllocationMementoMap"),
+ 0x08bc1: (169, "AllocationSiteMap"),
+ 0x08be9: (173, "PolymorphicCodeCacheMap"),
+ 0x08c11: (171, "ScriptMap"),
+ 0x08c61: (187, "ExternalMap"),
+ 0x08cb1: (176, "BoxMap"),
+ 0x08cd9: (158, "DeclaredAccessorDescriptorMap"),
+ 0x08d01: (159, "DeclaredAccessorInfoMap"),
+ 0x08d29: (160, "ExecutableAccessorInfoMap"),
+ 0x08d51: (161, "AccessorPairMap"),
+ 0x08d79: (162, "AccessCheckInfoMap"),
+ 0x08da1: (163, "InterceptorInfoMap"),
+ 0x08dc9: (164, "CallHandlerInfoMap"),
+ 0x08df1: (165, "FunctionTemplateInfoMap"),
+ 0x08e19: (166, "ObjectTemplateInfoMap"),
+ 0x08e41: (167, "SignatureInfoMap"),
+ 0x08e69: (168, "TypeSwitchInfoMap"),
+ 0x08e91: (172, "CodeCacheMap"),
+ 0x08eb9: (174, "TypeFeedbackInfoMap"),
+ 0x08ee1: (175, "AliasedArgumentsEntryMap"),
+ 0x08f09: (177, "DebugInfoMap"),
+ 0x08f31: (178, "BreakPointInfoMap"),
}
# List of known V8 objects.
KNOWN_OBJECTS = {
("OLD_POINTER_SPACE", 0x08081): "NullValue",
("OLD_POINTER_SPACE", 0x08091): "UndefinedValue",
- ("OLD_POINTER_SPACE", 0x080a1): "TheHoleValue",
- ("OLD_POINTER_SPACE", 0x080b1): "TrueValue",
- ("OLD_POINTER_SPACE", 0x080c1): "FalseValue",
- ("OLD_POINTER_SPACE", 0x080d1): "UninitializedValue",
- ("OLD_POINTER_SPACE", 0x080e1): "NoInterceptorResultSentinel",
- ("OLD_POINTER_SPACE", 0x080f1): "ArgumentsMarker",
- ("OLD_POINTER_SPACE", 0x08101): "NumberStringCache",
- ("OLD_POINTER_SPACE", 0x08909): "SingleCharacterStringCache",
- ("OLD_POINTER_SPACE", 0x08d11): "StringSplitCache",
- ("OLD_POINTER_SPACE", 0x09119): "RegExpMultipleCache",
- ("OLD_POINTER_SPACE", 0x09521): "TerminationException",
- ("OLD_POINTER_SPACE", 0x09531): "MessageListeners",
- ("OLD_POINTER_SPACE", 0x0954d): "CodeStubs",
- ("OLD_POINTER_SPACE", 0x10485): "NonMonomorphicCache",
- ("OLD_POINTER_SPACE", 0x10a99): "PolymorphicCodeCache",
- ("OLD_POINTER_SPACE", 0x10aa1): "NativesSourceCache",
- ("OLD_POINTER_SPACE", 0x10aed): "EmptyScript",
- ("OLD_POINTER_SPACE", 0x10b25): "IntrinsicFunctionNames",
- ("OLD_POINTER_SPACE", 0x13b41): "ObservationState",
- ("OLD_POINTER_SPACE", 0x13b4d): "FrozenSymbol",
- ("OLD_POINTER_SPACE", 0x13b5d): "ElementsTransitionSymbol",
- ("OLD_POINTER_SPACE", 0x13b6d): "EmptySlowElementDictionary",
- ("OLD_POINTER_SPACE", 0x13d09): "ObservedSymbol",
- ("OLD_POINTER_SPACE", 0x32325): "StringTable",
+ ("OLD_POINTER_SPACE", 0x0810d): "TheHoleValue",
+ ("OLD_POINTER_SPACE", 0x0811d): "TerminationException",
+ ("OLD_POINTER_SPACE", 0x0812d): "TrueValue",
+ ("OLD_POINTER_SPACE", 0x0813d): "FalseValue",
+ ("OLD_POINTER_SPACE", 0x081b9): "UninitializedValue",
+ ("OLD_POINTER_SPACE", 0x081c9): "NoInterceptorResultSentinel",
+ ("OLD_POINTER_SPACE", 0x081d9): "ArgumentsMarker",
+ ("OLD_POINTER_SPACE", 0x081e9): "NumberStringCache",
+ ("OLD_POINTER_SPACE", 0x089f1): "SingleCharacterStringCache",
+ ("OLD_POINTER_SPACE", 0x08df9): "StringSplitCache",
+ ("OLD_POINTER_SPACE", 0x09201): "RegExpMultipleCache",
+ ("OLD_POINTER_SPACE", 0x09609): "MessageListeners",
+ ("OLD_POINTER_SPACE", 0x09625): "CodeStubs",
+ ("OLD_POINTER_SPACE", 0x103e9): "NonMonomorphicCache",
+ ("OLD_POINTER_SPACE", 0x109fd): "PolymorphicCodeCache",
+ ("OLD_POINTER_SPACE", 0x10a05): "NativesSourceCache",
+ ("OLD_POINTER_SPACE", 0x10a51): "EmptyScript",
+ ("OLD_POINTER_SPACE", 0x10a89): "IntrinsicFunctionNames",
+ ("OLD_POINTER_SPACE", 0x13aa5): "ObservationState",
+ ("OLD_POINTER_SPACE", 0x13ab1): "FrozenSymbol",
+ ("OLD_POINTER_SPACE", 0x13ac1): "ElementsTransitionSymbol",
+ ("OLD_POINTER_SPACE", 0x13ad1): "EmptySlowElementDictionary",
+ ("OLD_POINTER_SPACE", 0x13c6d): "ObservedSymbol",
+ ("OLD_POINTER_SPACE", 0x13c7d): "AllocationSitesScratchpad",
+ ("OLD_POINTER_SPACE", 0x14085): "MicrotaskState",
+ ("OLD_POINTER_SPACE", 0x32885): "StringTable",
("OLD_DATA_SPACE", 0x08099): "EmptyDescriptorArray",
("OLD_DATA_SPACE", 0x080a1): "EmptyFixedArray",
("OLD_DATA_SPACE", 0x080a9): "NanValue",
- ("OLD_DATA_SPACE", 0x08141): "EmptyByteArray",
- ("OLD_DATA_SPACE", 0x08279): "EmptyExternalByteArray",
- ("OLD_DATA_SPACE", 0x08285): "EmptyExternalUnsignedByteArray",
- ("OLD_DATA_SPACE", 0x08291): "EmptyExternalShortArray",
- ("OLD_DATA_SPACE", 0x0829d): "EmptyExternalUnsignedShortArray",
- ("OLD_DATA_SPACE", 0x082a9): "EmptyExternalIntArray",
- ("OLD_DATA_SPACE", 0x082b5): "EmptyExternalUnsignedIntArray",
- ("OLD_DATA_SPACE", 0x082c1): "EmptyExternalFloatArray",
- ("OLD_DATA_SPACE", 0x082cd): "EmptyExternalDoubleArray",
- ("OLD_DATA_SPACE", 0x082d9): "EmptyExternalPixelArray",
- ("OLD_DATA_SPACE", 0x082e5): "InfinityValue",
- ("OLD_DATA_SPACE", 0x082f1): "MinusZeroValue",
- ("CODE_SPACE", 0x14181): "JsConstructEntryCode",
- ("CODE_SPACE", 0x15c61): "JsEntryCode",
+ ("OLD_DATA_SPACE", 0x080e5): "EmptyConstantPoolArray",
+ ("OLD_DATA_SPACE", 0x08235): "EmptyByteArray",
+ ("OLD_DATA_SPACE", 0x08349): "EmptyExternalInt8Array",
+ ("OLD_DATA_SPACE", 0x08355): "EmptyExternalUint8Array",
+ ("OLD_DATA_SPACE", 0x08361): "EmptyExternalInt16Array",
+ ("OLD_DATA_SPACE", 0x0836d): "EmptyExternalUint16Array",
+ ("OLD_DATA_SPACE", 0x08379): "EmptyExternalInt32Array",
+ ("OLD_DATA_SPACE", 0x08385): "EmptyExternalUint32Array",
+ ("OLD_DATA_SPACE", 0x08391): "EmptyExternalFloat32Array",
+ ("OLD_DATA_SPACE", 0x0839d): "EmptyExternalFloat64Array",
+ ("OLD_DATA_SPACE", 0x083a9): "EmptyExternalUint8ClampedArray",
+ ("OLD_DATA_SPACE", 0x083b5): "InfinityValue",
+ ("OLD_DATA_SPACE", 0x083c1): "MinusZeroValue",
+ ("CODE_SPACE", 0x13c81): "JsConstructEntryCode",
+ ("CODE_SPACE", 0x215a1): "JsEntryCode",
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.