| 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 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 value()->PrintNameTo(stream); | 1370 value()->PrintNameTo(stream); |
| 1371 } | 1371 } |
| 1372 | 1372 |
| 1373 | 1373 |
| 1374 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context, | 1374 HInstruction* HForceRepresentation::New(Zone* zone, HValue* context, |
| 1375 HValue* value, Representation required_representation) { | 1375 HValue* value, Representation required_representation) { |
| 1376 if (FLAG_fold_constants && value->IsConstant()) { | 1376 if (FLAG_fold_constants && value->IsConstant()) { |
| 1377 HConstant* c = HConstant::cast(value); | 1377 HConstant* c = HConstant::cast(value); |
| 1378 if (c->HasNumberValue()) { | 1378 if (c->HasNumberValue()) { |
| 1379 double double_res = c->DoubleValue(); | 1379 double double_res = c->DoubleValue(); |
| 1380 if (TypeInfo::IsInt32Double(double_res)) { | 1380 if (IsInt32Double(double_res)) { |
| 1381 return HConstant::New(zone, context, | 1381 return HConstant::New(zone, context, |
| 1382 static_cast<int32_t>(double_res), | 1382 static_cast<int32_t>(double_res), |
| 1383 required_representation); | 1383 required_representation); |
| 1384 } | 1384 } |
| 1385 } | 1385 } |
| 1386 } | 1386 } |
| 1387 return new(zone) HForceRepresentation(value, required_representation); | 1387 return new(zone) HForceRepresentation(value, required_representation); |
| 1388 } | 1388 } |
| 1389 | 1389 |
| 1390 | 1390 |
| (...skipping 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3780 HConstant::New(zone, context, static_cast<double>(val)) | 3780 HConstant::New(zone, context, static_cast<double>(val)) |
| 3781 | 3781 |
| 3782 #define DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HInstr, op) \ | 3782 #define DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HInstr, op) \ |
| 3783 HInstruction* HInstr::New( \ | 3783 HInstruction* HInstr::New( \ |
| 3784 Zone* zone, HValue* context, HValue* left, HValue* right) { \ | 3784 Zone* zone, HValue* context, HValue* left, HValue* right) { \ |
| 3785 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { \ | 3785 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { \ |
| 3786 HConstant* c_left = HConstant::cast(left); \ | 3786 HConstant* c_left = HConstant::cast(left); \ |
| 3787 HConstant* c_right = HConstant::cast(right); \ | 3787 HConstant* c_right = HConstant::cast(right); \ |
| 3788 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { \ | 3788 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { \ |
| 3789 double double_res = c_left->DoubleValue() op c_right->DoubleValue(); \ | 3789 double double_res = c_left->DoubleValue() op c_right->DoubleValue(); \ |
| 3790 if (TypeInfo::IsInt32Double(double_res)) { \ | 3790 if (IsInt32Double(double_res)) { \ |
| 3791 return H_CONSTANT_INT(double_res); \ | 3791 return H_CONSTANT_INT(double_res); \ |
| 3792 } \ | 3792 } \ |
| 3793 return H_CONSTANT_DOUBLE(double_res); \ | 3793 return H_CONSTANT_DOUBLE(double_res); \ |
| 3794 } \ | 3794 } \ |
| 3795 } \ | 3795 } \ |
| 3796 return new(zone) HInstr(context, left, right); \ | 3796 return new(zone) HInstr(context, left, right); \ |
| 3797 } | 3797 } |
| 3798 | 3798 |
| 3799 | 3799 |
| 3800 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HAdd, +) | 3800 DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HAdd, +) |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3976 | 3976 |
| 3977 HInstruction* HDiv::New( | 3977 HInstruction* HDiv::New( |
| 3978 Zone* zone, HValue* context, HValue* left, HValue* right) { | 3978 Zone* zone, HValue* context, HValue* left, HValue* right) { |
| 3979 // If left and right are constant values, try to return a constant value. | 3979 // If left and right are constant values, try to return a constant value. |
| 3980 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3980 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
| 3981 HConstant* c_left = HConstant::cast(left); | 3981 HConstant* c_left = HConstant::cast(left); |
| 3982 HConstant* c_right = HConstant::cast(right); | 3982 HConstant* c_right = HConstant::cast(right); |
| 3983 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { | 3983 if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { |
| 3984 if (c_right->DoubleValue() != 0) { | 3984 if (c_right->DoubleValue() != 0) { |
| 3985 double double_res = c_left->DoubleValue() / c_right->DoubleValue(); | 3985 double double_res = c_left->DoubleValue() / c_right->DoubleValue(); |
| 3986 if (TypeInfo::IsInt32Double(double_res)) { | 3986 if (IsInt32Double(double_res)) { |
| 3987 return H_CONSTANT_INT(double_res); | 3987 return H_CONSTANT_INT(double_res); |
| 3988 } | 3988 } |
| 3989 return H_CONSTANT_DOUBLE(double_res); | 3989 return H_CONSTANT_DOUBLE(double_res); |
| 3990 } else { | 3990 } else { |
| 3991 int sign = Double(c_left->DoubleValue()).Sign() * | 3991 int sign = Double(c_left->DoubleValue()).Sign() * |
| 3992 Double(c_right->DoubleValue()).Sign(); // Right could be -0. | 3992 Double(c_right->DoubleValue()).Sign(); // Right could be -0. |
| 3993 return H_CONSTANT_DOUBLE(sign * V8_INFINITY); | 3993 return H_CONSTANT_DOUBLE(sign * V8_INFINITY); |
| 3994 } | 3994 } |
| 3995 } | 3995 } |
| 3996 } | 3996 } |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4422 break; | 4422 break; |
| 4423 case kExternalMemory: | 4423 case kExternalMemory: |
| 4424 stream->Add("[external-memory]"); | 4424 stream->Add("[external-memory]"); |
| 4425 break; | 4425 break; |
| 4426 } | 4426 } |
| 4427 | 4427 |
| 4428 stream->Add("@%d", offset()); | 4428 stream->Add("@%d", offset()); |
| 4429 } | 4429 } |
| 4430 | 4430 |
| 4431 } } // namespace v8::internal | 4431 } } // namespace v8::internal |
| OLD | NEW |