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/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 HeapObject); | 85 HeapObject); |
86 } | 86 } |
87 | 87 |
88 | 88 |
89 Handle<Box> Factory::NewBox(Handle<Object> value) { | 89 Handle<Box> Factory::NewBox(Handle<Object> value) { |
90 Handle<Box> result = Handle<Box>::cast(NewStruct(BOX_TYPE)); | 90 Handle<Box> result = Handle<Box>::cast(NewStruct(BOX_TYPE)); |
91 result->set_value(*value); | 91 result->set_value(*value); |
92 return result; | 92 return result; |
93 } | 93 } |
94 | 94 |
95 | |
96 Handle<PrototypeInfo> Factory::NewPrototypeInfo() { | 95 Handle<PrototypeInfo> Factory::NewPrototypeInfo() { |
97 Handle<PrototypeInfo> result = | 96 Handle<PrototypeInfo> result = |
98 Handle<PrototypeInfo>::cast(NewStruct(PROTOTYPE_INFO_TYPE)); | 97 Handle<PrototypeInfo>::cast(NewStruct(PROTOTYPE_INFO_TYPE)); |
99 result->set_prototype_users(WeakFixedArray::Empty()); | 98 result->set_prototype_users(WeakFixedArray::Empty()); |
100 result->set_registry_slot(PrototypeInfo::UNREGISTERED); | 99 result->set_registry_slot(PrototypeInfo::UNREGISTERED); |
101 result->set_validity_cell(Smi::FromInt(0)); | 100 result->set_validity_cell(Smi::FromInt(0)); |
102 result->set_bit_field(0); | 101 result->set_bit_field(0); |
103 return result; | 102 return result; |
104 } | 103 } |
105 | 104 |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 } | 886 } |
888 | 887 |
889 | 888 |
890 Handle<Struct> Factory::NewStruct(InstanceType type) { | 889 Handle<Struct> Factory::NewStruct(InstanceType type) { |
891 CALL_HEAP_FUNCTION( | 890 CALL_HEAP_FUNCTION( |
892 isolate(), | 891 isolate(), |
893 isolate()->heap()->AllocateStruct(type), | 892 isolate()->heap()->AllocateStruct(type), |
894 Struct); | 893 Struct); |
895 } | 894 } |
896 | 895 |
| 896 Handle<PromiseContainer> Factory::NewPromiseContainer( |
| 897 Handle<JSObject> promise, Handle<JSObject> thenable, |
| 898 Handle<JSFunction> then, Handle<JSFunction> resolve, |
| 899 Handle<JSFunction> reject, Handle<Object> before_debug_event, |
| 900 Handle<Object> after_debug_event) { |
| 901 Handle<PromiseContainer> result = |
| 902 Handle<PromiseContainer>::cast(NewStruct(PROMISE_CONTAINER_TYPE)); |
| 903 result->set_promise(*promise); |
| 904 result->set_thenable(*thenable); |
| 905 result->set_then(*then); |
| 906 result->set_resolve(*resolve); |
| 907 result->set_reject(*reject); |
| 908 result->set_before_debug_event(*before_debug_event); |
| 909 result->set_after_debug_event(*after_debug_event); |
| 910 return result; |
| 911 } |
897 | 912 |
898 Handle<AliasedArgumentsEntry> Factory::NewAliasedArgumentsEntry( | 913 Handle<AliasedArgumentsEntry> Factory::NewAliasedArgumentsEntry( |
899 int aliased_context_slot) { | 914 int aliased_context_slot) { |
900 Handle<AliasedArgumentsEntry> entry = Handle<AliasedArgumentsEntry>::cast( | 915 Handle<AliasedArgumentsEntry> entry = Handle<AliasedArgumentsEntry>::cast( |
901 NewStruct(ALIASED_ARGUMENTS_ENTRY_TYPE)); | 916 NewStruct(ALIASED_ARGUMENTS_ENTRY_TYPE)); |
902 entry->set_aliased_context_slot(aliased_context_slot); | 917 entry->set_aliased_context_slot(aliased_context_slot); |
903 return entry; | 918 return entry; |
904 } | 919 } |
905 | 920 |
906 | 921 |
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2516 Handle<AccessorInfo> prototype = | 2531 Handle<AccessorInfo> prototype = |
2517 Accessors::FunctionPrototypeInfo(isolate(), attribs); | 2532 Accessors::FunctionPrototypeInfo(isolate(), attribs); |
2518 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 2533 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), |
2519 prototype, attribs); | 2534 prototype, attribs); |
2520 map->AppendDescriptor(&d); | 2535 map->AppendDescriptor(&d); |
2521 } | 2536 } |
2522 } | 2537 } |
2523 | 2538 |
2524 } // namespace internal | 2539 } // namespace internal |
2525 } // namespace v8 | 2540 } // namespace v8 |
OLD | NEW |