OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/debug/liveedit.h" | 5 #include "src/debug/liveedit.h" |
6 | 6 |
7 #include "src/ast/scopeinfo.h" | 7 #include "src/ast/scopeinfo.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 continue; | 1219 continue; |
1220 } | 1220 } |
1221 } | 1221 } |
1222 if (RelocInfo::IsRealRelocMode(rinfo->rmode())) { | 1222 if (RelocInfo::IsRealRelocMode(rinfo->rmode())) { |
1223 buffer_writer.Write(it.rinfo()); | 1223 buffer_writer.Write(it.rinfo()); |
1224 } | 1224 } |
1225 } | 1225 } |
1226 } | 1226 } |
1227 | 1227 |
1228 Vector<byte> buffer = buffer_writer.GetResult(); | 1228 Vector<byte> buffer = buffer_writer.GetResult(); |
| 1229 Handle<ByteArray> reloc_info = |
| 1230 isolate->factory()->NewByteArray(buffer.length(), TENURED); |
1229 | 1231 |
1230 if (buffer.length() == code->relocation_size()) { | 1232 DisallowHeapAllocation no_gc; |
1231 // Simply patch relocation area of code. | 1233 code->set_relocation_info(*reloc_info); |
1232 MemCopy(code->relocation_start(), buffer.start(), buffer.length()); | 1234 CopyBytes(code->relocation_start(), buffer.start(), buffer.length()); |
1233 return code; | 1235 return code; |
1234 } else { | |
1235 // Relocation info section now has different size. We cannot simply | |
1236 // rewrite it inside code object. Instead we have to create a new | |
1237 // code object. | |
1238 Handle<Code> result(isolate->factory()->CopyCode(code, buffer)); | |
1239 return result; | |
1240 } | |
1241 } | 1236 } |
1242 | 1237 |
1243 void PatchPositionsInBytecodeArray(Handle<BytecodeArray> bytecode, | 1238 void PatchPositionsInBytecodeArray(Handle<BytecodeArray> bytecode, |
1244 Handle<JSArray> position_change_array) { | 1239 Handle<JSArray> position_change_array) { |
1245 Isolate* isolate = bytecode->GetIsolate(); | 1240 Isolate* isolate = bytecode->GetIsolate(); |
1246 Zone zone(isolate->allocator()); | 1241 Zone zone(isolate->allocator()); |
1247 interpreter::SourcePositionTableBuilder builder(isolate, &zone); | 1242 interpreter::SourcePositionTableBuilder builder(isolate, &zone); |
1248 | 1243 |
1249 for (interpreter::SourcePositionTableIterator iterator( | 1244 for (interpreter::SourcePositionTableIterator iterator( |
1250 bytecode->source_position_table()); | 1245 bytecode->source_position_table()); |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 scope_info_length++; | 2060 scope_info_length++; |
2066 | 2061 |
2067 current_scope = current_scope->outer_scope(); | 2062 current_scope = current_scope->outer_scope(); |
2068 } | 2063 } |
2069 | 2064 |
2070 return scope_info_list; | 2065 return scope_info_list; |
2071 } | 2066 } |
2072 | 2067 |
2073 } // namespace internal | 2068 } // namespace internal |
2074 } // namespace v8 | 2069 } // namespace v8 |
OLD | NEW |