Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: src/deoptimizer.cc

Issue 211333002: Replace HeapNumber as doublebox with an explicit MutableHeapNumber. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/factory.h » ('j') | src/heap.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 Handle<Object> value = MaterializeNextValue(); 1835 Handle<Object> value = MaterializeNextValue();
1836 array->set(i, *value); 1836 array->set(i, *value);
1837 } 1837 }
1838 } else { 1838 } else {
1839 // Dispatch on the instance type of the object to be materialized. 1839 // Dispatch on the instance type of the object to be materialized.
1840 // We also need to make sure that the representation of all fields 1840 // We also need to make sure that the representation of all fields
1841 // in the given object are general enough to hold a tagged value. 1841 // in the given object are general enough to hold a tagged value.
1842 Handle<Map> map = Map::GeneralizeAllFieldRepresentations( 1842 Handle<Map> map = Map::GeneralizeAllFieldRepresentations(
1843 Handle<Map>::cast(MaterializeNextValue()), Representation::Tagged()); 1843 Handle<Map>::cast(MaterializeNextValue()), Representation::Tagged());
1844 switch (map->instance_type()) { 1844 switch (map->instance_type()) {
1845 case MUTABLE_HEAP_NUMBER_TYPE:
1845 case HEAP_NUMBER_TYPE: { 1846 case HEAP_NUMBER_TYPE: {
1846 // Reuse the HeapNumber value directly as it is already properly 1847 // Reuse the HeapNumber value directly as it is already properly
1847 // tagged and skip materializing the HeapNumber explicitly. 1848 // tagged and skip materializing the HeapNumber explicitly. Turn mutable
1849 // heap numbers immutable.
1848 Handle<Object> object = MaterializeNextValue(); 1850 Handle<Object> object = MaterializeNextValue();
1849 if (object_index < prev_materialized_count_) { 1851 if (object_index < prev_materialized_count_) {
1850 materialized_objects_->Add(Handle<Object>( 1852 materialized_objects_->Add(Handle<Object>(
1851 previously_materialized_objects_->get(object_index), isolate_)); 1853 previously_materialized_objects_->get(object_index), isolate_));
1852 } else { 1854 } else {
1853 materialized_objects_->Add(object); 1855 materialized_objects_->Add(object);
1854 } 1856 }
1855 materialization_value_index_ += kDoubleSize / kPointerSize - 1; 1857 materialization_value_index_ += kDoubleSize / kPointerSize - 1;
1856 break; 1858 break;
1857 } 1859 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 } 1900 }
1899 } 1901 }
1900 1902
1901 return materialized_objects_->at(object_index); 1903 return materialized_objects_->at(object_index);
1902 } 1904 }
1903 1905
1904 1906
1905 Handle<Object> Deoptimizer::MaterializeNextValue() { 1907 Handle<Object> Deoptimizer::MaterializeNextValue() {
1906 int value_index = materialization_value_index_++; 1908 int value_index = materialization_value_index_++;
1907 Handle<Object> value = materialized_values_->at(value_index); 1909 Handle<Object> value = materialized_values_->at(value_index);
1910 if (value->IsMutableHeapNumber()) {
1911 HeapNumber::cast(*value)->set_map(isolate_->heap()->heap_number_map());
Igor Sheludko 2014/03/27 11:30:16 I think it is worth adding a comment here about wh
1912 }
1908 if (*value == isolate_->heap()->arguments_marker()) { 1913 if (*value == isolate_->heap()->arguments_marker()) {
1909 value = MaterializeNextHeapObject(); 1914 value = MaterializeNextHeapObject();
1910 } 1915 }
1911 return value; 1916 return value;
1912 } 1917 }
1913 1918
1914 1919
1915 void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) { 1920 void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) {
1916 ASSERT_NE(DEBUGGER, bailout_type_); 1921 ASSERT_NE(DEBUGGER, bailout_type_);
1917 1922
(...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after
3339 return GetPreviouslyMaterialized(isolate, length); 3344 return GetPreviouslyMaterialized(isolate, length);
3340 } 3345 }
3341 3346
3342 Handle<Object> map_object = slot_refs_[current_slot_].GetValue(isolate); 3347 Handle<Object> map_object = slot_refs_[current_slot_].GetValue(isolate);
3343 Handle<Map> map = Map::GeneralizeAllFieldRepresentations( 3348 Handle<Map> map = Map::GeneralizeAllFieldRepresentations(
3344 Handle<Map>::cast(map_object), Representation::Tagged()); 3349 Handle<Map>::cast(map_object), Representation::Tagged());
3345 current_slot_++; 3350 current_slot_++;
3346 // TODO(jarin) this should be unified with the code in 3351 // TODO(jarin) this should be unified with the code in
3347 // Deoptimizer::MaterializeNextHeapObject() 3352 // Deoptimizer::MaterializeNextHeapObject()
3348 switch (map->instance_type()) { 3353 switch (map->instance_type()) {
3354 case MUTABLE_HEAP_NUMBER_TYPE:
3349 case HEAP_NUMBER_TYPE: { 3355 case HEAP_NUMBER_TYPE: {
3350 // Reuse the HeapNumber value directly as it is already properly 3356 // Reuse the HeapNumber value directly as it is already properly
3351 // tagged and skip materializing the HeapNumber explicitly. 3357 // tagged and skip materializing the HeapNumber explicitly.
3352 Handle<Object> object = GetNext(isolate, lvl + 1); 3358 Handle<Object> object = GetNext(isolate, lvl + 1);
3353 materialized_objects_.Add(object); 3359 materialized_objects_.Add(object);
3354 // On 32-bit architectures, there is an extra slot there because 3360 // On 32-bit architectures, there is an extra slot there because
3355 // the escape analysis calculates the number of slots as 3361 // the escape analysis calculates the number of slots as
3356 // object-size/pointer-size. To account for this, we read out 3362 // object-size/pointer-size. To account for this, we read out
3357 // any extra slots. 3363 // any extra slots.
3358 for (int i = 0; i < length - 2; i++) { 3364 for (int i = 0; i < length - 2; i++) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
3546 3552
3547 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 3553 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
3548 v->VisitPointer(BitCast<Object**>(&function_)); 3554 v->VisitPointer(BitCast<Object**>(&function_));
3549 v->VisitPointers(parameters_, parameters_ + parameters_count_); 3555 v->VisitPointers(parameters_, parameters_ + parameters_count_);
3550 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 3556 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
3551 } 3557 }
3552 3558
3553 #endif // ENABLE_DEBUGGER_SUPPORT 3559 #endif // ENABLE_DEBUGGER_SUPPORT
3554 3560
3555 } } // namespace v8::internal 3561 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/factory.h » ('j') | src/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698