OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1386 // Set up the global object as a normalized object. | 1386 // Set up the global object as a normalized object. |
1387 global->set_map(*new_map); | 1387 global->set_map(*new_map); |
1388 global->set_properties(*dictionary); | 1388 global->set_properties(*dictionary); |
1389 | 1389 |
1390 // Make sure result is a global object with properties in dictionary. | 1390 // Make sure result is a global object with properties in dictionary. |
1391 ASSERT(global->IsGlobalObject() && !global->HasFastProperties()); | 1391 ASSERT(global->IsGlobalObject() && !global->HasFastProperties()); |
1392 return global; | 1392 return global; |
1393 } | 1393 } |
1394 | 1394 |
1395 | 1395 |
1396 Handle<JSObject> Factory::NewJSObjectFromMap(Handle<Map> map, | 1396 Handle<JSObject> Factory::NewJSObjectFromMap( |
1397 PretenureFlag pretenure, | 1397 Handle<Map> map, |
1398 bool alloc_props) { | 1398 PretenureFlag pretenure, |
1399 bool alloc_props, | |
1400 Handle<AllocationSite> allocation_site) { | |
1399 CALL_HEAP_FUNCTION( | 1401 CALL_HEAP_FUNCTION( |
1400 isolate(), | 1402 isolate(), |
1401 isolate()->heap()->AllocateJSObjectFromMap(*map, pretenure, alloc_props), | 1403 isolate()->heap()->AllocateJSObjectFromMap( |
1404 *map, | |
1405 pretenure, | |
1406 alloc_props, | |
1407 allocation_site.is_null() ? NULL : *allocation_site), | |
1402 JSObject); | 1408 JSObject); |
1403 } | 1409 } |
1404 | 1410 |
1405 | 1411 |
1406 Handle<JSArray> Factory::NewJSArray(int capacity, | 1412 Handle<JSArray> Factory::NewJSArray(int capacity, |
1407 ElementsKind elements_kind, | 1413 ElementsKind elements_kind, |
1408 PretenureFlag pretenure) { | 1414 PretenureFlag pretenure) { |
1409 if (capacity != 0) { | 1415 if (capacity != 0) { |
1410 elements_kind = GetHoleyElementsKind(elements_kind); | 1416 elements_kind = GetHoleyElementsKind(elements_kind); |
1411 } | 1417 } |
(...skipping 14 matching lines...) Expand all Loading... | |
1426 CALL_HEAP_FUNCTION( | 1432 CALL_HEAP_FUNCTION( |
1427 isolate(), | 1433 isolate(), |
1428 isolate()->heap()->AllocateJSArrayWithElements(*elements, | 1434 isolate()->heap()->AllocateJSArrayWithElements(*elements, |
1429 elements_kind, | 1435 elements_kind, |
1430 elements->length(), | 1436 elements->length(), |
1431 pretenure), | 1437 pretenure), |
1432 JSArray); | 1438 JSArray); |
1433 } | 1439 } |
1434 | 1440 |
1435 | 1441 |
1442 void Factory::AllocateJSArrayStorage(Handle<JSArray> array, | |
Yang
2014/03/17 14:13:05
If a heap method is called AllocateX, we usually c
| |
1443 int length, | |
1444 int capacity, | |
1445 ArrayStorageAllocationMode mode) { | |
1446 CALL_HEAP_FUNCTION_VOID(isolate(), | |
1447 isolate()->heap()->AllocateJSArrayStorage(*array, | |
1448 length, | |
1449 capacity, | |
1450 mode)); | |
1451 } | |
1452 | |
1453 | |
1436 void Factory::SetElementsCapacityAndLength(Handle<JSArray> array, | 1454 void Factory::SetElementsCapacityAndLength(Handle<JSArray> array, |
1437 int capacity, | 1455 int capacity, |
1438 int length) { | 1456 int length) { |
1439 ElementsAccessor* accessor = array->GetElementsAccessor(); | 1457 ElementsAccessor* accessor = array->GetElementsAccessor(); |
1440 CALL_HEAP_FUNCTION_VOID( | 1458 CALL_HEAP_FUNCTION_VOID( |
1441 isolate(), | 1459 isolate(), |
1442 accessor->SetCapacityAndLength(*array, capacity, length)); | 1460 accessor->SetCapacityAndLength(*array, capacity, length)); |
1443 } | 1461 } |
1444 | 1462 |
1445 | 1463 |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1991 return Handle<Object>::null(); | 2009 return Handle<Object>::null(); |
1992 } | 2010 } |
1993 | 2011 |
1994 | 2012 |
1995 Handle<Object> Factory::ToBoolean(bool value) { | 2013 Handle<Object> Factory::ToBoolean(bool value) { |
1996 return value ? true_value() : false_value(); | 2014 return value ? true_value() : false_value(); |
1997 } | 2015 } |
1998 | 2016 |
1999 | 2017 |
2000 } } // namespace v8::internal | 2018 } } // namespace v8::internal |
OLD | NEW |