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 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1640 if (capacity == 0) { | 1640 if (capacity == 0) { |
| 1641 array->set_length(Smi::FromInt(0)); | 1641 array->set_length(Smi::FromInt(0)); |
| 1642 array->set_elements(*empty_fixed_array()); | 1642 array->set_elements(*empty_fixed_array()); |
| 1643 return; | 1643 return; |
| 1644 } | 1644 } |
| 1645 | 1645 |
| 1646 HandleScope inner_scope(isolate()); | 1646 HandleScope inner_scope(isolate()); |
| 1647 Handle<FixedArrayBase> elms; | 1647 Handle<FixedArrayBase> elms; |
| 1648 ElementsKind elements_kind = array->GetElementsKind(); | 1648 ElementsKind elements_kind = array->GetElementsKind(); |
| 1649 if (IsFastDoubleElementsKind(elements_kind)) { | 1649 if (IsFastDoubleElementsKind(elements_kind)) { |
| 1650 if (mode == DONT_INITIALIZE_ARRAY_ELEMENTS) { | 1650 switch (mode) { |
| 1651 elms = NewFixedDoubleArray(capacity); | 1651 case DONT_INITIALIZE_ARRAY_ELEMENTS: |
| 1652 } else { | 1652 elms = NewFixedDoubleArray(capacity); |
| 1653 DCHECK(mode == INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); | 1653 break; |
| 1654 elms = NewFixedDoubleArrayWithHoles(capacity); | 1654 case INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE: |
| 1655 elms = NewFixedDoubleArrayWithHoles(capacity); | |
| 1656 break; | |
| 1657 case INITIALIZE_ARRAY_ELEMENTS_WITH_UNDEFINED: | |
| 1658 UNREACHABLE(); | |
|
Igor Sheludko
2016/07/11 15:37:10
break;
| |
| 1655 } | 1659 } |
| 1656 } else { | 1660 } else { |
| 1657 DCHECK(IsFastSmiOrObjectElementsKind(elements_kind)); | 1661 DCHECK(IsFastSmiOrObjectElementsKind(elements_kind)); |
| 1658 if (mode == DONT_INITIALIZE_ARRAY_ELEMENTS) { | 1662 switch (mode) { |
| 1659 elms = NewUninitializedFixedArray(capacity); | 1663 case DONT_INITIALIZE_ARRAY_ELEMENTS: |
| 1660 } else { | 1664 elms = NewUninitializedFixedArray(capacity); |
| 1661 DCHECK(mode == INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); | 1665 break; |
| 1662 elms = NewFixedArrayWithHoles(capacity); | 1666 case INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE: |
| 1667 elms = NewFixedArrayWithHoles(capacity); | |
| 1668 break; | |
| 1669 case INITIALIZE_ARRAY_ELEMENTS_WITH_UNDEFINED: | |
| 1670 elms = NewFixedArray(capacity); | |
| 1671 break; | |
| 1663 } | 1672 } |
| 1664 } | 1673 } |
| 1665 | 1674 |
| 1666 array->set_elements(*elms); | 1675 array->set_elements(*elms); |
| 1667 array->set_length(Smi::FromInt(length)); | 1676 array->set_length(Smi::FromInt(length)); |
| 1668 } | 1677 } |
| 1669 | 1678 |
| 1670 | 1679 |
| 1671 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject( | 1680 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject( |
| 1672 Handle<JSFunction> function) { | 1681 Handle<JSFunction> function) { |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2378 } | 2387 } |
| 2379 | 2388 |
| 2380 | 2389 |
| 2381 Handle<Object> Factory::ToBoolean(bool value) { | 2390 Handle<Object> Factory::ToBoolean(bool value) { |
| 2382 return value ? true_value() : false_value(); | 2391 return value ? true_value() : false_value(); |
| 2383 } | 2392 } |
| 2384 | 2393 |
| 2385 | 2394 |
| 2386 } // namespace internal | 2395 } // namespace internal |
| 2387 } // namespace v8 | 2396 } // namespace v8 |
| OLD | NEW |