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

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

Issue 530783002: Convert Linkage to use MachineSignature. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | src/compiler/structured-machine-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 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 #include "src/compiler/pipeline.h" 5 #include "src/compiler/pipeline.h"
6 #include "src/compiler/raw-machine-assembler.h" 6 #include "src/compiler/raw-machine-assembler.h"
7 #include "src/compiler/scheduler.h" 7 #include "src/compiler/scheduler.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 namespace compiler { 11 namespace compiler {
12 12
13 RawMachineAssembler::RawMachineAssembler( 13 RawMachineAssembler::RawMachineAssembler(Graph* graph,
14 Graph* graph, MachineCallDescriptorBuilder* call_descriptor_builder, 14 MachineSignature* machine_sig,
15 MachineType word) 15 MachineType word)
16 : GraphBuilder(graph), 16 : GraphBuilder(graph),
17 schedule_(new (zone()) Schedule(zone())), 17 schedule_(new (zone()) Schedule(zone())),
18 machine_(zone(), word), 18 machine_(zone(), word),
19 common_(zone()), 19 common_(zone()),
20 call_descriptor_builder_(call_descriptor_builder), 20 machine_sig_(machine_sig),
21 call_descriptor_(
22 Linkage::GetSimplifiedCDescriptor(graph->zone(), machine_sig)),
21 parameters_(NULL), 23 parameters_(NULL),
22 exit_label_(schedule()->end()), 24 exit_label_(schedule()->end()),
23 current_block_(schedule()->start()) { 25 current_block_(schedule()->start()) {
24 Node* s = graph->NewNode(common_.Start(parameter_count())); 26 int param_count = static_cast<int>(parameter_count());
27 Node* s = graph->NewNode(common_.Start(param_count));
25 graph->SetStart(s); 28 graph->SetStart(s);
26 if (parameter_count() == 0) return; 29 if (parameter_count() == 0) return;
27 parameters_ = zone()->NewArray<Node*>(parameter_count()); 30 parameters_ = zone()->NewArray<Node*>(param_count);
28 for (int i = 0; i < parameter_count(); ++i) { 31 for (size_t i = 0; i < parameter_count(); ++i) {
29 parameters_[i] = NewNode(common()->Parameter(i), graph->start()); 32 parameters_[i] =
33 NewNode(common()->Parameter(static_cast<int>(i)), graph->start());
30 } 34 }
31 } 35 }
32 36
33 37
34 Schedule* RawMachineAssembler::Export() { 38 Schedule* RawMachineAssembler::Export() {
35 // Compute the correct codegen order. 39 // Compute the correct codegen order.
36 DCHECK(schedule_->rpo_order()->empty()); 40 DCHECK(schedule_->rpo_order()->empty());
37 Scheduler::ComputeSpecialRPO(schedule_); 41 Scheduler::ComputeSpecialRPO(schedule_);
38 // Invalidate MachineAssembler. 42 // Invalidate MachineAssembler.
39 Schedule* schedule = schedule_; 43 Schedule* schedule = schedule_;
40 schedule_ = NULL; 44 schedule_ = NULL;
41 return schedule; 45 return schedule;
42 } 46 }
43 47
44 48
45 Node* RawMachineAssembler::Parameter(int index) { 49 Node* RawMachineAssembler::Parameter(size_t index) {
46 DCHECK(0 <= index && index < parameter_count()); 50 DCHECK(index < parameter_count());
47 return parameters_[index]; 51 return parameters_[index];
48 } 52 }
49 53
50 54
51 RawMachineAssembler::Label* RawMachineAssembler::Exit() { 55 RawMachineAssembler::Label* RawMachineAssembler::Exit() {
52 exit_label_.used_ = true; 56 exit_label_.used_ = true;
53 return &exit_label_; 57 return &exit_label_;
54 } 58 }
55 59
56 60
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 d, 1, CallDescriptor::kNeedsFrameState, zone()); 92 d, 1, CallDescriptor::kNeedsFrameState, zone());
89 Node* stub_code = HeapConstant(stub.GetCode()); 93 Node* stub_code = HeapConstant(stub.GetCode());
90 Node* call = graph()->NewNode(common()->Call(desc), stub_code, function, 94 Node* call = graph()->NewNode(common()->Call(desc), stub_code, function,
91 receiver, context, frame_state); 95 receiver, context, frame_state);
92 schedule()->AddNode(CurrentBlock(), call); 96 schedule()->AddNode(CurrentBlock(), call);
93 return call; 97 return call;
94 } 98 }
95 99
96 100
97 Node* RawMachineAssembler::CallJS0(Node* function, Node* receiver, 101 Node* RawMachineAssembler::CallJS0(Node* function, Node* receiver,
98 Node* frame_state) { 102 Node* context, Node* frame_state) {
99 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(1, zone()); 103 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(1, zone());
100 Node* call = graph()->NewNode(common()->Call(descriptor), function, receiver, 104 Node* call = graph()->NewNode(common()->Call(descriptor), function, receiver,
101 frame_state); 105 context, frame_state);
102 schedule()->AddNode(CurrentBlock(), call); 106 schedule()->AddNode(CurrentBlock(), call);
103 return call; 107 return call;
104 } 108 }
105 109
106 110
107 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function, 111 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function,
108 Node* arg0, Node* frame_state) { 112 Node* arg0, Node* context,
113 Node* frame_state) {
109 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( 114 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor(
110 function, 1, Operator::kNoProperties, zone()); 115 function, 1, Operator::kNoProperties, zone());
111 116
112 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); 117 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
113 Node* ref = NewNode( 118 Node* ref = NewNode(
114 common()->ExternalConstant(ExternalReference(function, isolate()))); 119 common()->ExternalConstant(ExternalReference(function, isolate())));
115 Node* arity = Int32Constant(1); 120 Node* arity = Int32Constant(1);
116 Node* context = Parameter(1);
117 121
118 Node* call = graph()->NewNode(common()->Call(descriptor), centry, arg0, ref, 122 Node* call = graph()->NewNode(common()->Call(descriptor), centry, arg0, ref,
119 arity, context, frame_state); 123 arity, context, frame_state);
120 schedule()->AddNode(CurrentBlock(), call); 124 schedule()->AddNode(CurrentBlock(), call);
121 return call; 125 return call;
122 } 126 }
123 127
124 128
125 void RawMachineAssembler::Bind(Label* label) { 129 void RawMachineAssembler::Bind(Label* label) {
126 DCHECK(current_block_ == NULL); 130 DCHECK(current_block_ == NULL);
(...skipping 28 matching lines...) Expand all
155 Node* node = graph()->NewNode(op, input_count, inputs); 159 Node* node = graph()->NewNode(op, input_count, inputs);
156 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start() 160 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start()
157 : CurrentBlock(); 161 : CurrentBlock();
158 schedule()->AddNode(block, node); 162 schedule()->AddNode(block, node);
159 return node; 163 return node;
160 } 164 }
161 165
162 } // namespace compiler 166 } // namespace compiler
163 } // namespace internal 167 } // namespace internal
164 } // namespace v8 168 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | src/compiler/structured-machine-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698