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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, parameters_start); | 356 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, parameters_start); |
357 CONVERT_ARG_HANDLE_CHECKED(Object, type_info, parameters_start + 1); | 357 CONVERT_ARG_HANDLE_CHECKED(Object, type_info, parameters_start + 1); |
358 #ifdef DEBUG | 358 #ifdef DEBUG |
359 if (!no_caller_args) { | 359 if (!no_caller_args) { |
360 CONVERT_SMI_ARG_CHECKED(arg_count, parameters_start + 2); | 360 CONVERT_SMI_ARG_CHECKED(arg_count, parameters_start + 2); |
361 DCHECK(arg_count == caller_args->length()); | 361 DCHECK(arg_count == caller_args->length()); |
362 } | 362 } |
363 #endif | 363 #endif |
364 | 364 |
365 Handle<AllocationSite> site; | 365 Handle<AllocationSite> site; |
366 if (!type_info.is_null() && | 366 if (!type_info.is_null() && !type_info->IsUndefined(isolate)) { |
367 *type_info != isolate->heap()->undefined_value()) { | |
368 site = Handle<AllocationSite>::cast(type_info); | 367 site = Handle<AllocationSite>::cast(type_info); |
369 DCHECK(!site->SitePointsToLiteral()); | 368 DCHECK(!site->SitePointsToLiteral()); |
370 } | 369 } |
371 | 370 |
372 return ArrayConstructorCommon(isolate, constructor, constructor, site, | 371 return ArrayConstructorCommon(isolate, constructor, constructor, site, |
373 caller_args); | 372 caller_args); |
374 } | 373 } |
375 | 374 |
376 RUNTIME_FUNCTION(Runtime_InternalArrayConstructor) { | 375 RUNTIME_FUNCTION(Runtime_InternalArrayConstructor) { |
377 HandleScope scope(isolate); | 376 HandleScope scope(isolate); |
(...skipping 14 matching lines...) Expand all Loading... |
392 Handle<AllocationSite>::null(), caller_args); | 391 Handle<AllocationSite>::null(), caller_args); |
393 } | 392 } |
394 | 393 |
395 RUNTIME_FUNCTION(Runtime_ArraySingleArgumentConstructor) { | 394 RUNTIME_FUNCTION(Runtime_ArraySingleArgumentConstructor) { |
396 HandleScope scope(isolate); | 395 HandleScope scope(isolate); |
397 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0); | 396 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0); |
398 Object** argument_base = reinterpret_cast<Object**>(args[1]); | 397 Object** argument_base = reinterpret_cast<Object**>(args[1]); |
399 CONVERT_SMI_ARG_CHECKED(argument_count, 2); | 398 CONVERT_SMI_ARG_CHECKED(argument_count, 2); |
400 CONVERT_ARG_HANDLE_CHECKED(Object, raw_site, 3); | 399 CONVERT_ARG_HANDLE_CHECKED(Object, raw_site, 3); |
401 Handle<AllocationSite> casted_site = | 400 Handle<AllocationSite> casted_site = |
402 raw_site->IsUndefined() ? Handle<AllocationSite>::null() | 401 raw_site->IsUndefined(isolate) ? Handle<AllocationSite>::null() |
403 : Handle<AllocationSite>::cast(raw_site); | 402 : Handle<AllocationSite>::cast(raw_site); |
404 Arguments constructor_args(argument_count, argument_base); | 403 Arguments constructor_args(argument_count, argument_base); |
405 return ArrayConstructorCommon(isolate, constructor, constructor, casted_site, | 404 return ArrayConstructorCommon(isolate, constructor, constructor, casted_site, |
406 &constructor_args); | 405 &constructor_args); |
407 } | 406 } |
408 | 407 |
409 RUNTIME_FUNCTION(Runtime_NormalizeElements) { | 408 RUNTIME_FUNCTION(Runtime_NormalizeElements) { |
410 HandleScope scope(isolate); | 409 HandleScope scope(isolate); |
411 DCHECK(args.length() == 1); | 410 DCHECK(args.length() == 1); |
412 CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0); | 411 CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0); |
413 RUNTIME_ASSERT(!array->HasFixedTypedArrayElements() && | 412 RUNTIME_ASSERT(!array->HasFixedTypedArrayElements() && |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 RUNTIME_FUNCTION(Runtime_ArraySpeciesConstructor) { | 503 RUNTIME_FUNCTION(Runtime_ArraySpeciesConstructor) { |
505 HandleScope scope(isolate); | 504 HandleScope scope(isolate); |
506 DCHECK(args.length() == 1); | 505 DCHECK(args.length() == 1); |
507 CONVERT_ARG_HANDLE_CHECKED(Object, original_array, 0); | 506 CONVERT_ARG_HANDLE_CHECKED(Object, original_array, 0); |
508 RETURN_RESULT_OR_FAILURE( | 507 RETURN_RESULT_OR_FAILURE( |
509 isolate, Object::ArraySpeciesConstructor(isolate, original_array)); | 508 isolate, Object::ArraySpeciesConstructor(isolate, original_array)); |
510 } | 509 } |
511 | 510 |
512 } // namespace internal | 511 } // namespace internal |
513 } // namespace v8 | 512 } // namespace v8 |
OLD | NEW |