Don't check if vfc/vmc are set, because now they're set for all classes. Fixes #342.

This commit is contained in:
Marco Castelluccio 2014-09-25 19:20:57 -07:00
Родитель de7ec4104d
Коммит 10b9bb3b90
2 изменённых файлов: 6 добавлений и 20 удалений

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

@ -141,7 +141,7 @@ Classes.prototype.initPrimitiveArrayType = function(typeName, constructor) {
Classes.prototype.getField = function(classInfo, fieldName, signature, staticFlag) {
var fieldKey = ~~!!staticFlag + "." + fieldName + "." + signature;
if (classInfo.vfc && classInfo.vfc[fieldKey]) {
if (classInfo.vfc[fieldKey]) {
return classInfo.vfc[fieldKey];
}
@ -153,10 +153,7 @@ Classes.prototype.getField = function(classInfo, fieldName, signature, staticFla
field.key = ~~(ACCESS_FLAGS.isStatic(field.access_flags)) + "." + field.name + "." + field.signature;
}
if (field.key === fieldKey) {
if (classInfo.vfc) {
classInfo.vfc[fieldKey] = field;
}
return field;
return classInfo.vfc[fieldKey] = field;
}
}
@ -164,10 +161,7 @@ Classes.prototype.getField = function(classInfo, fieldName, signature, staticFla
for (var n = 0; n < classInfo.interfaces.length; ++n) {
var field = this.getField(classInfo.interfaces[n], fieldName, signature, staticFlag);
if (field) {
if (classInfo.vfc) {
classInfo.vfc[fieldKey] = field;
}
return field;
return classInfo.vfc[fieldKey] = field;
}
}
}
@ -187,11 +181,7 @@ Classes.prototype.getMethod = function(classInfo, methodKey) {
method.key = ~~(ACCESS_FLAGS.isStatic(method.access_flags)) + "." + method.name + "." + method.signature;
}
if (method.key === methodKey) {
if (classInfo.vmc) {
classInfo.vmc[methodKey] = method;
}
return method;
return classInfo.vmc[methodKey] = method;
}
}
c = c.superClass;
@ -201,11 +191,7 @@ Classes.prototype.getMethod = function(classInfo, methodKey) {
for (var n = 0; n < classInfo.interfaces.length; ++n) {
var method = this.getMethod(classInfo.interfaces[n], methodKey);
if (method) {
if (classInfo.vmc) {
classInfo.vmc[methodKey] = method;
}
return method;
return classInfo.vmc[methodKey] = method;
}
}
}

2
vm.js
Просмотреть файл

@ -1042,7 +1042,7 @@ VM.execute = function(ctx) {
}
// Check if the method is already in the virtual method cache
if (obj.class.vmc && obj.class.vmc[methodInfo.key]) {
if (obj.class.vmc[methodInfo.key]) {
methodInfo = obj.class.vmc[methodInfo.key];
} else {
methodInfo = CLASSES.getMethod(obj.class, methodInfo.key);