Chromium Code Reviews| 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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
| (...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1638 if (capacity == 0) { | 1638 if (capacity == 0) { |
| 1639 array->set_length(Smi::FromInt(0)); | 1639 array->set_length(Smi::FromInt(0)); |
| 1640 array->set_elements(*empty_fixed_array()); | 1640 array->set_elements(*empty_fixed_array()); |
| 1641 return; | 1641 return; |
| 1642 } | 1642 } |
| 1643 | 1643 |
| 1644 HandleScope inner_scope(isolate()); | 1644 HandleScope inner_scope(isolate()); |
| 1645 Handle<FixedArrayBase> elms; | 1645 Handle<FixedArrayBase> elms; |
| 1646 ElementsKind elements_kind = array->GetElementsKind(); | 1646 ElementsKind elements_kind = array->GetElementsKind(); |
| 1647 if (IsFastDoubleElementsKind(elements_kind)) { | 1647 if (IsFastDoubleElementsKind(elements_kind)) { |
| 1648 if (mode == DONT_INITIALIZE_ARRAY_ELEMENTS) { | 1648 switch (mode) { |
| 1649 elms = NewFixedDoubleArray(capacity); | 1649 case DONT_INITIALIZE_ARRAY_ELEMENTS: |
| 1650 } else { | 1650 elms = NewFixedDoubleArray(capacity); |
| 1651 DCHECK(mode == INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); | 1651 break; |
| 1652 elms = NewFixedDoubleArrayWithHoles(capacity); | 1652 case INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE: |
| 1653 elms = NewFixedDoubleArrayWithHoles(capacity); | |
| 1654 break; | |
| 1655 default: | |
|
ulan
2016/07/08 06:19:40
case INITIALIZE_ARRAY_ELEMENTS_WITH_UNDEFINED: UNR
Camillo Bruni
2016/07/11 11:46:38
done.
| |
| 1656 UNREACHABLE(); | |
| 1653 } | 1657 } |
| 1654 } else { | 1658 } else { |
| 1655 DCHECK(IsFastSmiOrObjectElementsKind(elements_kind)); | 1659 DCHECK(IsFastSmiOrObjectElementsKind(elements_kind)); |
| 1656 if (mode == DONT_INITIALIZE_ARRAY_ELEMENTS) { | 1660 switch (mode) { |
| 1657 elms = NewUninitializedFixedArray(capacity); | 1661 case DONT_INITIALIZE_ARRAY_ELEMENTS: |
| 1658 } else { | 1662 elms = NewUninitializedFixedArray(capacity); |
| 1659 DCHECK(mode == INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); | 1663 break; |
| 1660 elms = NewFixedArrayWithHoles(capacity); | 1664 case INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE: |
| 1665 elms = NewFixedArrayWithHoles(capacity); | |
| 1666 break; | |
| 1667 case INITIALIZE_ARRAY_ELEMENTS_WITH_UNDEFINED: | |
| 1668 elms = NewFixedArray(capacity); | |
|
Igor Sheludko
2016/07/08 08:38:22
I think it's better to have breaks even in the las
Camillo Bruni
2016/07/11 11:46:38
done.
| |
| 1661 } | 1669 } |
| 1662 } | 1670 } |
| 1663 | 1671 |
| 1664 array->set_elements(*elms); | 1672 array->set_elements(*elms); |
| 1665 array->set_length(Smi::FromInt(length)); | 1673 array->set_length(Smi::FromInt(length)); |
| 1666 } | 1674 } |
| 1667 | 1675 |
| 1668 | 1676 |
| 1669 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject( | 1677 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject( |
| 1670 Handle<JSFunction> function) { | 1678 Handle<JSFunction> function) { |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2376 } | 2384 } |
| 2377 | 2385 |
| 2378 | 2386 |
| 2379 Handle<Object> Factory::ToBoolean(bool value) { | 2387 Handle<Object> Factory::ToBoolean(bool value) { |
| 2380 return value ? true_value() : false_value(); | 2388 return value ? true_value() : false_value(); |
| 2381 } | 2389 } |
| 2382 | 2390 |
| 2383 | 2391 |
| 2384 } // namespace internal | 2392 } // namespace internal |
| 2385 } // namespace v8 | 2393 } // namespace v8 |
| OLD | NEW |