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

Side by Side Diff: src/hydrogen-instructions.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-instructions.h ('k') | src/hydrogen-mark-deoptimize.h » ('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 // 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 381
382 HUseListNode* HUseListNode::tail() { 382 HUseListNode* HUseListNode::tail() {
383 // Skip and remove dead items in the use list. 383 // Skip and remove dead items in the use list.
384 while (tail_ != NULL && tail_->value()->CheckFlag(HValue::kIsDead)) { 384 while (tail_ != NULL && tail_->value()->CheckFlag(HValue::kIsDead)) {
385 tail_ = tail_->tail_; 385 tail_ = tail_->tail_;
386 } 386 }
387 return tail_; 387 return tail_;
388 } 388 }
389 389
390 390
391 bool HValue::CheckUsesForFlag(Flag f) { 391 bool HValue::CheckUsesForFlag(Flag f) const {
392 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { 392 for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
393 if (it.value()->IsSimulate()) continue; 393 if (it.value()->IsSimulate()) continue;
394 if (!it.value()->CheckFlag(f)) return false; 394 if (!it.value()->CheckFlag(f)) return false;
395 } 395 }
396 return true; 396 return true;
397 } 397 }
398 398
399 399
400 bool HValue::HasAtLeastOneUseWithFlagAndNoneWithout(Flag f) { 400 bool HValue::HasAtLeastOneUseWithFlagAndNoneWithout(Flag f) const {
401 bool return_value = false; 401 bool return_value = false;
402 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { 402 for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
403 if (it.value()->IsSimulate()) continue; 403 if (it.value()->IsSimulate()) continue;
404 if (!it.value()->CheckFlag(f)) return false; 404 if (!it.value()->CheckFlag(f)) return false;
405 return_value = true; 405 return_value = true;
406 } 406 }
407 return return_value; 407 return return_value;
408 } 408 }
409 409
410 410
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 1295
1296 if (val->IsDiv() && (val->UseCount() == 1)) { 1296 if (val->IsDiv() && (val->UseCount() == 1)) {
1297 HDiv* hdiv = HDiv::cast(val); 1297 HDiv* hdiv = HDiv::cast(val);
1298 HValue* left = hdiv->left(); 1298 HValue* left = hdiv->left();
1299 HValue* right = hdiv->right(); 1299 HValue* right = hdiv->right();
1300 // Try to simplify left and right values of the division. 1300 // Try to simplify left and right values of the division.
1301 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left); 1301 HValue* new_left = SimplifiedDividendForMathFloorOfDiv(left);
1302 if (new_left == NULL && 1302 if (new_left == NULL &&
1303 hdiv->observed_input_representation(1).IsSmiOrInteger32()) { 1303 hdiv->observed_input_representation(1).IsSmiOrInteger32()) {
1304 new_left = new(block()->zone()) HChange( 1304 new_left = new(block()->zone()) HChange(
1305 left, Representation::Integer32(), false, false, false); 1305 left, Representation::Integer32(), false, false);
1306 HChange::cast(new_left)->InsertBefore(this); 1306 HChange::cast(new_left)->InsertBefore(this);
1307 } 1307 }
1308 HValue* new_right = 1308 HValue* new_right =
1309 LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(right); 1309 LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(right);
1310 if (new_right == NULL && 1310 if (new_right == NULL &&
1311 #if V8_TARGET_ARCH_ARM 1311 #if V8_TARGET_ARCH_ARM
1312 CpuFeatures::IsSupported(SUDIV) && 1312 CpuFeatures::IsSupported(SUDIV) &&
1313 #endif 1313 #endif
1314 hdiv->observed_input_representation(2).IsSmiOrInteger32()) { 1314 hdiv->observed_input_representation(2).IsSmiOrInteger32()) {
1315 new_right = new(block()->zone()) HChange( 1315 new_right = new(block()->zone()) HChange(
1316 right, Representation::Integer32(), false, false, false); 1316 right, Representation::Integer32(), false, false);
1317 HChange::cast(new_right)->InsertBefore(this); 1317 HChange::cast(new_right)->InsertBefore(this);
1318 } 1318 }
1319 1319
1320 // Return if left or right are not optimizable. 1320 // Return if left or right are not optimizable.
1321 if ((new_left == NULL) || (new_right == NULL)) return this; 1321 if ((new_left == NULL) || (new_right == NULL)) return this;
1322 1322
1323 // Insert the new values in the graph. 1323 // Insert the new values in the graph.
1324 if (new_left->IsInstruction() && 1324 if (new_left->IsInstruction() &&
1325 !HInstruction::cast(new_left)->IsLinked()) { 1325 !HInstruction::cast(new_left)->IsLinked()) {
1326 HInstruction::cast(new_left)->InsertBefore(this); 1326 HInstruction::cast(new_left)->InsertBefore(this);
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2766 2766
2767 2767
2768 void HCompareObjectEqAndBranch::PrintDataTo(StringStream* stream) { 2768 void HCompareObjectEqAndBranch::PrintDataTo(StringStream* stream) {
2769 left()->PrintNameTo(stream); 2769 left()->PrintNameTo(stream);
2770 stream->Add(" "); 2770 stream->Add(" ");
2771 right()->PrintNameTo(stream); 2771 right()->PrintNameTo(stream);
2772 HControlInstruction::PrintDataTo(stream); 2772 HControlInstruction::PrintDataTo(stream);
2773 } 2773 }
2774 2774
2775 2775
2776 void HCompareHoleAndBranch::PrintDataTo(StringStream* stream) {
2777 object()->PrintNameTo(stream);
2778 HControlInstruction::PrintDataTo(stream);
2779 }
2780
2781
2782 void HCompareHoleAndBranch::InferRepresentation(
2783 HInferRepresentationPhase* h_infer) {
2784 ChangeRepresentation(object()->representation());
2785 }
2786
2787
2776 void HGoto::PrintDataTo(StringStream* stream) { 2788 void HGoto::PrintDataTo(StringStream* stream) {
2777 stream->Add("B%d", SuccessorAt(0)->block_id()); 2789 stream->Add("B%d", SuccessorAt(0)->block_id());
2778 } 2790 }
2779 2791
2780 2792
2781 void HCompareNumericAndBranch::InferRepresentation( 2793 void HCompareNumericAndBranch::InferRepresentation(
2782 HInferRepresentationPhase* h_infer) { 2794 HInferRepresentationPhase* h_infer) {
2783 Representation left_rep = left()->representation(); 2795 Representation left_rep = left()->representation();
2784 Representation right_rep = right()->representation(); 2796 Representation right_rep = right()->representation();
2785 Representation observed_left = observed_input_representation(0); 2797 Representation observed_left = observed_input_representation(0);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { 3090 for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
3079 HValue* use = it.value(); 3091 HValue* use = it.value();
3080 if (!use->IsChange()) return false; 3092 if (!use->IsChange()) return false;
3081 } 3093 }
3082 3094
3083 return true; 3095 return true;
3084 } 3096 }
3085 3097
3086 3098
3087 bool HLoadKeyed::AllUsesCanTreatHoleAsNaN() const { 3099 bool HLoadKeyed::AllUsesCanTreatHoleAsNaN() const {
3088 if (!IsFastDoubleElementsKind(elements_kind())) { 3100 return IsFastDoubleElementsKind(elements_kind()) &&
3089 return false; 3101 CheckUsesForFlag(HValue::kAllowUndefinedAsNaN);
3090 }
3091
3092 for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
3093 HValue* use = it.value();
3094 if (!use->CheckFlag(HValue::kAllowUndefinedAsNaN)) {
3095 return false;
3096 }
3097 }
3098
3099 return true;
3100 } 3102 }
3101 3103
3102 3104
3103 bool HLoadKeyed::RequiresHoleCheck() const { 3105 bool HLoadKeyed::RequiresHoleCheck() const {
3104 if (IsFastPackedElementsKind(elements_kind())) { 3106 if (IsFastPackedElementsKind(elements_kind())) {
3105 return false; 3107 return false;
3106 } 3108 }
3107 3109
3108 if (IsExternalArrayElementsKind(elements_kind())) { 3110 if (IsExternalArrayElementsKind(elements_kind())) {
3109 return false; 3111 return false;
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
4135 break; 4137 break;
4136 case kExternalMemory: 4138 case kExternalMemory:
4137 stream->Add("[external-memory]"); 4139 stream->Add("[external-memory]");
4138 break; 4140 break;
4139 } 4141 }
4140 4142
4141 stream->Add("@%d", offset()); 4143 stream->Add("@%d", offset());
4142 } 4144 }
4143 4145
4144 } } // namespace v8::internal 4146 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/hydrogen-mark-deoptimize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698