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

Side by Side Diff: src/mark-compact.cc

Issue 100613004: Use optimized code map to cache OSR code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: correctly upload stuff Created 7 years 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 shared_function_info_candidates_head_ = NULL; 1061 shared_function_info_candidates_head_ = NULL;
1062 } 1062 }
1063 1063
1064 1064
1065 void CodeFlusher::ProcessOptimizedCodeMaps() { 1065 void CodeFlusher::ProcessOptimizedCodeMaps() {
1066 static const int kEntriesStart = SharedFunctionInfo::kEntriesStart; 1066 static const int kEntriesStart = SharedFunctionInfo::kEntriesStart;
1067 static const int kEntryLength = SharedFunctionInfo::kEntryLength; 1067 static const int kEntryLength = SharedFunctionInfo::kEntryLength;
1068 static const int kContextOffset = 0; 1068 static const int kContextOffset = 0;
1069 static const int kCodeOffset = 1; 1069 static const int kCodeOffset = 1;
1070 static const int kLiteralsOffset = 2; 1070 static const int kLiteralsOffset = 2;
1071 STATIC_ASSERT(kEntryLength == 3); 1071 static const int kOsrAstIdOffset = 3;
1072 STATIC_ASSERT(kEntryLength == 4);
1072 1073
1073 SharedFunctionInfo* holder = optimized_code_map_holder_head_; 1074 SharedFunctionInfo* holder = optimized_code_map_holder_head_;
1074 SharedFunctionInfo* next_holder; 1075 SharedFunctionInfo* next_holder;
1075 while (holder != NULL) { 1076 while (holder != NULL) {
1076 next_holder = GetNextCodeMap(holder); 1077 next_holder = GetNextCodeMap(holder);
1077 ClearNextCodeMap(holder); 1078 ClearNextCodeMap(holder);
1078 1079
1079 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); 1080 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
1080 int new_length = kEntriesStart; 1081 int new_length = kEntriesStart;
1081 int old_length = code_map->length(); 1082 int old_length = code_map->length();
(...skipping 23 matching lines...) Expand all
1105 RecordSlot(code_slot, code_slot, *code_slot); 1106 RecordSlot(code_slot, code_slot, *code_slot);
1106 1107
1107 // Update and record the literals slot in the optimized code map. 1108 // Update and record the literals slot in the optimized code map.
1108 Object** literals_slot = HeapObject::RawField(code_map, 1109 Object** literals_slot = HeapObject::RawField(code_map,
1109 FixedArray::OffsetOfElementAt(new_length)); 1110 FixedArray::OffsetOfElementAt(new_length));
1110 code_map->set(new_length++, code_map->get(i + kLiteralsOffset)); 1111 code_map->set(new_length++, code_map->get(i + kLiteralsOffset));
1111 ASSERT(Marking::IsBlack( 1112 ASSERT(Marking::IsBlack(
1112 Marking::MarkBitFrom(HeapObject::cast(*literals_slot)))); 1113 Marking::MarkBitFrom(HeapObject::cast(*literals_slot))));
1113 isolate_->heap()->mark_compact_collector()-> 1114 isolate_->heap()->mark_compact_collector()->
1114 RecordSlot(literals_slot, literals_slot, *literals_slot); 1115 RecordSlot(literals_slot, literals_slot, *literals_slot);
1116
1117 // Update and record the osr ast id slot in the optimized code map.
1118 code_map->set(new_length++, code_map->get(i + kOsrAstIdOffset));
1119 ASSERT(code_map->get(i + kOsrAstIdOffset)->IsSmi());
1115 } 1120 }
1116 1121
1117 // Trim the optimized code map if entries have been removed. 1122 // Trim the optimized code map if entries have been removed.
1118 if (new_length < old_length) { 1123 if (new_length < old_length) {
1119 holder->TrimOptimizedCodeMap(old_length - new_length); 1124 holder->TrimOptimizedCodeMap(old_length - new_length);
1120 } 1125 }
1121 1126
1122 holder = next_holder; 1127 holder = next_holder;
1123 } 1128 }
1124 1129
(...skipping 3242 matching lines...) Expand 10 before | Expand all | Expand 10 after
4367 while (buffer != NULL) { 4372 while (buffer != NULL) {
4368 SlotsBuffer* next_buffer = buffer->next(); 4373 SlotsBuffer* next_buffer = buffer->next();
4369 DeallocateBuffer(buffer); 4374 DeallocateBuffer(buffer);
4370 buffer = next_buffer; 4375 buffer = next_buffer;
4371 } 4376 }
4372 *buffer_address = NULL; 4377 *buffer_address = NULL;
4373 } 4378 }
4374 4379
4375 4380
4376 } } // namespace v8::internal 4381 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/objects.h » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698