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

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
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/code-stubs-ia32.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 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 3351 matching lines...) Expand 10 before | Expand all | Expand 10 after
3362 } 3362 }
3363 } 3363 }
3364 // All comparisons failed, must be NaN. 3364 // All comparisons failed, must be NaN.
3365 return H_CONSTANT_DOUBLE(OS::nan_value()); 3365 return H_CONSTANT_DOUBLE(OS::nan_value());
3366 } 3366 }
3367 } 3367 }
3368 return new(zone) HMathMinMax(context, left, right, op); 3368 return new(zone) HMathMinMax(context, left, right, op);
3369 } 3369 }
3370 3370
3371 3371
3372 HInstruction* HMod::New( 3372 HInstruction* HMod::New(Zone* zone,
3373 Zone* zone, HValue* context, HValue* left, HValue* right) { 3373 HValue* context,
3374 HValue* left,
3375 HValue* right,
3376 bool has_fixed_right_arg,
3377 int fixed_right_arg_value) {
3374 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 3378 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
3375 HConstant* c_left = HConstant::cast(left); 3379 HConstant* c_left = HConstant::cast(left);
3376 HConstant* c_right = HConstant::cast(right); 3380 HConstant* c_right = HConstant::cast(right);
3377 if (c_left->HasInteger32Value() && c_right->HasInteger32Value()) { 3381 if (c_left->HasInteger32Value() && c_right->HasInteger32Value()) {
3378 int32_t dividend = c_left->Integer32Value(); 3382 int32_t dividend = c_left->Integer32Value();
3379 int32_t divisor = c_right->Integer32Value(); 3383 int32_t divisor = c_right->Integer32Value();
3380 if (dividend == kMinInt && divisor == -1) { 3384 if (dividend == kMinInt && divisor == -1) {
3381 return H_CONSTANT_DOUBLE(-0.0); 3385 return H_CONSTANT_DOUBLE(-0.0);
3382 } 3386 }
3383 if (divisor != 0) { 3387 if (divisor != 0) {
3384 int32_t res = dividend % divisor; 3388 int32_t res = dividend % divisor;
3385 if ((res == 0) && (dividend < 0)) { 3389 if ((res == 0) && (dividend < 0)) {
3386 return H_CONSTANT_DOUBLE(-0.0); 3390 return H_CONSTANT_DOUBLE(-0.0);
3387 } 3391 }
3388 return H_CONSTANT_INT32(res); 3392 return H_CONSTANT_INT32(res);
3389 } 3393 }
3390 } 3394 }
3391 } 3395 }
3392 return new(zone) HMod(context, left, right); 3396 return new(zone) HMod(context,
3397 left,
3398 right,
3399 has_fixed_right_arg,
3400 fixed_right_arg_value);
3393 } 3401 }
3394 3402
3395 3403
3396 HInstruction* HDiv::New( 3404 HInstruction* HDiv::New(
3397 Zone* zone, HValue* context, HValue* left, HValue* right) { 3405 Zone* zone, HValue* context, HValue* left, HValue* right) {
3398 // If left and right are constant values, try to return a constant value. 3406 // If left and right are constant values, try to return a constant value.
3399 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 3407 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
3400 HConstant* c_left = HConstant::cast(left); 3408 HConstant* c_left = HConstant::cast(left);
3401 HConstant* c_right = HConstant::cast(right); 3409 HConstant* c_right = HConstant::cast(right);
3402 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { 3410 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) {
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
3756 case kBackingStore: 3764 case kBackingStore:
3757 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 3765 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
3758 stream->Add("[backing-store]"); 3766 stream->Add("[backing-store]");
3759 break; 3767 break;
3760 } 3768 }
3761 3769
3762 stream->Add("@%d", offset()); 3770 stream->Add("@%d", offset());
3763 } 3771 }
3764 3772
3765 } } // namespace v8::internal 3773 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698