diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-03 21:34:35 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-03 21:34:35 -0800 |
commit | f5e40d8bc62ea6e970777a3155c7c272ae626d2c (patch) | |
tree | edd2f41bca01d6519f980138c8e5174fe3cd497b | |
parent | 122b5bba34dd024a54b790caf5aabeec42a779d3 (diff) |
optimize type analysis loop
-rw-r--r-- | src/analyzer.js | 9 |
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) { |