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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 HeapObject); | 84 HeapObject); |
85 } | 85 } |
86 | 86 |
87 | 87 |
88 Handle<Box> Factory::NewBox(Handle<Object> value) { | 88 Handle<Box> Factory::NewBox(Handle<Object> value) { |
89 Handle<Box> result = Handle<Box>::cast(NewStruct(BOX_TYPE)); | 89 Handle<Box> result = Handle<Box>::cast(NewStruct(BOX_TYPE)); |
90 result->set_value(*value); | 90 result->set_value(*value); |
91 return result; | 91 return result; |
92 } | 92 } |
93 | 93 |
94 | |
95 Handle<PrototypeInfo> Factory::NewPrototypeInfo() { | 94 Handle<PrototypeInfo> Factory::NewPrototypeInfo() { |
96 Handle<PrototypeInfo> result = | 95 Handle<PrototypeInfo> result = |
97 Handle<PrototypeInfo>::cast(NewStruct(PROTOTYPE_INFO_TYPE)); | 96 Handle<PrototypeInfo>::cast(NewStruct(PROTOTYPE_INFO_TYPE)); |
98 result->set_prototype_users(WeakFixedArray::Empty()); | 97 result->set_prototype_users(WeakFixedArray::Empty()); |
99 result->set_registry_slot(PrototypeInfo::UNREGISTERED); | 98 result->set_registry_slot(PrototypeInfo::UNREGISTERED); |
100 result->set_validity_cell(Smi::FromInt(0)); | 99 result->set_validity_cell(Smi::FromInt(0)); |
101 result->set_bit_field(0); | 100 result->set_bit_field(0); |
102 return result; | 101 return result; |
103 } | 102 } |
104 | 103 |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 } | 881 } |
883 | 882 |
884 | 883 |
885 Handle<Struct> Factory::NewStruct(InstanceType type) { | 884 Handle<Struct> Factory::NewStruct(InstanceType type) { |
886 CALL_HEAP_FUNCTION( | 885 CALL_HEAP_FUNCTION( |
887 isolate(), | 886 isolate(), |
888 isolate()->heap()->AllocateStruct(type), | 887 isolate()->heap()->AllocateStruct(type), |
889 Struct); | 888 Struct); |
890 } | 889 } |
891 | 890 |
| 891 Handle<PromiseContainer> Factory::NewPromiseContainer( |
| 892 Handle<Object> promise, Handle<Object> thenable, Handle<JSFunction> then, |
| 893 Handle<JSFunction> resolve, Handle<JSFunction> reject) { |
| 894 Handle<PromiseContainer> result = |
| 895 Handle<PromiseContainer>::cast(NewStruct(PROMISE_CONTAINER_TYPE)); |
| 896 result->set_promise(*promise); |
| 897 result->set_thenable(*thenable); |
| 898 result->set_then(*then); |
| 899 result->set_resolve(*resolve); |
| 900 result->set_reject(*reject); |
| 901 return result; |
| 902 } |
892 | 903 |
893 Handle<AliasedArgumentsEntry> Factory::NewAliasedArgumentsEntry( | 904 Handle<AliasedArgumentsEntry> Factory::NewAliasedArgumentsEntry( |
894 int aliased_context_slot) { | 905 int aliased_context_slot) { |
895 Handle<AliasedArgumentsEntry> entry = Handle<AliasedArgumentsEntry>::cast( | 906 Handle<AliasedArgumentsEntry> entry = Handle<AliasedArgumentsEntry>::cast( |
896 NewStruct(ALIASED_ARGUMENTS_ENTRY_TYPE)); | 907 NewStruct(ALIASED_ARGUMENTS_ENTRY_TYPE)); |
897 entry->set_aliased_context_slot(aliased_context_slot); | 908 entry->set_aliased_context_slot(aliased_context_slot); |
898 return entry; | 909 return entry; |
899 } | 910 } |
900 | 911 |
901 | 912 |
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2511 Handle<AccessorInfo> prototype = | 2522 Handle<AccessorInfo> prototype = |
2512 Accessors::FunctionPrototypeInfo(isolate(), attribs); | 2523 Accessors::FunctionPrototypeInfo(isolate(), attribs); |
2513 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 2524 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), |
2514 prototype, attribs); | 2525 prototype, attribs); |
2515 map->AppendDescriptor(&d); | 2526 map->AppendDescriptor(&d); |
2516 } | 2527 } |
2517 } | 2528 } |
2518 | 2529 |
2519 } // namespace internal | 2530 } // namespace internal |
2520 } // namespace v8 | 2531 } // namespace v8 |
OLD | NEW |