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

Side by Side Diff: src/hydrogen-mark-deoptimize.cc

Issue 22152003: Never hchange nan-hole to hole or hole to nan-hole. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Also change in header Created 7 years, 4 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/hydrogen-mark-deoptimize.h ('k') | src/hydrogen-representation-changes.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 16 matching lines...) Expand all
27 27
28 #include "hydrogen-mark-deoptimize.h" 28 #include "hydrogen-mark-deoptimize.h"
29 29
30 namespace v8 { 30 namespace v8 {
31 namespace internal { 31 namespace internal {
32 32
33 void HMarkDeoptimizeOnUndefinedPhase::Run() { 33 void HMarkDeoptimizeOnUndefinedPhase::Run() {
34 const ZoneList<HPhi*>* phi_list = graph()->phi_list(); 34 const ZoneList<HPhi*>* phi_list = graph()->phi_list();
35 for (int i = 0; i < phi_list->length(); i++) { 35 for (int i = 0; i < phi_list->length(); i++) {
36 HPhi* phi = phi_list->at(i); 36 HPhi* phi = phi_list->at(i);
37 if (phi->CheckFlag(HValue::kAllowUndefinedAsNaN)) { 37 if (phi->CheckFlag(HValue::kAllowUndefinedAsNaN) &&
38 for (HUseIterator it(phi->uses()); !it.Done(); it.Advance()) { 38 !phi->CheckUsesForFlag(HValue::kAllowUndefinedAsNaN)) {
39 HValue* use_value = it.value(); 39 ProcessPhi(phi);
40 if (!use_value->CheckFlag(HValue::kAllowUndefinedAsNaN)) {
41 ProcessPhi(phi);
42 break;
43 }
44 }
45 } 40 }
46 } 41 }
47 } 42 }
48 43
49 44
50 void HMarkDeoptimizeOnUndefinedPhase::ProcessPhi(HPhi* phi) { 45 void HMarkDeoptimizeOnUndefinedPhase::ProcessPhi(HPhi* phi) {
51 ASSERT(phi->CheckFlag(HValue::kAllowUndefinedAsNaN)); 46 ASSERT(phi->CheckFlag(HValue::kAllowUndefinedAsNaN));
52 ASSERT(worklist_.is_empty()); 47 ASSERT(worklist_.is_empty());
53 48
54 // Push the phi onto the worklist 49 // Push the phi onto the worklist
55 phi->ClearFlag(HValue::kAllowUndefinedAsNaN); 50 phi->ClearFlag(HValue::kAllowUndefinedAsNaN);
56 worklist_.Add(phi, zone()); 51 worklist_.Add(phi, zone());
57 52
58 // Process all phis that can reach this phi 53 // Process all phis that can reach this phi
59 while (!worklist_.is_empty()) { 54 while (!worklist_.is_empty()) {
60 phi = worklist_.RemoveLast(); 55 phi = worklist_.RemoveLast();
61 for (int i = phi->OperandCount() - 1; i >= 0; --i) { 56 for (int i = phi->OperandCount() - 1; i >= 0; --i) {
62 HValue* input = phi->OperandAt(i); 57 HValue* input = phi->OperandAt(i);
63 if (input->IsPhi() && input->CheckFlag(HValue::kAllowUndefinedAsNaN)) { 58 if (input->IsPhi() && input->CheckFlag(HValue::kAllowUndefinedAsNaN)) {
64 input->ClearFlag(HValue::kAllowUndefinedAsNaN); 59 input->ClearFlag(HValue::kAllowUndefinedAsNaN);
65 worklist_.Add(HPhi::cast(input), zone()); 60 worklist_.Add(HPhi::cast(input), zone());
66 } 61 }
67 } 62 }
68 } 63 }
69 } 64 }
70 65
66
67 void HComputeChangeUndefinedToNaN::Run() {
68 const ZoneList<HBasicBlock*>* blocks(graph()->blocks());
69 for (int i = 0; i < blocks->length(); ++i) {
70 const HBasicBlock* block(blocks->at(i));
71 for (HInstruction* current = block->first(); current != NULL; ) {
72 HInstruction* next = current->next();
73 if (current->IsChange()) {
74 if (HChange::cast(current)->can_convert_undefined_to_nan()) {
75 current->SetFlag(HValue::kAllowUndefinedAsNaN);
76 }
77 }
78 current = next;
79 }
80 }
81 }
82
83
71 } } // namespace v8::internal 84 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-mark-deoptimize.h ('k') | src/hydrogen-representation-changes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698