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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 | 721 |
722 | 722 |
723 Handle<Context> Factory::NewNativeContext() { | 723 Handle<Context> Factory::NewNativeContext() { |
724 Handle<FixedArray> array = | 724 Handle<FixedArray> array = |
725 NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED); | 725 NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED); |
726 array->set_map_no_write_barrier(*native_context_map()); | 726 array->set_map_no_write_barrier(*native_context_map()); |
727 Handle<Context> context = Handle<Context>::cast(array); | 727 Handle<Context> context = Handle<Context>::cast(array); |
728 context->set_native_context(*context); | 728 context->set_native_context(*context); |
729 context->set_js_array_maps(*undefined_value()); | 729 context->set_js_array_maps(*undefined_value()); |
730 context->set_errors_thrown(Smi::FromInt(0)); | 730 context->set_errors_thrown(Smi::FromInt(0)); |
731 Handle<WeakCell> weak_cell = NewWeakCell(context); | |
732 context->set_self_weak_cell(*weak_cell); | |
733 DCHECK(context->IsNativeContext()); | 731 DCHECK(context->IsNativeContext()); |
734 return context; | 732 return context; |
735 } | 733 } |
736 | 734 |
737 | 735 |
738 Handle<Context> Factory::NewScriptContext(Handle<JSFunction> function, | 736 Handle<Context> Factory::NewScriptContext(Handle<JSFunction> function, |
739 Handle<ScopeInfo> scope_info) { | 737 Handle<ScopeInfo> scope_info) { |
740 Handle<FixedArray> array = | 738 Handle<FixedArray> array = |
741 NewFixedArray(scope_info->ContextLength(), TENURED); | 739 NewFixedArray(scope_info->ContextLength(), TENURED); |
742 array->set_map_no_write_barrier(*script_context_map()); | 740 array->set_map_no_write_barrier(*script_context_map()); |
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 } | 2333 } |
2336 | 2334 |
2337 | 2335 |
2338 Handle<Object> Factory::ToBoolean(bool value) { | 2336 Handle<Object> Factory::ToBoolean(bool value) { |
2339 return value ? true_value() : false_value(); | 2337 return value ? true_value() : false_value(); |
2340 } | 2338 } |
2341 | 2339 |
2342 | 2340 |
2343 } // namespace internal | 2341 } // namespace internal |
2344 } // namespace v8 | 2342 } // namespace v8 |
OLD | NEW |