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

Side by Side Diff: src/compiler/simplified-operator.cc

Issue 618643002: Replace OStream with std::ostream. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Created 6 years, 2 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/simplified-operator.h ('k') | src/compiler/simplified-operator-unittest.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/simplified-operator.h" 5 #include "src/compiler/simplified-operator.h"
6 6
7 #include "src/base/lazy-instance.h" 7 #include "src/base/lazy-instance.h"
8 #include "src/compiler/opcodes.h" 8 #include "src/compiler/opcodes.h"
9 #include "src/compiler/operator.h" 9 #include "src/compiler/operator.h"
10 #include "src/types-inl.h" 10 #include "src/types-inl.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 namespace compiler { 14 namespace compiler {
15 15
16 OStream& operator<<(OStream& os, BaseTaggedness base_taggedness) { 16 std::ostream& operator<<(std::ostream& os, BaseTaggedness base_taggedness) {
17 switch (base_taggedness) { 17 switch (base_taggedness) {
18 case kUntaggedBase: 18 case kUntaggedBase:
19 return os << "untagged base"; 19 return os << "untagged base";
20 case kTaggedBase: 20 case kTaggedBase:
21 return os << "tagged base"; 21 return os << "tagged base";
22 } 22 }
23 UNREACHABLE(); 23 UNREACHABLE();
24 return os; 24 return os;
25 } 25 }
26 26
27 27
28 bool operator==(ElementAccess const& lhs, ElementAccess const& rhs) { 28 bool operator==(ElementAccess const& lhs, ElementAccess const& rhs) {
29 return lhs.base_is_tagged == rhs.base_is_tagged && 29 return lhs.base_is_tagged == rhs.base_is_tagged &&
30 lhs.header_size == rhs.header_size && lhs.type == rhs.type && 30 lhs.header_size == rhs.header_size && lhs.type == rhs.type &&
31 lhs.machine_type == rhs.machine_type; 31 lhs.machine_type == rhs.machine_type;
32 } 32 }
33 33
34 34
35 bool operator!=(ElementAccess const& lhs, ElementAccess const& rhs) { 35 bool operator!=(ElementAccess const& lhs, ElementAccess const& rhs) {
36 return !(lhs == rhs); 36 return !(lhs == rhs);
37 } 37 }
38 38
39 39
40 OStream& operator<<(OStream& os, ElementAccess const& access) { 40 std::ostream& operator<<(std::ostream& os, ElementAccess const& access) {
41 os << "[" << access.base_is_tagged << ", " << access.header_size << ", "; 41 os << "[" << access.base_is_tagged << ", " << access.header_size << ", ";
42 access.type->PrintTo(os); 42 access.type->PrintTo(os);
43 os << ", " << access.machine_type << "]"; 43 os << ", " << access.machine_type << "]";
44 return os; 44 return os;
45 } 45 }
46 46
47 47
48 const FieldAccess& FieldAccessOf(const Operator* op) { 48 const FieldAccess& FieldAccessOf(const Operator* op) {
49 DCHECK_NOT_NULL(op); 49 DCHECK_NOT_NULL(op);
50 DCHECK(op->opcode() == IrOpcode::kLoadField || 50 DCHECK(op->opcode() == IrOpcode::kLoadField ||
51 op->opcode() == IrOpcode::kStoreField); 51 op->opcode() == IrOpcode::kStoreField);
52 return OpParameter<FieldAccess>(op); 52 return OpParameter<FieldAccess>(op);
53 } 53 }
54 54
55 55
56 const ElementAccess& ElementAccessOf(const Operator* op) { 56 const ElementAccess& ElementAccessOf(const Operator* op) {
57 DCHECK_NOT_NULL(op); 57 DCHECK_NOT_NULL(op);
58 DCHECK(op->opcode() == IrOpcode::kLoadElement || 58 DCHECK(op->opcode() == IrOpcode::kLoadElement ||
59 op->opcode() == IrOpcode::kStoreElement); 59 op->opcode() == IrOpcode::kStoreElement);
60 return OpParameter<ElementAccess>(op); 60 return OpParameter<ElementAccess>(op);
61 } 61 }
62 62
63 63
64 // Specialization for static parameters of type {FieldAccess}. 64 // Specialization for static parameters of type {FieldAccess}.
65 template <> 65 template <>
66 struct StaticParameterTraits<FieldAccess> { 66 struct StaticParameterTraits<FieldAccess> {
67 static OStream& PrintTo(OStream& os, const FieldAccess& val) { 67 static std::ostream& PrintTo(std::ostream& os, const FieldAccess& val) {
68 return os << val.offset; 68 return os << val.offset;
69 } 69 }
70 static int HashCode(const FieldAccess& val) { 70 static int HashCode(const FieldAccess& val) {
71 return (val.offset < 16) | (val.machine_type & 0xffff); 71 return (val.offset < 16) | (val.machine_type & 0xffff);
72 } 72 }
73 static bool Equals(const FieldAccess& lhs, const FieldAccess& rhs) { 73 static bool Equals(const FieldAccess& lhs, const FieldAccess& rhs) {
74 return lhs.base_is_tagged == rhs.base_is_tagged && 74 return lhs.base_is_tagged == rhs.base_is_tagged &&
75 lhs.offset == rhs.offset && lhs.machine_type == rhs.machine_type && 75 lhs.offset == rhs.offset && lhs.machine_type == rhs.machine_type &&
76 lhs.type->Is(rhs.type); 76 lhs.type->Is(rhs.type);
77 } 77 }
78 }; 78 };
79 79
80 80
81 // Specialization for static parameters of type {ElementAccess}. 81 // Specialization for static parameters of type {ElementAccess}.
82 template <> 82 template <>
83 struct StaticParameterTraits<ElementAccess> { 83 struct StaticParameterTraits<ElementAccess> {
84 static OStream& PrintTo(OStream& os, const ElementAccess& access) { 84 static std::ostream& PrintTo(std::ostream& os, const ElementAccess& access) {
85 return os << access; 85 return os << access;
86 } 86 }
87 static int HashCode(const ElementAccess& access) { 87 static int HashCode(const ElementAccess& access) {
88 return (access.header_size < 16) | (access.machine_type & 0xffff); 88 return (access.header_size < 16) | (access.machine_type & 0xffff);
89 } 89 }
90 static bool Equals(const ElementAccess& lhs, const ElementAccess& rhs) { 90 static bool Equals(const ElementAccess& lhs, const ElementAccess& rhs) {
91 return lhs.base_is_tagged == rhs.base_is_tagged && 91 return lhs.base_is_tagged == rhs.base_is_tagged &&
92 lhs.header_size == rhs.header_size && 92 lhs.header_size == rhs.header_size &&
93 lhs.machine_type == rhs.machine_type && lhs.type->Is(rhs.type); 93 lhs.machine_type == rhs.machine_type && lhs.type->Is(rhs.type);
94 } 94 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 return new (zone()) \ 169 return new (zone()) \
170 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \ 170 Operator1<Type>(IrOpcode::k##Name, Operator::kNoThrow | properties, \
171 input_count, output_count, #Name, access); \ 171 input_count, output_count, #Name, access); \
172 } 172 }
173 ACCESS_OP_LIST(ACCESS) 173 ACCESS_OP_LIST(ACCESS)
174 #undef ACCESS 174 #undef ACCESS
175 175
176 } // namespace compiler 176 } // namespace compiler
177 } // namespace internal 177 } // namespace internal
178 } // namespace v8 178 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator.h ('k') | src/compiler/simplified-operator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698