From: vegorov@chromium.org Date: Wed, 17 Nov 2010 12:49:27 +0000 (+0000) Subject: Store script's line ends in copy-on-write fixed array. X-Git-Tag: upstream/4.7.83~20946 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a298666fae84fc89e343b6b40dcfa92c6a648aa1;p=platform%2Fupstream%2Fv8.git Store script's line ends in copy-on-write fixed array. This allows to remove explicit copy from line ends JS accessor which is used for formatting of stack traces. Eager copying of line ends array might cause multiple full GC collections for huge scripts (e.g. scripts generated by GWT compiler with PRETY preset). Review URL: http://codereview.chromium.org/5148002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5839 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/accessors.cc b/src/accessors.cc index 7c21659..08ef41b 100644 --- a/src/accessors.cc +++ b/src/accessors.cc @@ -316,8 +316,10 @@ MaybeObject* Accessors::ScriptGetLineEnds(Object* object, void*) { InitScriptLineEnds(script); ASSERT(script->line_ends()->IsFixedArray()); Handle line_ends(FixedArray::cast(script->line_ends())); - Handle copy = Factory::CopyFixedArray(line_ends); - Handle js_array = Factory::NewJSArrayWithElements(copy); + // We do not want anyone to modify this array from JS. + ASSERT(*line_ends == Heap::empty_fixed_array() || + line_ends->map() == Heap::fixed_cow_array_map()); + Handle js_array = Factory::NewJSArrayWithElements(line_ends); return *js_array; } diff --git a/src/handles.cc b/src/handles.cc index 7a46bc3..1364951 100644 --- a/src/handles.cc +++ b/src/handles.cc @@ -499,6 +499,10 @@ void InitScriptLineEnds(Handle