Chromium Code Reviews| Index: src/parser.cc |
| diff --git a/src/parser.cc b/src/parser.cc |
| index e1a99cb4a038eca520caa99014de94c5df663125..04d510f2fdcf174fe9615e7e871fc20ae236ff2d 100644 |
| --- a/src/parser.cc |
| +++ b/src/parser.cc |
| @@ -3923,16 +3923,15 @@ Expression* Parser::NewThrowError(Handle<String> constructor, |
| Handle<String> type, |
| Vector< Handle<Object> > arguments) { |
| int argc = arguments.length(); |
| - Handle<JSArray> array = Factory::NewJSArray(argc, TENURED); |
| - ASSERT(array->IsJSArray() && array->HasFastElements()); |
| + Handle<FixedArray> elements = Factory::NewFixedArray(argc, TENURED); |
| for (int i = 0; i < argc; i++) { |
| Handle<Object> element = arguments[i]; |
| if (!element.is_null()) { |
| - // We know this doesn't cause a GC here because we allocated the JSArray |
| - // large enough. |
| - array->SetFastElement(i, *element)->ToObjectUnchecked(); |
| + elements->set(i, *element); |
| } |
| } |
| + Handle<JSArray> array = Factory::NewJSArrayWithElements(elements, TENURED); |
| + |
|
Lasse Reichstein
2011/02/10 14:26:18
Nice and simple way of avoiding setters!
|
| ZoneList<Expression*>* args = new ZoneList<Expression*>(2); |
| args->Add(new Literal(type)); |
| args->Add(new Literal(array)); |