diff options
author | Michajlo Matijkiw <michajlo@google.com> | 2015-12-07 15:51:18 +0000 |
---|---|---|
committer | David Chen <dzc@google.com> | 2015-12-07 21:20:09 +0000 |
commit | 8f15a51ef6c3ff0353d5e4537caa51e9f7b89a19 (patch) | |
tree | f1d71ed2714acd00c631099be7f9f44f208b8f47 /src/main/java/com/google/devtools/build/lib | |
parent | 371cb717b58335634295f69ad8c7962223d108f5 (diff) |
Avoid autoboxing on potential hot paths in LineNumberTable
We wind up hitting this code path each time we call a user defined function
to calculate a pretty string for profiling purposes.
--
MOS_MIGRATED_REVID=109580385
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/syntax/LineNumberTable.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/LineNumberTable.java b/src/main/java/com/google/devtools/build/lib/syntax/LineNumberTable.java index 5b7b395f1d..57ff2f9f5a 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/LineNumberTable.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/LineNumberTable.java @@ -110,7 +110,9 @@ public abstract class LineNumberTable implements Serializable { } private int getLineAt(int offset) { - Preconditions.checkArgument(offset >= 0, "Illegal position: ", offset); + if (offset < 0) { + throw new IllegalStateException("Illegal position: " + offset); + } int lowBoundary = 1, highBoundary = linestart.length - 1; while (true) { if ((highBoundary - lowBoundary) <= 1) { @@ -228,7 +230,9 @@ public abstract class LineNumberTable implements Serializable { } private SingleHashLine getHashLine(int offset) { - Preconditions.checkArgument(offset >= 0, "Illegal position: ", offset); + if (offset < 0) { + throw new IllegalStateException("Illegal position: " + offset); + } int binarySearchIndex = hashOrdering.binarySearch( table, new SingleHashLine(offset, -1, null)); if (binarySearchIndex >= 0) { |