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

Side by Side Diff: src/liveedit.cc

Issue 7945009: Merge experimental/gc branch to the bleeding_edge. (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 | « src/lithium-allocator.cc ('k') | src/liveobjectlist.cc » ('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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 ZoneList<Object**> rvalues_; 993 ZoneList<Object**> rvalues_;
994 ZoneList<RelocInfo> reloc_infos_; 994 ZoneList<RelocInfo> reloc_infos_;
995 ZoneList<Address> code_entries_; 995 ZoneList<Address> code_entries_;
996 }; 996 };
997 997
998 998
999 // Finds all references to original and replaces them with substitution. 999 // Finds all references to original and replaces them with substitution.
1000 static void ReplaceCodeObject(Code* original, Code* substitution) { 1000 static void ReplaceCodeObject(Code* original, Code* substitution) {
1001 ASSERT(!HEAP->InNewSpace(substitution)); 1001 ASSERT(!HEAP->InNewSpace(substitution));
1002 1002
1003 HeapIterator iterator;
1003 AssertNoAllocation no_allocations_please; 1004 AssertNoAllocation no_allocations_please;
1004 1005
1005 // A zone scope for ReferenceCollectorVisitor. 1006 // A zone scope for ReferenceCollectorVisitor.
1006 ZoneScope scope(Isolate::Current(), DELETE_ON_EXIT); 1007 ZoneScope scope(Isolate::Current(), DELETE_ON_EXIT);
1007 1008
1008 ReferenceCollectorVisitor visitor(original); 1009 ReferenceCollectorVisitor visitor(original);
1009 1010
1010 // Iterate over all roots. Stack frames may have pointer into original code, 1011 // Iterate over all roots. Stack frames may have pointer into original code,
1011 // so temporary replace the pointers with offset numbers 1012 // so temporary replace the pointers with offset numbers
1012 // in prologue/epilogue. 1013 // in prologue/epilogue.
1013 { 1014 {
1014 HEAP->IterateStrongRoots(&visitor, VISIT_ALL); 1015 HEAP->IterateStrongRoots(&visitor, VISIT_ALL);
1015 } 1016 }
1016 1017
1017 // Now iterate over all pointers of all objects, including code_target 1018 // Now iterate over all pointers of all objects, including code_target
1018 // implicit pointers. 1019 // implicit pointers.
1019 HeapIterator iterator;
1020 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 1020 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1021 obj->Iterate(&visitor); 1021 obj->Iterate(&visitor);
1022 } 1022 }
1023 1023
1024 visitor.Replace(substitution); 1024 visitor.Replace(substitution);
1025 } 1025 }
1026 1026
1027 1027
1028 // Check whether the code is natural function code (not a lazy-compile stub 1028 // Check whether the code is natural function code (not a lazy-compile stub
1029 // code). 1029 // code).
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 1094
1095 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { 1095 if (!SharedInfoWrapper::IsInstance(shared_info_array)) {
1096 return Isolate::Current()->ThrowIllegalOperation(); 1096 return Isolate::Current()->ThrowIllegalOperation();
1097 } 1097 }
1098 1098
1099 FunctionInfoWrapper compile_info_wrapper(new_compile_info_array); 1099 FunctionInfoWrapper compile_info_wrapper(new_compile_info_array);
1100 SharedInfoWrapper shared_info_wrapper(shared_info_array); 1100 SharedInfoWrapper shared_info_wrapper(shared_info_array);
1101 1101
1102 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo(); 1102 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo();
1103 1103
1104 HEAP->EnsureHeapIsIterable();
1105
1104 if (IsJSFunctionCode(shared_info->code())) { 1106 if (IsJSFunctionCode(shared_info->code())) {
1105 Handle<Code> code = compile_info_wrapper.GetFunctionCode(); 1107 Handle<Code> code = compile_info_wrapper.GetFunctionCode();
1106 ReplaceCodeObject(shared_info->code(), *code); 1108 ReplaceCodeObject(shared_info->code(), *code);
1107 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo(); 1109 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo();
1108 if (code_scope_info->IsFixedArray()) { 1110 if (code_scope_info->IsFixedArray()) {
1109 shared_info->set_scope_info(SerializedScopeInfo::cast(*code_scope_info)); 1111 shared_info->set_scope_info(SerializedScopeInfo::cast(*code_scope_info));
1110 } 1112 }
1111 } 1113 }
1112 1114
1113 if (shared_info->debug_info()->IsDebugInfo()) { 1115 if (shared_info->debug_info()->IsDebugInfo()) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 RelocInfoWriter reloc_info_writer_; 1266 RelocInfoWriter reloc_info_writer_;
1265 byte* buffer_; 1267 byte* buffer_;
1266 int buffer_size_; 1268 int buffer_size_;
1267 1269
1268 static const int kBufferGap = RelocInfoWriter::kMaxSize; 1270 static const int kBufferGap = RelocInfoWriter::kMaxSize;
1269 static const int kMaximalBufferSize = 512*MB; 1271 static const int kMaximalBufferSize = 512*MB;
1270 }; 1272 };
1271 1273
1272 // Patch positions in code (changes relocation info section) and possibly 1274 // Patch positions in code (changes relocation info section) and possibly
1273 // returns new instance of code. 1275 // returns new instance of code.
1274 static Handle<Code> PatchPositionsInCode(Handle<Code> code, 1276 static Handle<Code> PatchPositionsInCode(
1277 Handle<Code> code,
1275 Handle<JSArray> position_change_array) { 1278 Handle<JSArray> position_change_array) {
1276 1279
1277 RelocInfoBuffer buffer_writer(code->relocation_size(), 1280 RelocInfoBuffer buffer_writer(code->relocation_size(),
1278 code->instruction_start()); 1281 code->instruction_start());
1279 1282
1280 { 1283 {
1281 AssertNoAllocation no_allocations_please; 1284 AssertNoAllocation no_allocations_please;
1282 for (RelocIterator it(*code); !it.done(); it.next()) { 1285 for (RelocIterator it(*code); !it.done(); it.next()) {
1283 RelocInfo* rinfo = it.rinfo(); 1286 RelocInfo* rinfo = it.rinfo();
1284 if (RelocInfo::IsPosition(rinfo->rmode())) { 1287 if (RelocInfo::IsPosition(rinfo->rmode())) {
1285 int position = static_cast<int>(rinfo->data()); 1288 int position = static_cast<int>(rinfo->data());
1286 int new_position = TranslatePosition(position, 1289 int new_position = TranslatePosition(position,
1287 position_change_array); 1290 position_change_array);
1288 if (position != new_position) { 1291 if (position != new_position) {
1289 RelocInfo info_copy(rinfo->pc(), rinfo->rmode(), new_position); 1292 RelocInfo info_copy(rinfo->pc(), rinfo->rmode(), new_position, NULL);
1290 buffer_writer.Write(&info_copy); 1293 buffer_writer.Write(&info_copy);
1291 continue; 1294 continue;
1292 } 1295 }
1293 } 1296 }
1294 buffer_writer.Write(it.rinfo()); 1297 buffer_writer.Write(it.rinfo());
1295 } 1298 }
1296 } 1299 }
1297 1300
1298 Vector<byte> buffer = buffer_writer.GetResult(); 1301 Vector<byte> buffer = buffer_writer.GetResult();
1299 1302
(...skipping 26 matching lines...) Expand all
1326 position_change_array); 1329 position_change_array);
1327 int new_function_end = TranslatePosition(info->end_position(), 1330 int new_function_end = TranslatePosition(info->end_position(),
1328 position_change_array); 1331 position_change_array);
1329 int new_function_token_pos = 1332 int new_function_token_pos =
1330 TranslatePosition(info->function_token_position(), position_change_array); 1333 TranslatePosition(info->function_token_position(), position_change_array);
1331 1334
1332 info->set_start_position(new_function_start); 1335 info->set_start_position(new_function_start);
1333 info->set_end_position(new_function_end); 1336 info->set_end_position(new_function_end);
1334 info->set_function_token_position(new_function_token_pos); 1337 info->set_function_token_position(new_function_token_pos);
1335 1338
1339 HEAP->EnsureHeapIsIterable();
1340
1336 if (IsJSFunctionCode(info->code())) { 1341 if (IsJSFunctionCode(info->code())) {
1337 // Patch relocation info section of the code. 1342 // Patch relocation info section of the code.
1338 Handle<Code> patched_code = PatchPositionsInCode(Handle<Code>(info->code()), 1343 Handle<Code> patched_code = PatchPositionsInCode(Handle<Code>(info->code()),
1339 position_change_array); 1344 position_change_array);
1340 if (*patched_code != info->code()) { 1345 if (*patched_code != info->code()) {
1341 // Replace all references to the code across the heap. In particular, 1346 // Replace all references to the code across the heap. In particular,
1342 // some stubs may refer to this code and this code may be being executed 1347 // some stubs may refer to this code and this code may be being executed
1343 // on stack (it is safe to substitute the code object on stack, because 1348 // on stack (it is safe to substitute the code object on stack, because
1344 // we only change the structure of rinfo and leave instructions 1349 // we only change the structure of rinfo and leave instructions
1345 // untouched). 1350 // untouched).
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 1782
1778 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 1783 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
1779 return false; 1784 return false;
1780 } 1785 }
1781 1786
1782 #endif // ENABLE_DEBUGGER_SUPPORT 1787 #endif // ENABLE_DEBUGGER_SUPPORT
1783 1788
1784 1789
1785 1790
1786 } } // namespace v8::internal 1791 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/lithium-allocator.cc ('k') | src/liveobjectlist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698