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(int min_size) { | 1708 Handle<Module> Factory::NewModule(Handle<SharedFunctionInfo> code, |
| 1709 int min_size) { |
| 1710 Handle<ObjectHashTable> exports = ObjectHashTable::New(isolate(), min_size); |
1709 Handle<Module> module = Handle<Module>::cast(NewStruct(MODULE_TYPE)); | 1711 Handle<Module> module = Handle<Module>::cast(NewStruct(MODULE_TYPE)); |
1710 Handle<ObjectHashTable> exports = ObjectHashTable::New(isolate(), min_size); | 1712 module->set_code(*code); |
1711 module->set_exports(*exports); | 1713 module->set_exports(*exports); |
1712 return module; | 1714 return module; |
1713 } | 1715 } |
1714 | 1716 |
1715 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer(SharedFlag shared, | 1717 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer(SharedFlag shared, |
1716 PretenureFlag pretenure) { | 1718 PretenureFlag pretenure) { |
1717 Handle<JSFunction> array_buffer_fun( | 1719 Handle<JSFunction> array_buffer_fun( |
1718 shared == SharedFlag::kShared | 1720 shared == SharedFlag::kShared |
1719 ? isolate()->native_context()->shared_array_buffer_fun() | 1721 ? isolate()->native_context()->shared_array_buffer_fun() |
1720 : isolate()->native_context()->array_buffer_fun()); | 1722 : isolate()->native_context()->array_buffer_fun()); |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2532 Handle<AccessorInfo> prototype = | 2534 Handle<AccessorInfo> prototype = |
2533 Accessors::FunctionPrototypeInfo(isolate(), attribs); | 2535 Accessors::FunctionPrototypeInfo(isolate(), attribs); |
2534 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 2536 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), |
2535 prototype, attribs); | 2537 prototype, attribs); |
2536 map->AppendDescriptor(&d); | 2538 map->AppendDescriptor(&d); |
2537 } | 2539 } |
2538 } | 2540 } |
2539 | 2541 |
2540 } // namespace internal | 2542 } // namespace internal |
2541 } // namespace v8 | 2543 } // namespace v8 |
OLD | NEW |