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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 | 701 |
702 | 702 |
703 Handle<Symbol> Factory::NewSymbol() { | 703 Handle<Symbol> Factory::NewSymbol() { |
704 CALL_HEAP_FUNCTION( | 704 CALL_HEAP_FUNCTION( |
705 isolate(), | 705 isolate(), |
706 isolate()->heap()->AllocateSymbol(), | 706 isolate()->heap()->AllocateSymbol(), |
707 Symbol); | 707 Symbol); |
708 } | 708 } |
709 | 709 |
710 | 710 |
711 Handle<Symbol> Factory::NewPrivateSymbol(Handle<Object> name) { | 711 Handle<Symbol> Factory::NewPrivateSymbol() { |
712 Handle<Symbol> symbol = NewSymbol(); | 712 Handle<Symbol> symbol = NewSymbol(); |
713 symbol->set_is_private(true); | 713 symbol->set_is_private(true); |
714 if (name->IsString()) { | |
715 symbol->set_name(*name); | |
716 } else { | |
717 DCHECK(name->IsUndefined()); | |
718 } | |
719 return symbol; | 714 return symbol; |
720 } | 715 } |
721 | 716 |
722 | 717 |
723 Handle<Context> Factory::NewNativeContext() { | 718 Handle<Context> Factory::NewNativeContext() { |
724 Handle<FixedArray> array = | 719 Handle<FixedArray> array = |
725 NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED); | 720 NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED); |
726 array->set_map_no_write_barrier(*native_context_map()); | 721 array->set_map_no_write_barrier(*native_context_map()); |
727 Handle<Context> context = Handle<Context>::cast(array); | 722 Handle<Context> context = Handle<Context>::cast(array); |
728 context->set_js_array_maps(*undefined_value()); | 723 context->set_js_array_maps(*undefined_value()); |
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2389 } | 2384 } |
2390 | 2385 |
2391 | 2386 |
2392 Handle<Object> Factory::ToBoolean(bool value) { | 2387 Handle<Object> Factory::ToBoolean(bool value) { |
2393 return value ? true_value() : false_value(); | 2388 return value ? true_value() : false_value(); |
2394 } | 2389 } |
2395 | 2390 |
2396 | 2391 |
2397 } // namespace internal | 2392 } // namespace internal |
2398 } // namespace v8 | 2393 } // namespace v8 |
OLD | NEW |