| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/assembler-inl.h" | 5 #include "src/assembler-inl.h" |
| 6 #include "src/assert-scope.h" | 6 #include "src/assert-scope.h" |
| 7 #include "src/compiler/wasm-compiler.h" | 7 #include "src/compiler/wasm-compiler.h" |
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
| 9 #include "src/factory.h" | 9 #include "src/factory.h" |
| 10 #include "src/frames-inl.h" | 10 #include "src/frames-inl.h" |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 return new_arr; | 379 return new_arr; |
| 380 } | 380 } |
| 381 | 381 |
| 382 void RedirectCallsitesInCode(Code* code, Code* old_target, Code* new_target) { | 382 void RedirectCallsitesInCode(Code* code, Code* old_target, Code* new_target) { |
| 383 DisallowHeapAllocation no_gc; | 383 DisallowHeapAllocation no_gc; |
| 384 for (RelocIterator it(code, RelocInfo::kCodeTargetMask); !it.done(); | 384 for (RelocIterator it(code, RelocInfo::kCodeTargetMask); !it.done(); |
| 385 it.next()) { | 385 it.next()) { |
| 386 DCHECK(RelocInfo::IsCodeTarget(it.rinfo()->rmode())); | 386 DCHECK(RelocInfo::IsCodeTarget(it.rinfo()->rmode())); |
| 387 Code* target = Code::GetCodeFromTargetAddress(it.rinfo()->target_address()); | 387 Code* target = Code::GetCodeFromTargetAddress(it.rinfo()->target_address()); |
| 388 if (target != old_target) continue; | 388 if (target != old_target) continue; |
| 389 it.rinfo()->set_target_address(new_target->instruction_start()); | 389 it.rinfo()->set_target_address(code->GetIsolate(), |
| 390 new_target->instruction_start()); |
| 390 } | 391 } |
| 391 } | 392 } |
| 392 | 393 |
| 393 void RedirectCallsitesInInstance(Isolate* isolate, WasmInstanceObject* instance, | 394 void RedirectCallsitesInInstance(Isolate* isolate, WasmInstanceObject* instance, |
| 394 Code* old_target, Code* new_target) { | 395 Code* old_target, Code* new_target) { |
| 395 DisallowHeapAllocation no_gc; | 396 DisallowHeapAllocation no_gc; |
| 396 // Redirect all calls in wasm functions. | 397 // Redirect all calls in wasm functions. |
| 397 FixedArray* code_table = instance->compiled_module()->ptr_to_code_table(); | 398 FixedArray* code_table = instance->compiled_module()->ptr_to_code_table(); |
| 398 for (int i = 0, e = GetNumFunctions(instance); i < e; ++i) { | 399 for (int i = 0, e = GetNumFunctions(instance); i < e; ++i) { |
| 399 RedirectCallsitesInCode(Code::cast(code_table->get(i)), old_target, | 400 RedirectCallsitesInCode(Code::cast(code_table->get(i)), old_target, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 | 495 |
| 495 std::unique_ptr<wasm::InterpretedFrame> WasmDebugInfo::GetInterpretedFrame( | 496 std::unique_ptr<wasm::InterpretedFrame> WasmDebugInfo::GetInterpretedFrame( |
| 496 Address frame_pointer, int idx) { | 497 Address frame_pointer, int idx) { |
| 497 return GetInterpreterHandle(this)->GetInterpretedFrame(frame_pointer, idx); | 498 return GetInterpreterHandle(this)->GetInterpretedFrame(frame_pointer, idx); |
| 498 } | 499 } |
| 499 | 500 |
| 500 uint64_t WasmDebugInfo::NumInterpretedCalls() { | 501 uint64_t WasmDebugInfo::NumInterpretedCalls() { |
| 501 auto handle = GetInterpreterHandleOrNull(this); | 502 auto handle = GetInterpreterHandleOrNull(this); |
| 502 return handle ? handle->NumInterpretedCalls() : 0; | 503 return handle ? handle->NumInterpretedCalls() : 0; |
| 503 } | 504 } |
| OLD | NEW |