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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 Handle<PrototypeInfo>::cast(NewStruct(PROTOTYPE_INFO_TYPE)); | 97 Handle<PrototypeInfo>::cast(NewStruct(PROTOTYPE_INFO_TYPE)); |
98 result->set_prototype_users(WeakFixedArray::Empty()); | 98 result->set_prototype_users(WeakFixedArray::Empty()); |
99 result->set_registry_slot(PrototypeInfo::UNREGISTERED); | 99 result->set_registry_slot(PrototypeInfo::UNREGISTERED); |
100 result->set_validity_cell(Smi::FromInt(0)); | 100 result->set_validity_cell(Smi::FromInt(0)); |
101 result->set_bit_field(0); | 101 result->set_bit_field(0); |
102 return result; | 102 return result; |
103 } | 103 } |
104 | 104 |
105 Handle<ContextExtension> Factory::NewContextExtension( | 105 Handle<ContextExtension> Factory::NewContextExtension( |
106 Handle<ScopeInfo> scope_info, Handle<Object> extension) { | 106 Handle<ScopeInfo> scope_info, Handle<Object> extension) { |
107 DCHECK(scope_info->is_declaration_scope()); | |
108 Handle<ContextExtension> result = | 107 Handle<ContextExtension> result = |
109 Handle<ContextExtension>::cast(NewStruct(CONTEXT_EXTENSION_TYPE)); | 108 Handle<ContextExtension>::cast(NewStruct(CONTEXT_EXTENSION_TYPE)); |
110 result->set_scope_info(*scope_info); | 109 result->set_scope_info(*scope_info); |
111 result->set_extension(*extension); | 110 result->set_extension(*extension); |
112 return result; | 111 return result; |
113 } | 112 } |
114 | 113 |
115 Handle<Oddball> Factory::NewOddball(Handle<Map> map, const char* to_string, | 114 Handle<Oddball> Factory::NewOddball(Handle<Map> map, const char* to_string, |
116 Handle<Object> to_number, | 115 Handle<Object> to_number, |
117 const char* type_of, byte kind) { | 116 const char* type_of, byte kind) { |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 Handle<FixedArray> array = NewFixedArray(length); | 808 Handle<FixedArray> array = NewFixedArray(length); |
810 array->set_map_no_write_barrier(*function_context_map()); | 809 array->set_map_no_write_barrier(*function_context_map()); |
811 Handle<Context> context = Handle<Context>::cast(array); | 810 Handle<Context> context = Handle<Context>::cast(array); |
812 context->set_closure(*function); | 811 context->set_closure(*function); |
813 context->set_previous(function->context()); | 812 context->set_previous(function->context()); |
814 context->set_extension(*the_hole_value()); | 813 context->set_extension(*the_hole_value()); |
815 context->set_native_context(function->native_context()); | 814 context->set_native_context(function->native_context()); |
816 return context; | 815 return context; |
817 } | 816 } |
818 | 817 |
819 | |
820 Handle<Context> Factory::NewCatchContext(Handle<JSFunction> function, | 818 Handle<Context> Factory::NewCatchContext(Handle<JSFunction> function, |
821 Handle<Context> previous, | 819 Handle<Context> previous, |
| 820 Handle<ScopeInfo> scope_info, |
822 Handle<String> name, | 821 Handle<String> name, |
823 Handle<Object> thrown_object) { | 822 Handle<Object> thrown_object) { |
824 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == Context::THROWN_OBJECT_INDEX); | 823 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == Context::THROWN_OBJECT_INDEX); |
| 824 Handle<ContextExtension> extension = NewContextExtension(scope_info, name); |
825 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS + 1); | 825 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS + 1); |
826 array->set_map_no_write_barrier(*catch_context_map()); | 826 array->set_map_no_write_barrier(*catch_context_map()); |
827 Handle<Context> context = Handle<Context>::cast(array); | 827 Handle<Context> context = Handle<Context>::cast(array); |
828 context->set_closure(*function); | 828 context->set_closure(*function); |
829 context->set_previous(*previous); | 829 context->set_previous(*previous); |
830 context->set_extension(*name); | 830 context->set_extension(*extension); |
831 context->set_native_context(previous->native_context()); | 831 context->set_native_context(previous->native_context()); |
832 context->set(Context::THROWN_OBJECT_INDEX, *thrown_object); | 832 context->set(Context::THROWN_OBJECT_INDEX, *thrown_object); |
833 return context; | 833 return context; |
834 } | 834 } |
835 | 835 |
836 Handle<Context> Factory::NewDebugEvaluateContext(Handle<Context> previous, | 836 Handle<Context> Factory::NewDebugEvaluateContext(Handle<Context> previous, |
837 Handle<JSReceiver> extension, | 837 Handle<JSReceiver> extension, |
838 Handle<Context> wrapped, | 838 Handle<Context> wrapped, |
839 Handle<StringSet> whitelist) { | 839 Handle<StringSet> whitelist) { |
840 STATIC_ASSERT(Context::WHITE_LIST_INDEX == Context::MIN_CONTEXT_SLOTS + 1); | 840 STATIC_ASSERT(Context::WHITE_LIST_INDEX == Context::MIN_CONTEXT_SLOTS + 1); |
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2508 Handle<AccessorInfo> prototype = | 2508 Handle<AccessorInfo> prototype = |
2509 Accessors::FunctionPrototypeInfo(isolate(), attribs); | 2509 Accessors::FunctionPrototypeInfo(isolate(), attribs); |
2510 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 2510 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), |
2511 prototype, attribs); | 2511 prototype, attribs); |
2512 map->AppendDescriptor(&d); | 2512 map->AppendDescriptor(&d); |
2513 } | 2513 } |
2514 } | 2514 } |
2515 | 2515 |
2516 } // namespace internal | 2516 } // namespace internal |
2517 } // namespace v8 | 2517 } // namespace v8 |
OLD | NEW |