summaryrefslogtreecommitdiff
path: root/deps/v8/src/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/utils.h')
-rw-r--r--deps/v8/src/utils.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/deps/v8/src/utils.h b/deps/v8/src/utils.h
index dc3a171c8d..e03f96f6e5 100644
--- a/deps/v8/src/utils.h
+++ b/deps/v8/src/utils.h
@@ -862,7 +862,11 @@ class EmbeddedContainer {
public:
EmbeddedContainer() : elems_() { }
- int length() { return NumElements; }
+ int length() const { return NumElements; }
+ const ElementType& operator[](int i) const {
+ ASSERT(i < length());
+ return elems_[i];
+ }
ElementType& operator[](int i) {
ASSERT(i < length());
return elems_[i];
@@ -876,7 +880,12 @@ class EmbeddedContainer {
template<typename ElementType>
class EmbeddedContainer<ElementType, 0> {
public:
- int length() { return 0; }
+ int length() const { return 0; }
+ const ElementType& operator[](int i) const {
+ UNREACHABLE();
+ static ElementType t = 0;
+ return t;
+ }
ElementType& operator[](int i) {
UNREACHABLE();
static ElementType t = 0;
@@ -974,7 +983,7 @@ class EnumSet {
T Mask(E element) const {
// The strange typing in ASSERT is necessary to avoid stupid warnings, see:
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43680
- ASSERT(element < static_cast<int>(sizeof(T) * CHAR_BIT));
+ ASSERT(static_cast<int>(element) < static_cast<int>(sizeof(T) * CHAR_BIT));
return 1 << element;
}