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

Side by Side Diff: src/x64/builtins-x64.cc

Issue 1703453002: [interpreter, debugger] support debug breaks via bytecode array copy (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed last comment Created 4 years, 10 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
OLDNEW
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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 FrameScope frame_scope(masm, StackFrame::MANUAL); 487 FrameScope frame_scope(masm, StackFrame::MANUAL);
488 __ pushq(rbp); // Caller's frame pointer. 488 __ pushq(rbp); // Caller's frame pointer.
489 __ movp(rbp, rsp); 489 __ movp(rbp, rsp);
490 __ Push(rsi); // Callee's context. 490 __ Push(rsi); // Callee's context.
491 __ Push(rdi); // Callee's JS function. 491 __ Push(rdi); // Callee's JS function.
492 __ Push(rdx); // Callee's new target. 492 __ Push(rdx); // Callee's new target.
493 493
494 // Get the bytecode array from the function object and load the pointer to the 494 // Get the bytecode array from the function object and load the pointer to the
495 // first entry into edi (InterpreterBytecodeRegister). 495 // first entry into edi (InterpreterBytecodeRegister).
496 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); 496 __ movp(rax, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
497
498 Label load_debug_bytecode_array, bytecode_array_loaded;
499 __ cmpp(FieldOperand(rax, SharedFunctionInfo::kDebugInfoOffset),
500 Immediate(DebugInfo::uninitialized()));
501 __ j(not_equal, &load_debug_bytecode_array);
497 __ movp(kInterpreterBytecodeArrayRegister, 502 __ movp(kInterpreterBytecodeArrayRegister,
498 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset)); 503 FieldOperand(rax, SharedFunctionInfo::kFunctionDataOffset));
504 __ bind(&bytecode_array_loaded);
499 505
500 if (FLAG_debug_code) { 506 if (FLAG_debug_code) {
501 // Check function data field is actually a BytecodeArray object. 507 // Check function data field is actually a BytecodeArray object.
502 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); 508 __ AssertNotSmi(kInterpreterBytecodeArrayRegister);
503 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, 509 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE,
504 rax); 510 rax);
505 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 511 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
506 } 512 }
507 513
508 // Push bytecode array. 514 // Push bytecode array.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 kInterpreterBytecodeOffsetRegister, times_1, 0)); 568 kInterpreterBytecodeOffsetRegister, times_1, 0));
563 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx, 569 __ movp(rbx, Operand(kInterpreterDispatchTableRegister, rbx,
564 times_pointer_size, 0)); 570 times_pointer_size, 0));
565 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging 571 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging
566 // and header removal. 572 // and header removal.
567 __ addp(rbx, Immediate(Code::kHeaderSize - kHeapObjectTag)); 573 __ addp(rbx, Immediate(Code::kHeaderSize - kHeapObjectTag));
568 __ call(rbx); 574 __ call(rbx);
569 575
570 // Even though the first bytecode handler was called, we will never return. 576 // Even though the first bytecode handler was called, we will never return.
571 __ Abort(kUnexpectedReturnFromBytecodeHandler); 577 __ Abort(kUnexpectedReturnFromBytecodeHandler);
578
579 // Load debug copy of the bytecode array.
580 __ bind(&load_debug_bytecode_array);
581 Register debug_info = kInterpreterBytecodeArrayRegister;
582 __ movp(debug_info, FieldOperand(rax, SharedFunctionInfo::kDebugInfoOffset));
583 __ movp(kInterpreterBytecodeArrayRegister,
584 FieldOperand(debug_info, DebugInfo::kAbstractCodeIndex));
585 __ jmp(&bytecode_array_loaded);
572 } 586 }
573 587
574 588
575 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { 589 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
576 // TODO(rmcilroy): List of things not currently dealt with here but done in 590 // TODO(rmcilroy): List of things not currently dealt with here but done in
577 // fullcodegen's EmitReturnSequence. 591 // fullcodegen's EmitReturnSequence.
578 // - Supporting FLAG_trace for Runtime::TraceExit. 592 // - Supporting FLAG_trace for Runtime::TraceExit.
579 // - Support profiler (specifically decrementing profiling_counter 593 // - Support profiler (specifically decrementing profiling_counter
580 // appropriately and calling out to HandleInterrupts if necessary). 594 // appropriately and calling out to HandleInterrupts if necessary).
581 595
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 __ ret(0); 2741 __ ret(0);
2728 } 2742 }
2729 2743
2730 2744
2731 #undef __ 2745 #undef __
2732 2746
2733 } // namespace internal 2747 } // namespace internal
2734 } // namespace v8 2748 } // namespace v8
2735 2749
2736 #endif // V8_TARGET_ARCH_X64 2750 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698