| 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/conversions.h" | 9 #include "src/conversions.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 Handle<Context> Factory::NewNativeContext() { | 686 Handle<Context> Factory::NewNativeContext() { |
| 687 Handle<FixedArray> array = NewFixedArray(Context::NATIVE_CONTEXT_SLOTS); | 687 Handle<FixedArray> array = NewFixedArray(Context::NATIVE_CONTEXT_SLOTS); |
| 688 array->set_map_no_write_barrier(*native_context_map()); | 688 array->set_map_no_write_barrier(*native_context_map()); |
| 689 Handle<Context> context = Handle<Context>::cast(array); | 689 Handle<Context> context = Handle<Context>::cast(array); |
| 690 context->set_js_array_maps(*undefined_value()); | 690 context->set_js_array_maps(*undefined_value()); |
| 691 DCHECK(context->IsNativeContext()); | 691 DCHECK(context->IsNativeContext()); |
| 692 return context; | 692 return context; |
| 693 } | 693 } |
| 694 | 694 |
| 695 | 695 |
| 696 Handle<Context> Factory::NewGlobalContext(Handle<JSFunction> function, | 696 Handle<Context> Factory::NewScriptContext(Handle<JSFunction> function, |
| 697 Handle<ScopeInfo> scope_info) { | 697 Handle<ScopeInfo> scope_info) { |
| 698 Handle<FixedArray> array = | 698 Handle<FixedArray> array = |
| 699 NewFixedArray(scope_info->ContextLength(), TENURED); | 699 NewFixedArray(scope_info->ContextLength(), TENURED); |
| 700 array->set_map_no_write_barrier(*global_context_map()); | 700 array->set_map_no_write_barrier(*script_context_map()); |
| 701 Handle<Context> context = Handle<Context>::cast(array); | 701 Handle<Context> context = Handle<Context>::cast(array); |
| 702 context->set_closure(*function); | 702 context->set_closure(*function); |
| 703 context->set_previous(function->context()); | 703 context->set_previous(function->context()); |
| 704 context->set_extension(*scope_info); | 704 context->set_extension(*scope_info); |
| 705 context->set_global_object(function->context()->global_object()); | 705 context->set_global_object(function->context()->global_object()); |
| 706 DCHECK(context->IsGlobalContext()); | 706 DCHECK(context->IsScriptContext()); |
| 707 return context; | 707 return context; |
| 708 } | 708 } |
| 709 | 709 |
| 710 | 710 |
| 711 Handle<GlobalContextTable> Factory::NewGlobalContextTable() { | 711 Handle<ScriptContextTable> Factory::NewScriptContextTable() { |
| 712 Handle<FixedArray> array = NewFixedArray(1); | 712 Handle<FixedArray> array = NewFixedArray(1); |
| 713 array->set_map_no_write_barrier(*global_context_table_map()); | 713 array->set_map_no_write_barrier(*script_context_table_map()); |
| 714 Handle<GlobalContextTable> context_table = | 714 Handle<ScriptContextTable> context_table = |
| 715 Handle<GlobalContextTable>::cast(array); | 715 Handle<ScriptContextTable>::cast(array); |
| 716 context_table->set_used(0); | 716 context_table->set_used(0); |
| 717 return context_table; | 717 return context_table; |
| 718 } | 718 } |
| 719 | 719 |
| 720 | 720 |
| 721 Handle<Context> Factory::NewModuleContext(Handle<ScopeInfo> scope_info) { | 721 Handle<Context> Factory::NewModuleContext(Handle<ScopeInfo> scope_info) { |
| 722 Handle<FixedArray> array = | 722 Handle<FixedArray> array = |
| 723 NewFixedArray(scope_info->ContextLength(), TENURED); | 723 NewFixedArray(scope_info->ContextLength(), TENURED); |
| 724 array->set_map_no_write_barrier(*module_context_map()); | 724 array->set_map_no_write_barrier(*module_context_map()); |
| 725 // Instance link will be set later. | 725 // Instance link will be set later. |
| (...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2518 return Handle<Object>::null(); | 2518 return Handle<Object>::null(); |
| 2519 } | 2519 } |
| 2520 | 2520 |
| 2521 | 2521 |
| 2522 Handle<Object> Factory::ToBoolean(bool value) { | 2522 Handle<Object> Factory::ToBoolean(bool value) { |
| 2523 return value ? true_value() : false_value(); | 2523 return value ? true_value() : false_value(); |
| 2524 } | 2524 } |
| 2525 | 2525 |
| 2526 | 2526 |
| 2527 } } // namespace v8::internal | 2527 } } // namespace v8::internal |
| OLD | NEW |