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

Side by Side Diff: src/accessors.cc

Issue 5148002: Store script's line ends in copy-on-write fixed array. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address problems with empty fixed array Created 10 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/handles.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // Accessors::ScriptGetLineEnds 309 // Accessors::ScriptGetLineEnds
310 // 310 //
311 311
312 312
313 MaybeObject* Accessors::ScriptGetLineEnds(Object* object, void*) { 313 MaybeObject* Accessors::ScriptGetLineEnds(Object* object, void*) {
314 HandleScope scope; 314 HandleScope scope;
315 Handle<Script> script(Script::cast(JSValue::cast(object)->value())); 315 Handle<Script> script(Script::cast(JSValue::cast(object)->value()));
316 InitScriptLineEnds(script); 316 InitScriptLineEnds(script);
317 ASSERT(script->line_ends()->IsFixedArray()); 317 ASSERT(script->line_ends()->IsFixedArray());
318 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); 318 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends()));
319 Handle<FixedArray> copy = Factory::CopyFixedArray(line_ends); 319 // We do not want anyone to modify this array from JS.
320 Handle<JSArray> js_array = Factory::NewJSArrayWithElements(copy); 320 ASSERT(*line_ends == Heap::empty_fixed_array() ||
321 line_ends->map() == Heap::fixed_cow_array_map());
322 Handle<JSArray> js_array = Factory::NewJSArrayWithElements(line_ends);
321 return *js_array; 323 return *js_array;
322 } 324 }
323 325
324 326
325 const AccessorDescriptor Accessors::ScriptLineEnds = { 327 const AccessorDescriptor Accessors::ScriptLineEnds = {
326 ScriptGetLineEnds, 328 ScriptGetLineEnds,
327 IllegalSetter, 329 IllegalSetter,
328 0 330 0
329 }; 331 };
330 332
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 } 664 }
663 665
664 666
665 const AccessorDescriptor Accessors::ObjectPrototype = { 667 const AccessorDescriptor Accessors::ObjectPrototype = {
666 ObjectGetPrototype, 668 ObjectGetPrototype,
667 ObjectSetPrototype, 669 ObjectSetPrototype,
668 0 670 0
669 }; 671 };
670 672
671 } } // namespace v8::internal 673 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698