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 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2103 object->set_hash(*hash); | 2103 object->set_hash(*hash); |
2104 } | 2104 } |
2105 | 2105 |
2106 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( | 2106 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( |
2107 Handle<String> name, int number_of_literals, FunctionKind kind, | 2107 Handle<String> name, int number_of_literals, FunctionKind kind, |
2108 Handle<Code> code, Handle<ScopeInfo> scope_info) { | 2108 Handle<Code> code, Handle<ScopeInfo> scope_info) { |
2109 DCHECK(IsValidFunctionKind(kind)); | 2109 DCHECK(IsValidFunctionKind(kind)); |
2110 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo( | 2110 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo( |
2111 name, code, IsConstructable(kind, scope_info->language_mode())); | 2111 name, code, IsConstructable(kind, scope_info->language_mode())); |
2112 shared->set_scope_info(*scope_info); | 2112 shared->set_scope_info(*scope_info); |
| 2113 shared->set_outer_scope_info(*the_hole_value()); |
2113 shared->set_kind(kind); | 2114 shared->set_kind(kind); |
2114 shared->set_num_literals(number_of_literals); | 2115 shared->set_num_literals(number_of_literals); |
2115 if (IsGeneratorFunction(kind)) { | 2116 if (IsGeneratorFunction(kind)) { |
2116 shared->set_instance_class_name(isolate()->heap()->Generator_string()); | 2117 shared->set_instance_class_name(isolate()->heap()->Generator_string()); |
2117 } | 2118 } |
2118 return shared; | 2119 return shared; |
2119 } | 2120 } |
2120 | 2121 |
2121 | 2122 |
2122 Handle<JSMessageObject> Factory::NewJSMessageObject( | 2123 Handle<JSMessageObject> Factory::NewJSMessageObject( |
(...skipping 26 matching lines...) Expand all Loading... |
2149 | 2150 |
2150 // Set pointer fields. | 2151 // Set pointer fields. |
2151 share->set_name(*name); | 2152 share->set_name(*name); |
2152 Handle<Code> code; | 2153 Handle<Code> code; |
2153 if (!maybe_code.ToHandle(&code)) { | 2154 if (!maybe_code.ToHandle(&code)) { |
2154 code = isolate()->builtins()->Illegal(); | 2155 code = isolate()->builtins()->Illegal(); |
2155 } | 2156 } |
2156 share->set_code(*code); | 2157 share->set_code(*code); |
2157 share->set_optimized_code_map(*cleared_optimized_code_map()); | 2158 share->set_optimized_code_map(*cleared_optimized_code_map()); |
2158 share->set_scope_info(ScopeInfo::Empty(isolate())); | 2159 share->set_scope_info(ScopeInfo::Empty(isolate())); |
| 2160 share->set_outer_scope_info(*the_hole_value()); |
2159 Handle<Code> construct_stub = | 2161 Handle<Code> construct_stub = |
2160 is_constructor ? isolate()->builtins()->JSConstructStubGeneric() | 2162 is_constructor ? isolate()->builtins()->JSConstructStubGeneric() |
2161 : isolate()->builtins()->ConstructedNonConstructable(); | 2163 : isolate()->builtins()->ConstructedNonConstructable(); |
2162 share->SetConstructStub(*construct_stub); | 2164 share->SetConstructStub(*construct_stub); |
2163 share->set_instance_class_name(*Object_string()); | 2165 share->set_instance_class_name(*Object_string()); |
2164 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); | 2166 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); |
2165 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); | 2167 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); |
2166 share->set_debug_info(DebugInfo::uninitialized(), SKIP_WRITE_BARRIER); | 2168 share->set_debug_info(DebugInfo::uninitialized(), SKIP_WRITE_BARRIER); |
2167 share->set_function_identifier(*undefined_value(), SKIP_WRITE_BARRIER); | 2169 share->set_function_identifier(*undefined_value(), SKIP_WRITE_BARRIER); |
2168 StaticFeedbackVectorSpec empty_spec; | 2170 StaticFeedbackVectorSpec empty_spec; |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2541 Handle<AccessorInfo> prototype = | 2543 Handle<AccessorInfo> prototype = |
2542 Accessors::FunctionPrototypeInfo(isolate(), attribs); | 2544 Accessors::FunctionPrototypeInfo(isolate(), attribs); |
2543 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 2545 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), |
2544 prototype, attribs); | 2546 prototype, attribs); |
2545 map->AppendDescriptor(&d); | 2547 map->AppendDescriptor(&d); |
2546 } | 2548 } |
2547 } | 2549 } |
2548 | 2550 |
2549 } // namespace internal | 2551 } // namespace internal |
2550 } // namespace v8 | 2552 } // namespace v8 |
OLD | NEW |