Skip to content

Commit e457f82

Browse files
committed
Remove extra "parser.profiling.print" flag and move printing out of finally block.
1 parent c69d8da commit e457f82

File tree

1 file changed

+9
-11
lines changed
  • graal-js/src/com.oracle.js.parser/src/com/oracle/js/parser

1 file changed

+9
-11
lines changed

graal-js/src/com.oracle.js.parser/src/com/oracle/js/parser/Parser.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,7 @@ public class Parser extends AbstractParser {
370370
*/
371371
private ParserContextFunctionNode coverArrowFunction;
372372

373-
public static final boolean PROFILE_PARSING = Options.getBooleanProperty("parser.profiling", false);
374-
public static final boolean PROFILE_PARSING_PRINT = Options.getBooleanProperty("parser.profiling.print", true);
373+
private static final boolean PROFILE_PARSING = Options.getBooleanProperty("parser.profiling", false);
375374

376375
/**
377376
* Constructor
@@ -520,24 +519,23 @@ private TokenType lookaheadNoLineTerminator() {
520519
*/
521520
public FunctionNode parse(final TruffleString scriptName, final int startPos, final int len, final int reparseFlags, Scope parentScope, List<String> argumentNames) {
522521
long startTime = PROFILE_PARSING ? System.nanoTime() : 0L;
522+
FunctionNode program;
523523
try {
524524
prepareLexer(startPos, len);
525525

526526
scanFirstToken();
527527

528-
return program(scriptName, reparseFlags, parentScope, argumentNames);
528+
program = program(scriptName, reparseFlags, parentScope, argumentNames);
529529
} catch (final Exception e) {
530530
handleParseException(e);
531531

532-
return null;
533-
} finally {
534-
if (PROFILE_PARSING) {
535-
long duration = (System.nanoTime() - startTime);
536-
if (PROFILE_PARSING_PRINT) {
537-
System.out.println("Parsing: " + duration / 1_000_000);
538-
}
539-
}
532+
program = null;
533+
}
534+
if (PROFILE_PARSING) {
535+
long duration = (System.nanoTime() - startTime);
536+
System.out.println("Parsing: " + duration / 1_000_000);
540537
}
538+
return program;
541539
}
542540

543541
/**

0 commit comments

Comments
 (0)