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

Side by Side Diff: src/compiler/raw-machine-assembler.h

Issue 1239793002: [interpreter] Add basic framework for bytecode handler code generation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comment to count macro. Created 5 years, 5 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ 5 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_
6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ 6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_
7 7
8 #include "src/compiler.h"
Michael Starzinger 2015/07/17 13:20:59 Do we need this include here? This smells to inclu
rmcilroy 2015/07/21 11:13:21 The reason I did this is that raw_machine_assemble
8 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
9 #include "src/compiler/graph-builder.h" 10 #include "src/compiler/graph-builder.h"
10 #include "src/compiler/linkage.h" 11 #include "src/compiler/linkage.h"
11 #include "src/compiler/machine-operator.h" 12 #include "src/compiler/machine-operator.h"
12 #include "src/compiler/node.h" 13 #include "src/compiler/node.h"
13 #include "src/compiler/operator.h" 14 #include "src/compiler/operator.h"
14 15
15
16 namespace v8 { 16 namespace v8 {
17 namespace internal { 17 namespace internal {
18 namespace compiler { 18 namespace compiler {
19 19
20 class BasicBlock; 20 class BasicBlock;
21 class Schedule; 21 class Schedule;
22 22
23 23
24 class RawMachineAssembler : public GraphBuilder { 24 class RawMachineAssembler : public GraphBuilder {
25 public: 25 public:
(...skipping 14 matching lines...) Expand all
40 bool bound_; 40 bool bound_;
41 friend class RawMachineAssembler; 41 friend class RawMachineAssembler;
42 DISALLOW_COPY_AND_ASSIGN(Label); 42 DISALLOW_COPY_AND_ASSIGN(Label);
43 }; 43 };
44 44
45 RawMachineAssembler(Isolate* isolate, Graph* graph, 45 RawMachineAssembler(Isolate* isolate, Graph* graph,
46 CallDescriptor* call_descriptor, 46 CallDescriptor* call_descriptor,
47 MachineType word = kMachPtr, 47 MachineType word = kMachPtr,
48 MachineOperatorBuilder::Flags flags = 48 MachineOperatorBuilder::Flags flags =
49 MachineOperatorBuilder::Flag::kNoFlags); 49 MachineOperatorBuilder::Flag::kNoFlags);
50
50 ~RawMachineAssembler() override {} 51 ~RawMachineAssembler() override {}
51 52
52 Zone* zone() const { return graph()->zone(); } 53 Zone* zone() const { return graph()->zone(); }
53 MachineOperatorBuilder* machine() { return &machine_; } 54 MachineOperatorBuilder* machine() { return &machine_; }
54 CommonOperatorBuilder* common() { return &common_; } 55 CommonOperatorBuilder* common() { return &common_; }
55 CallDescriptor* call_descriptor() const { return call_descriptor_; } 56 CallDescriptor* call_descriptor() const { return call_descriptor_; }
56 size_t parameter_count() const { return machine_sig()->parameter_count(); } 57 size_t parameter_count() const { return machine_sig()->parameter_count(); }
57 const MachineSignature* machine_sig() const { 58 const MachineSignature* machine_sig() const {
58 return call_descriptor_->GetMachineSignature(); 59 return call_descriptor_->GetMachineSignature();
59 } 60 }
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 MachineType arg1_type, Node* function, Node* arg0, 487 MachineType arg1_type, Node* function, Node* arg0,
487 Node* arg1); 488 Node* arg1);
488 // Call to a C function with eight parameters. 489 // Call to a C function with eight parameters.
489 Node* CallCFunction8(MachineType return_type, MachineType arg0_type, 490 Node* CallCFunction8(MachineType return_type, MachineType arg0_type,
490 MachineType arg1_type, MachineType arg2_type, 491 MachineType arg1_type, MachineType arg2_type,
491 MachineType arg3_type, MachineType arg4_type, 492 MachineType arg3_type, MachineType arg4_type,
492 MachineType arg5_type, MachineType arg6_type, 493 MachineType arg5_type, MachineType arg6_type,
493 MachineType arg7_type, Node* function, Node* arg0, 494 MachineType arg7_type, Node* function, Node* arg0,
494 Node* arg1, Node* arg2, Node* arg3, Node* arg4, 495 Node* arg1, Node* arg2, Node* arg3, Node* arg4,
495 Node* arg5, Node* arg6, Node* arg7); 496 Node* arg5, Node* arg6, Node* arg7);
497 Node* CallInterpreterHandler(Node* target_handler,
498 Node* bytecodes,
499 Node* dispatch_table);
496 void Return(Node* value); 500 void Return(Node* value);
497 void Bind(Label* label); 501 void Bind(Label* label);
498 void Deoptimize(Node* state); 502 void Deoptimize(Node* state);
499 503
500 // Variables. 504 // Variables.
501 Node* Phi(MachineType type, Node* n1, Node* n2) { 505 Node* Phi(MachineType type, Node* n1, Node* n2) {
502 return NewNode(common()->Phi(type, 2), n1, n2); 506 return NewNode(common()->Phi(type, 2), n1, n2);
503 } 507 }
504 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3) { 508 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3) {
505 return NewNode(common()->Phi(type, 3), n1, n2, n3); 509 return NewNode(common()->Phi(type, 3), n1, n2, n3);
506 } 510 }
507 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3, Node* n4) { 511 Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3, Node* n4) {
508 return NewNode(common()->Phi(type, 4), n1, n2, n3, n4); 512 return NewNode(common()->Phi(type, 4), n1, n2, n3, n4);
509 } 513 }
510 514
511 // MachineAssembler is invalid after export. 515 // MachineAssembler is invalid after export.
512 Schedule* Export(); 516 Schedule* Export();
513 517
518 Schedule* schedule() {
519 DCHECK(ScheduleValid());
520 return schedule_;
521 }
522
523 BasicBlock* CurrentBlock();
524
514 protected: 525 protected:
515 Node* MakeNode(const Operator* op, int input_count, Node** inputs, 526 Node* MakeNode(const Operator* op, int input_count, Node** inputs,
516 bool incomplete) final; 527 bool incomplete) final;
517 528
518 bool ScheduleValid() { return schedule_ != NULL; } 529 bool ScheduleValid() { return schedule_ != NULL; }
519 530
520 Schedule* schedule() {
521 DCHECK(ScheduleValid());
522 return schedule_;
523 }
524
525 private: 531 private:
526 BasicBlock* Use(Label* label); 532 BasicBlock* Use(Label* label);
527 BasicBlock* EnsureBlock(Label* label); 533 BasicBlock* EnsureBlock(Label* label);
528 BasicBlock* CurrentBlock();
529 534
530 Schedule* schedule_; 535 Schedule* schedule_;
531 MachineOperatorBuilder machine_; 536 MachineOperatorBuilder machine_;
532 CommonOperatorBuilder common_; 537 CommonOperatorBuilder common_;
533 CallDescriptor* call_descriptor_; 538 CallDescriptor* call_descriptor_;
534 Node** parameters_; 539 Node** parameters_;
535 BasicBlock* current_block_; 540 BasicBlock* current_block_;
536 541
537 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); 542 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler);
538 }; 543 };
539 544
540 } // namespace compiler 545 } // namespace compiler
541 } // namespace internal 546 } // namespace internal
542 } // namespace v8 547 } // namespace v8
543 548
544 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ 549 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698