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

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: With all ports done Created 7 years, 8 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
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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 return isolate->heap()->undefined_value(); 193 return isolate->heap()->undefined_value();
194 } 194 }
195 195
196 196
197 #define CONVERT_ARG_STUB_CALLER_ARGS(name) \ 197 #define CONVERT_ARG_STUB_CALLER_ARGS(name) \
198 Arguments* name = reinterpret_cast<Arguments*>(args[0]); 198 Arguments* name = reinterpret_cast<Arguments*>(args[0]);
199 199
200 200
201 RUNTIME_FUNCTION(MaybeObject*, ArrayConstructor_StubFailure) { 201 RUNTIME_FUNCTION(MaybeObject*, ArrayConstructor_StubFailure) {
202 CONVERT_ARG_STUB_CALLER_ARGS(caller_args); 202 CONVERT_ARG_STUB_CALLER_ARGS(caller_args);
203 // ASSERT(args.length() == 3); 203 // ASSERT(args.length() == 2);
Hannes Payer (out of office) 2013/04/18 11:14:39 Is this ASSERT still needed?
mvstanton 2013/04/18 13:39:26 It's good to have, and I should enable the darn th
204 Handle<JSFunction> function = args.at<JSFunction>(1); 204 Handle<Object> type_info = args.at<Object>(1);
205 Handle<Object> type_info = args.at<Object>(2);
206 205
207 JSArray* array = NULL; 206 JSArray* array = NULL;
208 bool holey = false; 207 bool holey = false;
209 if (caller_args->length() == 1 && (*caller_args)[0]->IsSmi()) { 208 if (caller_args->length() == 1 && (*caller_args)[0]->IsSmi()) {
210 int value = Smi::cast((*caller_args)[0])->value(); 209 int value = Smi::cast((*caller_args)[0])->value();
211 holey = (value > 0 && value < JSObject::kInitialMaxFastElementArray); 210 holey = (value > 0 && value < JSObject::kInitialMaxFastElementArray);
212 } 211 }
213 212
214 MaybeObject* maybe_array; 213 MaybeObject* maybe_array;
215 if (*type_info != isolate->heap()->undefined_value()) { 214 if (*type_info != isolate->heap()->undefined_value()) {
(...skipping 11 matching lines...) Expand all
227 if (mode == TRACK_ALLOCATION_SITE) { 226 if (mode == TRACK_ALLOCATION_SITE) {
228 maybe_array = isolate->heap()->AllocateEmptyJSArrayWithAllocationSite( 227 maybe_array = isolate->heap()->AllocateEmptyJSArrayWithAllocationSite(
229 to_kind, type_info); 228 to_kind, type_info);
230 } else { 229 } else {
231 maybe_array = isolate->heap()->AllocateEmptyJSArray(to_kind); 230 maybe_array = isolate->heap()->AllocateEmptyJSArray(to_kind);
232 } 231 }
233 if (!maybe_array->To(&array)) return maybe_array; 232 if (!maybe_array->To(&array)) return maybe_array;
234 } 233 }
235 } 234 }
236 235
237 ASSERT(function->has_initial_map()); 236 ElementsKind kind = GetInitialFastElementsKind();
238 ElementsKind kind = function->initial_map()->elements_kind();
239 if (holey) { 237 if (holey) {
240 kind = GetHoleyElementsKind(kind); 238 kind = GetHoleyElementsKind(kind);
241 } 239 }
242 240
243 if (array == NULL) { 241 if (array == NULL) {
244 maybe_array = isolate->heap()->AllocateEmptyJSArray(kind); 242 maybe_array = isolate->heap()->AllocateEmptyJSArray(kind);
245 if (!maybe_array->To(&array)) return maybe_array; 243 if (!maybe_array->To(&array)) return maybe_array;
246 } 244 }
247 245
248 maybe_array = ArrayConstructInitializeElements(array, caller_args); 246 maybe_array = ArrayConstructInitializeElements(array, caller_args);
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 return Handle<Code>(code_address); \ 1873 return Handle<Code>(code_address); \
1876 } 1874 }
1877 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1875 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1878 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1876 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1879 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1877 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1880 #undef DEFINE_BUILTIN_ACCESSOR_C 1878 #undef DEFINE_BUILTIN_ACCESSOR_C
1881 #undef DEFINE_BUILTIN_ACCESSOR_A 1879 #undef DEFINE_BUILTIN_ACCESSOR_A
1882 1880
1883 1881
1884 } } // namespace v8::internal 1882 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698