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 3912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3923 return H_CONSTANT_DOUBLE(OS::nan_value()); | 3923 return H_CONSTANT_DOUBLE(OS::nan_value()); |
3924 } | 3924 } |
3925 } | 3925 } |
3926 return new(zone) HMathMinMax(context, left, right, op); | 3926 return new(zone) HMathMinMax(context, left, right, op); |
3927 } | 3927 } |
3928 | 3928 |
3929 | 3929 |
3930 HInstruction* HMod::New(Zone* zone, | 3930 HInstruction* HMod::New(Zone* zone, |
3931 HValue* context, | 3931 HValue* context, |
3932 HValue* left, | 3932 HValue* left, |
3933 HValue* right, | 3933 HValue* right) { |
3934 Maybe<int> fixed_right_arg) { | |
3935 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3934 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
3936 HConstant* c_left = HConstant::cast(left); | 3935 HConstant* c_left = HConstant::cast(left); |
3937 HConstant* c_right = HConstant::cast(right); | 3936 HConstant* c_right = HConstant::cast(right); |
3938 if (c_left->HasInteger32Value() && c_right->HasInteger32Value()) { | 3937 if (c_left->HasInteger32Value() && c_right->HasInteger32Value()) { |
3939 int32_t dividend = c_left->Integer32Value(); | 3938 int32_t dividend = c_left->Integer32Value(); |
3940 int32_t divisor = c_right->Integer32Value(); | 3939 int32_t divisor = c_right->Integer32Value(); |
3941 if (dividend == kMinInt && divisor == -1) { | 3940 if (dividend == kMinInt && divisor == -1) { |
3942 return H_CONSTANT_DOUBLE(-0.0); | 3941 return H_CONSTANT_DOUBLE(-0.0); |
3943 } | 3942 } |
3944 if (divisor != 0) { | 3943 if (divisor != 0) { |
3945 int32_t res = dividend % divisor; | 3944 int32_t res = dividend % divisor; |
3946 if ((res == 0) && (dividend < 0)) { | 3945 if ((res == 0) && (dividend < 0)) { |
3947 return H_CONSTANT_DOUBLE(-0.0); | 3946 return H_CONSTANT_DOUBLE(-0.0); |
3948 } | 3947 } |
3949 return H_CONSTANT_INT(res); | 3948 return H_CONSTANT_INT(res); |
3950 } | 3949 } |
3951 } | 3950 } |
3952 } | 3951 } |
3953 return new(zone) HMod(context, left, right, fixed_right_arg); | 3952 return new(zone) HMod(context, left, right); |
3954 } | 3953 } |
3955 | 3954 |
3956 | 3955 |
3957 HInstruction* HDiv::New( | 3956 HInstruction* HDiv::New( |
3958 Zone* zone, HValue* context, HValue* left, HValue* right) { | 3957 Zone* zone, HValue* context, HValue* left, HValue* right) { |
3959 // If left and right are constant values, try to return a constant value. | 3958 // If left and right are constant values, try to return a constant value. |
3960 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3959 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
3961 HConstant* c_left = HConstant::cast(left); | 3960 HConstant* c_left = HConstant::cast(left); |
3962 HConstant* c_right = HConstant::cast(right); | 3961 HConstant* c_right = HConstant::cast(right); |
3963 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { | 3962 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4375 break; | 4374 break; |
4376 case kExternalMemory: | 4375 case kExternalMemory: |
4377 stream->Add("[external-memory]"); | 4376 stream->Add("[external-memory]"); |
4378 break; | 4377 break; |
4379 } | 4378 } |
4380 | 4379 |
4381 stream->Add("@%d", offset()); | 4380 stream->Add("@%d", offset()); |
4382 } | 4381 } |
4383 | 4382 |
4384 } } // namespace v8::internal | 4383 } } // namespace v8::internal |
OLD | NEW |