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

Side by Side Diff: src/compiler/machine-type.h

Issue 528993002: First step to cleanup the power-of-2 mess. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: clang-format 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/arm/instruction-selector-arm.cc ('k') | src/compiler/representation-change.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_TYPE_H_ 5 #ifndef V8_COMPILER_MACHINE_TYPE_H_
6 #define V8_COMPILER_MACHINE_TYPE_H_ 6 #define V8_COMPILER_MACHINE_TYPE_H_
7 7
8 #include "src/base/bits.h"
8 #include "src/globals.h" 9 #include "src/globals.h"
9 10
10 namespace v8 { 11 namespace v8 {
11 namespace internal { 12 namespace internal {
12 13
13 class OStream; 14 class OStream;
14 15
15 namespace compiler { 16 namespace compiler {
16 17
17 // Machine-level types and representations. 18 // Machine-level types and representations.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 76
76 // Gets only the type of the given type. 77 // Gets only the type of the given type.
77 inline MachineType TypeOf(MachineType machine_type) { 78 inline MachineType TypeOf(MachineType machine_type) {
78 int result = machine_type & kTypeMask; 79 int result = machine_type & kTypeMask;
79 return static_cast<MachineType>(result); 80 return static_cast<MachineType>(result);
80 } 81 }
81 82
82 // Gets only the representation of the given type. 83 // Gets only the representation of the given type.
83 inline MachineType RepresentationOf(MachineType machine_type) { 84 inline MachineType RepresentationOf(MachineType machine_type) {
84 int result = machine_type & kRepMask; 85 int result = machine_type & kRepMask;
85 CHECK(IsPowerOf2(result)); 86 CHECK(base::bits::IsPowerOfTwo32(result));
86 return static_cast<MachineType>(result); 87 return static_cast<MachineType>(result);
87 } 88 }
88 89
89 // Gets the element size in bytes of the machine type. 90 // Gets the element size in bytes of the machine type.
90 inline int ElementSizeOf(MachineType machine_type) { 91 inline int ElementSizeOf(MachineType machine_type) {
91 switch (RepresentationOf(machine_type)) { 92 switch (RepresentationOf(machine_type)) {
92 case kRepBit: 93 case kRepBit:
93 case kRepWord8: 94 case kRepWord8:
94 return 1; 95 return 1;
95 case kRepWord16: 96 case kRepWord16:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 protected: 133 protected:
133 uint8_t return_count_; 134 uint8_t return_count_;
134 uint16_t param_count_; 135 uint16_t param_count_;
135 MachineType* reps_; 136 MachineType* reps_;
136 }; 137 };
137 } // namespace compiler 138 } // namespace compiler
138 } // namespace internal 139 } // namespace internal
139 } // namespace v8 140 } // namespace v8
140 141
141 #endif // V8_COMPILER_MACHINE_TYPE_H_ 142 #endif // V8_COMPILER_MACHINE_TYPE_H_
OLDNEW
« no previous file with comments | « src/compiler/arm/instruction-selector-arm.cc ('k') | src/compiler/representation-change.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698