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

Side by Side Diff: test/cctest/compiler/graph-builder-tester.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 | « test/cctest/compiler/graph-builder-tester.h ('k') | test/cctest/compiler/test-codegen-deopt.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 "test/cctest/compiler/graph-builder-tester.h" 5 #include "test/cctest/compiler/graph-builder-tester.h"
6 #include "src/compiler/pipeline.h" 6 #include "src/compiler/pipeline.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 namespace compiler { 10 namespace compiler {
11 11
12 MachineCallHelper::MachineCallHelper(Zone* zone, 12 MachineCallHelper::MachineCallHelper(Zone* zone, MachineSignature* machine_sig)
13 MachineCallDescriptorBuilder* builder) 13 : CallHelper(zone->isolate(), machine_sig),
14 : CallHelper(zone->isolate()),
15 call_descriptor_builder_(builder),
16 parameters_(NULL), 14 parameters_(NULL),
17 graph_(NULL) {} 15 graph_(NULL) {}
18 16
19 17
20 void MachineCallHelper::InitParameters(GraphBuilder* builder, 18 void MachineCallHelper::InitParameters(GraphBuilder* builder,
21 CommonOperatorBuilder* common) { 19 CommonOperatorBuilder* common) {
22 DCHECK_EQ(NULL, parameters_); 20 DCHECK_EQ(NULL, parameters_);
23 graph_ = builder->graph(); 21 graph_ = builder->graph();
24 if (parameter_count() == 0) return; 22 int param_count = static_cast<int>(parameter_count());
25 parameters_ = graph_->zone()->NewArray<Node*>(parameter_count()); 23 if (param_count == 0) return;
26 for (int i = 0; i < parameter_count(); ++i) { 24 parameters_ = graph_->zone()->NewArray<Node*>(param_count);
25 for (int i = 0; i < param_count; ++i) {
27 parameters_[i] = builder->NewNode(common->Parameter(i), graph_->start()); 26 parameters_[i] = builder->NewNode(common->Parameter(i), graph_->start());
28 } 27 }
29 } 28 }
30 29
31 30
32 byte* MachineCallHelper::Generate() { 31 byte* MachineCallHelper::Generate() {
33 DCHECK(parameter_count() == 0 || parameters_ != NULL); 32 DCHECK(parameter_count() == 0 || parameters_ != NULL);
34 if (!Pipeline::SupportedBackend()) return NULL; 33 if (!Pipeline::SupportedBackend()) return NULL;
35 if (code_.is_null()) { 34 if (code_.is_null()) {
36 Zone* zone = graph_->zone(); 35 Zone* zone = graph_->zone();
37 CompilationInfo info(zone->isolate(), zone); 36 CompilationInfo info(zone->isolate(), zone);
38 Linkage linkage(&info, call_descriptor_builder_->BuildCallDescriptor(zone)); 37 Linkage linkage(&info,
38 Linkage::GetSimplifiedCDescriptor(zone, machine_sig_));
39 Pipeline pipeline(&info); 39 Pipeline pipeline(&info);
40 code_ = pipeline.GenerateCodeForMachineGraph(&linkage, graph_); 40 code_ = pipeline.GenerateCodeForMachineGraph(&linkage, graph_);
41 } 41 }
42 return code_.ToHandleChecked()->entry(); 42 return code_.ToHandleChecked()->entry();
43 } 43 }
44 44
45 45
46 void MachineCallHelper::VerifyParameters(int parameter_count, 46 Node* MachineCallHelper::Parameter(size_t index) {
47 MachineType* parameter_types) {
48 CHECK_EQ(this->parameter_count(), parameter_count);
49 const MachineType* expected_types =
50 call_descriptor_builder_->parameter_types();
51 for (int i = 0; i < parameter_count; i++) {
52 CHECK_EQ(expected_types[i], parameter_types[i]);
53 }
54 }
55
56
57 Node* MachineCallHelper::Parameter(int offset) {
58 DCHECK_NE(NULL, parameters_); 47 DCHECK_NE(NULL, parameters_);
59 DCHECK(0 <= offset && offset < parameter_count()); 48 DCHECK(index < parameter_count());
60 return parameters_[offset]; 49 return parameters_[index];
61 } 50 }
62 51
63 } // namespace compiler 52 } // namespace compiler
64 } // namespace internal 53 } // namespace internal
65 } // namespace v8 54 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/graph-builder-tester.h ('k') | test/cctest/compiler/test-codegen-deopt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698