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

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

Issue 1887493004: [Interpreter] No longer require context machine register in bytecode handlers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_dispatch
Patch Set: Fix x87 Created 4 years, 8 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
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x87/interface-descriptors-x87.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 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_X87 5 #if V8_TARGET_ARCH_X87
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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 // - Code aging of the BytecodeArray object. 480 // - Code aging of the BytecodeArray object.
481 481
482 // Load accumulator, register file, bytecode offset, dispatch table into 482 // Load accumulator, register file, bytecode offset, dispatch table into
483 // registers. 483 // registers.
484 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); 484 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
485 __ mov(kInterpreterRegisterFileRegister, ebp); 485 __ mov(kInterpreterRegisterFileRegister, ebp);
486 __ add(kInterpreterRegisterFileRegister, 486 __ add(kInterpreterRegisterFileRegister,
487 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); 487 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp));
488 __ mov(kInterpreterBytecodeOffsetRegister, 488 __ mov(kInterpreterBytecodeOffsetRegister,
489 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); 489 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag));
490 __ mov(ebx, Immediate(ExternalReference::interpreter_dispatch_table_address( 490 __ mov(kInterpreterDispatchTableRegister,
491 masm->isolate()))); 491 Immediate(ExternalReference::interpreter_dispatch_table_address(
492 492 masm->isolate())));
493 // Push dispatch table as a stack located parameter to the bytecode handler.
494 DCHECK_EQ(-1, kInterpreterDispatchTableSpillSlot);
495 __ push(ebx);
496 493
497 // Dispatch to the first bytecode handler for the function. 494 // Dispatch to the first bytecode handler for the function.
498 __ movzx_b(eax, Operand(kInterpreterBytecodeArrayRegister, 495 __ movzx_b(ebx, Operand(kInterpreterBytecodeArrayRegister,
499 kInterpreterBytecodeOffsetRegister, times_1, 0)); 496 kInterpreterBytecodeOffsetRegister, times_1, 0));
500 __ mov(ebx, Operand(ebx, eax, times_pointer_size, 0)); 497 __ mov(ebx, Operand(kInterpreterDispatchTableRegister, ebx,
501 // Restore undefined_value in accumulator (eax) 498 times_pointer_size, 0));
502 // TODO(rmcilroy): Remove this once we move the dispatch table back into a
503 // register.
504 __ mov(eax, Immediate(masm->isolate()->factory()->undefined_value()));
505 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging 499 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging
506 // and header removal. 500 // and header removal.
507 __ add(ebx, Immediate(Code::kHeaderSize - kHeapObjectTag)); 501 __ add(ebx, Immediate(Code::kHeaderSize - kHeapObjectTag));
508 __ call(ebx); 502 __ call(ebx);
509 503
510 // Even though the first bytecode handler was called, we will never return. 504 // Even though the first bytecode handler was called, we will never return.
511 __ Abort(kUnexpectedReturnFromBytecodeHandler); 505 __ Abort(kUnexpectedReturnFromBytecodeHandler);
512 506
513 // Load debug copy of the bytecode array. 507 // Load debug copy of the bytecode array.
514 __ bind(&load_debug_bytecode_array); 508 __ bind(&load_debug_bytecode_array);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 617
624 // Re-push return address. 618 // Re-push return address.
625 __ Push(ecx); 619 __ Push(ecx);
626 620
627 // Call the constructor with unmodified eax, edi, ebi values. 621 // Call the constructor with unmodified eax, edi, ebi values.
628 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); 622 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
629 } 623 }
630 624
631 625
632 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { 626 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) {
633 // Initialize register file register. 627 // Initialize register file register and dispatch table register.
634 __ mov(kInterpreterRegisterFileRegister, ebp); 628 __ mov(kInterpreterRegisterFileRegister, ebp);
635 __ add(kInterpreterRegisterFileRegister, 629 __ add(kInterpreterRegisterFileRegister,
636 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp)); 630 Immediate(InterpreterFrameConstants::kRegisterFilePointerFromFp));
631 __ mov(kInterpreterDispatchTableRegister,
632 Immediate(ExternalReference::interpreter_dispatch_table_address(
633 masm->isolate())));
637 634
638 // Get the bytecode array pointer from the frame. 635 // Get the bytecode array pointer from the frame.
639 __ mov(kInterpreterBytecodeArrayRegister, 636 __ mov(kInterpreterBytecodeArrayRegister,
640 Operand(kInterpreterRegisterFileRegister, 637 Operand(kInterpreterRegisterFileRegister,
641 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer)); 638 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer));
642 639
643 if (FLAG_debug_code) { 640 if (FLAG_debug_code) {
644 // Check function data field is actually a BytecodeArray object. 641 // Check function data field is actually a BytecodeArray object.
645 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); 642 __ AssertNotSmi(kInterpreterBytecodeArrayRegister);
646 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, 643 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE,
647 ebx); 644 ebx);
648 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 645 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
649 } 646 }
650 647
651 // Get the target bytecode offset from the frame. 648 // Get the target bytecode offset from the frame.
652 __ mov( 649 __ mov(
653 kInterpreterBytecodeOffsetRegister, 650 kInterpreterBytecodeOffsetRegister,
654 Operand(kInterpreterRegisterFileRegister, 651 Operand(kInterpreterRegisterFileRegister,
655 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); 652 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer));
656 __ SmiUntag(kInterpreterBytecodeOffsetRegister); 653 __ SmiUntag(kInterpreterBytecodeOffsetRegister);
657 654
658 // Push dispatch table as a stack located parameter to the bytecode handler.
659 __ mov(ebx, Immediate(ExternalReference::interpreter_dispatch_table_address(
660 masm->isolate())));
661 DCHECK_EQ(-1, kInterpreterDispatchTableSpillSlot);
662 __ Pop(esi);
663 __ Push(ebx);
664 __ Push(esi);
665
666 // Dispatch to the target bytecode. 655 // Dispatch to the target bytecode.
667 __ movzx_b(esi, Operand(kInterpreterBytecodeArrayRegister, 656 __ movzx_b(ebx, Operand(kInterpreterBytecodeArrayRegister,
668 kInterpreterBytecodeOffsetRegister, times_1, 0)); 657 kInterpreterBytecodeOffsetRegister, times_1, 0));
669 __ mov(ebx, Operand(ebx, esi, times_pointer_size, 0)); 658 __ mov(ebx, Operand(kInterpreterDispatchTableRegister, ebx,
670 659 times_pointer_size, 0));
671 // Get the context from the frame.
672 __ mov(kContextRegister,
673 Operand(kInterpreterRegisterFileRegister,
674 InterpreterFrameConstants::kContextFromRegisterPointer));
675 660
676 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging 661 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging
677 // and header removal. 662 // and header removal.
678 __ add(ebx, Immediate(Code::kHeaderSize - kHeapObjectTag)); 663 __ add(ebx, Immediate(Code::kHeaderSize - kHeapObjectTag));
679 __ jmp(ebx); 664 __ jmp(ebx);
680 } 665 }
681 666
682 667
683 static void Generate_InterpreterNotifyDeoptimizedHelper( 668 static void Generate_InterpreterNotifyDeoptimizedHelper(
684 MacroAssembler* masm, Deoptimizer::BailoutType type) { 669 MacroAssembler* masm, Deoptimizer::BailoutType type) {
(...skipping 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 // And "return" to the OSR entry point of the function. 2623 // And "return" to the OSR entry point of the function.
2639 __ ret(0); 2624 __ ret(0);
2640 } 2625 }
2641 2626
2642 2627
2643 #undef __ 2628 #undef __
2644 } // namespace internal 2629 } // namespace internal
2645 } // namespace v8 2630 } // namespace v8
2646 2631
2647 #endif // V8_TARGET_ARCH_X87 2632 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x87/interface-descriptors-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698