| 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/factory.h" | 5 #include "src/factory.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 Handle<Context> context = Handle<Context>::cast(array); | 827 Handle<Context> context = Handle<Context>::cast(array); |
| 828 context->set_closure(*function); | 828 context->set_closure(*function); |
| 829 context->set_previous(*previous); | 829 context->set_previous(*previous); |
| 830 context->set_extension(*extension); | 830 context->set_extension(*extension); |
| 831 context->set_native_context(previous->native_context()); | 831 context->set_native_context(previous->native_context()); |
| 832 context->set(Context::THROWN_OBJECT_INDEX, *thrown_object); | 832 context->set(Context::THROWN_OBJECT_INDEX, *thrown_object); |
| 833 return context; | 833 return context; |
| 834 } | 834 } |
| 835 | 835 |
| 836 Handle<Context> Factory::NewDebugEvaluateContext(Handle<Context> previous, | 836 Handle<Context> Factory::NewDebugEvaluateContext(Handle<Context> previous, |
| 837 Handle<ScopeInfo> scope_info, |
| 837 Handle<JSReceiver> extension, | 838 Handle<JSReceiver> extension, |
| 838 Handle<Context> wrapped, | 839 Handle<Context> wrapped, |
| 839 Handle<StringSet> whitelist) { | 840 Handle<StringSet> whitelist) { |
| 840 STATIC_ASSERT(Context::WHITE_LIST_INDEX == Context::MIN_CONTEXT_SLOTS + 1); | 841 STATIC_ASSERT(Context::WHITE_LIST_INDEX == Context::MIN_CONTEXT_SLOTS + 1); |
| 842 Handle<ContextExtension> context_extension = NewContextExtension( |
| 843 scope_info, extension.is_null() ? Handle<Object>::cast(undefined_value()) |
| 844 : Handle<Object>::cast(extension)); |
| 841 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS + 2); | 845 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS + 2); |
| 842 array->set_map_no_write_barrier(*debug_evaluate_context_map()); | 846 array->set_map_no_write_barrier(*debug_evaluate_context_map()); |
| 843 Handle<Context> c = Handle<Context>::cast(array); | 847 Handle<Context> c = Handle<Context>::cast(array); |
| 844 c->set_closure(wrapped.is_null() ? previous->closure() : wrapped->closure()); | 848 c->set_closure(wrapped.is_null() ? previous->closure() : wrapped->closure()); |
| 845 c->set_previous(*previous); | 849 c->set_previous(*previous); |
| 846 c->set_native_context(previous->native_context()); | 850 c->set_native_context(previous->native_context()); |
| 847 if (!extension.is_null()) c->set(Context::EXTENSION_INDEX, *extension); | 851 c->set_extension(*context_extension); |
| 848 if (!wrapped.is_null()) c->set(Context::WRAPPED_CONTEXT_INDEX, *wrapped); | 852 if (!wrapped.is_null()) c->set(Context::WRAPPED_CONTEXT_INDEX, *wrapped); |
| 849 if (!whitelist.is_null()) c->set(Context::WHITE_LIST_INDEX, *whitelist); | 853 if (!whitelist.is_null()) c->set(Context::WHITE_LIST_INDEX, *whitelist); |
| 850 return c; | 854 return c; |
| 851 } | 855 } |
| 852 | 856 |
| 853 Handle<Context> Factory::NewWithContext(Handle<JSFunction> function, | 857 Handle<Context> Factory::NewWithContext(Handle<JSFunction> function, |
| 854 Handle<Context> previous, | 858 Handle<Context> previous, |
| 859 Handle<ScopeInfo> scope_info, |
| 855 Handle<JSReceiver> extension) { | 860 Handle<JSReceiver> extension) { |
| 861 Handle<ContextExtension> context_extension = |
| 862 NewContextExtension(scope_info, extension); |
| 856 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS); | 863 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS); |
| 857 array->set_map_no_write_barrier(*with_context_map()); | 864 array->set_map_no_write_barrier(*with_context_map()); |
| 858 Handle<Context> context = Handle<Context>::cast(array); | 865 Handle<Context> context = Handle<Context>::cast(array); |
| 859 context->set_closure(*function); | 866 context->set_closure(*function); |
| 860 context->set_previous(*previous); | 867 context->set_previous(*previous); |
| 861 context->set_extension(*extension); | 868 context->set_extension(*context_extension); |
| 862 context->set_native_context(previous->native_context()); | 869 context->set_native_context(previous->native_context()); |
| 863 return context; | 870 return context; |
| 864 } | 871 } |
| 865 | 872 |
| 866 | 873 |
| 867 Handle<Context> Factory::NewBlockContext(Handle<JSFunction> function, | 874 Handle<Context> Factory::NewBlockContext(Handle<JSFunction> function, |
| 868 Handle<Context> previous, | 875 Handle<Context> previous, |
| 869 Handle<ScopeInfo> scope_info) { | 876 Handle<ScopeInfo> scope_info) { |
| 870 DCHECK_EQ(scope_info->scope_type(), BLOCK_SCOPE); | 877 DCHECK_EQ(scope_info->scope_type(), BLOCK_SCOPE); |
| 871 Handle<FixedArray> array = NewFixedArray(scope_info->ContextLength()); | 878 Handle<FixedArray> array = NewFixedArray(scope_info->ContextLength()); |
| (...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2508 Handle<AccessorInfo> prototype = | 2515 Handle<AccessorInfo> prototype = |
| 2509 Accessors::FunctionPrototypeInfo(isolate(), attribs); | 2516 Accessors::FunctionPrototypeInfo(isolate(), attribs); |
| 2510 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 2517 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), |
| 2511 prototype, attribs); | 2518 prototype, attribs); |
| 2512 map->AppendDescriptor(&d); | 2519 map->AppendDescriptor(&d); |
| 2513 } | 2520 } |
| 2514 } | 2521 } |
| 2515 | 2522 |
| 2516 } // namespace internal | 2523 } // namespace internal |
| 2517 } // namespace v8 | 2524 } // namespace v8 |
| OLD | NEW |