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 3470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3481 } | 3481 } |
3482 } | 3482 } |
3483 return new(zone) HMathMinMax(context, left, right, op); | 3483 return new(zone) HMathMinMax(context, left, right, op); |
3484 } | 3484 } |
3485 | 3485 |
3486 | 3486 |
3487 HInstruction* HMod::New(Zone* zone, | 3487 HInstruction* HMod::New(Zone* zone, |
3488 HValue* context, | 3488 HValue* context, |
3489 HValue* left, | 3489 HValue* left, |
3490 HValue* right, | 3490 HValue* right, |
3491 bool has_fixed_right_arg, | 3491 Maybe<int> fixed_right_arg) { |
3492 int fixed_right_arg_value) { | |
3493 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3492 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
3494 HConstant* c_left = HConstant::cast(left); | 3493 HConstant* c_left = HConstant::cast(left); |
3495 HConstant* c_right = HConstant::cast(right); | 3494 HConstant* c_right = HConstant::cast(right); |
3496 if (c_left->HasInteger32Value() && c_right->HasInteger32Value()) { | 3495 if (c_left->HasInteger32Value() && c_right->HasInteger32Value()) { |
3497 int32_t dividend = c_left->Integer32Value(); | 3496 int32_t dividend = c_left->Integer32Value(); |
3498 int32_t divisor = c_right->Integer32Value(); | 3497 int32_t divisor = c_right->Integer32Value(); |
3499 if (dividend == kMinInt && divisor == -1) { | 3498 if (dividend == kMinInt && divisor == -1) { |
3500 return H_CONSTANT_DOUBLE(-0.0); | 3499 return H_CONSTANT_DOUBLE(-0.0); |
3501 } | 3500 } |
3502 if (divisor != 0) { | 3501 if (divisor != 0) { |
3503 int32_t res = dividend % divisor; | 3502 int32_t res = dividend % divisor; |
3504 if ((res == 0) && (dividend < 0)) { | 3503 if ((res == 0) && (dividend < 0)) { |
3505 return H_CONSTANT_DOUBLE(-0.0); | 3504 return H_CONSTANT_DOUBLE(-0.0); |
3506 } | 3505 } |
3507 return H_CONSTANT_INT32(res); | 3506 return H_CONSTANT_INT32(res); |
3508 } | 3507 } |
3509 } | 3508 } |
3510 } | 3509 } |
3511 return new(zone) HMod(context, | 3510 return new(zone) HMod(context, left, right, fixed_right_arg); |
3512 left, | |
3513 right, | |
3514 has_fixed_right_arg, | |
3515 fixed_right_arg_value); | |
3516 } | 3511 } |
3517 | 3512 |
3518 | 3513 |
3519 HInstruction* HDiv::New( | 3514 HInstruction* HDiv::New( |
3520 Zone* zone, HValue* context, HValue* left, HValue* right) { | 3515 Zone* zone, HValue* context, HValue* left, HValue* right) { |
3521 // If left and right are constant values, try to return a constant value. | 3516 // If left and right are constant values, try to return a constant value. |
3522 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3517 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
3523 HConstant* c_left = HConstant::cast(left); | 3518 HConstant* c_left = HConstant::cast(left); |
3524 HConstant* c_right = HConstant::cast(right); | 3519 HConstant* c_right = HConstant::cast(right); |
3525 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { | 3520 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3871 case kBackingStore: | 3866 case kBackingStore: |
3872 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3867 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3873 stream->Add("[backing-store]"); | 3868 stream->Add("[backing-store]"); |
3874 break; | 3869 break; |
3875 } | 3870 } |
3876 | 3871 |
3877 stream->Add("@%d", offset()); | 3872 stream->Add("@%d", offset()); |
3878 } | 3873 } |
3879 | 3874 |
3880 } } // namespace v8::internal | 3875 } } // namespace v8::internal |
OLD | NEW |