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

Unified Diff: src/runtime.cc

Issue 9950095: Fix array boilerplate object transitioning. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed moar comments by Daniel Clifford. Created 8 years, 9 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 | « no previous file | test/mjsunit/regress/regress-2055.js » ('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 0726b3d68aea560e6603f98980a61070e42d458f..f9b5fde7ae3035e18651f59790b68ac004dcc7ac 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -4669,7 +4669,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) {
HandleScope scope;
Object* raw_boilerplate_object = literals->get(literal_index);
- Handle<JSArray> boilerplate_object(JSArray::cast(raw_boilerplate_object));
+ Handle<JSArray> boilerplate(JSArray::cast(raw_boilerplate_object));
#if DEBUG
ElementsKind elements_kind = object->GetElementsKind();
#endif
@@ -4680,19 +4680,23 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) {
if (value->IsNumber()) {
ASSERT(elements_kind == FAST_SMI_ONLY_ELEMENTS);
JSObject::TransitionElementsKind(object, FAST_DOUBLE_ELEMENTS);
- JSObject::TransitionElementsKind(boilerplate_object, FAST_DOUBLE_ELEMENTS);
+ if (IsMoreGeneralElementsKindTransition(boilerplate->GetElementsKind(),
+ FAST_DOUBLE_ELEMENTS)) {
+ JSObject::TransitionElementsKind(boilerplate, FAST_DOUBLE_ELEMENTS);
+ }
ASSERT(object->GetElementsKind() == FAST_DOUBLE_ELEMENTS);
- FixedDoubleArray* double_array =
- FixedDoubleArray::cast(object->elements());
+ FixedDoubleArray* double_array = FixedDoubleArray::cast(object->elements());
HeapNumber* number = HeapNumber::cast(*value);
double_array->set(store_index, number->Number());
} else {
ASSERT(elements_kind == FAST_SMI_ONLY_ELEMENTS ||
elements_kind == FAST_DOUBLE_ELEMENTS);
JSObject::TransitionElementsKind(object, FAST_ELEMENTS);
- JSObject::TransitionElementsKind(boilerplate_object, FAST_ELEMENTS);
- FixedArray* object_array =
- FixedArray::cast(object->elements());
+ if (IsMoreGeneralElementsKindTransition(boilerplate->GetElementsKind(),
+ FAST_ELEMENTS)) {
+ JSObject::TransitionElementsKind(boilerplate, FAST_ELEMENTS);
+ }
+ FixedArray* object_array = FixedArray::cast(object->elements());
object_array->set(store_index, *value);
}
return *object;
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2055.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698