Index: src/ast/compile-time-value.cc |
diff --git a/src/ast/compile-time-value.cc b/src/ast/compile-time-value.cc |
index 27dd29fee0a75af04e951f4f35e68fb1c46c63b2..b86343d059f223b11f88da62fddb3edb53d23a08 100644 |
--- a/src/ast/compile-time-value.cc |
+++ b/src/ast/compile-time-value.cc |
@@ -24,28 +24,24 @@ Handle<FixedArray> CompileTimeValue::GetValue(Isolate* isolate, |
Factory* factory = isolate->factory(); |
DCHECK(IsCompileTimeValue(expression)); |
Handle<FixedArray> result = factory->NewFixedArray(2, TENURED); |
- ObjectLiteral* object_literal = expression->AsObjectLiteral(); |
- if (object_literal != NULL) { |
+ if (expression->IsObjectLiteral()) { |
+ ObjectLiteral* object_literal = expression->AsObjectLiteral(); |
DCHECK(object_literal->is_simple()); |
- if (object_literal->fast_elements()) { |
- result->set(kLiteralTypeSlot, Smi::FromInt(OBJECT_LITERAL_FAST_ELEMENTS)); |
- } else { |
- result->set(kLiteralTypeSlot, Smi::FromInt(OBJECT_LITERAL_SLOW_ELEMENTS)); |
- } |
+ int literalTypeFlag = object_literal->EncodeLiteralType(); |
+ DCHECK_NE(kArrayLiteralFlag, literalTypeFlag); |
+ result->set(kLiteralTypeSlot, Smi::FromInt(literalTypeFlag)); |
result->set(kElementsSlot, *object_literal->constant_properties()); |
} else { |
ArrayLiteral* array_literal = expression->AsArrayLiteral(); |
DCHECK(array_literal != NULL && array_literal->is_simple()); |
- result->set(kLiteralTypeSlot, Smi::FromInt(ARRAY_LITERAL)); |
+ result->set(kLiteralTypeSlot, Smi::FromInt(kArrayLiteralFlag)); |
result->set(kElementsSlot, *array_literal->constant_elements()); |
} |
return result; |
} |
-CompileTimeValue::LiteralType CompileTimeValue::GetLiteralType( |
- Handle<FixedArray> value) { |
- Smi* literal_type = Smi::cast(value->get(kLiteralTypeSlot)); |
- return static_cast<LiteralType>(literal_type->value()); |
+int CompileTimeValue::GetLiteralTypeFlags(Handle<FixedArray> value) { |
+ return Smi::cast(value->get(kLiteralTypeSlot))->value(); |
} |
Handle<HeapObject> CompileTimeValue::GetElements(Handle<FixedArray> value) { |