OLD | NEW |
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 3363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3374 } | 3374 } |
3375 } | 3375 } |
3376 // All comparisons failed, must be NaN. | 3376 // All comparisons failed, must be NaN. |
3377 return H_CONSTANT_DOUBLE(OS::nan_value()); | 3377 return H_CONSTANT_DOUBLE(OS::nan_value()); |
3378 } | 3378 } |
3379 } | 3379 } |
3380 return new(zone) HMathMinMax(context, left, right, op); | 3380 return new(zone) HMathMinMax(context, left, right, op); |
3381 } | 3381 } |
3382 | 3382 |
3383 | 3383 |
3384 HInstruction* HMod::New( | 3384 HInstruction* HMod::New(Zone* zone, |
3385 Zone* zone, HValue* context, HValue* left, HValue* right) { | 3385 HValue* context, |
| 3386 HValue* left, |
| 3387 HValue* right, |
| 3388 bool has_fixed_right_arg, |
| 3389 int fixed_right_arg_value) { |
3386 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3390 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
3387 HConstant* c_left = HConstant::cast(left); | 3391 HConstant* c_left = HConstant::cast(left); |
3388 HConstant* c_right = HConstant::cast(right); | 3392 HConstant* c_right = HConstant::cast(right); |
3389 if (c_left->HasInteger32Value() && c_right->HasInteger32Value()) { | 3393 if (c_left->HasInteger32Value() && c_right->HasInteger32Value()) { |
3390 int32_t dividend = c_left->Integer32Value(); | 3394 int32_t dividend = c_left->Integer32Value(); |
3391 int32_t divisor = c_right->Integer32Value(); | 3395 int32_t divisor = c_right->Integer32Value(); |
3392 if (dividend == kMinInt && divisor == -1) { | 3396 if (dividend == kMinInt && divisor == -1) { |
3393 return H_CONSTANT_DOUBLE(-0.0); | 3397 return H_CONSTANT_DOUBLE(-0.0); |
3394 } | 3398 } |
3395 if (divisor != 0) { | 3399 if (divisor != 0) { |
3396 int32_t res = dividend % divisor; | 3400 int32_t res = dividend % divisor; |
3397 if ((res == 0) && (dividend < 0)) { | 3401 if ((res == 0) && (dividend < 0)) { |
3398 return H_CONSTANT_DOUBLE(-0.0); | 3402 return H_CONSTANT_DOUBLE(-0.0); |
3399 } | 3403 } |
3400 return H_CONSTANT_INT32(res); | 3404 return H_CONSTANT_INT32(res); |
3401 } | 3405 } |
3402 } | 3406 } |
3403 } | 3407 } |
3404 return new(zone) HMod(context, left, right); | 3408 return new(zone) HMod(context, |
| 3409 left, |
| 3410 right, |
| 3411 has_fixed_right_arg, |
| 3412 fixed_right_arg_value); |
3405 } | 3413 } |
3406 | 3414 |
3407 | 3415 |
3408 HInstruction* HDiv::New( | 3416 HInstruction* HDiv::New( |
3409 Zone* zone, HValue* context, HValue* left, HValue* right) { | 3417 Zone* zone, HValue* context, HValue* left, HValue* right) { |
3410 // If left and right are constant values, try to return a constant value. | 3418 // If left and right are constant values, try to return a constant value. |
3411 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3419 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
3412 HConstant* c_left = HConstant::cast(left); | 3420 HConstant* c_left = HConstant::cast(left); |
3413 HConstant* c_right = HConstant::cast(right); | 3421 HConstant* c_right = HConstant::cast(right); |
3414 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { | 3422 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3805 case kBackingStore: | 3813 case kBackingStore: |
3806 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3814 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3807 stream->Add("[backing-store]"); | 3815 stream->Add("[backing-store]"); |
3808 break; | 3816 break; |
3809 } | 3817 } |
3810 | 3818 |
3811 stream->Add("@%d", offset()); | 3819 stream->Add("@%d", offset()); |
3812 } | 3820 } |
3813 | 3821 |
3814 } } // namespace v8::internal | 3822 } } // namespace v8::internal |
OLD | NEW |