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

Side by Side Diff: src/compiler/structured-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/structured-machine-assembler.h ('k') | src/compiler/x64/code-generator-x64.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 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/scheduler.h" 6 #include "src/compiler/scheduler.h"
7 #include "src/compiler/structured-machine-assembler.h" 7 #include "src/compiler/structured-machine-assembler.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 namespace compiler { 11 namespace compiler {
12 12
13 Node* Variable::Get() const { return smasm_->GetVariable(offset_); } 13 Node* Variable::Get() const { return smasm_->GetVariable(offset_); }
14 14
15 15
16 void Variable::Set(Node* value) const { smasm_->SetVariable(offset_, value); } 16 void Variable::Set(Node* value) const { smasm_->SetVariable(offset_, value); }
17 17
18 18
19 StructuredMachineAssembler::StructuredMachineAssembler( 19 StructuredMachineAssembler::StructuredMachineAssembler(
20 Graph* graph, MachineCallDescriptorBuilder* call_descriptor_builder, 20 Graph* graph, MachineSignature* machine_sig, MachineType word)
21 MachineType word)
22 : GraphBuilder(graph), 21 : GraphBuilder(graph),
23 schedule_(new (zone()) Schedule(zone())), 22 schedule_(new (zone()) Schedule(zone())),
24 machine_(zone(), word), 23 machine_(zone(), word),
25 common_(zone()), 24 common_(zone()),
26 call_descriptor_builder_(call_descriptor_builder), 25 machine_sig_(machine_sig),
26 call_descriptor_(
27 Linkage::GetSimplifiedCDescriptor(graph->zone(), machine_sig)),
27 parameters_(NULL), 28 parameters_(NULL),
28 current_environment_(new (zone()) 29 current_environment_(new (zone())
29 Environment(zone(), schedule()->start(), false)), 30 Environment(zone(), schedule()->start(), false)),
30 number_of_variables_(0) { 31 number_of_variables_(0) {
31 Node* s = graph->NewNode(common_.Start(parameter_count())); 32 int param_count = static_cast<int>(parameter_count());
33 Node* s = graph->NewNode(common_.Start(param_count));
32 graph->SetStart(s); 34 graph->SetStart(s);
33 if (parameter_count() == 0) return; 35 if (parameter_count() == 0) return;
34 parameters_ = zone()->NewArray<Node*>(parameter_count()); 36 parameters_ = zone()->NewArray<Node*>(param_count);
35 for (int i = 0; i < parameter_count(); ++i) { 37 for (size_t i = 0; i < parameter_count(); ++i) {
36 parameters_[i] = NewNode(common()->Parameter(i), graph->start()); 38 parameters_[i] =
39 NewNode(common()->Parameter(static_cast<int>(i)), graph->start());
37 } 40 }
38 } 41 }
39 42
40 43
41 Schedule* StructuredMachineAssembler::Export() { 44 Schedule* StructuredMachineAssembler::Export() {
42 // Compute the correct codegen order. 45 // Compute the correct codegen order.
43 DCHECK(schedule_->rpo_order()->empty()); 46 DCHECK(schedule_->rpo_order()->empty());
44 Scheduler::ComputeSpecialRPO(schedule_); 47 Scheduler::ComputeSpecialRPO(schedule_);
45 // Invalidate MachineAssembler. 48 // Invalidate MachineAssembler.
46 Schedule* schedule = schedule_; 49 Schedule* schedule = schedule_;
47 schedule_ = NULL; 50 schedule_ = NULL;
48 return schedule; 51 return schedule;
49 } 52 }
50 53
51 54
52 Node* StructuredMachineAssembler::Parameter(int index) { 55 Node* StructuredMachineAssembler::Parameter(size_t index) {
53 DCHECK(0 <= index && index < parameter_count()); 56 DCHECK(index < parameter_count());
54 return parameters_[index]; 57 return parameters_[index];
55 } 58 }
56 59
57 60
58 Node* StructuredMachineAssembler::MakeNode(Operator* op, int input_count, 61 Node* StructuredMachineAssembler::MakeNode(Operator* op, int input_count,
59 Node** inputs) { 62 Node** inputs) {
60 DCHECK(ScheduleValid()); 63 DCHECK(ScheduleValid());
61 DCHECK(current_environment_ != NULL); 64 DCHECK(current_environment_ != NULL);
62 Node* node = graph()->NewNode(op, input_count, inputs); 65 Node* node = graph()->NewNode(op, input_count, inputs);
63 BasicBlock* block = NULL; 66 BasicBlock* block = NULL;
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 } 655 }
653 pending_header_merges_.clear(); 656 pending_header_merges_.clear();
654 pending_exit_merges_.clear(); 657 pending_exit_merges_.clear();
655 header_environment_ = NULL; 658 header_environment_ = NULL;
656 DCHECK(IsDone()); 659 DCHECK(IsDone());
657 } 660 }
658 661
659 } // namespace compiler 662 } // namespace compiler
660 } // namespace internal 663 } // namespace internal
661 } // namespace v8 664 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/structured-machine-assembler.h ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698