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 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 int capacity, | 1675 int capacity, |
1676 ArrayStorageAllocationMode mode) { | 1676 ArrayStorageAllocationMode mode) { |
1677 DCHECK(capacity >= length); | 1677 DCHECK(capacity >= length); |
1678 | 1678 |
1679 if (capacity == 0) { | 1679 if (capacity == 0) { |
1680 array->set_length(Smi::FromInt(0)); | 1680 array->set_length(Smi::FromInt(0)); |
1681 array->set_elements(*empty_fixed_array()); | 1681 array->set_elements(*empty_fixed_array()); |
1682 return; | 1682 return; |
1683 } | 1683 } |
1684 | 1684 |
| 1685 HandleScope inner_scope(isolate()); |
1685 Handle<FixedArrayBase> elms; | 1686 Handle<FixedArrayBase> elms; |
1686 ElementsKind elements_kind = array->GetElementsKind(); | 1687 ElementsKind elements_kind = array->GetElementsKind(); |
1687 if (IsFastDoubleElementsKind(elements_kind)) { | 1688 if (IsFastDoubleElementsKind(elements_kind)) { |
1688 if (mode == DONT_INITIALIZE_ARRAY_ELEMENTS) { | 1689 if (mode == DONT_INITIALIZE_ARRAY_ELEMENTS) { |
1689 elms = NewFixedDoubleArray(capacity); | 1690 elms = NewFixedDoubleArray(capacity); |
1690 } else { | 1691 } else { |
1691 DCHECK(mode == INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); | 1692 DCHECK(mode == INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); |
1692 elms = NewFixedDoubleArrayWithHoles(capacity); | 1693 elms = NewFixedDoubleArrayWithHoles(capacity); |
1693 } | 1694 } |
1694 } else { | 1695 } else { |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2521 return Handle<Object>::null(); | 2522 return Handle<Object>::null(); |
2522 } | 2523 } |
2523 | 2524 |
2524 | 2525 |
2525 Handle<Object> Factory::ToBoolean(bool value) { | 2526 Handle<Object> Factory::ToBoolean(bool value) { |
2526 return value ? true_value() : false_value(); | 2527 return value ? true_value() : false_value(); |
2527 } | 2528 } |
2528 | 2529 |
2529 | 2530 |
2530 } } // namespace v8::internal | 2531 } } // namespace v8::internal |
OLD | NEW |