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

Unified Diff: src/builtins.cc

Issue 9356002: Remove unnecessary elements type check when allocating array in runtime. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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 | src/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index 1badca7bc574f4c76225c02784ba0ef0cf6f8915..e48c676b4f97a39fe45a8b0663e1cd862dfabd17 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -218,12 +218,12 @@ static MaybeObject* ArrayCodeGenericCommon(Arguments* args,
if (obj->IsSmi()) {
int len = Smi::cast(obj)->value();
if (len >= 0 && len < JSObject::kInitialMaxFastElementArray) {
- Object* obj;
+ Object* fixed_array;
{ MaybeObject* maybe_obj = heap->AllocateFixedArrayWithHoles(len);
- if (!maybe_obj->ToObject(&obj)) return maybe_obj;
+ if (!maybe_obj->ToObject(&fixed_array)) return maybe_obj;
}
- MaybeObject* maybe_obj = array->SetContent(FixedArray::cast(obj));
- if (maybe_obj->IsFailure()) return maybe_obj;
+ array->set_elements(FixedArray::cast(fixed_array));
danno 2012/02/15 12:08:11 Add a comment why SetContent isn't a good idea her
+ array->set_length(Smi::cast(obj));
return array;
}
}
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698