OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/conversions-inl.h" | 9 #include "src/conversions-inl.h" |
10 #include "src/elements.h" | 10 #include "src/elements.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 #ifdef DEBUG | 384 #ifdef DEBUG |
385 if (!no_caller_args) { | 385 if (!no_caller_args) { |
386 CONVERT_SMI_ARG_CHECKED(arg_count, parameters_start + 1); | 386 CONVERT_SMI_ARG_CHECKED(arg_count, parameters_start + 1); |
387 DCHECK(arg_count == caller_args->length()); | 387 DCHECK(arg_count == caller_args->length()); |
388 } | 388 } |
389 #endif | 389 #endif |
390 return ArrayConstructorCommon(isolate, constructor, constructor, | 390 return ArrayConstructorCommon(isolate, constructor, constructor, |
391 Handle<AllocationSite>::null(), caller_args); | 391 Handle<AllocationSite>::null(), caller_args); |
392 } | 392 } |
393 | 393 |
| 394 RUNTIME_FUNCTION(Runtime_ArraySingleArgumentConstructor) { |
| 395 HandleScope scope(isolate); |
| 396 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0); |
| 397 Object** argument_base = reinterpret_cast<Object**>(args[1]); |
| 398 CONVERT_SMI_ARG_CHECKED(argument_count, 2); |
| 399 CONVERT_ARG_HANDLE_CHECKED(Object, raw_site, 3); |
| 400 Handle<AllocationSite> casted_site = |
| 401 raw_site->IsUndefined() ? Handle<AllocationSite>::null() |
| 402 : Handle<AllocationSite>::cast(raw_site); |
| 403 Arguments constructor_args(argument_count, argument_base); |
| 404 return ArrayConstructorCommon(isolate, constructor, constructor, casted_site, |
| 405 &constructor_args); |
| 406 } |
394 | 407 |
395 RUNTIME_FUNCTION(Runtime_NormalizeElements) { | 408 RUNTIME_FUNCTION(Runtime_NormalizeElements) { |
396 HandleScope scope(isolate); | 409 HandleScope scope(isolate); |
397 DCHECK(args.length() == 1); | 410 DCHECK(args.length() == 1); |
398 CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0); | 411 CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0); |
399 RUNTIME_ASSERT(!array->HasFixedTypedArrayElements() && | 412 RUNTIME_ASSERT(!array->HasFixedTypedArrayElements() && |
400 !array->IsJSGlobalProxy()); | 413 !array->IsJSGlobalProxy()); |
401 JSObject::NormalizeElements(array); | 414 JSObject::NormalizeElements(array); |
402 return *array; | 415 return *array; |
403 } | 416 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 CONVERT_ARG_HANDLE_CHECKED(Object, original_array, 0); | 506 CONVERT_ARG_HANDLE_CHECKED(Object, original_array, 0); |
494 Handle<Object> constructor; | 507 Handle<Object> constructor; |
495 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 508 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
496 isolate, constructor, | 509 isolate, constructor, |
497 Object::ArraySpeciesConstructor(isolate, original_array)); | 510 Object::ArraySpeciesConstructor(isolate, original_array)); |
498 return *constructor; | 511 return *constructor; |
499 } | 512 } |
500 | 513 |
501 } // namespace internal | 514 } // namespace internal |
502 } // namespace v8 | 515 } // namespace v8 |
OLD | NEW |