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 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 DCHECK(function->shared()->is_resumable()); | 1698 DCHECK(function->shared()->is_resumable()); |
1699 JSFunction::EnsureHasInitialMap(function); | 1699 JSFunction::EnsureHasInitialMap(function); |
1700 Handle<Map> map(function->initial_map()); | 1700 Handle<Map> map(function->initial_map()); |
1701 DCHECK_EQ(JS_GENERATOR_OBJECT_TYPE, map->instance_type()); | 1701 DCHECK_EQ(JS_GENERATOR_OBJECT_TYPE, map->instance_type()); |
1702 CALL_HEAP_FUNCTION( | 1702 CALL_HEAP_FUNCTION( |
1703 isolate(), | 1703 isolate(), |
1704 isolate()->heap()->AllocateJSObjectFromMap(*map), | 1704 isolate()->heap()->AllocateJSObjectFromMap(*map), |
1705 JSGeneratorObject); | 1705 JSGeneratorObject); |
1706 } | 1706 } |
1707 | 1707 |
1708 Handle<Module> Factory::NewModule(Handle<SharedFunctionInfo> code, | 1708 Handle<Module> Factory::NewModule(Handle<SharedFunctionInfo> code) { |
1709 int min_size) { | 1709 Handle<ModuleInfo> module_info(code->scope_info()->ModuleDescriptorInfo(), |
1710 Handle<ObjectHashTable> exports = ObjectHashTable::New(isolate(), min_size); | 1710 isolate()); |
| 1711 Handle<ObjectHashTable> exports = |
| 1712 ObjectHashTable::New(isolate(), module_info->regular_exports()->length()); |
| 1713 int requested_modules_length = module_info->module_requests()->length(); |
| 1714 Handle<FixedArray> requested_modules = |
| 1715 requested_modules_length > 0 ? NewFixedArray(requested_modules_length) |
| 1716 : empty_fixed_array(); |
| 1717 |
1711 Handle<Module> module = Handle<Module>::cast(NewStruct(MODULE_TYPE)); | 1718 Handle<Module> module = Handle<Module>::cast(NewStruct(MODULE_TYPE)); |
1712 module->set_code(*code); | 1719 module->set_code(*code); |
1713 module->set_exports(*exports); | 1720 module->set_exports(*exports); |
| 1721 module->set_requested_modules(*requested_modules); |
1714 return module; | 1722 return module; |
1715 } | 1723 } |
1716 | 1724 |
1717 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer(SharedFlag shared, | 1725 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer(SharedFlag shared, |
1718 PretenureFlag pretenure) { | 1726 PretenureFlag pretenure) { |
1719 Handle<JSFunction> array_buffer_fun( | 1727 Handle<JSFunction> array_buffer_fun( |
1720 shared == SharedFlag::kShared | 1728 shared == SharedFlag::kShared |
1721 ? isolate()->native_context()->shared_array_buffer_fun() | 1729 ? isolate()->native_context()->shared_array_buffer_fun() |
1722 : isolate()->native_context()->array_buffer_fun()); | 1730 : isolate()->native_context()->array_buffer_fun()); |
1723 CALL_HEAP_FUNCTION(isolate(), isolate()->heap()->AllocateJSObject( | 1731 CALL_HEAP_FUNCTION(isolate(), isolate()->heap()->AllocateJSObject( |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2534 Handle<AccessorInfo> prototype = | 2542 Handle<AccessorInfo> prototype = |
2535 Accessors::FunctionPrototypeInfo(isolate(), attribs); | 2543 Accessors::FunctionPrototypeInfo(isolate(), attribs); |
2536 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 2544 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), |
2537 prototype, attribs); | 2545 prototype, attribs); |
2538 map->AppendDescriptor(&d); | 2546 map->AppendDescriptor(&d); |
2539 } | 2547 } |
2540 } | 2548 } |
2541 | 2549 |
2542 } // namespace internal | 2550 } // namespace internal |
2543 } // namespace v8 | 2551 } // namespace v8 |
OLD | NEW |