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

Side by Side Diff: src/builtins.cc

Issue 12385014: Hydrogen stubs for array constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: We still generated the arrays with feature flag off. Fixed. Created 7 years, 7 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/builtins.h ('k') | src/code-stubs.h » ('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 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 return isolate->heap()->undefined_value(); 185 return isolate->heap()->undefined_value();
186 } 186 }
187 187
188 188
189 #define CONVERT_ARG_STUB_CALLER_ARGS(name) \ 189 #define CONVERT_ARG_STUB_CALLER_ARGS(name) \
190 Arguments* name = reinterpret_cast<Arguments*>(args[0]); 190 Arguments* name = reinterpret_cast<Arguments*>(args[0]);
191 191
192 192
193 RUNTIME_FUNCTION(MaybeObject*, ArrayConstructor_StubFailure) { 193 RUNTIME_FUNCTION(MaybeObject*, ArrayConstructor_StubFailure) {
194 CONVERT_ARG_STUB_CALLER_ARGS(caller_args); 194 CONVERT_ARG_STUB_CALLER_ARGS(caller_args);
195 // ASSERT(args.length() == 3); 195 ASSERT(args.length() == 2);
196 Handle<JSFunction> function = args.at<JSFunction>(1); 196 Handle<Object> type_info = args.at<Object>(1);
197 Handle<Object> type_info = args.at<Object>(2);
198 197
199 JSArray* array = NULL; 198 JSArray* array = NULL;
200 bool holey = false; 199 bool holey = false;
201 if (caller_args->length() == 1 && (*caller_args)[0]->IsSmi()) { 200 if (caller_args->length() == 1 && (*caller_args)[0]->IsSmi()) {
202 int value = Smi::cast((*caller_args)[0])->value(); 201 int value = Smi::cast((*caller_args)[0])->value();
203 holey = (value > 0 && value < JSObject::kInitialMaxFastElementArray); 202 holey = (value > 0 && value < JSObject::kInitialMaxFastElementArray);
204 } 203 }
205 204
206 MaybeObject* maybe_array; 205 MaybeObject* maybe_array;
207 if (*type_info != isolate->heap()->undefined_value()) { 206 if (*type_info != isolate->heap()->undefined_value()) {
(...skipping 11 matching lines...) Expand all
219 if (mode == TRACK_ALLOCATION_SITE) { 218 if (mode == TRACK_ALLOCATION_SITE) {
220 maybe_array = isolate->heap()->AllocateEmptyJSArrayWithAllocationSite( 219 maybe_array = isolate->heap()->AllocateEmptyJSArrayWithAllocationSite(
221 to_kind, type_info); 220 to_kind, type_info);
222 } else { 221 } else {
223 maybe_array = isolate->heap()->AllocateEmptyJSArray(to_kind); 222 maybe_array = isolate->heap()->AllocateEmptyJSArray(to_kind);
224 } 223 }
225 if (!maybe_array->To(&array)) return maybe_array; 224 if (!maybe_array->To(&array)) return maybe_array;
226 } 225 }
227 } 226 }
228 227
229 ASSERT(function->has_initial_map()); 228 ElementsKind kind = GetInitialFastElementsKind();
230 ElementsKind kind = function->initial_map()->elements_kind();
231 if (holey) { 229 if (holey) {
232 kind = GetHoleyElementsKind(kind); 230 kind = GetHoleyElementsKind(kind);
233 } 231 }
234 232
235 if (array == NULL) { 233 if (array == NULL) {
236 maybe_array = isolate->heap()->AllocateEmptyJSArray(kind); 234 maybe_array = isolate->heap()->AllocateEmptyJSArray(kind);
237 if (!maybe_array->To(&array)) return maybe_array; 235 if (!maybe_array->To(&array)) return maybe_array;
238 } 236 }
239 237
240 maybe_array = ArrayConstructInitializeElements(array, caller_args); 238 maybe_array = ArrayConstructInitializeElements(array, caller_args);
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 return Handle<Code>(code_address); \ 1865 return Handle<Code>(code_address); \
1868 } 1866 }
1869 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1867 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1870 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1868 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1871 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1869 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1872 #undef DEFINE_BUILTIN_ACCESSOR_C 1870 #undef DEFINE_BUILTIN_ACCESSOR_C
1873 #undef DEFINE_BUILTIN_ACCESSOR_A 1871 #undef DEFINE_BUILTIN_ACCESSOR_A
1874 1872
1875 1873
1876 } } // namespace v8::internal 1874 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698