change ordering of functions a bit

This commit is contained in:
Andreas Gal 2014-07-25 13:09:49 -07:00
Родитель 72f91a6a1a
Коммит de6deb1935
1 изменённых файлов: 27 добавлений и 31 удалений

Просмотреть файл

@ -29,17 +29,6 @@ Context.prototype.popFrame = function() {
return caller;
}
Context.prototype.run = function(stopFrame) {
while (this.current() !== stopFrame) {
try {
VM.execute(this);
} catch (e) {
if (e !== VM.Yield)
throw e;
}
}
}
Context.prototype.monitorEnter = function(obj) {
var lock = obj.lock;
if (!lock) {
@ -69,9 +58,20 @@ Context.prototype.monitorLeave = function(obj) {
window.setZeroTimeout(VM.execute.bind(null, waiters[n]));
}
Context.prototype.raiseException = function(className, message) {
this.pushExceptionFrame(className, message);
throw VM.Yield;
Context.prototype.pushClassInitFrame = function(classInfo) {
if (classInfo.initialized)
return;
if (classInfo.superClass)
this.pushClassInitFrame(classInfo.superClass);
classInfo.initialized = true;
classInfo.staticFields = {};
classInfo.constructor = function () {
}
classInfo.constructor.prototype.class = classInfo;
var clinit = CLASSES.getMethod(classInfo, "<clinit>", "()V", true, false);
if (!clinit)
return;
this.pushFrame(clinit, 0);
}
Context.prototype.backTrace = function() {
@ -107,23 +107,7 @@ Context.prototype.backTrace = function() {
return stack.join("\n");
}
Context.prototype.pushClassInitFrame = function(classInfo) {
if (classInfo.initialized)
return;
if (classInfo.superClass)
this.pushClassInitFrame(classInfo.superClass);
classInfo.initialized = true;
classInfo.staticFields = {};
classInfo.constructor = function () {
}
classInfo.constructor.prototype.class = classInfo;
var clinit = CLASSES.getMethod(classInfo, "<clinit>", "()V", true, false);
if (!clinit)
return;
this.pushFrame(clinit, 0);
}
Context.prototype.pushExceptionFrame = function(className, message) {
Context.prototype.raiseException = function(className, message) {
if (!message)
message = "";
message = "" + message;
@ -149,6 +133,7 @@ Context.prototype.pushExceptionFrame = function(className, message) {
],
};
this.pushFrame(syntheticMethod, 0);
throw VM.Yield;
}
Context.prototype.newString = function(s) {
@ -162,3 +147,14 @@ Context.prototype.newString = function(s) {
obj["java/lang/String$count"] = length;
return obj;
}
Context.prototype.run = function(stopFrame) {
while (this.current() !== stopFrame) {
try {
VM.execute(this);
} catch (e) {
if (e !== VM.Yield)
throw e;
}
}
}