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

Side by Side Diff: src/builtins.cc

Issue 11416238: Move CopyElements to the accessor of the target. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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/elements.h » ('j') | src/elements.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 MaybeObject* maybe_array = 1213 MaybeObject* maybe_array =
1214 heap->AllocateJSArrayAndStorage(elements_kind, 1214 heap->AllocateJSArrayAndStorage(elements_kind,
1215 result_len, 1215 result_len,
1216 result_len, 1216 result_len,
1217 mode); 1217 mode);
1218 if (!maybe_array->To(&result_array)) return maybe_array; 1218 if (!maybe_array->To(&result_array)) return maybe_array;
1219 if (result_len == 0) return result_array; 1219 if (result_len == 0) return result_array;
1220 1220
1221 int j = 0; 1221 int j = 0;
1222 FixedArrayBase* storage = result_array->elements(); 1222 FixedArrayBase* storage = result_array->elements();
1223 ElementsAccessor* accessor = ElementsAccessor::ForKind(elements_kind);
1223 for (int i = 0; i < n_arguments; i++) { 1224 for (int i = 0; i < n_arguments; i++) {
1224 JSArray* array = JSArray::cast(args[i]); 1225 JSArray* array = JSArray::cast(args[i]);
1225 int len = Smi::cast(array->length())->value(); 1226 int len = Smi::cast(array->length())->value();
1227 ElementsKind origin_kind = array->GetElementsKind();
Michael Starzinger 2012/11/29 09:39:32 Use "from_kind" as name for consistency.
Toon Verwaest 2012/11/29 14:04:40 Done.
1226 if (len > 0) { 1228 if (len > 0) {
1227 ElementsAccessor* accessor = array->GetElementsAccessor();
1228 MaybeObject* maybe_failure = 1229 MaybeObject* maybe_failure =
1229 accessor->CopyElements(array, 0, storage, elements_kind, j, len); 1230 accessor->CopyElements(array, 0, storage, origin_kind, j, len);
1230 if (maybe_failure->IsFailure()) return maybe_failure; 1231 if (maybe_failure->IsFailure()) return maybe_failure;
1231 j += len; 1232 j += len;
1232 } 1233 }
1233 } 1234 }
1234 1235
1235 ASSERT(j == result_len); 1236 ASSERT(j == result_len);
1236 1237
1237 return result_array; 1238 return result_array;
1238 } 1239 }
1239 1240
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 return Handle<Code>(code_address); \ 1936 return Handle<Code>(code_address); \
1936 } 1937 }
1937 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1938 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1938 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1939 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1939 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1940 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1940 #undef DEFINE_BUILTIN_ACCESSOR_C 1941 #undef DEFINE_BUILTIN_ACCESSOR_C
1941 #undef DEFINE_BUILTIN_ACCESSOR_A 1942 #undef DEFINE_BUILTIN_ACCESSOR_A
1942 1943
1943 1944
1944 } } // namespace v8::internal 1945 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/elements.h » ('j') | src/elements.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698