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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 | 513 |
514 private: | 514 private: |
515 Object** parameters_; | 515 Object** parameters_; |
516 }; | 516 }; |
517 | 517 |
518 } // namespace | 518 } // namespace |
519 | 519 |
520 | 520 |
521 RUNTIME_FUNCTION(Runtime_NewSloppyArguments_Generic) { | 521 RUNTIME_FUNCTION(Runtime_NewSloppyArguments_Generic) { |
522 HandleScope scope(isolate); | 522 HandleScope scope(isolate); |
523 DCHECK(args.length() == 1); | 523 DCHECK_EQ(1, args.length()); |
524 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0); | 524 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0); |
525 // This generic runtime function can also be used when the caller has been | 525 // This generic runtime function can also be used when the caller has been |
526 // inlined, we use the slow but accurate {GetCallerArguments}. | 526 // inlined, we use the slow but accurate {GetCallerArguments}. |
527 int argument_count = 0; | 527 int argument_count = 0; |
528 std::unique_ptr<Handle<Object>[]> arguments = | 528 std::unique_ptr<Handle<Object>[]> arguments = |
529 GetCallerArguments(isolate, &argument_count); | 529 GetCallerArguments(isolate, &argument_count); |
530 HandleArguments argument_getter(arguments.get()); | 530 HandleArguments argument_getter(arguments.get()); |
531 return *NewSloppyArguments(isolate, callee, argument_getter, argument_count); | 531 return *NewSloppyArguments(isolate, callee, argument_getter, argument_count); |
532 } | 532 } |
533 | 533 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 for (int i = 0; i < num_elements; i++) { | 578 for (int i = 0; i < num_elements; i++) { |
579 elements->set(i, *arguments[i + start_index], mode); | 579 elements->set(i, *arguments[i + start_index], mode); |
580 } | 580 } |
581 } | 581 } |
582 return *result; | 582 return *result; |
583 } | 583 } |
584 | 584 |
585 | 585 |
586 RUNTIME_FUNCTION(Runtime_NewSloppyArguments) { | 586 RUNTIME_FUNCTION(Runtime_NewSloppyArguments) { |
587 HandleScope scope(isolate); | 587 HandleScope scope(isolate); |
588 DCHECK(args.length() == 3); | 588 DCHECK_EQ(3, args.length()); |
589 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0); | 589 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0); |
590 Object** parameters = reinterpret_cast<Object**>(args[1]); | 590 Object** parameters = reinterpret_cast<Object**>(args[1]); |
591 CONVERT_SMI_ARG_CHECKED(argument_count, 2); | 591 CONVERT_SMI_ARG_CHECKED(argument_count, 2); |
592 ParameterArguments argument_getter(parameters); | 592 ParameterArguments argument_getter(parameters); |
593 return *NewSloppyArguments(isolate, callee, argument_getter, argument_count); | 593 return *NewSloppyArguments(isolate, callee, argument_getter, argument_count); |
594 } | 594 } |
595 | 595 |
596 RUNTIME_FUNCTION(Runtime_NewArgumentsElements) { | 596 RUNTIME_FUNCTION(Runtime_NewArgumentsElements) { |
597 HandleScope scope(isolate); | 597 HandleScope scope(isolate); |
598 DCHECK_EQ(2, args.length()); | 598 DCHECK_EQ(2, args.length()); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 | 665 |
666 JSGlobalObject::InvalidatePropertyCell(global_object, name); | 666 JSGlobalObject::InvalidatePropertyCell(global_object, name); |
667 } | 667 } |
668 } | 668 } |
669 return isolate->heap()->undefined_value(); | 669 return isolate->heap()->undefined_value(); |
670 } | 670 } |
671 | 671 |
672 | 672 |
673 RUNTIME_FUNCTION(Runtime_NewScriptContext) { | 673 RUNTIME_FUNCTION(Runtime_NewScriptContext) { |
674 HandleScope scope(isolate); | 674 HandleScope scope(isolate); |
675 DCHECK(args.length() == 2); | 675 DCHECK_EQ(2, args.length()); |
676 | 676 |
677 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 677 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
678 CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 1); | 678 CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 1); |
679 Handle<JSGlobalObject> global_object(function->context()->global_object()); | 679 Handle<JSGlobalObject> global_object(function->context()->global_object()); |
680 Handle<Context> native_context(global_object->native_context()); | 680 Handle<Context> native_context(global_object->native_context()); |
681 Handle<ScriptContextTable> script_context_table( | 681 Handle<ScriptContextTable> script_context_table( |
682 native_context->script_context_table()); | 682 native_context->script_context_table()); |
683 | 683 |
684 Object* name_clash_result = | 684 Object* name_clash_result = |
685 FindNameClash(scope_info, global_object, script_context_table); | 685 FindNameClash(scope_info, global_object, script_context_table); |
(...skipping 12 matching lines...) Expand all Loading... |
698 DCHECK(*global_object == result->global_object()); | 698 DCHECK(*global_object == result->global_object()); |
699 | 699 |
700 Handle<ScriptContextTable> new_script_context_table = | 700 Handle<ScriptContextTable> new_script_context_table = |
701 ScriptContextTable::Extend(script_context_table, result); | 701 ScriptContextTable::Extend(script_context_table, result); |
702 native_context->set_script_context_table(*new_script_context_table); | 702 native_context->set_script_context_table(*new_script_context_table); |
703 return *result; | 703 return *result; |
704 } | 704 } |
705 | 705 |
706 RUNTIME_FUNCTION(Runtime_NewFunctionContext) { | 706 RUNTIME_FUNCTION(Runtime_NewFunctionContext) { |
707 HandleScope scope(isolate); | 707 HandleScope scope(isolate); |
708 DCHECK(args.length() == 2); | 708 DCHECK_EQ(2, args.length()); |
709 | 709 |
710 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 710 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
711 CONVERT_SMI_ARG_CHECKED(scope_type, 1); | 711 CONVERT_SMI_ARG_CHECKED(scope_type, 1); |
712 | 712 |
713 DCHECK(function->context() == isolate->context()); | 713 DCHECK(function->context() == isolate->context()); |
714 int length = function->shared()->scope_info()->ContextLength(); | 714 int length = function->shared()->scope_info()->ContextLength(); |
715 return *isolate->factory()->NewFunctionContext( | 715 return *isolate->factory()->NewFunctionContext( |
716 length, function, static_cast<ScopeType>(scope_type)); | 716 length, function, static_cast<ScopeType>(scope_type)); |
717 } | 717 } |
718 | 718 |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { | 975 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { |
976 HandleScope scope(isolate); | 976 HandleScope scope(isolate); |
977 DCHECK_EQ(2, args.length()); | 977 DCHECK_EQ(2, args.length()); |
978 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 978 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
979 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 979 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
980 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); | 980 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); |
981 } | 981 } |
982 | 982 |
983 } // namespace internal | 983 } // namespace internal |
984 } // namespace v8 | 984 } // namespace v8 |
OLD | NEW |