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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 864803002: Remove deprecated v8::base::OS::nan_value(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix invalid test expectation. Created 5 years, 11 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
« no previous file with comments | « src/hydrogen.cc ('k') | src/json-parser.h » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/double.h" 8 #include "src/double.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/hydrogen-infer-representation.h" 10 #include "src/hydrogen-infer-representation.h"
(...skipping 2940 matching lines...) Expand 10 before | Expand all | Expand 10 after
2951 } 2951 }
2952 2952
2953 2953
2954 Maybe<HConstant*> HConstant::CopyToTruncatedNumber(Zone* zone) { 2954 Maybe<HConstant*> HConstant::CopyToTruncatedNumber(Zone* zone) {
2955 HConstant* res = NULL; 2955 HConstant* res = NULL;
2956 Handle<Object> handle = this->handle(zone->isolate()); 2956 Handle<Object> handle = this->handle(zone->isolate());
2957 if (handle->IsBoolean()) { 2957 if (handle->IsBoolean()) {
2958 res = handle->BooleanValue() ? 2958 res = handle->BooleanValue() ?
2959 new(zone) HConstant(1) : new(zone) HConstant(0); 2959 new(zone) HConstant(1) : new(zone) HConstant(0);
2960 } else if (handle->IsUndefined()) { 2960 } else if (handle->IsUndefined()) {
2961 res = new(zone) HConstant(base::OS::nan_value()); 2961 res = new (zone) HConstant(std::numeric_limits<double>::quiet_NaN());
2962 } else if (handle->IsNull()) { 2962 } else if (handle->IsNull()) {
2963 res = new(zone) HConstant(0); 2963 res = new(zone) HConstant(0);
2964 } 2964 }
2965 return Maybe<HConstant*>(res != NULL, res); 2965 return Maybe<HConstant*>(res != NULL, res);
2966 } 2966 }
2967 2967
2968 2968
2969 std::ostream& HConstant::PrintDataTo(std::ostream& os) const { // NOLINT 2969 std::ostream& HConstant::PrintDataTo(std::ostream& os) const { // NOLINT
2970 if (HasInteger32Value()) { 2970 if (HasInteger32Value()) {
2971 os << int32_value_ << " "; 2971 os << int32_value_ << " ";
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
4166 4166
4167 HInstruction* HUnaryMathOperation::New( 4167 HInstruction* HUnaryMathOperation::New(
4168 Zone* zone, HValue* context, HValue* value, BuiltinFunctionId op) { 4168 Zone* zone, HValue* context, HValue* value, BuiltinFunctionId op) {
4169 do { 4169 do {
4170 if (!FLAG_fold_constants) break; 4170 if (!FLAG_fold_constants) break;
4171 if (!value->IsConstant()) break; 4171 if (!value->IsConstant()) break;
4172 HConstant* constant = HConstant::cast(value); 4172 HConstant* constant = HConstant::cast(value);
4173 if (!constant->HasNumberValue()) break; 4173 if (!constant->HasNumberValue()) break;
4174 double d = constant->DoubleValue(); 4174 double d = constant->DoubleValue();
4175 if (std::isnan(d)) { // NaN poisons everything. 4175 if (std::isnan(d)) { // NaN poisons everything.
4176 return H_CONSTANT_DOUBLE(base::OS::nan_value()); 4176 return H_CONSTANT_DOUBLE(std::numeric_limits<double>::quiet_NaN());
4177 } 4177 }
4178 if (std::isinf(d)) { // +Infinity and -Infinity. 4178 if (std::isinf(d)) { // +Infinity and -Infinity.
4179 switch (op) { 4179 switch (op) {
4180 case kMathExp: 4180 case kMathExp:
4181 return H_CONSTANT_DOUBLE((d > 0.0) ? d : 0.0); 4181 return H_CONSTANT_DOUBLE((d > 0.0) ? d : 0.0);
4182 case kMathLog: 4182 case kMathLog:
4183 case kMathSqrt: 4183 case kMathSqrt:
4184 return H_CONSTANT_DOUBLE((d > 0.0) ? d : base::OS::nan_value()); 4184 return H_CONSTANT_DOUBLE(
4185 (d > 0.0) ? d : std::numeric_limits<double>::quiet_NaN());
4185 case kMathPowHalf: 4186 case kMathPowHalf:
4186 case kMathAbs: 4187 case kMathAbs:
4187 return H_CONSTANT_DOUBLE((d > 0.0) ? d : -d); 4188 return H_CONSTANT_DOUBLE((d > 0.0) ? d : -d);
4188 case kMathRound: 4189 case kMathRound:
4189 case kMathFround: 4190 case kMathFround:
4190 case kMathFloor: 4191 case kMathFloor:
4191 return H_CONSTANT_DOUBLE(d); 4192 return H_CONSTANT_DOUBLE(d);
4192 case kMathClz32: 4193 case kMathClz32:
4193 return H_CONSTANT_INT(32); 4194 return H_CONSTANT_INT(32);
4194 default: 4195 default:
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
4271 HInstruction* HPower::New(Zone* zone, 4272 HInstruction* HPower::New(Zone* zone,
4272 HValue* context, 4273 HValue* context,
4273 HValue* left, 4274 HValue* left,
4274 HValue* right) { 4275 HValue* right) {
4275 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 4276 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
4276 HConstant* c_left = HConstant::cast(left); 4277 HConstant* c_left = HConstant::cast(left);
4277 HConstant* c_right = HConstant::cast(right); 4278 HConstant* c_right = HConstant::cast(right);
4278 if (c_left->HasNumberValue() && c_right->HasNumberValue()) { 4279 if (c_left->HasNumberValue() && c_right->HasNumberValue()) {
4279 double result = power_helper(c_left->DoubleValue(), 4280 double result = power_helper(c_left->DoubleValue(),
4280 c_right->DoubleValue()); 4281 c_right->DoubleValue());
4281 return H_CONSTANT_DOUBLE(std::isnan(result) ? base::OS::nan_value() 4282 return H_CONSTANT_DOUBLE(std::isnan(result)
4282 : result); 4283 ? std::numeric_limits<double>::quiet_NaN()
4284 : result);
4283 } 4285 }
4284 } 4286 }
4285 return new(zone) HPower(left, right); 4287 return new(zone) HPower(left, right);
4286 } 4288 }
4287 4289
4288 4290
4289 HInstruction* HMathMinMax::New( 4291 HInstruction* HMathMinMax::New(
4290 Zone* zone, HValue* context, HValue* left, HValue* right, Operation op) { 4292 Zone* zone, HValue* context, HValue* left, HValue* right, Operation op) {
4291 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 4293 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
4292 HConstant* c_left = HConstant::cast(left); 4294 HConstant* c_left = HConstant::cast(left);
(...skipping 12 matching lines...) Expand all
4305 } else { 4307 } else {
4306 if (d_left < d_right) return H_CONSTANT_DOUBLE(d_right); 4308 if (d_left < d_right) return H_CONSTANT_DOUBLE(d_right);
4307 if (d_left > d_right) return H_CONSTANT_DOUBLE(d_left); 4309 if (d_left > d_right) return H_CONSTANT_DOUBLE(d_left);
4308 if (d_left == d_right) { 4310 if (d_left == d_right) {
4309 // Handle +0 and -0. 4311 // Handle +0 and -0.
4310 return H_CONSTANT_DOUBLE((Double(d_left).Sign() == -1) ? d_right 4312 return H_CONSTANT_DOUBLE((Double(d_left).Sign() == -1) ? d_right
4311 : d_left); 4313 : d_left);
4312 } 4314 }
4313 } 4315 }
4314 // All comparisons failed, must be NaN. 4316 // All comparisons failed, must be NaN.
4315 return H_CONSTANT_DOUBLE(base::OS::nan_value()); 4317 return H_CONSTANT_DOUBLE(std::numeric_limits<double>::quiet_NaN());
4316 } 4318 }
4317 } 4319 }
4318 return new(zone) HMathMinMax(context, left, right, op); 4320 return new(zone) HMathMinMax(context, left, right, op);
4319 } 4321 }
4320 4322
4321 4323
4322 HInstruction* HMod::New(Zone* zone, 4324 HInstruction* HMod::New(Zone* zone,
4323 HValue* context, 4325 HValue* context,
4324 HValue* left, 4326 HValue* left,
4325 HValue* right) { 4327 HValue* right) {
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
4821 break; 4823 break;
4822 case HObjectAccess::kExternalMemory: 4824 case HObjectAccess::kExternalMemory:
4823 os << "[external-memory]"; 4825 os << "[external-memory]";
4824 break; 4826 break;
4825 } 4827 }
4826 4828
4827 return os << "@" << access.offset(); 4829 return os << "@" << access.offset();
4828 } 4830 }
4829 4831
4830 } } // namespace v8::internal 4832 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/json-parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698