| 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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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->IsGlobalContext()); |
| 707 return context; | 707 return context; |
| 708 } | 708 } |
| 709 | 709 |
| 710 | 710 |
| 711 Handle<GlobalContextTable> Factory::NewGlobalContextTable(int length) { |
| 712 Handle<FixedArray> array = NewFixedArray(length + 1); // TODO: cleanup |
| 713 array->set_map_no_write_barrier(*global_context_table_map()); |
| 714 Handle<GlobalContextTable> context_table = |
| 715 Handle<GlobalContextTable>::cast(array); |
| 716 return context_table; |
| 717 } |
| 718 |
| 719 |
| 711 Handle<Context> Factory::NewModuleContext(Handle<ScopeInfo> scope_info) { | 720 Handle<Context> Factory::NewModuleContext(Handle<ScopeInfo> scope_info) { |
| 712 Handle<FixedArray> array = | 721 Handle<FixedArray> array = |
| 713 NewFixedArray(scope_info->ContextLength(), TENURED); | 722 NewFixedArray(scope_info->ContextLength(), TENURED); |
| 714 array->set_map_no_write_barrier(*module_context_map()); | 723 array->set_map_no_write_barrier(*module_context_map()); |
| 715 // Instance link will be set later. | 724 // Instance link will be set later. |
| 716 Handle<Context> context = Handle<Context>::cast(array); | 725 Handle<Context> context = Handle<Context>::cast(array); |
| 717 context->set_extension(Smi::FromInt(0)); | 726 context->set_extension(Smi::FromInt(0)); |
| 718 return context; | 727 return context; |
| 719 } | 728 } |
| 720 | 729 |
| (...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2498 return Handle<Object>::null(); | 2507 return Handle<Object>::null(); |
| 2499 } | 2508 } |
| 2500 | 2509 |
| 2501 | 2510 |
| 2502 Handle<Object> Factory::ToBoolean(bool value) { | 2511 Handle<Object> Factory::ToBoolean(bool value) { |
| 2503 return value ? true_value() : false_value(); | 2512 return value ? true_value() : false_value(); |
| 2504 } | 2513 } |
| 2505 | 2514 |
| 2506 | 2515 |
| 2507 } } // namespace v8::internal | 2516 } } // namespace v8::internal |
| OLD | NEW |