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