OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 CALL_HEAP_FUNCTION( | 943 CALL_HEAP_FUNCTION( |
944 isolate(), | 944 isolate(), |
945 isolate()->heap()->AllocateJSObjectFromMap(*map, NOT_TENURED), | 945 isolate()->heap()->AllocateJSObjectFromMap(*map, NOT_TENURED), |
946 JSObject); | 946 JSObject); |
947 } | 947 } |
948 | 948 |
949 | 949 |
950 Handle<JSArray> Factory::NewJSArray(int capacity, | 950 Handle<JSArray> Factory::NewJSArray(int capacity, |
951 ElementsKind elements_kind, | 951 ElementsKind elements_kind, |
952 PretenureFlag pretenure) { | 952 PretenureFlag pretenure) { |
| 953 if (capacity != 0) { |
| 954 elements_kind = GetHoleyElementsKind(elements_kind); |
| 955 } |
953 CALL_HEAP_FUNCTION(isolate(), | 956 CALL_HEAP_FUNCTION(isolate(), |
954 isolate()->heap()->AllocateJSArrayAndStorage( | 957 isolate()->heap()->AllocateJSArrayAndStorage( |
955 elements_kind, | 958 elements_kind, |
956 0, | 959 0, |
957 capacity, | 960 capacity, |
958 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, | 961 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, |
959 pretenure), | 962 pretenure), |
960 JSArray); | 963 JSArray); |
961 } | 964 } |
962 | 965 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 | 1443 |
1441 | 1444 |
1442 Handle<Object> Factory::ToBoolean(bool value) { | 1445 Handle<Object> Factory::ToBoolean(bool value) { |
1443 return Handle<Object>(value | 1446 return Handle<Object>(value |
1444 ? isolate()->heap()->true_value() | 1447 ? isolate()->heap()->true_value() |
1445 : isolate()->heap()->false_value()); | 1448 : isolate()->heap()->false_value()); |
1446 } | 1449 } |
1447 | 1450 |
1448 | 1451 |
1449 } } // namespace v8::internal | 1452 } } // namespace v8::internal |
OLD | NEW |