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/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 return context_table; | 757 return context_table; |
758 } | 758 } |
759 | 759 |
760 | 760 |
761 Handle<Context> Factory::NewModuleContext(Handle<ScopeInfo> scope_info) { | 761 Handle<Context> Factory::NewModuleContext(Handle<ScopeInfo> scope_info) { |
762 Handle<FixedArray> array = | 762 Handle<FixedArray> array = |
763 NewFixedArray(scope_info->ContextLength(), TENURED); | 763 NewFixedArray(scope_info->ContextLength(), TENURED); |
764 array->set_map_no_write_barrier(*module_context_map()); | 764 array->set_map_no_write_barrier(*module_context_map()); |
765 // Instance link will be set later. | 765 // Instance link will be set later. |
766 Handle<Context> context = Handle<Context>::cast(array); | 766 Handle<Context> context = Handle<Context>::cast(array); |
767 context->set_extension(Smi::FromInt(0)); | 767 context->set_extension(*the_hole_value()); |
768 return context; | 768 return context; |
769 } | 769 } |
770 | 770 |
771 | 771 |
772 Handle<Context> Factory::NewFunctionContext(int length, | 772 Handle<Context> Factory::NewFunctionContext(int length, |
773 Handle<JSFunction> function) { | 773 Handle<JSFunction> function) { |
774 DCHECK(length >= Context::MIN_CONTEXT_SLOTS); | 774 DCHECK(length >= Context::MIN_CONTEXT_SLOTS); |
775 Handle<FixedArray> array = NewFixedArray(length); | 775 Handle<FixedArray> array = NewFixedArray(length); |
776 array->set_map_no_write_barrier(*function_context_map()); | 776 array->set_map_no_write_barrier(*function_context_map()); |
777 Handle<Context> context = Handle<Context>::cast(array); | 777 Handle<Context> context = Handle<Context>::cast(array); |
778 context->set_closure(*function); | 778 context->set_closure(*function); |
779 context->set_previous(function->context()); | 779 context->set_previous(function->context()); |
780 context->set_extension(Smi::FromInt(0)); | 780 context->set_extension(*the_hole_value()); |
781 context->set_native_context(function->native_context()); | 781 context->set_native_context(function->native_context()); |
782 return context; | 782 return context; |
783 } | 783 } |
784 | 784 |
785 | 785 |
786 Handle<Context> Factory::NewCatchContext(Handle<JSFunction> function, | 786 Handle<Context> Factory::NewCatchContext(Handle<JSFunction> function, |
787 Handle<Context> previous, | 787 Handle<Context> previous, |
788 Handle<String> name, | 788 Handle<String> name, |
789 Handle<Object> thrown_object) { | 789 Handle<Object> thrown_object) { |
790 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == Context::THROWN_OBJECT_INDEX); | 790 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == Context::THROWN_OBJECT_INDEX); |
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2333 } | 2333 } |
2334 | 2334 |
2335 | 2335 |
2336 Handle<Object> Factory::ToBoolean(bool value) { | 2336 Handle<Object> Factory::ToBoolean(bool value) { |
2337 return value ? true_value() : false_value(); | 2337 return value ? true_value() : false_value(); |
2338 } | 2338 } |
2339 | 2339 |
2340 | 2340 |
2341 } // namespace internal | 2341 } // namespace internal |
2342 } // namespace v8 | 2342 } // namespace v8 |
OLD | NEW |