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 1351 matching lines...) Loading... |
1362 allocation_site.is_null() ? NULL : *allocation_site), | 1362 allocation_site.is_null() ? NULL : *allocation_site), |
1363 JSObject); | 1363 JSObject); |
1364 } | 1364 } |
1365 | 1365 |
1366 | 1366 |
1367 Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind, | 1367 Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind, |
1368 int length, | 1368 int length, |
1369 int capacity, | 1369 int capacity, |
1370 ArrayStorageAllocationMode mode, | 1370 ArrayStorageAllocationMode mode, |
1371 PretenureFlag pretenure) { | 1371 PretenureFlag pretenure) { |
1372 if (capacity != 0) { | |
1373 elements_kind = GetHoleyElementsKind(elements_kind); | |
1374 } | |
1375 CALL_HEAP_FUNCTION(isolate(), | 1372 CALL_HEAP_FUNCTION(isolate(), |
1376 isolate()->heap()->AllocateJSArrayAndStorage( | 1373 isolate()->heap()->AllocateJSArrayAndStorage( |
1377 elements_kind, | 1374 elements_kind, |
1378 length, | 1375 length, |
1379 capacity, | 1376 capacity, |
1380 mode, | 1377 mode, |
1381 pretenure), | 1378 pretenure), |
1382 JSArray); | 1379 JSArray); |
1383 } | 1380 } |
1384 | 1381 |
(...skipping 561 matching lines...) Loading... |
1946 if (name->Equals(h->infinity_string())) return infinity_value(); | 1943 if (name->Equals(h->infinity_string())) return infinity_value(); |
1947 return Handle<Object>::null(); | 1944 return Handle<Object>::null(); |
1948 } | 1945 } |
1949 | 1946 |
1950 | 1947 |
1951 Handle<Object> Factory::ToBoolean(bool value) { | 1948 Handle<Object> Factory::ToBoolean(bool value) { |
1952 return value ? true_value() : false_value(); | 1949 return value ? true_value() : false_value(); |
1953 } | 1950 } |
1954 | 1951 |
1955 } } // namespace v8::internal | 1952 } } // namespace v8::internal |
OLD | NEW |