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

Side by Side Diff: src/compiler/code-assembler.cc

Issue 2600183004: [turbofan] Remove virtual methods from CodeAssembler. (Closed)
Patch Set: Created 3 years, 11 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/compiler/code-assembler.h ('k') | src/interpreter/interpreter-assembler.h » ('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 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/compiler/code-assembler.h" 5 #include "src/compiler/code-assembler.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 }; 89 };
90 90
91 void CodeAssembler::BreakOnNode(int node_id) { 91 void CodeAssembler::BreakOnNode(int node_id) {
92 Graph* graph = raw_assembler()->graph(); 92 Graph* graph = raw_assembler()->graph();
93 Zone* zone = graph->zone(); 93 Zone* zone = graph->zone();
94 GraphDecorator* decorator = 94 GraphDecorator* decorator =
95 new (zone) BreakOnNodeDecorator(static_cast<NodeId>(node_id)); 95 new (zone) BreakOnNodeDecorator(static_cast<NodeId>(node_id));
96 graph->AddDecorator(decorator); 96 graph->AddDecorator(decorator);
97 } 97 }
98 98
99 void CodeAssembler::CallPrologue() {} 99 void CodeAssembler::RegisterCallGenerationCallbacks(
100 const CodeAssemblerCallback& call_prologue,
101 const CodeAssemblerCallback& call_epilogue) {
102 // The callback can be registered only once.
103 DCHECK(!state_->call_prologue_);
104 DCHECK(!state_->call_epilogue_);
105 state_->call_prologue_ = call_prologue;
106 state_->call_epilogue_ = call_epilogue;
107 }
100 108
101 void CodeAssembler::CallEpilogue() {} 109 void CodeAssembler::UnregisterCallGenerationCallbacks() {
110 state_->call_prologue_ = nullptr;
111 state_->call_epilogue_ = nullptr;
112 }
113
114 void CodeAssembler::CallPrologue() {
115 if (state_->call_prologue_) {
116 state_->call_prologue_();
117 }
118 }
119
120 void CodeAssembler::CallEpilogue() {
121 if (state_->call_epilogue_) {
122 state_->call_epilogue_();
123 }
124 }
102 125
103 // static 126 // static
104 Handle<Code> CodeAssembler::GenerateCode(CodeAssemblerState* state) { 127 Handle<Code> CodeAssembler::GenerateCode(CodeAssemblerState* state) {
105 DCHECK(!state->code_generated_); 128 DCHECK(!state->code_generated_);
106 129
107 RawMachineAssembler* rasm = state->raw_assembler_.get(); 130 RawMachineAssembler* rasm = state->raw_assembler_.get();
108 Schedule* schedule = rasm->Export(); 131 Schedule* schedule = rasm->Export();
109 Handle<Code> code = Pipeline::GenerateCodeForCodeStub( 132 Handle<Code> code = Pipeline::GenerateCodeForCodeStub(
110 rasm->isolate(), rasm->call_descriptor(), rasm->graph(), schedule, 133 rasm->isolate(), rasm->call_descriptor(), rasm->graph(), schedule,
111 state->flags_, state->name_); 134 state->flags_, state->name_);
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 CallDescriptor::kSupportsTailCalls); 466 CallDescriptor::kSupportsTailCalls);
444 int return_count = static_cast<int>(desc->ReturnCount()); 467 int return_count = static_cast<int>(desc->ReturnCount());
445 468
446 Node* centry = 469 Node* centry =
447 HeapConstant(CodeFactory::RuntimeCEntry(isolate(), return_count)); 470 HeapConstant(CodeFactory::RuntimeCEntry(isolate(), return_count));
448 Node* ref = ExternalConstant(ExternalReference(function, isolate())); 471 Node* ref = ExternalConstant(ExternalReference(function, isolate()));
449 Node* arity = Int32Constant(argc); 472 Node* arity = Int32Constant(argc);
450 473
451 Node* nodes[] = {centry, args..., ref, arity, context}; 474 Node* nodes[] = {centry, args..., ref, arity, context};
452 475
453 CallPrologue(); 476 return raw_assembler()->TailCallN(desc, arraysize(nodes), nodes);
Igor Sheludko 2016/12/28 15:22:38 Drive-by fix.
rmcilroy 2017/01/03 09:37:50 Thanks!
454 Node* return_value =
455 raw_assembler()->TailCallN(desc, arraysize(nodes), nodes);
456 CallEpilogue();
457 return return_value;
458 } 477 }
459 478
460 // Instantiate TailCallRuntime() with up to 6 arguments. 479 // Instantiate TailCallRuntime() with up to 6 arguments.
461 #define INSTANTIATE(...) \ 480 #define INSTANTIATE(...) \
462 template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallRuntime( \ 481 template V8_EXPORT_PRIVATE Node* CodeAssembler::TailCallRuntime( \
463 Runtime::FunctionId, __VA_ARGS__); 482 Runtime::FunctionId, __VA_ARGS__);
464 REPEAT_1_TO_7(INSTANTIATE, Node*) 483 REPEAT_1_TO_7(INSTANTIATE, Node*)
465 #undef INSTANTIATE 484 #undef INSTANTIATE
466 485
467 template <class... TArgs> 486 template <class... TArgs>
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 } 773 }
755 } 774 }
756 } 775 }
757 776
758 bound_ = true; 777 bound_ = true;
759 } 778 }
760 779
761 } // namespace compiler 780 } // namespace compiler
762 } // namespace internal 781 } // namespace internal
763 } // namespace v8 782 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/code-assembler.h ('k') | src/interpreter/interpreter-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698