summaryrefslogtreecommitdiffstats
path: root/compiler/utils
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils')
-rw-r--r--compiler/utils/growable_array.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/utils/growable_array.h b/compiler/utils/growable_array.h
index b59187032e..82b6a607e7 100644
--- a/compiler/utils/growable_array.h
+++ b/compiler/utils/growable_array.h
@@ -161,6 +161,18 @@ class GrowableArray {
size_t Size() const { return num_used_; }
+ bool IsEmpty() const { return num_used_ == 0; }
+
+ T Pop() {
+ DCHECK_GE(num_used_, (size_t)0);
+ return elem_list_[--num_used_];
+ }
+
+ T Peek() const {
+ DCHECK_GE(num_used_, (size_t)0);
+ return elem_list_[num_used_ - 1];
+ }
+
void SetSize(size_t new_size) {
Resize(new_size);
num_used_ = new_size;