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/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1716 } | 1716 } |
1717 | 1717 |
1718 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, | 1718 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, |
1719 PretenureFlag pretenure) { | 1719 PretenureFlag pretenure) { |
1720 JSFunction::EnsureHasInitialMap(constructor); | 1720 JSFunction::EnsureHasInitialMap(constructor); |
1721 CALL_HEAP_FUNCTION( | 1721 CALL_HEAP_FUNCTION( |
1722 isolate(), | 1722 isolate(), |
1723 isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject); | 1723 isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject); |
1724 } | 1724 } |
1725 | 1725 |
1726 | 1726 Handle<JSObject> Factory::NewJSObjectWithNullProto(PretenureFlag pretenure) { |
1727 Handle<JSObject> Factory::NewJSObjectWithNullProto() { | 1727 Handle<JSObject> result = |
1728 Handle<JSObject> result = NewJSObject(isolate()->object_function()); | 1728 NewJSObject(isolate()->object_function(), pretenure); |
1729 Handle<Map> new_map = | 1729 Handle<Map> new_map = |
1730 Map::Copy(Handle<Map>(result->map()), "ObjectWithNullProto"); | 1730 Map::Copy(Handle<Map>(result->map()), "ObjectWithNullProto"); |
1731 Map::SetPrototype(new_map, null_value()); | 1731 Map::SetPrototype(new_map, null_value()); |
1732 JSObject::MigrateToMap(result, new_map); | 1732 JSObject::MigrateToMap(result, new_map); |
1733 return result; | 1733 return result; |
1734 } | 1734 } |
1735 | 1735 |
1736 Handle<JSGlobalObject> Factory::NewJSGlobalObject( | 1736 Handle<JSGlobalObject> Factory::NewJSGlobalObject( |
1737 Handle<JSFunction> constructor) { | 1737 Handle<JSFunction> constructor) { |
1738 DCHECK(constructor->has_initial_map()); | 1738 DCHECK(constructor->has_initial_map()); |
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2842 Handle<AccessorInfo> prototype = | 2842 Handle<AccessorInfo> prototype = |
2843 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); | 2843 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); |
2844 Descriptor d = Descriptor::AccessorConstant( | 2844 Descriptor d = Descriptor::AccessorConstant( |
2845 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); | 2845 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); |
2846 map->AppendDescriptor(&d); | 2846 map->AppendDescriptor(&d); |
2847 } | 2847 } |
2848 } | 2848 } |
2849 | 2849 |
2850 } // namespace internal | 2850 } // namespace internal |
2851 } // namespace v8 | 2851 } // namespace v8 |
OLD | NEW |