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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 } | 891 } |
893 | 892 |
894 | 893 |
895 Handle<Struct> Factory::NewStruct(InstanceType type) { | 894 Handle<Struct> Factory::NewStruct(InstanceType type) { |
896 CALL_HEAP_FUNCTION( | 895 CALL_HEAP_FUNCTION( |
897 isolate(), | 896 isolate(), |
898 isolate()->heap()->AllocateStruct(type), | 897 isolate()->heap()->AllocateStruct(type), |
899 Struct); | 898 Struct); |
900 } | 899 } |
901 | 900 |
| 901 Handle<PromiseContainer> Factory::NewPromiseContainer( |
| 902 Handle<JSReceiver> thenable, Handle<JSFunction> then, |
| 903 Handle<JSFunction> resolve, Handle<JSFunction> reject, |
| 904 Handle<Object> before_debug_event, Handle<Object> after_debug_event) { |
| 905 Handle<PromiseContainer> result = |
| 906 Handle<PromiseContainer>::cast(NewStruct(PROMISE_CONTAINER_TYPE)); |
| 907 result->set_thenable(*thenable); |
| 908 result->set_then(*then); |
| 909 result->set_resolve(*resolve); |
| 910 result->set_reject(*reject); |
| 911 result->set_before_debug_event(*before_debug_event); |
| 912 result->set_after_debug_event(*after_debug_event); |
| 913 return result; |
| 914 } |
902 | 915 |
903 Handle<AliasedArgumentsEntry> Factory::NewAliasedArgumentsEntry( | 916 Handle<AliasedArgumentsEntry> Factory::NewAliasedArgumentsEntry( |
904 int aliased_context_slot) { | 917 int aliased_context_slot) { |
905 Handle<AliasedArgumentsEntry> entry = Handle<AliasedArgumentsEntry>::cast( | 918 Handle<AliasedArgumentsEntry> entry = Handle<AliasedArgumentsEntry>::cast( |
906 NewStruct(ALIASED_ARGUMENTS_ENTRY_TYPE)); | 919 NewStruct(ALIASED_ARGUMENTS_ENTRY_TYPE)); |
907 entry->set_aliased_context_slot(aliased_context_slot); | 920 entry->set_aliased_context_slot(aliased_context_slot); |
908 return entry; | 921 return entry; |
909 } | 922 } |
910 | 923 |
911 | 924 |
(...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2534 Handle<AccessorInfo> prototype = | 2547 Handle<AccessorInfo> prototype = |
2535 Accessors::FunctionPrototypeInfo(isolate(), attribs); | 2548 Accessors::FunctionPrototypeInfo(isolate(), attribs); |
2536 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 2549 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), |
2537 prototype, attribs); | 2550 prototype, attribs); |
2538 map->AppendDescriptor(&d); | 2551 map->AppendDescriptor(&d); |
2539 } | 2552 } |
2540 } | 2553 } |
2541 | 2554 |
2542 } // namespace internal | 2555 } // namespace internal |
2543 } // namespace v8 | 2556 } // namespace v8 |
OLD | NEW |