1222 final DebugLogger log = getLogger(Compiler.class);
1223 if (log.isEnabled()) {
1224 log.fine(new RuntimeEvent<>(Level.INFO, source), "Code cache hit for ", source, " avoiding recompile.");
1225 }
1226 return script;
1227 }
1228
1229 StoredScript storedScript = null;
1230 FunctionNode functionNode = null;
1231 // Don't use code store if optimistic types is enabled but lazy compilation is not.
1232 // This would store a full script compilation with many wrong optimistic assumptions that would
1233 // do more harm than good on later runs with both optimistic types and lazy compilation enabled.
1234 final boolean useCodeStore = codeStore != null && !env._parse_only && (!env._optimistic_types || env._lazy_compilation);
1235 final String cacheKey = useCodeStore ? CodeStore.getCacheKey("script", null) : null;
1236
1237 if (useCodeStore) {
1238 storedScript = codeStore.load(source, cacheKey);
1239 }
1240
1241 if (storedScript == null) {
1242 functionNode = new Parser(env, source, errMan, strict, getLogger(Parser.class)).parse();
1243
1244 if (errMan.hasErrors()) {
1245 return null;
1246 }
1247
1248 if (env._print_ast || functionNode.getFlag(FunctionNode.IS_PRINT_AST)) {
1249 getErr().println(new ASTWriter(functionNode));
1250 }
1251
1252 if (env._print_parse || functionNode.getFlag(FunctionNode.IS_PRINT_PARSE)) {
1253 getErr().println(new PrintVisitor(functionNode, true, false));
1254 }
1255 }
1256
1257 if (env._parse_only) {
1258 return null;
1259 }
1260
1261 final URL url = source.getURL();
|
1222 final DebugLogger log = getLogger(Compiler.class);
1223 if (log.isEnabled()) {
1224 log.fine(new RuntimeEvent<>(Level.INFO, source), "Code cache hit for ", source, " avoiding recompile.");
1225 }
1226 return script;
1227 }
1228
1229 StoredScript storedScript = null;
1230 FunctionNode functionNode = null;
1231 // Don't use code store if optimistic types is enabled but lazy compilation is not.
1232 // This would store a full script compilation with many wrong optimistic assumptions that would
1233 // do more harm than good on later runs with both optimistic types and lazy compilation enabled.
1234 final boolean useCodeStore = codeStore != null && !env._parse_only && (!env._optimistic_types || env._lazy_compilation);
1235 final String cacheKey = useCodeStore ? CodeStore.getCacheKey("script", null) : null;
1236
1237 if (useCodeStore) {
1238 storedScript = codeStore.load(source, cacheKey);
1239 }
1240
1241 if (storedScript == null) {
1242 if (env._dest_dir != null) {
1243 source.dump(env._dest_dir);
1244 }
1245
1246 functionNode = new Parser(env, source, errMan, strict, getLogger(Parser.class)).parse();
1247
1248 if (errMan.hasErrors()) {
1249 return null;
1250 }
1251
1252 if (env._print_ast || functionNode.getFlag(FunctionNode.IS_PRINT_AST)) {
1253 getErr().println(new ASTWriter(functionNode));
1254 }
1255
1256 if (env._print_parse || functionNode.getFlag(FunctionNode.IS_PRINT_PARSE)) {
1257 getErr().println(new PrintVisitor(functionNode, true, false));
1258 }
1259 }
1260
1261 if (env._parse_only) {
1262 return null;
1263 }
1264
1265 final URL url = source.getURL();
|