Inline frequently called Object initializer.

This commit is contained in:
Michael Bebenita 2015-01-21 16:51:48 -08:00
Родитель f298163226
Коммит 032f6ab6e1
2 изменённых файлов: 18 добавлений и 0 удалений

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

@ -1147,6 +1147,13 @@ module J2ME {
// Resolve method and do the class init check if necessary.
var calleeMethodInfo = resolveMethod(index, mi.classInfo, isStatic);
// Fast path for some of the most common interpreter call targets.
if (calleeMethodInfo.implKey === "java/lang/Object.<init>.()V") {
stack.pop();
continue;
}
if (isStatic) {
classInitCheck(calleeMethodInfo.classInfo, lastPC);
if (U) {

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

@ -12,6 +12,13 @@ module J2ME {
export var baselineCounter = null; // new Metrics.Counter(true);
/**
* Expressions to inline for commonly invoked methods.
*/
var inlineMethods = {
"java/lang/Object.<init>.()V": "undefined"
};
/**
* Detects common control flow patterns and tries to emit "if" statements
* whenever possible.
@ -650,6 +657,10 @@ module J2ME {
} else {
call = mangleClassAndMethod(methodInfo) + "(" + args.join(", ") + ")";
}
if (methodInfo.implKey in inlineMethods) {
emitDebugInfoComments && this.emitter.writeLn("// Inlining: " + methodInfo.implKey);
call = inlineMethods[methodInfo.implKey];
}
this.needsVariable("re");
this.emitter.writeLn("re = " + call + ";");
if (calleeCanYield) {