aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-03 21:34:35 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-03 21:34:35 -0800
commitf5e40d8bc62ea6e970777a3155c7c272ae626d2c (patch)
treeedd2f41bca01d6519f980138c8e5174fe3cd497b
parent122b5bba34dd024a54b790caf5aabeec42a779d3 (diff)
optimize type analysis loop
-rw-r--r--src/analyzer.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 677b61b0..526d0249 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -206,8 +206,9 @@ function analyzer(data) {
var more = true;
while (more) {
more = false;
- values(types).forEach(function(type) {
- if (type.flatIndexes) return;
+ for (var typeName in types) {
+ var type = types[typeName];
+ if (type.flatIndexes) continue;
var ready = true;
type.fields.forEach(function(field) {
if (isStructType(field)) {
@@ -223,14 +224,14 @@ function analyzer(data) {
});
if (!ready) {
more = true;
- return;
+ continue;
}
Runtime.calculateStructAlignment(type);
if (dcheck('types')) dprint('type (fat=' + !!fatTypes + '): ' + type.name_ + ' : ' + JSON.stringify(type.fields));
if (dcheck('types')) dprint(' has final size of ' + type.flatSize + ', flatting: ' + type.needsFlattening + ' ? ' + (type.flatFactor ? type.flatFactor : JSON.stringify(type.flatIndexes)));
- });
+ }
}
if (QUANTUM_SIZE === 1 && !fatTypes) {