| OLD | NEW |
| 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_SIMPLIFIED_OPERATOR_H_ | 5 #ifndef V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
| 6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_ | 6 #define V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/compiler/operator.h" | 10 #include "src/compiler/operator.h" |
| 11 #include "src/compiler/type-hints.h" | |
| 12 #include "src/handles.h" | 11 #include "src/handles.h" |
| 13 #include "src/machine-type.h" | 12 #include "src/machine-type.h" |
| 14 #include "src/objects.h" | 13 #include "src/objects.h" |
| 15 | 14 |
| 16 namespace v8 { | 15 namespace v8 { |
| 17 namespace internal { | 16 namespace internal { |
| 18 | 17 |
| 19 // Forward declarations. | 18 // Forward declarations. |
| 20 class Type; | 19 class Type; |
| 21 class Zone; | 20 class Zone; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 kFastTransition, // simple transition, just updating the map. | 146 kFastTransition, // simple transition, just updating the map. |
| 148 kSlowTransition // full transition, round-trip to the runtime. | 147 kSlowTransition // full transition, round-trip to the runtime. |
| 149 }; | 148 }; |
| 150 | 149 |
| 151 size_t hash_value(ElementsTransition); | 150 size_t hash_value(ElementsTransition); |
| 152 | 151 |
| 153 std::ostream& operator<<(std::ostream&, ElementsTransition); | 152 std::ostream& operator<<(std::ostream&, ElementsTransition); |
| 154 | 153 |
| 155 ElementsTransition ElementsTransitionOf(const Operator* op) WARN_UNUSED_RESULT; | 154 ElementsTransition ElementsTransitionOf(const Operator* op) WARN_UNUSED_RESULT; |
| 156 | 155 |
| 157 BinaryOperationHints::Hint BinaryOperationHintOf(const Operator* op); | 156 // A hint for speculative number operations. |
| 157 enum class NumberOperationHint : uint8_t { |
| 158 kSignedSmall, // Inputs were always Smi so far, output was in Smi range. |
| 159 kSigned32, // Inputs and output were Signed32 so far. |
| 160 kNumberOrOddball, // Inputs were Number or Oddball, output was Number. |
| 161 }; |
| 158 | 162 |
| 159 CompareOperationHints::Hint CompareOperationHintOf(const Operator* op); | 163 size_t hash_value(NumberOperationHint); |
| 164 |
| 165 std::ostream& operator<<(std::ostream&, NumberOperationHint); |
| 166 |
| 167 NumberOperationHint NumberOperationHintOf(const Operator* op) |
| 168 WARN_UNUSED_RESULT; |
| 160 | 169 |
| 161 // Interface for building simplified operators, which represent the | 170 // Interface for building simplified operators, which represent the |
| 162 // medium-level operations of V8, including adding numbers, allocating objects, | 171 // medium-level operations of V8, including adding numbers, allocating objects, |
| 163 // indexing into objects and arrays, etc. | 172 // indexing into objects and arrays, etc. |
| 164 // All operators are typed but many are representation independent. | 173 // All operators are typed but many are representation independent. |
| 165 | 174 |
| 166 // Number values from JS can be in one of these representations: | 175 // Number values from JS can be in one of these representations: |
| 167 // - Tagged: word-sized integer that is either | 176 // - Tagged: word-sized integer that is either |
| 168 // - a signed small integer (31 or 32 bits plus a tag) | 177 // - a signed small integer (31 or 32 bits plus a tag) |
| 169 // - a tagged pointer to a HeapNumber object that has a float64 field | 178 // - a tagged pointer to a HeapNumber object that has a float64 field |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 const Operator* NumberSinh(); | 240 const Operator* NumberSinh(); |
| 232 const Operator* NumberSqrt(); | 241 const Operator* NumberSqrt(); |
| 233 const Operator* NumberTan(); | 242 const Operator* NumberTan(); |
| 234 const Operator* NumberTanh(); | 243 const Operator* NumberTanh(); |
| 235 const Operator* NumberTrunc(); | 244 const Operator* NumberTrunc(); |
| 236 const Operator* NumberToInt32(); | 245 const Operator* NumberToInt32(); |
| 237 const Operator* NumberToUint32(); | 246 const Operator* NumberToUint32(); |
| 238 | 247 |
| 239 const Operator* NumberSilenceNaN(); | 248 const Operator* NumberSilenceNaN(); |
| 240 | 249 |
| 241 const Operator* SpeculativeNumberAdd(BinaryOperationHints::Hint hint); | 250 const Operator* SpeculativeNumberAdd(NumberOperationHint hint); |
| 242 const Operator* SpeculativeNumberSubtract(BinaryOperationHints::Hint hint); | 251 const Operator* SpeculativeNumberSubtract(NumberOperationHint hint); |
| 243 const Operator* SpeculativeNumberMultiply(BinaryOperationHints::Hint hint); | 252 const Operator* SpeculativeNumberMultiply(NumberOperationHint hint); |
| 244 const Operator* SpeculativeNumberDivide(BinaryOperationHints::Hint hint); | 253 const Operator* SpeculativeNumberDivide(NumberOperationHint hint); |
| 245 const Operator* SpeculativeNumberModulus(BinaryOperationHints::Hint hint); | 254 const Operator* SpeculativeNumberModulus(NumberOperationHint hint); |
| 246 const Operator* SpeculativeNumberShiftLeft(BinaryOperationHints::Hint hint); | 255 const Operator* SpeculativeNumberShiftLeft(NumberOperationHint hint); |
| 247 const Operator* SpeculativeNumberShiftRight(BinaryOperationHints::Hint hint); | 256 const Operator* SpeculativeNumberShiftRight(NumberOperationHint hint); |
| 248 const Operator* SpeculativeNumberShiftRightLogical( | 257 const Operator* SpeculativeNumberShiftRightLogical(NumberOperationHint hint); |
| 249 BinaryOperationHints::Hint hint); | 258 const Operator* SpeculativeNumberBitwiseAnd(NumberOperationHint hint); |
| 250 const Operator* SpeculativeNumberBitwiseAnd(BinaryOperationHints::Hint hint); | 259 const Operator* SpeculativeNumberBitwiseOr(NumberOperationHint hint); |
| 251 const Operator* SpeculativeNumberBitwiseOr(BinaryOperationHints::Hint hint); | 260 const Operator* SpeculativeNumberBitwiseXor(NumberOperationHint hint); |
| 252 const Operator* SpeculativeNumberBitwiseXor(BinaryOperationHints::Hint hint); | |
| 253 | 261 |
| 254 const Operator* SpeculativeNumberLessThan(CompareOperationHints::Hint hint); | 262 const Operator* SpeculativeNumberLessThan(NumberOperationHint hint); |
| 255 const Operator* SpeculativeNumberLessThanOrEqual( | 263 const Operator* SpeculativeNumberLessThanOrEqual(NumberOperationHint hint); |
| 256 CompareOperationHints::Hint hint); | 264 const Operator* SpeculativeNumberEqual(NumberOperationHint hint); |
| 257 const Operator* SpeculativeNumberEqual(CompareOperationHints::Hint hint); | |
| 258 | 265 |
| 259 const Operator* ReferenceEqual(Type* type); | 266 const Operator* ReferenceEqual(Type* type); |
| 260 | 267 |
| 261 const Operator* StringEqual(); | 268 const Operator* StringEqual(); |
| 262 const Operator* StringLessThan(); | 269 const Operator* StringLessThan(); |
| 263 const Operator* StringLessThanOrEqual(); | 270 const Operator* StringLessThanOrEqual(); |
| 264 const Operator* StringCharCodeAt(); | 271 const Operator* StringCharCodeAt(); |
| 265 const Operator* StringFromCharCode(); | 272 const Operator* StringFromCharCode(); |
| 266 | 273 |
| 267 const Operator* PlainPrimitiveToNumber(); | 274 const Operator* PlainPrimitiveToNumber(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 Zone* const zone_; | 356 Zone* const zone_; |
| 350 | 357 |
| 351 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder); | 358 DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorBuilder); |
| 352 }; | 359 }; |
| 353 | 360 |
| 354 } // namespace compiler | 361 } // namespace compiler |
| 355 } // namespace internal | 362 } // namespace internal |
| 356 } // namespace v8 | 363 } // namespace v8 |
| 357 | 364 |
| 358 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ | 365 #endif // V8_COMPILER_SIMPLIFIED_OPERATOR_H_ |
| OLD | NEW |