Skip to content

Instantly share code, notes, and snippets.

//
// There are 2 types of native classes in playerGlobal:
//
// (1) ActionScript data and methods, but have [native(cls="..")] metadata
// Examples: Matrix, Point, etc
// (2) Native data (accessed via getters and setters) and methods
// Examples: Transform, ApplicationDomain, etc
//
// (1), despite all functionality being in ActionScript, are represented by
// native classes because they need to be accessed by other native
function isIndex(n) {
// This isn't right, but pretend that this checks if n is an index in the
// way that SpiderMonkey checks in js_IdIsIndex.
return Number(n) % 1 == 0;
}
function indices(obj) {
var result = [];
for (var i = 0; i < obj.length; i++)
result.push(i);
diff --git a/src/avm2/bin/avm.js b/src/avm2/bin/avm.js
index 7a448a0..a9f2a59 100644
--- a/src/avm2/bin/avm.js
+++ b/src/avm2/bin/avm.js
@@ -53,6 +53,9 @@ load("../viz.js");
load("../interpreter.js");
load("../native.js");
load("../vm.js");
+
+load("../../glue/test/stubs.js");
["Test"].forEach(function makeStub(className) {
const global = this;
global[className] = function () {
if (!avm2) {
throw new Error("AVM2 not initialized");
}
var c = avm2.systemDomain.getClass(className);
assert(c.instance);
global[className] = c.instance;
//
// Higher dimensional wrapper with inferred shape for one-dimensional parallel
// arrays.
//
var ParallelMatrix = (function () {
function leafShape(pa) {
var row = pa[0];
if (!(row instanceof ParallelMatrix))
return [];
# HG changeset patch
# Parent b857905d82b45456853866330c98b372b14f20db
# User Nicholas D. Matsakis <nmatsakis@mozilla.com>
Permit multiple ion compilation modes. This implies the possibility of
multiple ion scripts per JSScript.
* * *
Add abstractions for cases that handle all comp. modes at once.
* * *
split out separate fields for seq, par
* * *
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp
index 47060f4..8b2e769 100644
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -738,7 +738,8 @@ js::PerThreadData::PerThreadData(JSRuntime *runtime)
{}
JSRuntime::JSRuntime(JSUseHelperThreads useHelperThreads)
- : mainThread(this),
+ : RuntimeFriendFields(&mainThread),
diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp
index f20a2f2..0009b47 100644
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -23,7 +23,7 @@ using namespace js;
using namespace JS;
// Required by PerThreadDataFriendFields::getMainThread()
-JS_STATIC_ASSERT(offsetof(JSRuntime, mainThread) == JS_PERTHREADDATAOFFSET);
+JS_STATIC_ASSERT(offsetof(JSRuntime, mainThread) == PerThreadDataFriendFields::PerThreadDataOffset);
diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp
index f20a2f2..0009b47 100644
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -23,7 +23,7 @@ using namespace js;
using namespace JS;
// Required by PerThreadDataFriendFields::getMainThread()
-JS_STATIC_ASSERT(offsetof(JSRuntime, mainThread) == JS_PERTHREADDATAOFFSET);
+JS_STATIC_ASSERT(offsetof(JSRuntime, mainThread) == PerThreadDataFriendFields::PerThreadDataOffset);
diff --git a/js/src/ion/MCallOptimize.cpp b/js/src/ion/MCallOptimize.cpp
index 02f4ca5..ae32a22 100644
--- a/js/src/ion/MCallOptimize.cpp
+++ b/js/src/ion/MCallOptimize.cpp
@@ -470,15 +470,23 @@ IonBuilder::inlineMathAbs(CallInfo &callInfo)
MIRType argType = getInlineArgType(callInfo, 0);
if (argType != MIRType_Int32 && argType != MIRType_Double)
return InliningStatus_NotInlined;
- if (argType != returnType)
- return InliningStatus_NotInlined;