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/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 Handle<JSObject> Factory::NewJSObjectWithMemento( | 1491 Handle<JSObject> Factory::NewJSObjectWithMemento( |
1492 Handle<JSFunction> constructor, | 1492 Handle<JSFunction> constructor, |
1493 Handle<AllocationSite> site) { | 1493 Handle<AllocationSite> site) { |
1494 JSFunction::EnsureHasInitialMap(constructor); | 1494 JSFunction::EnsureHasInitialMap(constructor); |
1495 CALL_HEAP_FUNCTION( | 1495 CALL_HEAP_FUNCTION( |
1496 isolate(), | 1496 isolate(), |
1497 isolate()->heap()->AllocateJSObject(*constructor, NOT_TENURED, *site), | 1497 isolate()->heap()->AllocateJSObject(*constructor, NOT_TENURED, *site), |
1498 JSObject); | 1498 JSObject); |
1499 } | 1499 } |
1500 | 1500 |
| 1501 Handle<JSObject> Factory::NewJSObjectWithNullProto() { |
| 1502 Handle<JSObject> result = NewJSObject(isolate()->object_function()); |
| 1503 Handle<Map> new_map = |
| 1504 Map::Copy(Handle<Map>(result->map()), "ObjectWithNullProto"); |
| 1505 Map::SetPrototype(new_map, null_value()); |
| 1506 JSObject::MigrateToMap(result, new_map); |
| 1507 return result; |
| 1508 } |
1501 | 1509 |
1502 Handle<JSModule> Factory::NewJSModule(Handle<Context> context, | 1510 Handle<JSModule> Factory::NewJSModule(Handle<Context> context, |
1503 Handle<ScopeInfo> scope_info) { | 1511 Handle<ScopeInfo> scope_info) { |
1504 // Allocate a fresh map. Modules do not have a prototype. | 1512 // Allocate a fresh map. Modules do not have a prototype. |
1505 Handle<Map> map = NewMap(JS_MODULE_TYPE, JSModule::kSize); | 1513 Handle<Map> map = NewMap(JS_MODULE_TYPE, JSModule::kSize); |
1506 // Allocate the object based on the map. | 1514 // Allocate the object based on the map. |
1507 Handle<JSModule> module = | 1515 Handle<JSModule> module = |
1508 Handle<JSModule>::cast(NewJSObjectFromMap(map, TENURED)); | 1516 Handle<JSModule>::cast(NewJSObjectFromMap(map, TENURED)); |
1509 module->set_context(*context); | 1517 module->set_context(*context); |
1510 module->set_scope_info(*scope_info); | 1518 module->set_scope_info(*scope_info); |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 } | 2379 } |
2372 | 2380 |
2373 | 2381 |
2374 Handle<Object> Factory::ToBoolean(bool value) { | 2382 Handle<Object> Factory::ToBoolean(bool value) { |
2375 return value ? true_value() : false_value(); | 2383 return value ? true_value() : false_value(); |
2376 } | 2384 } |
2377 | 2385 |
2378 | 2386 |
2379 } // namespace internal | 2387 } // namespace internal |
2380 } // namespace v8 | 2388 } // namespace v8 |
OLD | NEW |