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

Side by Side Diff: src/compiler/representation-change.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/raw-machine-assembler.cc ('k') | src/compiler/simplified-lowering.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 #ifndef V8_COMPILER_REPRESENTATION_CHANGE_H_ 5 #ifndef V8_COMPILER_REPRESENTATION_CHANGE_H_
6 #define V8_COMPILER_REPRESENTATION_CHANGE_H_ 6 #define V8_COMPILER_REPRESENTATION_CHANGE_H_
7 7
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
11 #include "src/compiler/simplified-operator.h" 11 #include "src/compiler/simplified-operator.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 namespace compiler { 15 namespace compiler {
16 16
17 // The types and representations tracked during representation inference 17 // The types and representations tracked during representation inference
18 // and change insertion. 18 // and change insertion.
19 // TODO(titzer): First, merge MachineRepresentation and RepType. 19 // TODO(titzer): First, merge MachineType and RepType.
20 // TODO(titzer): Second, Use the real type system instead of RepType. 20 // TODO(titzer): Second, Use the real type system instead of RepType.
21 enum RepType { 21 enum RepType {
22 // Representations. 22 // Representations.
23 rBit = 1 << 0, 23 rBit = 1 << 0,
24 rWord32 = 1 << 1, 24 rWord32 = 1 << 1,
25 rWord64 = 1 << 2, 25 rWord64 = 1 << 2,
26 rFloat64 = 1 << 3, 26 rFloat64 = 1 << 3,
27 rTagged = 1 << 4, 27 rTagged = 1 << 4,
28 28
29 // Types. 29 // Types.
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 } 258 }
259 259
260 Node* GetWord64RepresentationFor(Node* node, RepTypeUnion output_type) { 260 Node* GetWord64RepresentationFor(Node* node, RepTypeUnion output_type) {
261 if (output_type & rBit) { 261 if (output_type & rBit) {
262 return node; // Sloppy comparison -> word64 262 return node; // Sloppy comparison -> word64
263 } 263 }
264 // Can't really convert Word64 to anything else. Purported to be internal. 264 // Can't really convert Word64 to anything else. Purported to be internal.
265 return TypeError(node, output_type, rWord64); 265 return TypeError(node, output_type, rWord64);
266 } 266 }
267 267
268 static RepType TypeForMachineRepresentation(MachineRepresentation rep) { 268 static RepType TypeForMachineType(MachineType rep) {
269 // TODO(titzer): merge MachineRepresentation and RepType. 269 // TODO(titzer): merge MachineType and RepType.
270 switch (rep) { 270 switch (rep) {
271 case kMachineWord8: 271 case kMachineWord8:
272 return rWord32; 272 return rWord32;
273 case kMachineWord16: 273 case kMachineWord16:
274 return rWord32; 274 return rWord32;
275 case kMachineWord32: 275 case kMachineWord32:
276 return rWord32; 276 return rWord32;
277 case kMachineWord64: 277 case kMachineWord64:
278 return rWord64; 278 return rWord64;
279 case kMachineFloat64: 279 case kMachineFloat64:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 case IrOpcode::kNumberLessThanOrEqual: 341 case IrOpcode::kNumberLessThanOrEqual:
342 return machine()->Float64LessThanOrEqual(); 342 return machine()->Float64LessThanOrEqual();
343 default: 343 default:
344 UNREACHABLE(); 344 UNREACHABLE();
345 return NULL; 345 return NULL;
346 } 346 }
347 } 347 }
348 348
349 RepType TypeForField(const FieldAccess& access) { 349 RepType TypeForField(const FieldAccess& access) {
350 RepType tElement = static_cast<RepType>(0); // TODO(titzer) 350 RepType tElement = static_cast<RepType>(0); // TODO(titzer)
351 RepType rElement = TypeForMachineRepresentation(access.representation); 351 RepType rElement = TypeForMachineType(access.representation);
352 return static_cast<RepType>(tElement | rElement); 352 return static_cast<RepType>(tElement | rElement);
353 } 353 }
354 354
355 RepType TypeForElement(const ElementAccess& access) { 355 RepType TypeForElement(const ElementAccess& access) {
356 RepType tElement = static_cast<RepType>(0); // TODO(titzer) 356 RepType tElement = static_cast<RepType>(0); // TODO(titzer)
357 RepType rElement = TypeForMachineRepresentation(access.representation); 357 RepType rElement = TypeForMachineType(access.representation);
358 return static_cast<RepType>(tElement | rElement); 358 return static_cast<RepType>(tElement | rElement);
359 } 359 }
360 360
361 RepType TypeForBasePointer(const FieldAccess& access) { 361 RepType TypeForBasePointer(const FieldAccess& access) {
362 if (access.tag() != 0) return static_cast<RepType>(tAny | rTagged); 362 if (access.tag() != 0) return static_cast<RepType>(tAny | rTagged);
363 return kPointerSize == 8 ? rWord64 : rWord32; 363 return kPointerSize == 8 ? rWord64 : rWord32;
364 } 364 }
365 365
366 RepType TypeForBasePointer(const ElementAccess& access) { 366 RepType TypeForBasePointer(const ElementAccess& access) {
367 if (access.tag() != 0) return static_cast<RepType>(tAny | rTagged); 367 if (access.tag() != 0) return static_cast<RepType>(tAny | rTagged);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 JSGraph* jsgraph() { return jsgraph_; } 407 JSGraph* jsgraph() { return jsgraph_; }
408 Isolate* isolate() { return isolate_; } 408 Isolate* isolate() { return isolate_; }
409 SimplifiedOperatorBuilder* simplified() { return simplified_; } 409 SimplifiedOperatorBuilder* simplified() { return simplified_; }
410 MachineOperatorBuilder* machine() { return machine_; } 410 MachineOperatorBuilder* machine() { return machine_; }
411 }; 411 };
412 } 412 }
413 } 413 }
414 } // namespace v8::internal::compiler 414 } // namespace v8::internal::compiler
415 415
416 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_ 416 #endif // V8_COMPILER_REPRESENTATION_CHANGE_H_
OLDNEW
« no previous file with comments | « src/compiler/raw-machine-assembler.cc ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698