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 "factory.h" | 5 #include "factory.h" |
6 | 6 |
7 #include "isolate-inl.h" | 7 #include "isolate-inl.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 isolate()->heap()->AllocateJSObjectFromMap( | 1363 isolate()->heap()->AllocateJSObjectFromMap( |
1364 *map, | 1364 *map, |
1365 pretenure, | 1365 pretenure, |
1366 alloc_props, | 1366 alloc_props, |
1367 allocation_site.is_null() ? NULL : *allocation_site), | 1367 allocation_site.is_null() ? NULL : *allocation_site), |
1368 JSObject); | 1368 JSObject); |
1369 } | 1369 } |
1370 | 1370 |
1371 | 1371 |
1372 Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind, | 1372 Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind, |
| 1373 PretenureFlag pretenure) { |
| 1374 CALL_HEAP_FUNCTION(isolate(), |
| 1375 isolate()->heap()->AllocateJSArray(elements_kind, |
| 1376 pretenure), |
| 1377 JSArray); |
| 1378 } |
| 1379 |
| 1380 |
| 1381 Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind, |
1373 int length, | 1382 int length, |
1374 int capacity, | 1383 int capacity, |
1375 ArrayStorageAllocationMode mode, | 1384 ArrayStorageAllocationMode mode, |
1376 PretenureFlag pretenure) { | 1385 PretenureFlag pretenure) { |
1377 CALL_HEAP_FUNCTION(isolate(), | 1386 CALL_HEAP_FUNCTION(isolate(), |
1378 isolate()->heap()->AllocateJSArrayAndStorage( | 1387 isolate()->heap()->AllocateJSArrayAndStorage( |
1379 elements_kind, | 1388 elements_kind, |
1380 length, | 1389 length, |
1381 capacity, | 1390 capacity, |
1382 mode, | 1391 mode, |
1383 pretenure), | 1392 pretenure), |
1384 JSArray); | 1393 JSArray); |
1385 } | 1394 } |
1386 | 1395 |
1387 | 1396 |
1388 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements, | 1397 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements, |
1389 ElementsKind elements_kind, | 1398 ElementsKind elements_kind, |
1390 int length, | 1399 int length, |
1391 PretenureFlag pretenure) { | 1400 PretenureFlag pretenure) { |
1392 ASSERT(length <= elements->length()); | 1401 return isolate()->heap()->AllocateJSArrayWithElements( |
1393 CALL_HEAP_FUNCTION( | 1402 elements, elements_kind, length, pretenure); |
1394 isolate(), | |
1395 isolate()->heap()->AllocateJSArrayWithElements(*elements, | |
1396 elements_kind, | |
1397 length, | |
1398 pretenure), | |
1399 JSArray); | |
1400 } | 1403 } |
1401 | 1404 |
1402 | 1405 |
1403 void Factory::NewJSArrayStorage(Handle<JSArray> array, | 1406 void Factory::NewJSArrayStorage(Handle<JSArray> array, |
1404 int length, | 1407 int length, |
1405 int capacity, | 1408 int capacity, |
1406 ArrayStorageAllocationMode mode) { | 1409 ArrayStorageAllocationMode mode) { |
1407 CALL_HEAP_FUNCTION_VOID(isolate(), | 1410 CALL_HEAP_FUNCTION_VOID(isolate(), |
1408 isolate()->heap()->AllocateJSArrayStorage(*array, | 1411 isolate()->heap()->AllocateJSArrayStorage(*array, |
1409 length, | 1412 length, |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1948 if (name->Equals(h->infinity_string())) return infinity_value(); | 1951 if (name->Equals(h->infinity_string())) return infinity_value(); |
1949 return Handle<Object>::null(); | 1952 return Handle<Object>::null(); |
1950 } | 1953 } |
1951 | 1954 |
1952 | 1955 |
1953 Handle<Object> Factory::ToBoolean(bool value) { | 1956 Handle<Object> Factory::ToBoolean(bool value) { |
1954 return value ? true_value() : false_value(); | 1957 return value ? true_value() : false_value(); |
1955 } | 1958 } |
1956 | 1959 |
1957 } } // namespace v8::internal | 1960 } } // namespace v8::internal |
OLD | NEW |