| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/disasm.h" | 10 #include "src/disasm.h" |
| (...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1806 Handle<Object> value = MaterializeNextValue(); | 1806 Handle<Object> value = MaterializeNextValue(); |
| 1807 array->set(i, *value); | 1807 array->set(i, *value); |
| 1808 } | 1808 } |
| 1809 } else { | 1809 } else { |
| 1810 // Dispatch on the instance type of the object to be materialized. | 1810 // Dispatch on the instance type of the object to be materialized. |
| 1811 // We also need to make sure that the representation of all fields | 1811 // We also need to make sure that the representation of all fields |
| 1812 // in the given object are general enough to hold a tagged value. | 1812 // in the given object are general enough to hold a tagged value. |
| 1813 Handle<Map> map = Map::GeneralizeAllFieldRepresentations( | 1813 Handle<Map> map = Map::GeneralizeAllFieldRepresentations( |
| 1814 Handle<Map>::cast(MaterializeNextValue())); | 1814 Handle<Map>::cast(MaterializeNextValue())); |
| 1815 switch (map->instance_type()) { | 1815 switch (map->instance_type()) { |
| 1816 case MUTABLE_HEAP_NUMBER_TYPE: |
| 1816 case HEAP_NUMBER_TYPE: { | 1817 case HEAP_NUMBER_TYPE: { |
| 1817 // Reuse the HeapNumber value directly as it is already properly | 1818 // Reuse the HeapNumber value directly as it is already properly |
| 1818 // tagged and skip materializing the HeapNumber explicitly. | 1819 // tagged and skip materializing the HeapNumber explicitly. Turn mutable |
| 1820 // heap numbers immutable. |
| 1819 Handle<Object> object = MaterializeNextValue(); | 1821 Handle<Object> object = MaterializeNextValue(); |
| 1820 if (object_index < prev_materialized_count_) { | 1822 if (object_index < prev_materialized_count_) { |
| 1821 materialized_objects_->Add(Handle<Object>( | 1823 materialized_objects_->Add(Handle<Object>( |
| 1822 previously_materialized_objects_->get(object_index), isolate_)); | 1824 previously_materialized_objects_->get(object_index), isolate_)); |
| 1823 } else { | 1825 } else { |
| 1824 materialized_objects_->Add(object); | 1826 materialized_objects_->Add(object); |
| 1825 } | 1827 } |
| 1826 materialization_value_index_ += kDoubleSize / kPointerSize - 1; | 1828 materialization_value_index_ += kDoubleSize / kPointerSize - 1; |
| 1827 break; | 1829 break; |
| 1828 } | 1830 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1870 } | 1872 } |
| 1871 } | 1873 } |
| 1872 | 1874 |
| 1873 return materialized_objects_->at(object_index); | 1875 return materialized_objects_->at(object_index); |
| 1874 } | 1876 } |
| 1875 | 1877 |
| 1876 | 1878 |
| 1877 Handle<Object> Deoptimizer::MaterializeNextValue() { | 1879 Handle<Object> Deoptimizer::MaterializeNextValue() { |
| 1878 int value_index = materialization_value_index_++; | 1880 int value_index = materialization_value_index_++; |
| 1879 Handle<Object> value = materialized_values_->at(value_index); | 1881 Handle<Object> value = materialized_values_->at(value_index); |
| 1882 if (value->IsMutableHeapNumber()) { |
| 1883 HeapNumber::cast(*value)->set_map(isolate_->heap()->heap_number_map()); |
| 1884 } |
| 1880 if (*value == isolate_->heap()->arguments_marker()) { | 1885 if (*value == isolate_->heap()->arguments_marker()) { |
| 1881 value = MaterializeNextHeapObject(); | 1886 value = MaterializeNextHeapObject(); |
| 1882 } | 1887 } |
| 1883 return value; | 1888 return value; |
| 1884 } | 1889 } |
| 1885 | 1890 |
| 1886 | 1891 |
| 1887 void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) { | 1892 void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) { |
| 1888 ASSERT_NE(DEBUGGER, bailout_type_); | 1893 ASSERT_NE(DEBUGGER, bailout_type_); |
| 1889 | 1894 |
| (...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3376 return GetPreviouslyMaterialized(isolate, length); | 3381 return GetPreviouslyMaterialized(isolate, length); |
| 3377 } | 3382 } |
| 3378 | 3383 |
| 3379 Handle<Object> map_object = slot_refs_[current_slot_].GetValue(isolate); | 3384 Handle<Object> map_object = slot_refs_[current_slot_].GetValue(isolate); |
| 3380 Handle<Map> map = Map::GeneralizeAllFieldRepresentations( | 3385 Handle<Map> map = Map::GeneralizeAllFieldRepresentations( |
| 3381 Handle<Map>::cast(map_object)); | 3386 Handle<Map>::cast(map_object)); |
| 3382 current_slot_++; | 3387 current_slot_++; |
| 3383 // TODO(jarin) this should be unified with the code in | 3388 // TODO(jarin) this should be unified with the code in |
| 3384 // Deoptimizer::MaterializeNextHeapObject() | 3389 // Deoptimizer::MaterializeNextHeapObject() |
| 3385 switch (map->instance_type()) { | 3390 switch (map->instance_type()) { |
| 3391 case MUTABLE_HEAP_NUMBER_TYPE: |
| 3386 case HEAP_NUMBER_TYPE: { | 3392 case HEAP_NUMBER_TYPE: { |
| 3387 // Reuse the HeapNumber value directly as it is already properly | 3393 // Reuse the HeapNumber value directly as it is already properly |
| 3388 // tagged and skip materializing the HeapNumber explicitly. | 3394 // tagged and skip materializing the HeapNumber explicitly. |
| 3389 Handle<Object> object = GetNext(isolate, lvl + 1); | 3395 Handle<Object> object = GetNext(isolate, lvl + 1); |
| 3390 materialized_objects_.Add(object); | 3396 materialized_objects_.Add(object); |
| 3391 // On 32-bit architectures, there is an extra slot there because | 3397 // On 32-bit architectures, there is an extra slot there because |
| 3392 // the escape analysis calculates the number of slots as | 3398 // the escape analysis calculates the number of slots as |
| 3393 // object-size/pointer-size. To account for this, we read out | 3399 // object-size/pointer-size. To account for this, we read out |
| 3394 // any extra slots. | 3400 // any extra slots. |
| 3395 for (int i = 0; i < length - 2; i++) { | 3401 for (int i = 0; i < length - 2; i++) { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3582 } | 3588 } |
| 3583 | 3589 |
| 3584 | 3590 |
| 3585 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 3591 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
| 3586 v->VisitPointer(BitCast<Object**>(&function_)); | 3592 v->VisitPointer(BitCast<Object**>(&function_)); |
| 3587 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 3593 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
| 3588 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 3594 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
| 3589 } | 3595 } |
| 3590 | 3596 |
| 3591 } } // namespace v8::internal | 3597 } } // namespace v8::internal |
| OLD | NEW |