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

Unified Diff: src/objects-inl.h

Issue 206223003: JSArray::SetContent() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing review notes Created 6 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 | « src/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 811b2f9c8776de4613a1ece5b2f62deef2415204..eeb2c9de42bdece8c8c9d607e525173c76179e64 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1031,7 +1031,6 @@ bool Object::IsNaN() {
}
-// static
Handle<Object> Object::ToSmi(Isolate* isolate, Handle<Object> object) {
if (object->IsSmi()) return object;
if (object->IsHeapNumber()) {
@@ -1662,6 +1661,18 @@ MaybeObject* JSObject::EnsureCanContainElements(Object** objects,
}
+// TODO(ishell): Temporary wrapper until handlified.
+void JSObject::EnsureCanContainElements(Handle<JSObject> object,
+ Handle<FixedArrayBase> elements,
+ uint32_t length,
+ EnsureElementsMode mode) {
+ CALL_HEAP_FUNCTION_VOID(object->GetIsolate(),
+ object->EnsureCanContainElements(*elements,
+ length,
+ mode));
+}
+
+
MaybeObject* JSObject::EnsureCanContainElements(FixedArrayBase* elements,
uint32_t length,
EnsureElementsMode mode) {
@@ -6568,19 +6579,19 @@ bool JSArray::AllowsSetElementsLength() {
}
-MaybeObject* JSArray::SetContent(FixedArrayBase* storage) {
- MaybeObject* maybe_result = EnsureCanContainElements(
- storage, storage->length(), ALLOW_COPIED_DOUBLE_ELEMENTS);
- if (maybe_result->IsFailure()) return maybe_result;
- ASSERT((storage->map() == GetHeap()->fixed_double_array_map() &&
- IsFastDoubleElementsKind(GetElementsKind())) ||
- ((storage->map() != GetHeap()->fixed_double_array_map()) &&
- (IsFastObjectElementsKind(GetElementsKind()) ||
- (IsFastSmiElementsKind(GetElementsKind()) &&
- FixedArray::cast(storage)->ContainsOnlySmisOrHoles()))));
- set_elements(storage);
- set_length(Smi::FromInt(storage->length()));
- return this;
+void JSArray::SetContent(Handle<JSArray> array,
+ Handle<FixedArrayBase> storage) {
+ EnsureCanContainElements(array, storage, storage->length(),
+ ALLOW_COPIED_DOUBLE_ELEMENTS);
+
+ ASSERT((storage->map() == array->GetHeap()->fixed_double_array_map() &&
+ IsFastDoubleElementsKind(array->GetElementsKind())) ||
+ ((storage->map() != array->GetHeap()->fixed_double_array_map()) &&
+ (IsFastObjectElementsKind(array->GetElementsKind()) ||
+ (IsFastSmiElementsKind(array->GetElementsKind()) &&
+ Handle<FixedArray>::cast(storage)->ContainsOnlySmisOrHoles()))));
+ array->set_elements(*storage);
+ array->set_length(Smi::FromInt(storage->length()));
}
« no previous file with comments | « src/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698