Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(968)

Unified Diff: src/runtime.cc

Issue 7849017: Mechanical refactor to move ElementsKind type out of JSObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: latest changes Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | src/stub-cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 95a24f0ef2ef79ce3af505f3444d920267874fa0..44ab519ce3668c32c443e18ba1af7dec19a95523 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -177,7 +177,7 @@ MUST_USE_RESULT static MaybeObject* DeepCopyBoilerplate(Isolate* isolate,
// Pixel elements cannot be created using an object literal.
ASSERT(!copy->HasExternalArrayElements());
switch (copy->GetElementsKind()) {
- case JSObject::FAST_ELEMENTS: {
+ case FAST_ELEMENTS: {
FixedArray* elements = FixedArray::cast(copy->elements());
if (elements->map() == heap->fixed_cow_array_map()) {
isolate->counters()->cow_arrays_created_runtime()->Increment();
@@ -201,7 +201,7 @@ MUST_USE_RESULT static MaybeObject* DeepCopyBoilerplate(Isolate* isolate,
}
break;
}
- case JSObject::DICTIONARY_ELEMENTS: {
+ case DICTIONARY_ELEMENTS: {
NumberDictionary* element_dictionary = copy->element_dictionary();
int capacity = element_dictionary->Capacity();
for (int i = 0; i < capacity; i++) {
@@ -220,19 +220,19 @@ MUST_USE_RESULT static MaybeObject* DeepCopyBoilerplate(Isolate* isolate,
}
break;
}
- case JSObject::NON_STRICT_ARGUMENTS_ELEMENTS:
+ case NON_STRICT_ARGUMENTS_ELEMENTS:
UNIMPLEMENTED();
break;
- case JSObject::EXTERNAL_PIXEL_ELEMENTS:
- case JSObject::EXTERNAL_BYTE_ELEMENTS:
- case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
- case JSObject::EXTERNAL_SHORT_ELEMENTS:
- case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
- case JSObject::EXTERNAL_INT_ELEMENTS:
- case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS:
- case JSObject::EXTERNAL_FLOAT_ELEMENTS:
- case JSObject::EXTERNAL_DOUBLE_ELEMENTS:
- case JSObject::FAST_DOUBLE_ELEMENTS:
+ case EXTERNAL_PIXEL_ELEMENTS:
+ case EXTERNAL_BYTE_ELEMENTS:
+ case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
+ case EXTERNAL_SHORT_ELEMENTS:
+ case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
+ case EXTERNAL_INT_ELEMENTS:
+ case EXTERNAL_UNSIGNED_INT_ELEMENTS:
+ case EXTERNAL_FLOAT_ELEMENTS:
+ case EXTERNAL_DOUBLE_ELEMENTS:
+ case FAST_DOUBLE_ELEMENTS:
// No contained objects, nothing to do.
break;
}
@@ -4300,8 +4300,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) {
Handle<NumberDictionary> extended_dictionary =
NumberDictionarySet(dictionary, index, obj_value, details);
if (*extended_dictionary != *dictionary) {
- if (js_object->GetElementsKind() ==
- JSObject::NON_STRICT_ARGUMENTS_ELEMENTS) {
+ if (js_object->GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) {
FixedArray::cast(js_object->elements())->set(1, *extended_dictionary);
} else {
js_object->set_elements(*extended_dictionary);
@@ -7770,7 +7769,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewArgumentsFast) {
Handle<Map> old_map(result->map());
Handle<Map> new_map =
isolate->factory()->CopyMapDropTransitions(old_map);
- new_map->set_elements_kind(JSObject::NON_STRICT_ARGUMENTS_ELEMENTS);
+ new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS);
result->set_map(*new_map);
result->set_elements(*parameter_map);
@@ -9468,7 +9467,7 @@ static uint32_t EstimateElementCount(Handle<JSArray> array) {
uint32_t length = static_cast<uint32_t>(array->length()->Number());
int element_count = 0;
switch (array->GetElementsKind()) {
- case JSObject::FAST_ELEMENTS: {
+ case FAST_ELEMENTS: {
// Fast elements can't have lengths that are not representable by
// a 32-bit signed integer.
ASSERT(static_cast<int32_t>(FixedArray::kMaxLength) >= 0);
@@ -9479,7 +9478,7 @@ static uint32_t EstimateElementCount(Handle<JSArray> array) {
}
break;
}
- case JSObject::DICTIONARY_ELEMENTS: {
+ case DICTIONARY_ELEMENTS: {
Handle<NumberDictionary> dictionary(
NumberDictionary::cast(array->elements()));
int capacity = dictionary->Capacity();
@@ -9555,9 +9554,9 @@ static int compareUInt32(const uint32_t* ap, const uint32_t* bp) {
static void CollectElementIndices(Handle<JSObject> object,
uint32_t range,
List<uint32_t>* indices) {
- JSObject::ElementsKind kind = object->GetElementsKind();
+ ElementsKind kind = object->GetElementsKind();
switch (kind) {
- case JSObject::FAST_ELEMENTS: {
+ case FAST_ELEMENTS: {
Handle<FixedArray> elements(FixedArray::cast(object->elements()));
uint32_t length = static_cast<uint32_t>(elements->length());
if (range < length) length = range;
@@ -9568,7 +9567,7 @@ static void CollectElementIndices(Handle<JSObject> object,
}
break;
}
- case JSObject::DICTIONARY_ELEMENTS: {
+ case DICTIONARY_ELEMENTS: {
Handle<NumberDictionary> dict(NumberDictionary::cast(object->elements()));
uint32_t capacity = dict->Capacity();
for (uint32_t j = 0; j < capacity; j++) {
@@ -9587,47 +9586,47 @@ static void CollectElementIndices(Handle<JSObject> object,
default: {
int dense_elements_length;
switch (kind) {
- case JSObject::EXTERNAL_PIXEL_ELEMENTS: {
+ case EXTERNAL_PIXEL_ELEMENTS: {
dense_elements_length =
ExternalPixelArray::cast(object->elements())->length();
break;
}
- case JSObject::EXTERNAL_BYTE_ELEMENTS: {
+ case EXTERNAL_BYTE_ELEMENTS: {
dense_elements_length =
ExternalByteArray::cast(object->elements())->length();
break;
}
- case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: {
+ case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: {
dense_elements_length =
ExternalUnsignedByteArray::cast(object->elements())->length();
break;
}
- case JSObject::EXTERNAL_SHORT_ELEMENTS: {
+ case EXTERNAL_SHORT_ELEMENTS: {
dense_elements_length =
ExternalShortArray::cast(object->elements())->length();
break;
}
- case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: {
+ case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: {
dense_elements_length =
ExternalUnsignedShortArray::cast(object->elements())->length();
break;
}
- case JSObject::EXTERNAL_INT_ELEMENTS: {
+ case EXTERNAL_INT_ELEMENTS: {
dense_elements_length =
ExternalIntArray::cast(object->elements())->length();
break;
}
- case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: {
+ case EXTERNAL_UNSIGNED_INT_ELEMENTS: {
dense_elements_length =
ExternalUnsignedIntArray::cast(object->elements())->length();
break;
}
- case JSObject::EXTERNAL_FLOAT_ELEMENTS: {
+ case EXTERNAL_FLOAT_ELEMENTS: {
dense_elements_length =
ExternalFloatArray::cast(object->elements())->length();
break;
}
- case JSObject::EXTERNAL_DOUBLE_ELEMENTS: {
+ case EXTERNAL_DOUBLE_ELEMENTS: {
dense_elements_length =
ExternalDoubleArray::cast(object->elements())->length();
break;
@@ -9676,7 +9675,7 @@ static bool IterateElements(Isolate* isolate,
ArrayConcatVisitor* visitor) {
uint32_t length = static_cast<uint32_t>(receiver->length()->Number());
switch (receiver->GetElementsKind()) {
- case JSObject::FAST_ELEMENTS: {
+ case FAST_ELEMENTS: {
// Run through the elements FixedArray and use HasElement and GetElement
// to check the prototype for missing elements.
Handle<FixedArray> elements(FixedArray::cast(receiver->elements()));
@@ -9697,7 +9696,7 @@ static bool IterateElements(Isolate* isolate,
}
break;
}
- case JSObject::DICTIONARY_ELEMENTS: {
+ case DICTIONARY_ELEMENTS: {
Handle<NumberDictionary> dict(receiver->element_dictionary());
List<uint32_t> indices(dict->Capacity() / 2);
// Collect all indices in the object and the prototypes less
@@ -9719,7 +9718,7 @@ static bool IterateElements(Isolate* isolate,
}
break;
}
- case JSObject::EXTERNAL_PIXEL_ELEMENTS: {
+ case EXTERNAL_PIXEL_ELEMENTS: {
Handle<ExternalPixelArray> pixels(ExternalPixelArray::cast(
receiver->elements()));
for (uint32_t j = 0; j < length; j++) {
@@ -9728,42 +9727,42 @@ static bool IterateElements(Isolate* isolate,
}
break;
}
- case JSObject::EXTERNAL_BYTE_ELEMENTS: {
+ case EXTERNAL_BYTE_ELEMENTS: {
IterateExternalArrayElements<ExternalByteArray, int8_t>(
isolate, receiver, true, true, visitor);
break;
}
- case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: {
+ case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: {
IterateExternalArrayElements<ExternalUnsignedByteArray, uint8_t>(
isolate, receiver, true, true, visitor);
break;
}
- case JSObject::EXTERNAL_SHORT_ELEMENTS: {
+ case EXTERNAL_SHORT_ELEMENTS: {
IterateExternalArrayElements<ExternalShortArray, int16_t>(
isolate, receiver, true, true, visitor);
break;
}
- case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: {
+ case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: {
IterateExternalArrayElements<ExternalUnsignedShortArray, uint16_t>(
isolate, receiver, true, true, visitor);
break;
}
- case JSObject::EXTERNAL_INT_ELEMENTS: {
+ case EXTERNAL_INT_ELEMENTS: {
IterateExternalArrayElements<ExternalIntArray, int32_t>(
isolate, receiver, true, false, visitor);
break;
}
- case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: {
+ case EXTERNAL_UNSIGNED_INT_ELEMENTS: {
IterateExternalArrayElements<ExternalUnsignedIntArray, uint32_t>(
isolate, receiver, true, false, visitor);
break;
}
- case JSObject::EXTERNAL_FLOAT_ELEMENTS: {
+ case EXTERNAL_FLOAT_ELEMENTS: {
IterateExternalArrayElements<ExternalFloatArray, float>(
isolate, receiver, false, false, visitor);
break;
}
- case JSObject::EXTERNAL_DOUBLE_ELEMENTS: {
+ case EXTERNAL_DOUBLE_ELEMENTS: {
IterateExternalArrayElements<ExternalDoubleArray, double>(
isolate, receiver, false, false, visitor);
break;
« no previous file with comments | « src/objects-inl.h ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698