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

Side by Side Diff: src/compiler/machine-node-factory.h

Issue 456333002: Move MachineRepresentation to machine-type.h and rename to MachineType in preparation for merging i… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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/linkage-impl.h ('k') | src/compiler/machine-operator.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 #ifndef V8_COMPILER_MACHINE_NODE_FACTORY_H_ 5 #ifndef V8_COMPILER_MACHINE_NODE_FACTORY_H_
6 #define V8_COMPILER_MACHINE_NODE_FACTORY_H_ 6 #define V8_COMPILER_MACHINE_NODE_FACTORY_H_
7 7
8 #ifdef USE_SIMULATOR 8 #ifdef USE_SIMULATOR
9 #define MACHINE_ASSEMBLER_SUPPORTS_CALL_C 0 9 #define MACHINE_ASSEMBLER_SUPPORTS_CALL_C 0
10 #else 10 #else
11 #define MACHINE_ASSEMBLER_SUPPORTS_CALL_C 1 11 #define MACHINE_ASSEMBLER_SUPPORTS_CALL_C 1
12 #endif 12 #endif
13 13
14 #include "src/v8.h" 14 #include "src/v8.h"
15 15
16 #include "src/compiler/machine-operator.h" 16 #include "src/compiler/machine-operator.h"
17 #include "src/compiler/node.h" 17 #include "src/compiler/node.h"
18 18
19 namespace v8 { 19 namespace v8 {
20 namespace internal { 20 namespace internal {
21 namespace compiler { 21 namespace compiler {
22 22
23 class MachineCallDescriptorBuilder : public ZoneObject { 23 class MachineCallDescriptorBuilder : public ZoneObject {
24 public: 24 public:
25 MachineCallDescriptorBuilder(MachineRepresentation return_type, 25 MachineCallDescriptorBuilder(MachineType return_type, int parameter_count,
26 int parameter_count, 26 const MachineType* parameter_types)
27 const MachineRepresentation* parameter_types)
28 : return_type_(return_type), 27 : return_type_(return_type),
29 parameter_count_(parameter_count), 28 parameter_count_(parameter_count),
30 parameter_types_(parameter_types) {} 29 parameter_types_(parameter_types) {}
31 30
32 int parameter_count() const { return parameter_count_; } 31 int parameter_count() const { return parameter_count_; }
33 const MachineRepresentation* parameter_types() const { 32 const MachineType* parameter_types() const { return parameter_types_; }
34 return parameter_types_;
35 }
36 33
37 CallDescriptor* BuildCallDescriptor(Zone* zone) { 34 CallDescriptor* BuildCallDescriptor(Zone* zone) {
38 return Linkage::GetSimplifiedCDescriptor(zone, parameter_count_, 35 return Linkage::GetSimplifiedCDescriptor(zone, parameter_count_,
39 return_type_, parameter_types_); 36 return_type_, parameter_types_);
40 } 37 }
41 38
42 private: 39 private:
43 const MachineRepresentation return_type_; 40 const MachineType return_type_;
44 const int parameter_count_; 41 const int parameter_count_;
45 const MachineRepresentation* const parameter_types_; 42 const MachineType* const parameter_types_;
46 }; 43 };
47 44
48 45
49 #define ZONE() static_cast<NodeFactory*>(this)->zone() 46 #define ZONE() static_cast<NodeFactory*>(this)->zone()
50 #define COMMON() static_cast<NodeFactory*>(this)->common() 47 #define COMMON() static_cast<NodeFactory*>(this)->common()
51 #define MACHINE() static_cast<NodeFactory*>(this)->machine() 48 #define MACHINE() static_cast<NodeFactory*>(this)->machine()
52 #define NEW_NODE_0(op) static_cast<NodeFactory*>(this)->NewNode(op) 49 #define NEW_NODE_0(op) static_cast<NodeFactory*>(this)->NewNode(op)
53 #define NEW_NODE_1(op, a) static_cast<NodeFactory*>(this)->NewNode(op, a) 50 #define NEW_NODE_1(op, a) static_cast<NodeFactory*>(this)->NewNode(op, a)
54 #define NEW_NODE_2(op, a, b) static_cast<NodeFactory*>(this)->NewNode(op, a, b) 51 #define NEW_NODE_2(op, a, b) static_cast<NodeFactory*>(this)->NewNode(op, a, b)
55 #define NEW_NODE_3(op, a, b, c) \ 52 #define NEW_NODE_3(op, a, b, c) \
(...skipping 27 matching lines...) Expand all
83 PrintableUnique<Object> val = 80 PrintableUnique<Object> val =
84 PrintableUnique<Object>::CreateUninitialized(ZONE(), object); 81 PrintableUnique<Object>::CreateUninitialized(ZONE(), object);
85 return NEW_NODE_0(COMMON()->HeapConstant(val)); 82 return NEW_NODE_0(COMMON()->HeapConstant(val));
86 } 83 }
87 84
88 Node* Projection(int index, Node* a) { 85 Node* Projection(int index, Node* a) {
89 return NEW_NODE_1(COMMON()->Projection(index), a); 86 return NEW_NODE_1(COMMON()->Projection(index), a);
90 } 87 }
91 88
92 // Memory Operations. 89 // Memory Operations.
93 Node* Load(MachineRepresentation rep, Node* base) { 90 Node* Load(MachineType rep, Node* base) {
94 return Load(rep, base, Int32Constant(0)); 91 return Load(rep, base, Int32Constant(0));
95 } 92 }
96 Node* Load(MachineRepresentation rep, Node* base, Node* index) { 93 Node* Load(MachineType rep, Node* base, Node* index) {
97 return NEW_NODE_2(MACHINE()->Load(rep), base, index); 94 return NEW_NODE_2(MACHINE()->Load(rep), base, index);
98 } 95 }
99 void Store(MachineRepresentation rep, Node* base, Node* value) { 96 void Store(MachineType rep, Node* base, Node* value) {
100 Store(rep, base, Int32Constant(0), value); 97 Store(rep, base, Int32Constant(0), value);
101 } 98 }
102 void Store(MachineRepresentation rep, Node* base, Node* index, Node* value) { 99 void Store(MachineType rep, Node* base, Node* index, Node* value) {
103 NEW_NODE_3(MACHINE()->Store(rep, kNoWriteBarrier), base, index, value); 100 NEW_NODE_3(MACHINE()->Store(rep, kNoWriteBarrier), base, index, value);
104 } 101 }
105 // Arithmetic Operations. 102 // Arithmetic Operations.
106 Node* WordAnd(Node* a, Node* b) { 103 Node* WordAnd(Node* a, Node* b) {
107 return NEW_NODE_2(MACHINE()->WordAnd(), a, b); 104 return NEW_NODE_2(MACHINE()->WordAnd(), a, b);
108 } 105 }
109 Node* WordOr(Node* a, Node* b) { 106 Node* WordOr(Node* a, Node* b) {
110 return NEW_NODE_2(MACHINE()->WordOr(), a, b); 107 return NEW_NODE_2(MACHINE()->WordOr(), a, b);
111 } 108 }
112 Node* WordXor(Node* a, Node* b) { 109 Node* WordXor(Node* a, Node* b) {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } 344 }
348 Node* ChangeFloat64ToInt32(Node* a) { 345 Node* ChangeFloat64ToInt32(Node* a) {
349 return NEW_NODE_1(MACHINE()->ChangeFloat64ToInt32(), a); 346 return NEW_NODE_1(MACHINE()->ChangeFloat64ToInt32(), a);
350 } 347 }
351 Node* ChangeFloat64ToUint32(Node* a) { 348 Node* ChangeFloat64ToUint32(Node* a) {
352 return NEW_NODE_1(MACHINE()->ChangeFloat64ToUint32(), a); 349 return NEW_NODE_1(MACHINE()->ChangeFloat64ToUint32(), a);
353 } 350 }
354 351
355 #ifdef MACHINE_ASSEMBLER_SUPPORTS_CALL_C 352 #ifdef MACHINE_ASSEMBLER_SUPPORTS_CALL_C
356 // Call to C. 353 // Call to C.
357 Node* CallC(Node* function_address, MachineRepresentation return_type, 354 Node* CallC(Node* function_address, MachineType return_type,
358 MachineRepresentation* arg_types, Node** args, int n_args) { 355 MachineType* arg_types, Node** args, int n_args) {
359 CallDescriptor* descriptor = Linkage::GetSimplifiedCDescriptor( 356 CallDescriptor* descriptor = Linkage::GetSimplifiedCDescriptor(
360 ZONE(), n_args, return_type, arg_types); 357 ZONE(), n_args, return_type, arg_types);
361 Node** passed_args = 358 Node** passed_args =
362 static_cast<Node**>(alloca((n_args + 1) * sizeof(args[0]))); 359 static_cast<Node**>(alloca((n_args + 1) * sizeof(args[0])));
363 passed_args[0] = function_address; 360 passed_args[0] = function_address;
364 for (int i = 0; i < n_args; ++i) { 361 for (int i = 0; i < n_args; ++i) {
365 passed_args[i + 1] = args[i]; 362 passed_args[i + 1] = args[i];
366 } 363 }
367 return NEW_NODE_2(COMMON()->Call(descriptor), n_args + 1, passed_args); 364 return NEW_NODE_2(COMMON()->Call(descriptor), n_args + 1, passed_args);
368 } 365 }
369 #endif 366 #endif
370 }; 367 };
371 368
372 #undef NEW_NODE_0 369 #undef NEW_NODE_0
373 #undef NEW_NODE_1 370 #undef NEW_NODE_1
374 #undef NEW_NODE_2 371 #undef NEW_NODE_2
375 #undef NEW_NODE_3 372 #undef NEW_NODE_3
376 #undef MACHINE 373 #undef MACHINE
377 #undef COMMON 374 #undef COMMON
378 #undef ZONE 375 #undef ZONE
379 376
380 } // namespace compiler 377 } // namespace compiler
381 } // namespace internal 378 } // namespace internal
382 } // namespace v8 379 } // namespace v8
383 380
384 #endif // V8_COMPILER_MACHINE_NODE_FACTORY_H_ 381 #endif // V8_COMPILER_MACHINE_NODE_FACTORY_H_
OLDNEW
« no previous file with comments | « src/compiler/linkage-impl.h ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698