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 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1625 | 1625 |
1626 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, | 1626 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, |
1627 PretenureFlag pretenure) { | 1627 PretenureFlag pretenure) { |
1628 JSFunction::EnsureHasInitialMap(constructor); | 1628 JSFunction::EnsureHasInitialMap(constructor); |
1629 CALL_HEAP_FUNCTION( | 1629 CALL_HEAP_FUNCTION( |
1630 isolate(), | 1630 isolate(), |
1631 isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject); | 1631 isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject); |
1632 } | 1632 } |
1633 | 1633 |
1634 | 1634 |
1635 Handle<JSObject> Factory::NewJSObjectWithMemento( | |
1636 Handle<JSFunction> constructor, | |
1637 Handle<AllocationSite> site) { | |
1638 JSFunction::EnsureHasInitialMap(constructor); | |
1639 CALL_HEAP_FUNCTION( | |
1640 isolate(), | |
1641 isolate()->heap()->AllocateJSObject(*constructor, NOT_TENURED, *site), | |
1642 JSObject); | |
1643 } | |
1644 | |
1645 Handle<JSObject> Factory::NewJSObjectWithNullProto() { | 1635 Handle<JSObject> Factory::NewJSObjectWithNullProto() { |
1646 Handle<JSObject> result = NewJSObject(isolate()->object_function()); | 1636 Handle<JSObject> result = NewJSObject(isolate()->object_function()); |
1647 Handle<Map> new_map = | 1637 Handle<Map> new_map = |
1648 Map::Copy(Handle<Map>(result->map()), "ObjectWithNullProto"); | 1638 Map::Copy(Handle<Map>(result->map()), "ObjectWithNullProto"); |
1649 Map::SetPrototype(new_map, null_value()); | 1639 Map::SetPrototype(new_map, null_value()); |
1650 JSObject::MigrateToMap(result, new_map); | 1640 JSObject::MigrateToMap(result, new_map); |
1651 return result; | 1641 return result; |
1652 } | 1642 } |
1653 | 1643 |
1654 Handle<JSGlobalObject> Factory::NewJSGlobalObject( | 1644 Handle<JSGlobalObject> Factory::NewJSGlobalObject( |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2707 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); | 2697 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); |
2708 iterator->set_initial_next(*next); | 2698 iterator->set_initial_next(*next); |
2709 iterator->set_array(*array); | 2699 iterator->set_array(*array); |
2710 iterator->set_index(0); | 2700 iterator->set_index(0); |
2711 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); | 2701 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); |
2712 return iterator; | 2702 return iterator; |
2713 } | 2703 } |
2714 | 2704 |
2715 } // namespace internal | 2705 } // namespace internal |
2716 } // namespace v8 | 2706 } // namespace v8 |
OLD | NEW |