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 12335132: Fix materialization of arguments objects with unknown values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Sven Panne. Created 7 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 | « src/deoptimizer.h ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »
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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 ASSERT(array->length() == length); 878 ASSERT(array->length() == length);
879 for (int i = length - 1; i >= 0 ; --i) { 879 for (int i = length - 1; i >= 0 ; --i) {
880 array->set(i, *values.RemoveLast()); 880 array->set(i, *values.RemoveLast());
881 } 881 }
882 arguments->set_elements(*array); 882 arguments->set_elements(*array);
883 } 883 }
884 } 884 }
885 frame->SetExpression(i, *arguments); 885 frame->SetExpression(i, *arguments);
886 ASSERT_EQ(Memory::Object_at(descriptor.slot_address()), *arguments); 886 ASSERT_EQ(Memory::Object_at(descriptor.slot_address()), *arguments);
887 if (trace_) { 887 if (trace_) {
888 PrintF("Materializing %sarguments object for %p: ", 888 PrintF("Materializing %sarguments object of length %d for %p: ",
889 frame->has_adapted_arguments() ? "(adapted) " : "", 889 frame->has_adapted_arguments() ? "(adapted) " : "",
890 arguments->elements()->length(),
890 reinterpret_cast<void*>(descriptor.slot_address())); 891 reinterpret_cast<void*>(descriptor.slot_address()));
891 arguments->ShortPrint(); 892 arguments->ShortPrint();
892 PrintF("\n"); 893 PrintF("\n");
893 } 894 }
894 } 895 }
895 } 896 }
896 } 897 }
897 } 898 }
898 899
899 900
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 output_offset); 1174 output_offset);
1174 literal->ShortPrint(); 1175 literal->ShortPrint();
1175 PrintF(" ; literal\n"); 1176 PrintF(" ; literal\n");
1176 } 1177 }
1177 intptr_t value = reinterpret_cast<intptr_t>(literal); 1178 intptr_t value = reinterpret_cast<intptr_t>(literal);
1178 output_[frame_index]->SetFrameSlot(output_offset, value); 1179 output_[frame_index]->SetFrameSlot(output_offset, value);
1179 return; 1180 return;
1180 } 1181 }
1181 1182
1182 case Translation::ARGUMENTS_OBJECT: { 1183 case Translation::ARGUMENTS_OBJECT: {
1184 bool args_known = iterator->Next();
1183 int args_index = iterator->Next() + 1; // Skip receiver. 1185 int args_index = iterator->Next() + 1; // Skip receiver.
1184 int args_length = iterator->Next() - 1; // Skip receiver. 1186 int args_length = iterator->Next() - 1; // Skip receiver.
1185 if (trace_) { 1187 if (trace_) {
1186 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- ", 1188 PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- ",
1187 output_[frame_index]->GetTop() + output_offset, 1189 output_[frame_index]->GetTop() + output_offset,
1188 output_offset); 1190 output_offset);
1189 isolate_->heap()->arguments_marker()->ShortPrint(); 1191 isolate_->heap()->arguments_marker()->ShortPrint();
1190 PrintF(" ; arguments object\n"); 1192 PrintF(" ; %sarguments object\n", args_known ? "" : "dummy ");
1191 } 1193 }
1192 // Use the arguments marker value as a sentinel and fill in the arguments 1194 // Use the arguments marker value as a sentinel and fill in the arguments
1193 // object after the deoptimized frame is built. 1195 // object after the deoptimized frame is built.
1194 intptr_t value = reinterpret_cast<intptr_t>( 1196 intptr_t value = reinterpret_cast<intptr_t>(
1195 isolate_->heap()->arguments_marker()); 1197 isolate_->heap()->arguments_marker());
1196 AddArgumentsObject( 1198 AddArgumentsObject(
1197 output_[frame_index]->GetTop() + output_offset, args_length); 1199 output_[frame_index]->GetTop() + output_offset, args_length);
1198 output_[frame_index]->SetFrameSlot(output_offset, value); 1200 output_[frame_index]->SetFrameSlot(output_offset, value);
1199 // We save the tagged argument values on the side and materialize the 1201 // We save the tagged argument values on the side and materialize the
1200 // actual arguments object after the deoptimized frame is built. 1202 // actual arguments object after the deoptimized frame is built.
1201 for (int i = 0; i < args_length; i++) { 1203 for (int i = 0; i < args_length; i++) {
1202 unsigned input_offset = input_->GetOffsetFromSlotIndex(args_index + i); 1204 unsigned input_offset = input_->GetOffsetFromSlotIndex(args_index + i);
1203 intptr_t input_value = input_->GetFrameSlot(input_offset); 1205 intptr_t input_value = args_known
1206 ? input_->GetFrameSlot(input_offset)
1207 : reinterpret_cast<intptr_t>(isolate_->heap()->the_hole_value());
1204 AddArgumentsObjectValue(input_value); 1208 AddArgumentsObjectValue(input_value);
1205 } 1209 }
1206 return; 1210 return;
1207 } 1211 }
1208 } 1212 }
1209 } 1213 }
1210 1214
1211 1215
1212 static bool ObjectToInt32(Object* obj, int32_t* value) { 1216 static bool ObjectToInt32(Object* obj, int32_t* value) {
1213 if (obj->IsSmi()) { 1217 if (obj->IsSmi()) {
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 buffer_->Add(index, zone()); 1838 buffer_->Add(index, zone());
1835 } 1839 }
1836 1840
1837 1841
1838 void Translation::StoreLiteral(int literal_id) { 1842 void Translation::StoreLiteral(int literal_id) {
1839 buffer_->Add(LITERAL, zone()); 1843 buffer_->Add(LITERAL, zone());
1840 buffer_->Add(literal_id, zone()); 1844 buffer_->Add(literal_id, zone());
1841 } 1845 }
1842 1846
1843 1847
1844 void Translation::StoreArgumentsObject(int args_index, int args_length) { 1848 void Translation::StoreArgumentsObject(bool args_known,
1849 int args_index,
1850 int args_length) {
1845 buffer_->Add(ARGUMENTS_OBJECT, zone()); 1851 buffer_->Add(ARGUMENTS_OBJECT, zone());
1852 buffer_->Add(args_known, zone());
1846 buffer_->Add(args_index, zone()); 1853 buffer_->Add(args_index, zone());
1847 buffer_->Add(args_length, zone()); 1854 buffer_->Add(args_length, zone());
1848 } 1855 }
1849 1856
1850 1857
1851 void Translation::MarkDuplicate() { 1858 void Translation::MarkDuplicate() {
1852 buffer_->Add(DUPLICATE, zone()); 1859 buffer_->Add(DUPLICATE, zone());
1853 } 1860 }
1854 1861
1855 1862
(...skipping 10 matching lines...) Expand all
1866 case STACK_SLOT: 1873 case STACK_SLOT:
1867 case INT32_STACK_SLOT: 1874 case INT32_STACK_SLOT:
1868 case UINT32_STACK_SLOT: 1875 case UINT32_STACK_SLOT:
1869 case DOUBLE_STACK_SLOT: 1876 case DOUBLE_STACK_SLOT:
1870 case LITERAL: 1877 case LITERAL:
1871 case COMPILED_STUB_FRAME: 1878 case COMPILED_STUB_FRAME:
1872 return 1; 1879 return 1;
1873 case BEGIN: 1880 case BEGIN:
1874 case ARGUMENTS_ADAPTOR_FRAME: 1881 case ARGUMENTS_ADAPTOR_FRAME:
1875 case CONSTRUCT_STUB_FRAME: 1882 case CONSTRUCT_STUB_FRAME:
1876 case ARGUMENTS_OBJECT:
1877 return 2; 1883 return 2;
1878 case JS_FRAME: 1884 case JS_FRAME:
1885 case ARGUMENTS_OBJECT:
1879 return 3; 1886 return 3;
1880 } 1887 }
1881 UNREACHABLE(); 1888 UNREACHABLE();
1882 return -1; 1889 return -1;
1883 } 1890 }
1884 1891
1885 1892
1886 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) 1893 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
1887 1894
1888 const char* Translation::StringFor(Opcode opcode) { 1895 const char* Translation::StringFor(Opcode opcode) {
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2137 2144
2138 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 2145 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
2139 v->VisitPointer(BitCast<Object**>(&function_)); 2146 v->VisitPointer(BitCast<Object**>(&function_));
2140 v->VisitPointers(parameters_, parameters_ + parameters_count_); 2147 v->VisitPointers(parameters_, parameters_ + parameters_count_);
2141 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 2148 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
2142 } 2149 }
2143 2150
2144 #endif // ENABLE_DEBUGGER_SUPPORT 2151 #endif // ENABLE_DEBUGGER_SUPPORT
2145 2152
2146 } } // namespace v8::internal 2153 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/deoptimizer.h ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698