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 "src/factory.h" | 5 #include "src/factory.h" |
6 | 6 |
7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 int capacity, | 1658 int capacity, |
1659 ArrayStorageAllocationMode mode) { | 1659 ArrayStorageAllocationMode mode) { |
1660 DCHECK(capacity >= length); | 1660 DCHECK(capacity >= length); |
1661 | 1661 |
1662 if (capacity == 0) { | 1662 if (capacity == 0) { |
1663 array->set_length(Smi::FromInt(0)); | 1663 array->set_length(Smi::FromInt(0)); |
1664 array->set_elements(*empty_fixed_array()); | 1664 array->set_elements(*empty_fixed_array()); |
1665 return; | 1665 return; |
1666 } | 1666 } |
1667 | 1667 |
| 1668 HandleScope inner_scope(isolate()); |
1668 Handle<FixedArrayBase> elms; | 1669 Handle<FixedArrayBase> elms; |
1669 ElementsKind elements_kind = array->GetElementsKind(); | 1670 ElementsKind elements_kind = array->GetElementsKind(); |
1670 if (IsFastDoubleElementsKind(elements_kind)) { | 1671 if (IsFastDoubleElementsKind(elements_kind)) { |
1671 if (mode == DONT_INITIALIZE_ARRAY_ELEMENTS) { | 1672 if (mode == DONT_INITIALIZE_ARRAY_ELEMENTS) { |
1672 elms = NewFixedDoubleArray(capacity); | 1673 elms = NewFixedDoubleArray(capacity); |
1673 } else { | 1674 } else { |
1674 DCHECK(mode == INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); | 1675 DCHECK(mode == INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); |
1675 elms = NewFixedDoubleArrayWithHoles(capacity); | 1676 elms = NewFixedDoubleArrayWithHoles(capacity); |
1676 } | 1677 } |
1677 } else { | 1678 } else { |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 return Handle<Object>::null(); | 2499 return Handle<Object>::null(); |
2499 } | 2500 } |
2500 | 2501 |
2501 | 2502 |
2502 Handle<Object> Factory::ToBoolean(bool value) { | 2503 Handle<Object> Factory::ToBoolean(bool value) { |
2503 return value ? true_value() : false_value(); | 2504 return value ? true_value() : false_value(); |
2504 } | 2505 } |
2505 | 2506 |
2506 | 2507 |
2507 } } // namespace v8::internal | 2508 } } // namespace v8::internal |
OLD | NEW |