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 #include "src/ic/ic-state.h" | 5 #include "src/ic/ic-state.h" |
6 | 6 |
7 #include "src/ic/ic.h" | 7 #include "src/ic/ic.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 right_kind_ = GENERIC; | 263 right_kind_ = GENERIC; |
264 } | 264 } |
265 } | 265 } |
266 } | 266 } |
267 | 267 |
268 | 268 |
269 BinaryOpICState::Kind BinaryOpICState::UpdateKind(Handle<Object> object, | 269 BinaryOpICState::Kind BinaryOpICState::UpdateKind(Handle<Object> object, |
270 Kind kind) const { | 270 Kind kind) const { |
271 Kind new_kind = GENERIC; | 271 Kind new_kind = GENERIC; |
272 bool is_truncating = Token::IsTruncatingBinaryOp(op()); | 272 bool is_truncating = Token::IsTruncatingBinaryOp(op()); |
273 if (object->IsBoolean() && is_truncating) { | 273 if (object->IsOddball() && is_truncating) { |
274 // Booleans will be automatically truncated by HChange. | 274 // Oddballs will be automatically truncated by HChange. |
275 new_kind = INT32; | 275 new_kind = INT32; |
276 } else if (object->IsUndefined(isolate_)) { | 276 } else if (object->IsUndefined(isolate_)) { |
277 // Undefined will be automatically truncated by HChange. | 277 // Undefined will be automatically truncated by HChange. |
278 new_kind = is_truncating ? INT32 : NUMBER; | 278 new_kind = is_truncating ? INT32 : NUMBER; |
279 } else if (object->IsSmi()) { | 279 } else if (object->IsSmi()) { |
280 new_kind = SMI; | 280 new_kind = SMI; |
281 } else if (object->IsHeapNumber()) { | 281 } else if (object->IsHeapNumber()) { |
282 double value = Handle<HeapNumber>::cast(object)->value(); | 282 double value = Handle<HeapNumber>::cast(object)->value(); |
283 new_kind = IsInt32Double(value) ? INT32 : NUMBER; | 283 new_kind = IsInt32Double(value) ? INT32 : NUMBER; |
284 } else if (object->IsString() && op() == Token::ADD) { | 284 } else if (object->IsString() && op() == Token::ADD) { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 case RECEIVER: | 505 case RECEIVER: |
506 case GENERIC: | 506 case GENERIC: |
507 return GENERIC; | 507 return GENERIC; |
508 } | 508 } |
509 UNREACHABLE(); | 509 UNREACHABLE(); |
510 return GENERIC; // Make the compiler happy. | 510 return GENERIC; // Make the compiler happy. |
511 } | 511 } |
512 | 512 |
513 } // namespace internal | 513 } // namespace internal |
514 } // namespace v8 | 514 } // namespace v8 |
OLD | NEW |