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

Side by Side Diff: src/factory.cc

Issue 6674034: Fix Array::New(length) in the API to return an array with the provided length. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments. Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/factory.h ('k') | test/cctest/test-api.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 } 710 }
711 711
712 712
713 713
714 Handle<JSObject> Factory::NewJSObjectFromMap(Handle<Map> map) { 714 Handle<JSObject> Factory::NewJSObjectFromMap(Handle<Map> map) {
715 CALL_HEAP_FUNCTION(Heap::AllocateJSObjectFromMap(*map, NOT_TENURED), 715 CALL_HEAP_FUNCTION(Heap::AllocateJSObjectFromMap(*map, NOT_TENURED),
716 JSObject); 716 JSObject);
717 } 717 }
718 718
719 719
720 Handle<JSArray> Factory::NewJSArray(int length, 720 Handle<JSArray> Factory::NewJSArray(int capacity,
721 PretenureFlag pretenure) { 721 PretenureFlag pretenure) {
722 Handle<JSObject> obj = NewJSObject(Top::array_function(), pretenure); 722 Handle<JSObject> obj = NewJSObject(Top::array_function(), pretenure);
723 CALL_HEAP_FUNCTION(Handle<JSArray>::cast(obj)->Initialize(length), JSArray); 723 CALL_HEAP_FUNCTION(Handle<JSArray>::cast(obj)->Initialize(capacity), JSArray);
724 } 724 }
725 725
726 726
727 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArray> elements, 727 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArray> elements,
728 PretenureFlag pretenure) { 728 PretenureFlag pretenure) {
729 Handle<JSArray> result = 729 Handle<JSArray> result =
730 Handle<JSArray>::cast(NewJSObject(Top::array_function(), pretenure)); 730 Handle<JSArray>::cast(NewJSObject(Top::array_function(), pretenure));
731 result->SetContent(*elements); 731 result->SetContent(*elements);
732 return result; 732 return result;
733 } 733 }
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 Execution::ConfigureInstance(instance, 1069 Execution::ConfigureInstance(instance,
1070 instance_template, 1070 instance_template,
1071 pending_exception); 1071 pending_exception);
1072 } else { 1072 } else {
1073 *pending_exception = false; 1073 *pending_exception = false;
1074 } 1074 }
1075 } 1075 }
1076 1076
1077 1077
1078 } } // namespace v8::internal 1078 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698