Chromium Code Reviews| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/frames-inl.h" | 9 #include "src/frames-inl.h" |
| 10 #include "src/messages.h" | 10 #include "src/messages.h" |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 HandleScope scope(isolate); | 629 HandleScope scope(isolate); |
| 630 DCHECK(args.length() == 2); | 630 DCHECK(args.length() == 2); |
| 631 | 631 |
| 632 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 632 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 633 CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 1); | 633 CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 1); |
| 634 Handle<GlobalObject> global_object(function->context()->global_object()); | 634 Handle<GlobalObject> global_object(function->context()->global_object()); |
| 635 Handle<Context> native_context(global_object->native_context()); | 635 Handle<Context> native_context(global_object->native_context()); |
| 636 Handle<ScriptContextTable> script_context_table( | 636 Handle<ScriptContextTable> script_context_table( |
| 637 native_context->script_context_table()); | 637 native_context->script_context_table()); |
| 638 | 638 |
| 639 Handle<String> clashed_name; | |
| 640 Object* name_clash_result = | 639 Object* name_clash_result = |
| 641 FindNameClash(scope_info, global_object, script_context_table); | 640 FindNameClash(scope_info, global_object, script_context_table); |
| 642 if (isolate->has_pending_exception()) return name_clash_result; | 641 if (isolate->has_pending_exception()) return name_clash_result; |
| 643 | 642 |
| 644 // Script contexts have a canonical empty function as their closure, not the | 643 // Script contexts have a canonical empty function as their closure, not the |
| 645 // anonymous closure containing the global code. See | 644 // anonymous closure containing the global code. See |
| 646 // FullCodeGenerator::PushFunctionArgumentForContextAllocation. | 645 // FullCodeGenerator::PushFunctionArgumentForContextAllocation. |
| 647 Handle<JSFunction> closure(native_context->closure()); | 646 Handle<JSFunction> closure(global_object->IsJSBuiltinsObject() |
| 647 ? *function | |
| 648 : native_context->closure()); | |
| 648 Handle<Context> result = | 649 Handle<Context> result = |
| 649 isolate->factory()->NewScriptContext(closure, scope_info); | 650 isolate->factory()->NewScriptContext(closure, scope_info); |
| 650 | 651 |
| 652 result->InvalidateGlobalSlots(); | |
|
Toon Verwaest
2015/07/01 09:28:55
InitializeGlobalSlots
Igor Sheludko
2015/07/02 16:50:13
Done.
| |
| 653 | |
| 651 DCHECK(function->context() == isolate->context()); | 654 DCHECK(function->context() == isolate->context()); |
| 652 DCHECK(function->context()->global_object() == result->global_object()); | 655 DCHECK(*global_object == result->global_object()); |
| 653 | 656 |
| 654 Handle<ScriptContextTable> new_script_context_table = | 657 Handle<ScriptContextTable> new_script_context_table = |
| 655 ScriptContextTable::Extend(script_context_table, result); | 658 ScriptContextTable::Extend(script_context_table, result); |
| 656 native_context->set_script_context_table(*new_script_context_table); | 659 native_context->set_script_context_table(*new_script_context_table); |
| 657 return *result; | 660 return *result; |
| 658 } | 661 } |
| 659 | 662 |
| 660 | 663 |
| 661 RUNTIME_FUNCTION(Runtime_NewFunctionContext) { | 664 RUNTIME_FUNCTION(Runtime_NewFunctionContext) { |
| 662 HandleScope scope(isolate); | 665 HandleScope scope(isolate); |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1133 return Smi::FromInt(frame->GetArgumentsLength()); | 1136 return Smi::FromInt(frame->GetArgumentsLength()); |
| 1134 } | 1137 } |
| 1135 | 1138 |
| 1136 | 1139 |
| 1137 RUNTIME_FUNCTION(Runtime_Arguments) { | 1140 RUNTIME_FUNCTION(Runtime_Arguments) { |
| 1138 SealHandleScope shs(isolate); | 1141 SealHandleScope shs(isolate); |
| 1139 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); | 1142 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); |
| 1140 } | 1143 } |
| 1141 } // namespace internal | 1144 } // namespace internal |
| 1142 } // namespace v8 | 1145 } // namespace v8 |
| OLD | NEW |