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

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

Issue 15735005: Collect type feedback for power-of-2 right operands in BinaryOps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 7 years, 6 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 3350 matching lines...) Expand 10 before | Expand all | Expand 10 after
3361 } 3361 }
3362 } 3362 }
3363 // All comparisons failed, must be NaN. 3363 // All comparisons failed, must be NaN.
3364 return H_CONSTANT_DOUBLE(OS::nan_value()); 3364 return H_CONSTANT_DOUBLE(OS::nan_value());
3365 } 3365 }
3366 } 3366 }
3367 return new(zone) HMathMinMax(context, left, right, op); 3367 return new(zone) HMathMinMax(context, left, right, op);
3368 } 3368 }
3369 3369
3370 3370
3371 HInstruction* HMod::New( 3371 HInstruction* HMod::New(Zone* zone,
3372 Zone* zone, HValue* context, HValue* left, HValue* right) { 3372 HValue* context,
3373 HValue* left,
3374 HValue* right,
3375 bool has_fixed_right_arg,
3376 int fixed_right_arg_value) {
3373 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 3377 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
3374 HConstant* c_left = HConstant::cast(left); 3378 HConstant* c_left = HConstant::cast(left);
3375 HConstant* c_right = HConstant::cast(right); 3379 HConstant* c_right = HConstant::cast(right);
3376 if (c_left->HasInteger32Value() && c_right->HasInteger32Value()) { 3380 if (c_left->HasInteger32Value() && c_right->HasInteger32Value()) {
3377 int32_t dividend = c_left->Integer32Value(); 3381 int32_t dividend = c_left->Integer32Value();
3378 int32_t divisor = c_right->Integer32Value(); 3382 int32_t divisor = c_right->Integer32Value();
3379 if (dividend == kMinInt && divisor == -1) { 3383 if (dividend == kMinInt && divisor == -1) {
3380 return H_CONSTANT_DOUBLE(-0.0); 3384 return H_CONSTANT_DOUBLE(-0.0);
3381 } 3385 }
3382 if (divisor != 0) { 3386 if (divisor != 0) {
3383 int32_t res = dividend % divisor; 3387 int32_t res = dividend % divisor;
3384 if ((res == 0) && (dividend < 0)) { 3388 if ((res == 0) && (dividend < 0)) {
3385 return H_CONSTANT_DOUBLE(-0.0); 3389 return H_CONSTANT_DOUBLE(-0.0);
3386 } 3390 }
3387 return H_CONSTANT_INT32(res); 3391 return H_CONSTANT_INT32(res);
3388 } 3392 }
3389 } 3393 }
3390 } 3394 }
3391 return new(zone) HMod(context, left, right); 3395 return new(zone) HMod(context,
3396 left,
3397 right,
3398 has_fixed_right_arg,
3399 fixed_right_arg_value);
3392 } 3400 }
3393 3401
3394 3402
3395 HInstruction* HDiv::New( 3403 HInstruction* HDiv::New(
3396 Zone* zone, HValue* context, HValue* left, HValue* right) { 3404 Zone* zone, HValue* context, HValue* left, HValue* right) {
3397 // If left and right are constant values, try to return a constant value. 3405 // If left and right are constant values, try to return a constant value.
3398 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 3406 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
3399 HConstant* c_left = HConstant::cast(left); 3407 HConstant* c_left = HConstant::cast(left);
3400 HConstant* c_right = HConstant::cast(right); 3408 HConstant* c_right = HConstant::cast(right);
3401 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { 3409 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) {
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
3793 case kBackingStore: 3801 case kBackingStore:
3794 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 3802 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
3795 stream->Add("[backing-store]"); 3803 stream->Add("[backing-store]");
3796 break; 3804 break;
3797 } 3805 }
3798 3806
3799 stream->Add("@%d", offset()); 3807 stream->Add("@%d", offset());
3800 } 3808 }
3801 3809
3802 } } // namespace v8::internal 3810 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698