From 7fff53cf33fe3c9c8547256cf3d8e38d389d368b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 28 Mar 2015 23:50:52 -0700 Subject: [PATCH] Remove experimental flag to cache for-of length checks. --- Jakefile | 2 +- src/compiler/commandLineParser.ts | 6 ------ src/compiler/emitter.ts | 19 ++----------------- src/compiler/types.ts | 1 - 4 files changed, 3 insertions(+), 25 deletions(-) diff --git a/Jakefile b/Jakefile index dd09085800cae..8f3bdffaa5d56 100644 --- a/Jakefile +++ b/Jakefile @@ -254,7 +254,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu options += " --stripInternal" } - options += " --cacheDownlevelForOfLength --preserveNewLines"; + options += " --preserveNewLines"; var cmd = host + " " + dir + compilerFilename + " " + options + " "; cmd = cmd + sources.join(" "); diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 269f23492e20c..e79d762524c12 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -146,12 +146,6 @@ module ts { description: Diagnostics.Preserve_new_lines_when_emitting_code, experimental: true }, - { - name: "cacheDownlevelForOfLength", - type: "boolean", - description: "Cache length access when downlevel emitting for-of statements", - experimental: true, - }, { name: "target", shortName: "t", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 71a3543268563..249651def2fbf 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2168,8 +2168,6 @@ module ts { let counter = createTempVariable(TempFlags._i); let rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(TempFlags.Auto); - var cachedLength = compilerOptions.cacheDownlevelForOfLength ? createTempVariable(TempFlags._n) : undefined; - // This is the let keyword for the counter and rhsReference. The let keyword for // the LHS will be emitted inside the body. emitStart(node.expression); @@ -2190,14 +2188,6 @@ module ts { emitEnd(node.expression); } - if (cachedLength) { - write(", "); - emitNodeWithoutSourceMap(cachedLength); - write(" = "); - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } - write("; "); // _i < _a.length; @@ -2205,13 +2195,8 @@ module ts { emitNodeWithoutSourceMap(counter); write(" < "); - if (cachedLength) { - emitNodeWithoutSourceMap(cachedLength); - } - else { - emitNodeWithoutSourceMap(rhsReference); - write(".length"); - } + emitNodeWithoutSourceMap(rhsReference); + write(".length"); emitEnd(node.initializer); write("; "); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index e5697f9f37239..892f51d990630 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1589,7 +1589,6 @@ module ts { watch?: boolean; /* @internal */ stripInternal?: boolean; /* @internal */ preserveNewLines?: boolean; - /* @internal */ cacheDownlevelForOfLength?: boolean; [option: string]: string | number | boolean; }