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

Side by Side Diff: src/interpreter/interpreter-assembler.cc

Issue 1912853003: [turbofan] Add the Verifier to the pipeline for code stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/interpreter-assembler.h" 5 #include "src/interpreter/interpreter-assembler.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 495 }
496 496
497 Node* InterpreterAssembler::Advance(int delta) { 497 Node* InterpreterAssembler::Advance(int delta) {
498 return IntPtrAdd(BytecodeOffset(), IntPtrConstant(delta)); 498 return IntPtrAdd(BytecodeOffset(), IntPtrConstant(delta));
499 } 499 }
500 500
501 Node* InterpreterAssembler::Advance(Node* delta) { 501 Node* InterpreterAssembler::Advance(Node* delta) {
502 return IntPtrAdd(BytecodeOffset(), delta); 502 return IntPtrAdd(BytecodeOffset(), delta);
503 } 503 }
504 504
505 void InterpreterAssembler::Jump(Node* delta) { 505 Node* InterpreterAssembler::Jump(Node* delta) {
506 UpdateInterruptBudget(delta); 506 UpdateInterruptBudget(delta);
507 DispatchTo(Advance(delta)); 507 return DispatchTo(Advance(delta));
508 } 508 }
509 509
510 void InterpreterAssembler::JumpConditional(Node* condition, Node* delta) { 510 void InterpreterAssembler::JumpConditional(Node* condition, Node* delta) {
511 CodeStubAssembler::Label match(this); 511 CodeStubAssembler::Label match(this);
512 CodeStubAssembler::Label no_match(this); 512 CodeStubAssembler::Label no_match(this);
513 513
514 Branch(condition, &match, &no_match); 514 Branch(condition, &match, &no_match);
515 Bind(&match); 515 Bind(&match);
516 Jump(delta); 516 Jump(delta);
517 Bind(&no_match); 517 Bind(&no_match);
518 Dispatch(); 518 Dispatch();
519 } 519 }
520 520
521 void InterpreterAssembler::JumpIfWordEqual(Node* lhs, Node* rhs, Node* delta) { 521 void InterpreterAssembler::JumpIfWordEqual(Node* lhs, Node* rhs, Node* delta) {
522 JumpConditional(WordEqual(lhs, rhs), delta); 522 JumpConditional(WordEqual(lhs, rhs), delta);
523 } 523 }
524 524
525 void InterpreterAssembler::JumpIfWordNotEqual(Node* lhs, Node* rhs, 525 void InterpreterAssembler::JumpIfWordNotEqual(Node* lhs, Node* rhs,
526 Node* delta) { 526 Node* delta) {
527 JumpConditional(WordNotEqual(lhs, rhs), delta); 527 JumpConditional(WordNotEqual(lhs, rhs), delta);
528 } 528 }
529 529
530 void InterpreterAssembler::Dispatch() { 530 Node* InterpreterAssembler::Dispatch() {
531 DispatchTo(Advance(Bytecodes::Size(bytecode_, operand_scale_))); 531 return DispatchTo(Advance(Bytecodes::Size(bytecode_, operand_scale_)));
532 } 532 }
533 533
534 void InterpreterAssembler::DispatchTo(Node* new_bytecode_offset) { 534 Node* InterpreterAssembler::DispatchTo(Node* new_bytecode_offset) {
535 Node* target_bytecode = Load( 535 Node* target_bytecode = Load(
536 MachineType::Uint8(), BytecodeArrayTaggedPointer(), new_bytecode_offset); 536 MachineType::Uint8(), BytecodeArrayTaggedPointer(), new_bytecode_offset);
537 if (kPointerSize == 8) { 537 if (kPointerSize == 8) {
538 target_bytecode = ChangeUint32ToUint64(target_bytecode); 538 target_bytecode = ChangeUint32ToUint64(target_bytecode);
539 } 539 }
540 540
541 if (FLAG_trace_ignition_dispatches) { 541 if (FLAG_trace_ignition_dispatches) {
542 TraceBytecodeDispatch(target_bytecode); 542 TraceBytecodeDispatch(target_bytecode);
543 } 543 }
544 544
545 Node* target_code_entry = 545 Node* target_code_entry =
546 Load(MachineType::Pointer(), DispatchTableRawPointer(), 546 Load(MachineType::Pointer(), DispatchTableRawPointer(),
547 WordShl(target_bytecode, IntPtrConstant(kPointerSizeLog2))); 547 WordShl(target_bytecode, IntPtrConstant(kPointerSizeLog2)));
548 548
549 DispatchToBytecodeHandlerEntry(target_code_entry, new_bytecode_offset); 549 return DispatchToBytecodeHandlerEntry(target_code_entry, new_bytecode_offset);
550 } 550 }
551 551
552 void InterpreterAssembler::DispatchToBytecodeHandler(Node* handler, 552 Node* InterpreterAssembler::DispatchToBytecodeHandler(Node* handler,
553 Node* bytecode_offset) { 553 Node* bytecode_offset) {
554 Node* handler_entry = 554 Node* handler_entry =
555 IntPtrAdd(handler, IntPtrConstant(Code::kHeaderSize - kHeapObjectTag)); 555 IntPtrAdd(handler, IntPtrConstant(Code::kHeaderSize - kHeapObjectTag));
556 DispatchToBytecodeHandlerEntry(handler_entry, bytecode_offset); 556 return DispatchToBytecodeHandlerEntry(handler_entry, bytecode_offset);
557 } 557 }
558 558
559 void InterpreterAssembler::DispatchToBytecodeHandlerEntry( 559 Node* InterpreterAssembler::DispatchToBytecodeHandlerEntry(
560 Node* handler_entry, Node* bytecode_offset) { 560 Node* handler_entry, Node* bytecode_offset) {
561 if (FLAG_trace_ignition) { 561 if (FLAG_trace_ignition) {
562 TraceBytecode(Runtime::kInterpreterTraceBytecodeExit); 562 TraceBytecode(Runtime::kInterpreterTraceBytecodeExit);
563 } 563 }
564 564
565 InterpreterDispatchDescriptor descriptor(isolate()); 565 InterpreterDispatchDescriptor descriptor(isolate());
566 Node* args[] = {GetAccumulatorUnchecked(), bytecode_offset, 566 Node* args[] = {GetAccumulatorUnchecked(), bytecode_offset,
567 BytecodeArrayTaggedPointer(), DispatchTableRawPointer()}; 567 BytecodeArrayTaggedPointer(), DispatchTableRawPointer()};
568 TailCallBytecodeDispatch(descriptor, handler_entry, args); 568 return TailCallBytecodeDispatch(descriptor, handler_entry, args);
569 } 569 }
570 570
571 void InterpreterAssembler::DispatchWide(OperandScale operand_scale) { 571 void InterpreterAssembler::DispatchWide(OperandScale operand_scale) {
572 // Dispatching a wide bytecode requires treating the prefix 572 // Dispatching a wide bytecode requires treating the prefix
573 // bytecode a base pointer into the dispatch table and dispatching 573 // bytecode a base pointer into the dispatch table and dispatching
574 // the bytecode that follows relative to this base. 574 // the bytecode that follows relative to this base.
575 // 575 //
576 // Indices 0-255 correspond to bytecodes with operand_scale == 0 576 // Indices 0-255 correspond to bytecodes with operand_scale == 0
577 // Indices 256-511 correspond to bytecodes with operand_scale == 1 577 // Indices 256-511 correspond to bytecodes with operand_scale == 1
578 // Indices 512-767 correspond to bytecodes with operand_scale == 2 578 // Indices 512-767 correspond to bytecodes with operand_scale == 2
(...skipping 21 matching lines...) Expand all
600 base_index = nullptr; 600 base_index = nullptr;
601 } 601 }
602 Node* target_index = IntPtrAdd(base_index, next_bytecode); 602 Node* target_index = IntPtrAdd(base_index, next_bytecode);
603 Node* target_code_entry = 603 Node* target_code_entry =
604 Load(MachineType::Pointer(), DispatchTableRawPointer(), 604 Load(MachineType::Pointer(), DispatchTableRawPointer(),
605 WordShl(target_index, kPointerSizeLog2)); 605 WordShl(target_index, kPointerSizeLog2));
606 606
607 DispatchToBytecodeHandlerEntry(target_code_entry, next_bytecode_offset); 607 DispatchToBytecodeHandlerEntry(target_code_entry, next_bytecode_offset);
608 } 608 }
609 609
610 void InterpreterAssembler::InterpreterReturn() { 610 compiler::Node* InterpreterAssembler::InterpreterReturn() {
611 // TODO(rmcilroy): Investigate whether it is worth supporting self 611 // TODO(rmcilroy): Investigate whether it is worth supporting self
612 // optimization of primitive functions like FullCodegen. 612 // optimization of primitive functions like FullCodegen.
613 613
614 // Update profiling count by -BytecodeOffset to simulate backedge to start of 614 // Update profiling count by -BytecodeOffset to simulate backedge to start of
615 // function. 615 // function.
616 Node* profiling_weight = 616 Node* profiling_weight =
617 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize), 617 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize),
618 BytecodeOffset()); 618 BytecodeOffset());
619 UpdateInterruptBudget(profiling_weight); 619 UpdateInterruptBudget(profiling_weight);
620 620
621 Node* exit_trampoline_code_object = 621 Node* exit_trampoline_code_object =
622 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); 622 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline());
623 DispatchToBytecodeHandler(exit_trampoline_code_object); 623 return DispatchToBytecodeHandler(exit_trampoline_code_object);
624 } 624 }
625 625
626 void InterpreterAssembler::StackCheck() { 626 void InterpreterAssembler::StackCheck() {
627 CodeStubAssembler::Label end(this); 627 CodeStubAssembler::Label end(this);
628 CodeStubAssembler::Label ok(this); 628 CodeStubAssembler::Label ok(this);
629 CodeStubAssembler::Label stack_guard(this); 629 CodeStubAssembler::Label stack_guard(this);
630 630
631 Node* sp = LoadStackPointer(); 631 Node* sp = LoadStackPointer();
632 Node* stack_limit = Load( 632 Node* stack_limit = Load(
633 MachineType::Pointer(), 633 MachineType::Pointer(),
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 V8_TARGET_ARCH_S390 709 V8_TARGET_ARCH_S390
710 return true; 710 return true;
711 #else 711 #else
712 #error "Unknown Architecture" 712 #error "Unknown Architecture"
713 #endif 713 #endif
714 } 714 }
715 715
716 } // namespace interpreter 716 } // namespace interpreter
717 } // namespace internal 717 } // namespace internal
718 } // namespace v8 718 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter-assembler.h ('k') | test/unittests/interpreter/interpreter-assembler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698