зеркало из https://github.com/mozilla/pluotsorbet.git
Merge branch 'master' into remove-console
This commit is contained in:
Коммит
ed5785e6bc
15
Makefile
15
Makefile
|
@ -7,6 +7,7 @@ VERSION ?=$(shell date +%s)
|
|||
PROFILE ?= 0
|
||||
BENCHMARK ?= 0
|
||||
CONSOLE ?= 1
|
||||
VERBOSE ?= 0
|
||||
|
||||
# Sensor support
|
||||
JSR_256 ?= 1
|
||||
|
@ -28,6 +29,14 @@ else
|
|||
J2ME_JS_OPTIMIZATION_LEVEL = SIMPLE
|
||||
endif
|
||||
|
||||
# Closure is really chatty, so we shush it by default to reduce log lines
|
||||
# for Travis.
|
||||
ifeq ($(VERBOSE),1)
|
||||
CLOSURE_WARNING_LEVEL = VERBOSE
|
||||
else
|
||||
CLOSURE_WARNING_LEVEL = QUIET
|
||||
endif
|
||||
|
||||
MAIN_JS_SRCS = \
|
||||
polyfill/canvas-toblob.js \
|
||||
polyfill/fromcodepoint.js \
|
||||
|
@ -191,7 +200,7 @@ relooper:
|
|||
bld/j2me.js: $(BASIC_SRCS) $(JIT_SRCS) build_tools/closure.jar .checksum
|
||||
@echo "Building J2ME"
|
||||
tsc --sourcemap --target ES5 references.ts -d --out bld/j2me.js
|
||||
java -jar build_tools/closure.jar --language_in ECMASCRIPT5 -O $(J2ME_JS_OPTIMIZATION_LEVEL) bld/j2me.js > bld/j2me.cc.js \
|
||||
java -jar build_tools/closure.jar --warning_level $(CLOSURE_WARNING_LEVEL) --language_in ECMASCRIPT5 -O $(J2ME_JS_OPTIMIZATION_LEVEL) bld/j2me.js > bld/j2me.cc.js \
|
||||
&& mv bld/j2me.cc.js bld/j2me.js
|
||||
|
||||
bld/j2me-jsc.js: $(BASIC_SRCS) $(JIT_SRCS)
|
||||
|
@ -207,7 +216,7 @@ bld/jsc.js: jsc.ts bld/j2me-jsc.js
|
|||
# out-language) in order for Closure to compile them, even though for now
|
||||
# we're optimizing "WHITESPACE_ONLY".
|
||||
bld/main-all.js: $(MAIN_JS_SRCS) build_tools/closure.jar .checksum
|
||||
java -jar build_tools/closure.jar --language_in ES6 --language_out ES5 --create_source_map bld/main-all.js.map --source_map_location_mapping "|../" -O WHITESPACE_ONLY $(MAIN_JS_SRCS) > bld/main-all.js
|
||||
java -jar build_tools/closure.jar --warning_level $(CLOSURE_WARNING_LEVEL) --language_in ES6 --language_out ES5 --create_source_map bld/main-all.js.map --source_map_location_mapping "|../" -O WHITESPACE_ONLY $(MAIN_JS_SRCS) > bld/main-all.js
|
||||
echo '//# sourceMappingURL=main-all.js.map' >> bld/main-all.js
|
||||
|
||||
j2me: bld/j2me.js bld/jsc.js
|
||||
|
@ -216,7 +225,7 @@ aot: bld/classes.jar.js
|
|||
bld/classes.jar.js: java/classes.jar bld/jsc.js aot-methods.txt build_tools/closure.jar
|
||||
@echo "Compiling ..."
|
||||
js bld/jsc.js -cp java/classes.jar -d -jf java/classes.jar -mff aot-methods.txt > bld/classes.jar.js
|
||||
java -jar build_tools/closure.jar --language_in ECMASCRIPT5 -O J2ME_AOT_OPTIMIZATIONS bld/classes.jar.js > bld/classes.jar.cc.js \
|
||||
java -jar build_tools/closure.jar --warning_level $(CLOSURE_WARNING_LEVEL) --language_in ECMASCRIPT5 -O SIMPLE bld/classes.jar.js > bld/classes.jar.cc.js \
|
||||
&& mv bld/classes.jar.cc.js bld/classes.jar.js
|
||||
|
||||
bld/tests.jar.js: tests/tests.jar bld/jsc.js aot-methods.txt
|
||||
|
|
|
@ -350,52 +350,52 @@ module J2ME {
|
|||
stack.push2(constant);
|
||||
break;
|
||||
case Bytecodes.ILOAD:
|
||||
stack.push(frame.getLocal(frame.read8()));
|
||||
stack.push(frame.local[frame.read8()]);
|
||||
break;
|
||||
case Bytecodes.FLOAD:
|
||||
stack.push(frame.getLocal(frame.read8()));
|
||||
stack.push(frame.local[frame.read8()]);
|
||||
break;
|
||||
case Bytecodes.ALOAD:
|
||||
stack.push(frame.getLocal(frame.read8()));
|
||||
stack.push(frame.local[frame.read8()]);
|
||||
break;
|
||||
case Bytecodes.ALOAD_ILOAD:
|
||||
stack.push(frame.getLocal(frame.read8()));
|
||||
stack.push(frame.local[frame.read8()]);
|
||||
frame.pc ++;
|
||||
stack.push(frame.getLocal(frame.read8()));
|
||||
stack.push(frame.local[frame.read8()]);
|
||||
break;
|
||||
case Bytecodes.LLOAD:
|
||||
case Bytecodes.DLOAD:
|
||||
stack.push2(frame.getLocal(frame.read8()));
|
||||
stack.push2(frame.local[frame.read8()]);
|
||||
break;
|
||||
case Bytecodes.ILOAD_0:
|
||||
case Bytecodes.ILOAD_1:
|
||||
case Bytecodes.ILOAD_2:
|
||||
case Bytecodes.ILOAD_3:
|
||||
stack.push(frame.getLocal(op - Bytecodes.ILOAD_0));
|
||||
stack.push(frame.local[op - Bytecodes.ILOAD_0]);
|
||||
break;
|
||||
case Bytecodes.FLOAD_0:
|
||||
case Bytecodes.FLOAD_1:
|
||||
case Bytecodes.FLOAD_2:
|
||||
case Bytecodes.FLOAD_3:
|
||||
stack.push(frame.getLocal(op - Bytecodes.FLOAD_0));
|
||||
stack.push(frame.local[op - Bytecodes.FLOAD_0]);
|
||||
break;
|
||||
case Bytecodes.ALOAD_0:
|
||||
case Bytecodes.ALOAD_1:
|
||||
case Bytecodes.ALOAD_2:
|
||||
case Bytecodes.ALOAD_3:
|
||||
stack.push(frame.getLocal(op - Bytecodes.ALOAD_0));
|
||||
stack.push(frame.local[op - Bytecodes.ALOAD_0]);
|
||||
break;
|
||||
case Bytecodes.LLOAD_0:
|
||||
case Bytecodes.LLOAD_1:
|
||||
case Bytecodes.LLOAD_2:
|
||||
case Bytecodes.LLOAD_3:
|
||||
stack.push2(frame.getLocal(op - Bytecodes.LLOAD_0));
|
||||
stack.push2(frame.local[op - Bytecodes.LLOAD_0]);
|
||||
break;
|
||||
case Bytecodes.DLOAD_0:
|
||||
case Bytecodes.DLOAD_1:
|
||||
case Bytecodes.DLOAD_2:
|
||||
case Bytecodes.DLOAD_3:
|
||||
stack.push2(frame.getLocal(op - Bytecodes.DLOAD_0));
|
||||
stack.push2(frame.local[op - Bytecodes.DLOAD_0]);
|
||||
break;
|
||||
case Bytecodes.IALOAD:
|
||||
case Bytecodes.FALOAD:
|
||||
|
@ -418,47 +418,47 @@ module J2ME {
|
|||
case Bytecodes.ISTORE:
|
||||
case Bytecodes.FSTORE:
|
||||
case Bytecodes.ASTORE:
|
||||
frame.setLocal(frame.read8(), stack.pop());
|
||||
frame.local[frame.read8()] = stack.pop();
|
||||
break;
|
||||
case Bytecodes.LSTORE:
|
||||
case Bytecodes.DSTORE:
|
||||
frame.setLocal(frame.read8(), stack.pop2());
|
||||
frame.local[frame.read8()] = stack.pop2();
|
||||
break;
|
||||
case Bytecodes.ISTORE_0:
|
||||
case Bytecodes.FSTORE_0:
|
||||
case Bytecodes.ASTORE_0:
|
||||
frame.setLocal(0, stack.pop());
|
||||
frame.local[0] = stack.pop();
|
||||
break;
|
||||
case Bytecodes.ISTORE_1:
|
||||
case Bytecodes.FSTORE_1:
|
||||
case Bytecodes.ASTORE_1:
|
||||
frame.setLocal(1, stack.pop());
|
||||
frame.local[1] = stack.pop();
|
||||
break;
|
||||
case Bytecodes.ISTORE_2:
|
||||
case Bytecodes.FSTORE_2:
|
||||
case Bytecodes.ASTORE_2:
|
||||
frame.setLocal(2, stack.pop());
|
||||
frame.local[2] = stack.pop();
|
||||
break;
|
||||
case Bytecodes.ISTORE_3:
|
||||
case Bytecodes.FSTORE_3:
|
||||
case Bytecodes.ASTORE_3:
|
||||
frame.setLocal(3, stack.pop());
|
||||
frame.local[3] = stack.pop();
|
||||
break;
|
||||
case Bytecodes.LSTORE_0:
|
||||
case Bytecodes.DSTORE_0:
|
||||
frame.setLocal(0, stack.pop2());
|
||||
frame.local[0] = stack.pop2();
|
||||
break;
|
||||
case Bytecodes.LSTORE_1:
|
||||
case Bytecodes.DSTORE_1:
|
||||
frame.setLocal(1, stack.pop2());
|
||||
frame.local[1] = stack.pop2();
|
||||
break;
|
||||
case Bytecodes.LSTORE_2:
|
||||
case Bytecodes.DSTORE_2:
|
||||
frame.setLocal(2, stack.pop2());
|
||||
frame.local[2] = stack.pop2();
|
||||
break;
|
||||
case Bytecodes.LSTORE_3:
|
||||
case Bytecodes.DSTORE_3:
|
||||
frame.setLocal(3, stack.pop2());
|
||||
frame.local[3] = stack.pop2();
|
||||
break;
|
||||
case Bytecodes.IASTORE:
|
||||
case Bytecodes.FASTORE:
|
||||
|
@ -551,12 +551,12 @@ module J2ME {
|
|||
case Bytecodes.IINC:
|
||||
index = frame.read8();
|
||||
value = frame.read8Signed();
|
||||
frame.incLocal(index, value);
|
||||
frame.local[index] += value | 0;
|
||||
break;
|
||||
case Bytecodes.IINC_GOTO:
|
||||
index = frame.read8();
|
||||
value = frame.read8Signed();
|
||||
frame.setLocal(index, frame.getLocal(index) + value);
|
||||
frame.local[index] += frame.local[index];
|
||||
frame.pc ++;
|
||||
frame.pc = frame.readTargetPC();
|
||||
break;
|
||||
|
@ -876,7 +876,7 @@ module J2ME {
|
|||
frame.pc = pc;
|
||||
break;
|
||||
case Bytecodes.RET:
|
||||
frame.pc = frame.getLocal(frame.read8());
|
||||
frame.pc = frame.local[frame.read8()];
|
||||
break;
|
||||
case Bytecodes.I2L:
|
||||
stack.push2(Long.fromInt(stack.pop()));
|
||||
|
@ -1066,7 +1066,7 @@ module J2ME {
|
|||
!calleeTargetMethodInfo.isSynchronized &&
|
||||
!calleeTargetMethodInfo.isNative &&
|
||||
calleeTargetMethodInfo.state !== MethodState.Compiled) {
|
||||
var calleeFrame = Frame.create(calleeTargetMethodInfo, [], 0);
|
||||
var calleeFrame = Frame.create(calleeTargetMethodInfo, []);
|
||||
ArrayUtilities.popManyInto(stack, calleeTargetMethodInfo.consumeArgumentSlots, calleeFrame.local);
|
||||
frames.push(calleeFrame);
|
||||
frame = calleeFrame;
|
||||
|
@ -1174,7 +1174,7 @@ module J2ME {
|
|||
}
|
||||
// Call method directly in the interpreter if we can.
|
||||
if (calleeTargetMethodInfo && !calleeTargetMethodInfo.isNative && calleeTargetMethodInfo.state !== MethodState.Compiled) {
|
||||
var calleeFrame = Frame.create(calleeTargetMethodInfo, [], 0);
|
||||
var calleeFrame = Frame.create(calleeTargetMethodInfo, []);
|
||||
ArrayUtilities.popManyInto(stack, calleeTargetMethodInfo.consumeArgumentSlots, calleeFrame.local);
|
||||
frames.push(calleeFrame);
|
||||
frame = calleeFrame;
|
||||
|
@ -1188,7 +1188,7 @@ module J2ME {
|
|||
if (!calleeFrame.lockObject) {
|
||||
frame.lockObject = calleeTargetMethodInfo.isStatic
|
||||
? calleeTargetMethodInfo.classInfo.getClassObject()
|
||||
: frame.getLocal(0);
|
||||
: frame.local[0];
|
||||
}
|
||||
ctx.monitorEnter(calleeFrame.lockObject);
|
||||
if (U === VMState.Pausing || U === VMState.Stopping) {
|
||||
|
|
|
@ -227,8 +227,6 @@ function AudioPlayer(playerContainer) {
|
|||
}
|
||||
}.bind(this));
|
||||
|
||||
/* @type HTMLAudioElement */
|
||||
this.audio = new Audio();
|
||||
this.paused = true;
|
||||
this.loaded = false;
|
||||
this.volume = 100;
|
||||
|
|
|
@ -79,7 +79,7 @@ function promptForMessageText() {
|
|||
|
||||
var text = minutes + ":";
|
||||
|
||||
if (seconds > 10) {
|
||||
if (seconds >= 10) {
|
||||
text += seconds;
|
||||
} else {
|
||||
text += "0" + seconds;
|
||||
|
|
|
@ -262,7 +262,7 @@ var TextEditorProvider = (function() {
|
|||
|
||||
// Replace <br> by \n so that textContent attribute doesn't
|
||||
// strip new lines.
|
||||
html = html.replace("<br>", "\n", "g");
|
||||
html = html.replace(/<br>/g, "\n");
|
||||
|
||||
// Convert the emoji images back to characters.
|
||||
// The original character is stored in the alt attribute of its
|
||||
|
@ -294,7 +294,7 @@ var TextEditorProvider = (function() {
|
|||
|
||||
setContent: function(content) {
|
||||
// Filter all the \r characters as we use \n.
|
||||
content = content.replace("\r", "", "g");
|
||||
content = content.replace(/\r/g, "");
|
||||
|
||||
this.content = content;
|
||||
|
||||
|
@ -322,7 +322,7 @@ var TextEditorProvider = (function() {
|
|||
}.bind(this);
|
||||
|
||||
// Replace "\n" by <br>
|
||||
html = html.replace("\n", "<br>", "g");
|
||||
html = html.replace(/\n/g, "<br>");
|
||||
|
||||
html = html.replace(emoji.regEx, toImg) + "<br>";
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ function asyncImpl(returnKind, promise) {
|
|||
}, function(exception) {
|
||||
var classInfo = CLASSES.getClass("org/mozilla/internal/Sys");
|
||||
var methodInfo = classInfo.getMethodByNameString("throwException", "(Ljava/lang/Exception;)V", true);
|
||||
ctx.frames.push(Frame.create(methodInfo, [exception], 0));
|
||||
ctx.frames.push(Frame.create(methodInfo, [exception]));
|
||||
ctx.execute();
|
||||
});
|
||||
$.pause("Async");
|
||||
|
@ -309,7 +309,7 @@ Native["java/lang/Class.invoke_clinit.()V"] = function() {
|
|||
var className = classInfo.getClassNameSlow();
|
||||
var clinit = classInfo.staticInitializer;
|
||||
if (clinit && clinit.classInfo.getClassNameSlow() === className) {
|
||||
$.ctx.executeFrame(Frame.create(clinit, [], 0));
|
||||
$.ctx.executeFrame(Frame.create(clinit, []));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -538,7 +538,7 @@ Native["java/lang/Thread.start0.()V"] = function() {
|
|||
|
||||
var classInfo = CLASSES.getClass("org/mozilla/internal/Sys");
|
||||
var run = classInfo.getMethodByNameString("runThread", "(Ljava/lang/Thread;)V", true);
|
||||
newCtx.start([new Frame(run, [ this ], 0)]);
|
||||
newCtx.start([Frame.create(run, [ this ])]);
|
||||
}
|
||||
|
||||
Native["java/lang/Thread.isAlive.()Z"] = function() {
|
||||
|
|
|
@ -49,12 +49,12 @@ javax/microedition/media/test.webm: gfx/images/red.png
|
|||
ffmpeg -loop 1 -i gfx/images/red.png -t 10 javax/microedition/media/test.webm
|
||||
|
||||
Testlets.java: $(SRCS) $(JASMIN_SRCS) Makefile
|
||||
echo "public class Testlets {" > $@
|
||||
echo " static String[] list = {" >> $@
|
||||
grep "implements Testlet" $(SRCS) | sed -e "s/^.\///" -e "s/\.java.*//" -e "s/\(.*\)/\"\1\",/" >> $@
|
||||
grep "implements gnu/testlet/Testlet" `find . -name "*.j"` | sed -e "s/^.\///" -e "s/\.j.*//" -e "s/\(.*\)/\"\1\",/" >> $@
|
||||
echo " null};" >> $@
|
||||
echo "};" >> $@
|
||||
@echo "public class Testlets {" > $@
|
||||
@echo " static String[] list = {" >> $@
|
||||
@grep "implements Testlet" $(SRCS) | sed -e "s/^.\///" -e "s/\.java.*//" -e "s/\(.*\)/\"\1\",/" >> $@
|
||||
@grep "implements gnu/testlet/Testlet" `find . -name "*.j"` | sed -e "s/^.\///" -e "s/\.j.*//" -e "s/\(.*\)/\"\1\",/" >> $@
|
||||
@echo " null};" >> $@
|
||||
@echo "};" >> $@
|
||||
|
||||
tests.jar: $(SRCS) $(JASMIN_SRCS) Testlets.java
|
||||
rm -rf build
|
||||
|
|
|
@ -51,7 +51,7 @@ var gfxTests = [
|
|||
{ name: "gfx/GetRGBDrawRGBxyTest", maxDifferentLinux: 0, maxDifferentMac: 0 },
|
||||
{ name: "gfx/GetRGBDrawRGBNoAlphaTest", maxDifferentLinux: 0, maxDifferentMac: 0, todo: true },
|
||||
{ name: "gfx/ClippingTest", maxDifferentLinux: 0, maxDifferentMac: 0 },
|
||||
{ name: "gfx/ImageProcessingTest", maxDifferentLinux: 5830, maxDifferentMac: 6466 },
|
||||
{ name: "gfx/ImageProcessingTest", maxDifferentLinux: 0, maxDifferentMac: 0 },
|
||||
{ name: "gfx/CreateImageWithRegionTest", maxDifferentLinux: 0, maxDifferentMac: 0 },
|
||||
{ name: "gfx/DrawSubstringTest", maxDifferentLinux: 205, maxDifferentMac: 295 },
|
||||
{ name: "gfx/DrawLineOffscreenCanvasTest", maxDifferentLinux: 0, maxDifferentMac: 788 },
|
||||
|
|
|
@ -139,7 +139,7 @@ public final class TestRunner {
|
|||
System.out.print(passed ? " passed (" : " failed (");
|
||||
System.out.print(description);
|
||||
System.out.println(")");
|
||||
if (testLog.length() > 0) {
|
||||
if (testLog.length() > 0 && !passed) {
|
||||
System.out.print("TESTLOG: ");
|
||||
System.out.println(testLog);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ImageProcessingTest extends MIDlet {
|
|||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
|
||||
if (image != null) {
|
||||
g.drawImage(image, 0, 0, Graphics.TOP | Graphics.LEFT);
|
||||
g.drawImage(image, 20, 20, Graphics.TOP | Graphics.LEFT);
|
||||
}
|
||||
System.out.println("PAINTED");
|
||||
}
|
||||
|
@ -45,12 +45,12 @@ public class ImageProcessingTest extends MIDlet {
|
|||
client.receive(msg);
|
||||
byte[] clientData = msg.getData();
|
||||
|
||||
FileConnection originalImage = (FileConnection)Connector.open("file:////test.jpg", Connector.READ_WRITE);
|
||||
FileConnection originalImage = (FileConnection)Connector.open("file:////test.png", Connector.READ_WRITE);
|
||||
if (!originalImage.exists()) {
|
||||
originalImage.create();
|
||||
}
|
||||
OutputStream os = originalImage.openDataOutputStream();
|
||||
InputStream is = getClass().getResourceAsStream("/org/mozilla/io/test.jpg");
|
||||
InputStream is = getClass().getResourceAsStream("/gfx/images/red.png");
|
||||
os.write(TestUtils.read(is));
|
||||
os.close();
|
||||
|
||||
|
@ -58,10 +58,10 @@ public class ImageProcessingTest extends MIDlet {
|
|||
dataEncoder.putStart(14, "event");
|
||||
dataEncoder.put(13, "name", "Scale");
|
||||
dataEncoder.put(2, "trans_id", 42);
|
||||
dataEncoder.put(11, "filename", "test.jpg");
|
||||
dataEncoder.put(11, "filename", "test.png");
|
||||
dataEncoder.putStart(15, "limits");
|
||||
dataEncoder.put(5, "max_hres", 100);
|
||||
dataEncoder.put(5, "max_vres", 100);
|
||||
dataEncoder.put(5, "max_hres", 70);
|
||||
dataEncoder.put(5, "max_vres", 40);
|
||||
dataEncoder.putEnd(15, "limits");
|
||||
dataEncoder.put(10, "aspect", "FullImage");
|
||||
dataEncoder.put(2, "quality", 80);
|
||||
|
|
Двоичные данные
tests/gfx/ImageProcessingTest.png
Двоичные данные
tests/gfx/ImageProcessingTest.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 17 KiB После Ширина: | Высота: | Размер: 1.0 KiB |
|
@ -79,7 +79,6 @@ module J2ME {
|
|||
pc: number;
|
||||
opPC: number;
|
||||
cp: any;
|
||||
localBase: number;
|
||||
lockObject: java.lang.Object;
|
||||
|
||||
static dirtyStack: Frame [] = [];
|
||||
|
@ -87,24 +86,24 @@ module J2ME {
|
|||
/**
|
||||
* Denotes the start of the context frame stack.
|
||||
*/
|
||||
static Start: Frame = Frame.create(null, null, 0);
|
||||
static Start: Frame = Frame.create(null, null);
|
||||
|
||||
/**
|
||||
* Marks a frame set.
|
||||
*/
|
||||
static Marker: Frame = Frame.create(null, null, 0);
|
||||
static Marker: Frame = Frame.create(null, null);
|
||||
|
||||
static isMarker(frame: Frame) {
|
||||
return frame.methodInfo === null;
|
||||
}
|
||||
|
||||
constructor(methodInfo: MethodInfo, local: any [], localBase: number) {
|
||||
constructor(methodInfo: MethodInfo, local: any []) {
|
||||
frameCount ++;
|
||||
this.stack = [];
|
||||
this.reset(methodInfo, local, localBase);
|
||||
this.reset(methodInfo, local);
|
||||
}
|
||||
|
||||
reset(methodInfo: MethodInfo, local: any [], localBase: number) {
|
||||
reset(methodInfo: MethodInfo, local: any []) {
|
||||
this.methodInfo = methodInfo;
|
||||
this.cp = methodInfo ? methodInfo.classInfo.constantPool : null;
|
||||
this.code = methodInfo ? methodInfo.codeAttribute.code : null;
|
||||
|
@ -112,18 +111,17 @@ module J2ME {
|
|||
this.opPC = 0;
|
||||
this.stack.length = 0;
|
||||
this.local = local;
|
||||
this.localBase = localBase;
|
||||
this.lockObject = null;
|
||||
}
|
||||
|
||||
static create(methodInfo: MethodInfo, local: any [], localBase: number): Frame {
|
||||
static create(methodInfo: MethodInfo, local: any []): Frame {
|
||||
var dirtyStack = Frame.dirtyStack;
|
||||
if (dirtyStack.length) {
|
||||
var frame = dirtyStack.pop();
|
||||
frame.reset(methodInfo, local, localBase);
|
||||
frame.reset(methodInfo, local);
|
||||
return frame;
|
||||
} else {
|
||||
return new Frame(methodInfo, local, localBase);
|
||||
return new Frame(methodInfo, local);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,17 +130,8 @@ module J2ME {
|
|||
Frame.dirtyStack.push(this);
|
||||
}
|
||||
|
||||
getLocal(i: number): any {
|
||||
return this.local[this.localBase + i];
|
||||
}
|
||||
|
||||
setLocal(i: number, value: any) {
|
||||
this.local[this.localBase + i] = value;
|
||||
}
|
||||
|
||||
incLocal(i: number, value: any) {
|
||||
var j = this.localBase + i;
|
||||
this.local[j] = this.local[j] + value | 0;
|
||||
this.local[i] += value | 0;
|
||||
}
|
||||
|
||||
read8(): number {
|
||||
|
@ -238,28 +227,28 @@ module J2ME {
|
|||
case Bytecodes.ILOAD:
|
||||
case Bytecodes.FLOAD:
|
||||
case Bytecodes.ALOAD:
|
||||
stack.push(this.getLocal(this.read16()));
|
||||
stack.push(this.local[this.read16()]);
|
||||
break;
|
||||
case Bytecodes.LLOAD:
|
||||
case Bytecodes.DLOAD:
|
||||
stack.push2(this.getLocal(this.read16()));
|
||||
stack.push2(this.local[this.read16()]);
|
||||
break;
|
||||
case Bytecodes.ISTORE:
|
||||
case Bytecodes.FSTORE:
|
||||
case Bytecodes.ASTORE:
|
||||
this.setLocal(this.read16(), stack.pop());
|
||||
this.local[this.read16()] = stack.pop();
|
||||
break;
|
||||
case Bytecodes.LSTORE:
|
||||
case Bytecodes.DSTORE:
|
||||
this.setLocal(this.read16(), stack.pop2());
|
||||
this.local[this.read16()] = stack.pop2();
|
||||
break;
|
||||
case Bytecodes.IINC:
|
||||
var index = this.read16();
|
||||
var value = this.read16Signed();
|
||||
this.setLocal(index, this.getLocal(index) + value);
|
||||
this.local[index] += value;
|
||||
break;
|
||||
case Bytecodes.RET:
|
||||
this.pc = this.getLocal(this.read16());
|
||||
this.pc = this.local[this.read16()];
|
||||
break;
|
||||
default:
|
||||
var opName = Bytecodes[op];
|
||||
|
@ -618,7 +607,7 @@ module J2ME {
|
|||
|
||||
bailout(methodInfo: MethodInfo, pc: number, nextPC: number, local: any [], stack: any [], lockObject: java.lang.Object) {
|
||||
// perfWriter && perfWriter.writeLn("C Unwind: " + methodInfo.implKey);
|
||||
var frame = Frame.create(methodInfo, local, 0);
|
||||
var frame = Frame.create(methodInfo, local);
|
||||
frame.stack = stack;
|
||||
frame.pc = nextPC;
|
||||
frame.opPC = pc;
|
||||
|
|
|
@ -38,9 +38,9 @@ module J2ME {
|
|||
|
||||
// The <init> frames go at the end of the array so they are executed first to initialize the thread and isolate.
|
||||
ctx.start([
|
||||
Frame.create(isolateClassInfo.getMethodByNameString("start", "()V"), [ isolate ], 0),
|
||||
Frame.create(isolateClassInfo.getMethodByNameString("start", "()V"), [ isolate ]),
|
||||
Frame.create(isolateClassInfo.getMethodByNameString("<init>", "(Ljava/lang/String;[Ljava/lang/String;)V"),
|
||||
[ isolate, J2ME.newString(className.replace(/\./g, "/")), array ], 0)
|
||||
[ isolate, J2ME.newString(className.replace(/\./g, "/")), array ])
|
||||
]);
|
||||
release || Debug.assert(!U, "Unexpected unwind during isolate initialization.");
|
||||
}
|
||||
|
@ -70,9 +70,9 @@ module J2ME {
|
|||
}
|
||||
|
||||
ctx.start([
|
||||
Frame.create(entryPoint, [ args ], 0),
|
||||
Frame.create(entryPoint, [ args ]),
|
||||
Frame.create(CLASSES.java_lang_Thread.getMethodByNameString("<init>", "(Ljava/lang/String;)V"),
|
||||
[ runtime.mainThread, J2ME.newString("main") ], 0)
|
||||
[ runtime.mainThread, J2ME.newString("main") ])
|
||||
]);
|
||||
release || Debug.assert(!U, "Unexpected unwind during isolate initialization.");
|
||||
}
|
||||
|
|
|
@ -1273,14 +1273,14 @@ module J2ME {
|
|||
// Adapter for the most common case.
|
||||
if (!methodInfo.isSynchronized && !methodInfo.hasTwoSlotArguments) {
|
||||
var method = function fastInterpreterFrameAdapter() {
|
||||
var frame = Frame.create(methodInfo, [], 0);
|
||||
var frame = Frame.create(methodInfo, []);
|
||||
var j = 0;
|
||||
if (!methodInfo.isStatic) {
|
||||
frame.setLocal(j++, this);
|
||||
frame.local[j++] = this;
|
||||
}
|
||||
var slots = methodInfo.argumentSlots;
|
||||
for (var i = 0; i < slots; i++) {
|
||||
frame.setLocal(j++, arguments[i]);
|
||||
frame.local[j++] = arguments[i];
|
||||
}
|
||||
return $.ctx.executeFrame(frame);
|
||||
};
|
||||
|
@ -1289,25 +1289,25 @@ module J2ME {
|
|||
}
|
||||
|
||||
var method = function interpreterFrameAdapter() {
|
||||
var frame = Frame.create(methodInfo, [], 0);
|
||||
var frame = Frame.create(methodInfo, []);
|
||||
var j = 0;
|
||||
if (!methodInfo.isStatic) {
|
||||
frame.setLocal(j++, this);
|
||||
frame.local[j++] = this;
|
||||
}
|
||||
var signatureKinds = methodInfo.signatureKinds;
|
||||
release || assert (arguments.length === signatureKinds.length - 1,
|
||||
"Number of adapter frame arguments (" + arguments.length + ") does not match signature descriptor.");
|
||||
for (var i = 1; i < signatureKinds.length; i++) {
|
||||
frame.setLocal(j++, arguments[i - 1]);
|
||||
frame.local[j++] = arguments[i - 1];
|
||||
if (isTwoSlot(signatureKinds[i])) {
|
||||
frame.setLocal(j++, null);
|
||||
frame.local[j++] = null;
|
||||
}
|
||||
}
|
||||
if (methodInfo.isSynchronized) {
|
||||
if (!frame.lockObject) {
|
||||
frame.lockObject = methodInfo.isStatic
|
||||
? methodInfo.classInfo.getClassObject()
|
||||
: frame.getLocal(0);
|
||||
: frame.local[0];
|
||||
}
|
||||
$.ctx.monitorEnter(frame.lockObject);
|
||||
if (U === VMState.Pausing) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче