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

Side by Side Diff: src/frames.cc

Issue 7969013: Fix pc to code cache so it can cope with a pointer to the start of the code (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 3 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 | « no previous file | src/objects-inl.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 1163
1164 1164
1165 static int GcSafeSizeOfCodeSpaceObject(HeapObject* object) { 1165 static int GcSafeSizeOfCodeSpaceObject(HeapObject* object) {
1166 MapWord map_word = object->map_word(); 1166 MapWord map_word = object->map_word();
1167 Map* map = map_word.IsForwardingAddress() ? 1167 Map* map = map_word.IsForwardingAddress() ?
1168 map_word.ToForwardingAddress()->map() : map_word.ToMap(); 1168 map_word.ToForwardingAddress()->map() : map_word.ToMap();
1169 return object->SizeFromMap(map); 1169 return object->SizeFromMap(map);
1170 } 1170 }
1171 1171
1172 1172
1173 Code* PcToCodeCache::GcSafeFindCodeForPc(Address pc) { 1173 Code* PcToCodeCache::GcSafeFindCodeForPc(Address pc) {
Rico 2011/09/20 09:10:35 We should consider renaming pc to something else s
1174 Heap* heap = isolate_->heap(); 1174 Heap* heap = isolate_->heap();
1175 // Check if the pc points into a large object chunk. 1175 // Check if the pc points into a large object chunk.
1176 LargePage* large_page = heap->lo_space()->FindPageContainingPc(pc); 1176 LargePage* large_page = heap->lo_space()->FindPageContainingPc(pc);
1177 if (large_page != NULL) return GcSafeCastToCode(large_page->GetObject(), pc); 1177 if (large_page != NULL) return GcSafeCastToCode(large_page->GetObject(), pc);
1178 1178
1179 // Iterate through the page until we reach the end or find an object starting 1179 // Iterate through the page until we reach the end or find an object starting
1180 // after the pc. 1180 // after the pc.
1181 Page* page = Page::FromAddress(pc); 1181 Page* page = Page::FromAddress(pc);
1182 1182
1183 Address addr = page->skip_list()->StartFor(pc); 1183 Address addr = page->skip_list()->StartFor(pc);
1184 1184
1185 Address top = heap->code_space()->top(); 1185 Address top = heap->code_space()->top();
1186 Address limit = heap->code_space()->limit(); 1186 Address limit = heap->code_space()->limit();
1187 1187
1188 while (true) { 1188 while (true) {
1189 if (addr == top && addr != limit) { 1189 if (addr == top && addr != limit) {
1190 addr = limit; 1190 addr = limit;
1191 continue; 1191 continue;
1192 } 1192 }
1193 1193
1194 HeapObject* obj = HeapObject::FromAddress(addr); 1194 HeapObject* obj = HeapObject::FromAddress(addr);
1195 int obj_size = GcSafeSizeOfCodeSpaceObject(obj); 1195 int obj_size = GcSafeSizeOfCodeSpaceObject(obj);
1196 Address next_addr = addr + obj_size; 1196 Address next_addr = addr + obj_size;
1197 if (next_addr >= pc) return GcSafeCastToCode(obj, pc); 1197 if (next_addr > pc) return GcSafeCastToCode(obj, pc);
1198 addr = next_addr; 1198 addr = next_addr;
1199 } 1199 }
1200 } 1200 }
1201 1201
1202 1202
1203 PcToCodeCache::PcToCodeCacheEntry* PcToCodeCache::GetCacheEntry(Address pc) { 1203 PcToCodeCache::PcToCodeCacheEntry* PcToCodeCache::GetCacheEntry(Address pc) {
1204 isolate_->counters()->pc_to_code()->Increment(); 1204 isolate_->counters()->pc_to_code()->Increment();
1205 ASSERT(IsPowerOf2(kPcToCodeCacheSize)); 1205 ASSERT(IsPowerOf2(kPcToCodeCacheSize));
1206 uint32_t hash = ComputeIntegerHash( 1206 uint32_t hash = ComputeIntegerHash(
1207 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(pc))); 1207 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(pc)));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 ZoneList<StackFrame*> list(10); 1287 ZoneList<StackFrame*> list(10);
1288 for (StackFrameIterator it; !it.done(); it.Advance()) { 1288 for (StackFrameIterator it; !it.done(); it.Advance()) {
1289 StackFrame* frame = AllocateFrameCopy(it.frame()); 1289 StackFrame* frame = AllocateFrameCopy(it.frame());
1290 list.Add(frame); 1290 list.Add(frame);
1291 } 1291 }
1292 return list.ToVector(); 1292 return list.ToVector();
1293 } 1293 }
1294 1294
1295 1295
1296 } } // namespace v8::internal 1296 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698