Permalink
Browse files

Don't compile static and script initializers.

  • Loading branch information...
1 parent 7e75d5d commit b0bca5631f0c5e5c5b58ca706b920fcd9bf5ee17 @mbebenita committed Apr 7, 2013
Showing with 6 additions and 0 deletions.
  1. +2 −0 src/avm2/parser.js
  2. +4 −0 src/avm2/runtime.js
View
@@ -1177,6 +1177,7 @@ var ClassInfo = (function () {
function classInfo(abc, instanceInfo, stream) {
this.id = nextID ++;
this.init = abc.methods[stream.readU30()];
+ this.init.isClassInitializer = true;
attachHolder(this.init, this);
this.traits = parseTraits(abc, stream, this);
this.instanceInfo = instanceInfo;
@@ -1196,6 +1197,7 @@ var ScriptInfo = (function scriptInfo() {
this.abc = abc;
this.name = abc.name + "$script" + idx;
this.init = abc.methods[stream.readU30()];
+ this.init.isScriptInitializer = true;
attachHolder(this.init, this);
this.traits = parseTraits(abc, stream, this);
this.traits.verified = true;
View
@@ -883,6 +883,10 @@ var Runtime = (function () {
} else if (mi.code.length > compilerMaximumMethodSize.value) {
return false;
}
+ // Don't compile class and script initializers since they only run once.
+ if (mi.isClassInitializer || mi.isScriptInitializer) {
+ return false;
+ }
return true;
}

0 comments on commit b0bca56

Please sign in to comment.