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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 if (isolate->has_pending_exception()) return name_clash_result; | 658 if (isolate->has_pending_exception()) return name_clash_result; |
659 | 659 |
660 // Script contexts have a canonical empty function as their closure, not the | 660 // Script contexts have a canonical empty function as their closure, not the |
661 // anonymous closure containing the global code. See | 661 // anonymous closure containing the global code. See |
662 // FullCodeGenerator::PushFunctionArgumentForContextAllocation. | 662 // FullCodeGenerator::PushFunctionArgumentForContextAllocation. |
663 Handle<JSFunction> closure( | 663 Handle<JSFunction> closure( |
664 function->shared()->IsBuiltin() ? *function : native_context->closure()); | 664 function->shared()->IsBuiltin() ? *function : native_context->closure()); |
665 Handle<Context> result = | 665 Handle<Context> result = |
666 isolate->factory()->NewScriptContext(closure, scope_info); | 666 isolate->factory()->NewScriptContext(closure, scope_info); |
667 | 667 |
668 result->InitializeGlobalSlots(); | |
669 | |
670 DCHECK(function->context() == isolate->context()); | 668 DCHECK(function->context() == isolate->context()); |
671 DCHECK(*global_object == result->global_object()); | 669 DCHECK(*global_object == result->global_object()); |
672 | 670 |
673 Handle<ScriptContextTable> new_script_context_table = | 671 Handle<ScriptContextTable> new_script_context_table = |
674 ScriptContextTable::Extend(script_context_table, result); | 672 ScriptContextTable::Extend(script_context_table, result); |
675 native_context->set_script_context_table(*new_script_context_table); | 673 native_context->set_script_context_table(*new_script_context_table); |
676 return *result; | 674 return *result; |
677 } | 675 } |
678 | 676 |
679 | 677 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { | 931 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { |
934 HandleScope scope(isolate); | 932 HandleScope scope(isolate); |
935 DCHECK_EQ(2, args.length()); | 933 DCHECK_EQ(2, args.length()); |
936 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 934 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
937 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 935 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
938 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); | 936 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); |
939 } | 937 } |
940 | 938 |
941 } // namespace internal | 939 } // namespace internal |
942 } // namespace v8 | 940 } // namespace v8 |
OLD | NEW |