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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 12918028: Canonicalize NaNs on store to Fast(Float|Double) arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2572 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 stream->Add(" check_hole"); 2583 stream->Add(" check_hole");
2584 } 2584 }
2585 } 2585 }
2586 2586
2587 2587
2588 bool HLoadKeyed::UsesMustHandleHole() const { 2588 bool HLoadKeyed::UsesMustHandleHole() const {
2589 if (IsFastPackedElementsKind(elements_kind())) { 2589 if (IsFastPackedElementsKind(elements_kind())) {
2590 return false; 2590 return false;
2591 } 2591 }
2592 2592
2593 if (IsExternalArrayElementsKind(elements_kind())) {
2594 return false;
2595 }
2596
2593 if (hole_mode() == ALLOW_RETURN_HOLE) return true; 2597 if (hole_mode() == ALLOW_RETURN_HOLE) return true;
2594 2598
2595 if (IsFastDoubleElementsKind(elements_kind())) { 2599 if (IsFastDoubleElementsKind(elements_kind())) {
2596 return false; 2600 return false;
2597 } 2601 }
2598 2602
2599 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { 2603 for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
2600 HValue* use = it.value(); 2604 HValue* use = it.value();
2601 if (!use->IsChange()) { 2605 if (!use->IsChange()) {
2602 return false; 2606 return false;
2603 } 2607 }
2604 } 2608 }
2605 2609
2606 return true; 2610 return true;
2607 } 2611 }
2608 2612
2609 2613
2610 bool HLoadKeyed::RequiresHoleCheck() const { 2614 bool HLoadKeyed::RequiresHoleCheck() const {
2611 if (IsFastPackedElementsKind(elements_kind())) { 2615 if (IsFastPackedElementsKind(elements_kind())) {
2612 return false; 2616 return false;
2613 } 2617 }
2614 2618
2615 return !UsesMustHandleHole(); 2619 return !UsesMustHandleHole();
danno 2013/03/28 08:49:39 Watch out. By returning false in UsesMustHandleHol
Dmitry Lomov (no reviews) 2013/03/28 10:01:27 Done, good catch. On 2013/03/28 08:49:39, danno wr
2616 } 2620 }
2617 2621
2618 2622
2619 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) { 2623 void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) {
2620 object()->PrintNameTo(stream); 2624 object()->PrintNameTo(stream);
2621 stream->Add("["); 2625 stream->Add("[");
2622 key()->PrintNameTo(stream); 2626 key()->PrintNameTo(stream);
2623 stream->Add("]"); 2627 stream->Add("]");
2624 } 2628 }
2625 2629
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
3030 return left(); 3034 return left();
3031 } 3035 }
3032 return NULL; 3036 return NULL;
3033 } 3037 }
3034 3038
3035 3039
3036 bool HStoreKeyed::NeedsCanonicalization() { 3040 bool HStoreKeyed::NeedsCanonicalization() {
3037 // If value is an integer or smi or comes from the result of a keyed load or 3041 // If value is an integer or smi or comes from the result of a keyed load or
3038 // constant then it is either be a non-hole value or in the case of a constant 3042 // constant then it is either be a non-hole value or in the case of a constant
3039 // the hole is only being stored explicitly: no need for canonicalization. 3043 // the hole is only being stored explicitly: no need for canonicalization.
3040 if (value()->IsLoadKeyed() || value()->IsConstant()) { 3044 //
3045 // The exception to that is keyed loads from external float or double arrays:
3046 // these can load arbitrary representation of NaN
Jakob Kummerow 2013/03/28 10:17:38 nit: full stop at the end of the line, please.
3047
3048 if (value()->IsConstant()) {
3041 return false; 3049 return false;
3042 } 3050 }
3043 3051
3052 if (value()->IsLoadKeyed()) {
3053 return HLoadKeyed::cast(value())->can_load_hole_nan();
danno 2013/03/28 08:49:39 I am not sure you need a separate predicate for th
Dmitry Lomov (no reviews) 2013/03/28 10:01:27 I strongly disagree. We have enough hidden depende
danno 2013/03/28 10:07:16 Well, the name you have chose isn't correct, and i
Dmitry Lomov (no reviews) 2013/03/28 12:19:40 Alright so we have had a little offline discussion
3054 }
3055
3044 if (value()->IsChange()) { 3056 if (value()->IsChange()) {
3045 if (HChange::cast(value())->from().IsInteger32()) { 3057 if (HChange::cast(value())->from().IsInteger32()) {
3046 return false; 3058 return false;
3047 } 3059 }
3048 if (HChange::cast(value())->value()->type().IsSmi()) { 3060 if (HChange::cast(value())->value()->type().IsSmi()) {
3049 return false; 3061 return false;
3050 } 3062 }
3051 } 3063 }
3052 return true; 3064 return true;
3053 } 3065 }
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
3519 3531
3520 3532
3521 void HCheckFunction::Verify() { 3533 void HCheckFunction::Verify() {
3522 HInstruction::Verify(); 3534 HInstruction::Verify();
3523 ASSERT(HasNoUses()); 3535 ASSERT(HasNoUses());
3524 } 3536 }
3525 3537
3526 #endif 3538 #endif
3527 3539
3528 } } // namespace v8::internal 3540 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698