зеркало из https://github.com/mozilla/pluotsorbet.git
Inline frequently called Object initializer.
This commit is contained in:
Родитель
f298163226
Коммит
032f6ab6e1
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче