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 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 isolate(), | 1434 isolate(), |
1435 isolate()->heap()->AllocateJSObjectFromMap( | 1435 isolate()->heap()->AllocateJSObjectFromMap( |
1436 *map, | 1436 *map, |
1437 pretenure, | 1437 pretenure, |
1438 alloc_props, | 1438 alloc_props, |
1439 allocation_site.is_null() ? NULL : *allocation_site), | 1439 allocation_site.is_null() ? NULL : *allocation_site), |
1440 JSObject); | 1440 JSObject); |
1441 } | 1441 } |
1442 | 1442 |
1443 | 1443 |
1444 Handle<JSArray> Factory::NewJSArray(int capacity, | 1444 Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind, |
1445 ElementsKind elements_kind, | 1445 int length, |
| 1446 int capacity, |
1446 PretenureFlag pretenure) { | 1447 PretenureFlag pretenure) { |
1447 if (capacity != 0) { | 1448 if (capacity != 0) { |
1448 elements_kind = GetHoleyElementsKind(elements_kind); | 1449 elements_kind = GetHoleyElementsKind(elements_kind); |
1449 } | 1450 } |
1450 CALL_HEAP_FUNCTION(isolate(), | 1451 CALL_HEAP_FUNCTION(isolate(), |
1451 isolate()->heap()->AllocateJSArrayAndStorage( | 1452 isolate()->heap()->AllocateJSArrayAndStorage( |
1452 elements_kind, | 1453 elements_kind, |
1453 0, | 1454 length, |
1454 capacity, | 1455 capacity, |
1455 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, | 1456 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, |
1456 pretenure), | 1457 pretenure), |
1457 JSArray); | 1458 JSArray); |
1458 } | 1459 } |
1459 | 1460 |
1460 | 1461 |
1461 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements, | 1462 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements, |
1462 ElementsKind elements_kind, | 1463 ElementsKind elements_kind, |
| 1464 int length, |
| 1465 PretenureFlag pretenure) { |
| 1466 ASSERT(length <= elements->length()); |
| 1467 CALL_HEAP_FUNCTION( |
| 1468 isolate(), |
| 1469 isolate()->heap()->AllocateJSArrayWithElements(*elements, |
| 1470 elements_kind, |
| 1471 length, |
| 1472 pretenure), |
| 1473 JSArray); |
| 1474 } |
| 1475 |
| 1476 |
| 1477 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements, |
| 1478 ElementsKind elements_kind, |
1463 PretenureFlag pretenure) { | 1479 PretenureFlag pretenure) { |
1464 CALL_HEAP_FUNCTION( | 1480 return NewJSArrayWithElements( |
1465 isolate(), | 1481 elements, elements_kind, elements->length(), pretenure); |
1466 isolate()->heap()->AllocateJSArrayWithElements(*elements, | |
1467 elements_kind, | |
1468 elements->length(), | |
1469 pretenure), | |
1470 JSArray); | |
1471 } | 1482 } |
1472 | 1483 |
1473 | 1484 |
1474 void Factory::NewJSArrayStorage(Handle<JSArray> array, | 1485 void Factory::NewJSArrayStorage(Handle<JSArray> array, |
1475 int length, | 1486 int length, |
1476 int capacity, | 1487 int capacity, |
1477 ArrayStorageAllocationMode mode) { | 1488 ArrayStorageAllocationMode mode) { |
1478 CALL_HEAP_FUNCTION_VOID(isolate(), | 1489 CALL_HEAP_FUNCTION_VOID(isolate(), |
1479 isolate()->heap()->AllocateJSArrayStorage(*array, | 1490 isolate()->heap()->AllocateJSArrayStorage(*array, |
1480 length, | 1491 length, |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 return Handle<Object>::null(); | 2050 return Handle<Object>::null(); |
2040 } | 2051 } |
2041 | 2052 |
2042 | 2053 |
2043 Handle<Object> Factory::ToBoolean(bool value) { | 2054 Handle<Object> Factory::ToBoolean(bool value) { |
2044 return value ? true_value() : false_value(); | 2055 return value ? true_value() : false_value(); |
2045 } | 2056 } |
2046 | 2057 |
2047 | 2058 |
2048 } } // namespace v8::internal | 2059 } } // namespace v8::internal |
OLD | NEW |