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

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

Issue 14362023: Replace math.h with cmath (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ic.cc » ('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 // 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 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 2132
2133 2133
2134 HConstant::HConstant(double double_value, 2134 HConstant::HConstant(double double_value,
2135 Representation r, 2135 Representation r,
2136 Handle<Object> optional_handle) 2136 Handle<Object> optional_handle)
2137 : handle_(optional_handle), 2137 : handle_(optional_handle),
2138 unique_id_(), 2138 unique_id_(),
2139 has_int32_value_(IsInteger32(double_value)), 2139 has_int32_value_(IsInteger32(double_value)),
2140 has_double_value_(true), 2140 has_double_value_(true),
2141 is_internalized_string_(false), 2141 is_internalized_string_(false),
2142 boolean_value_(double_value != 0 && !isnan(double_value)), 2142 boolean_value_(double_value != 0 && !std::isnan(double_value)),
2143 int32_value_(DoubleToInt32(double_value)), 2143 int32_value_(DoubleToInt32(double_value)),
2144 double_value_(double_value) { 2144 double_value_(double_value) {
2145 Initialize(r); 2145 Initialize(r);
2146 } 2146 }
2147 2147
2148 2148
2149 void HConstant::Initialize(Representation r) { 2149 void HConstant::Initialize(Representation r) {
2150 set_representation(r); 2150 set_representation(r);
2151 SetFlag(kUseGVN); 2151 SetFlag(kUseGVN);
2152 if (representation().IsInteger32()) { 2152 if (representation().IsInteger32()) {
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
3169 return new(zone) HStringAdd(context, left, right); 3169 return new(zone) HStringAdd(context, left, right);
3170 } 3170 }
3171 3171
3172 3172
3173 HInstruction* HStringCharFromCode::New( 3173 HInstruction* HStringCharFromCode::New(
3174 Zone* zone, HValue* context, HValue* char_code) { 3174 Zone* zone, HValue* context, HValue* char_code) {
3175 if (FLAG_fold_constants && char_code->IsConstant()) { 3175 if (FLAG_fold_constants && char_code->IsConstant()) {
3176 HConstant* c_code = HConstant::cast(char_code); 3176 HConstant* c_code = HConstant::cast(char_code);
3177 Isolate* isolate = Isolate::Current(); 3177 Isolate* isolate = Isolate::Current();
3178 if (c_code->HasNumberValue()) { 3178 if (c_code->HasNumberValue()) {
3179 if (isfinite(c_code->DoubleValue())) { 3179 if (std::isfinite(c_code->DoubleValue())) {
3180 uint32_t code = c_code->NumberValueAsInteger32() & 0xffff; 3180 uint32_t code = c_code->NumberValueAsInteger32() & 0xffff;
3181 return new(zone) HConstant(LookupSingleCharacterStringFromCode(isolate, 3181 return new(zone) HConstant(LookupSingleCharacterStringFromCode(isolate,
3182 code), 3182 code),
3183 Representation::Tagged()); 3183 Representation::Tagged());
3184 } 3184 }
3185 return new(zone) HConstant(isolate->factory()->empty_string(), 3185 return new(zone) HConstant(isolate->factory()->empty_string(),
3186 Representation::Tagged()); 3186 Representation::Tagged());
3187 } 3187 }
3188 } 3188 }
3189 return new(zone) HStringCharFromCode(context, char_code); 3189 return new(zone) HStringCharFromCode(context, char_code);
(...skipping 12 matching lines...) Expand all
3202 3202
3203 3203
3204 HInstruction* HUnaryMathOperation::New( 3204 HInstruction* HUnaryMathOperation::New(
3205 Zone* zone, HValue* context, HValue* value, BuiltinFunctionId op) { 3205 Zone* zone, HValue* context, HValue* value, BuiltinFunctionId op) {
3206 do { 3206 do {
3207 if (!FLAG_fold_constants) break; 3207 if (!FLAG_fold_constants) break;
3208 if (!value->IsConstant()) break; 3208 if (!value->IsConstant()) break;
3209 HConstant* constant = HConstant::cast(value); 3209 HConstant* constant = HConstant::cast(value);
3210 if (!constant->HasNumberValue()) break; 3210 if (!constant->HasNumberValue()) break;
3211 double d = constant->DoubleValue(); 3211 double d = constant->DoubleValue();
3212 if (isnan(d)) { // NaN poisons everything. 3212 if (std::isnan(d)) { // NaN poisons everything.
3213 return H_CONSTANT_DOUBLE(OS::nan_value()); 3213 return H_CONSTANT_DOUBLE(OS::nan_value());
3214 } 3214 }
3215 if (isinf(d)) { // +Infinity and -Infinity. 3215 if (std::isinf(d)) { // +Infinity and -Infinity.
3216 switch (op) { 3216 switch (op) {
3217 case kMathSin: 3217 case kMathSin:
3218 case kMathCos: 3218 case kMathCos:
3219 case kMathTan: 3219 case kMathTan:
3220 return H_CONSTANT_DOUBLE(OS::nan_value()); 3220 return H_CONSTANT_DOUBLE(OS::nan_value());
3221 case kMathExp: 3221 case kMathExp:
3222 return H_CONSTANT_DOUBLE((d > 0.0) ? d : 0.0); 3222 return H_CONSTANT_DOUBLE((d > 0.0) ? d : 0.0);
3223 case kMathLog: 3223 case kMathLog:
3224 case kMathSqrt: 3224 case kMathSqrt:
3225 return H_CONSTANT_DOUBLE((d > 0.0) ? d : OS::nan_value()); 3225 return H_CONSTANT_DOUBLE((d > 0.0) ? d : OS::nan_value());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3269 } 3269 }
3270 3270
3271 3271
3272 HInstruction* HPower::New(Zone* zone, HValue* left, HValue* right) { 3272 HInstruction* HPower::New(Zone* zone, HValue* left, HValue* right) {
3273 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 3273 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
3274 HConstant* c_left = HConstant::cast(left); 3274 HConstant* c_left = HConstant::cast(left);
3275 HConstant* c_right = HConstant::cast(right); 3275 HConstant* c_right = HConstant::cast(right);
3276 if (c_left->HasNumberValue() && c_right->HasNumberValue()) { 3276 if (c_left->HasNumberValue() && c_right->HasNumberValue()) {
3277 double result = power_helper(c_left->DoubleValue(), 3277 double result = power_helper(c_left->DoubleValue(),
3278 c_right->DoubleValue()); 3278 c_right->DoubleValue());
3279 return H_CONSTANT_DOUBLE(isnan(result) ? OS::nan_value() : result); 3279 return H_CONSTANT_DOUBLE(std::isnan(result) ? OS::nan_value() : result);
3280 } 3280 }
3281 } 3281 }
3282 return new(zone) HPower(left, right); 3282 return new(zone) HPower(left, right);
3283 } 3283 }
3284 3284
3285 3285
3286 HInstruction* HMathMinMax::New( 3286 HInstruction* HMathMinMax::New(
3287 Zone* zone, HValue* context, HValue* left, HValue* right, Operation op) { 3287 Zone* zone, HValue* context, HValue* left, HValue* right, Operation op) {
3288 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { 3288 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) {
3289 HConstant* c_left = HConstant::cast(left); 3289 HConstant* c_left = HConstant::cast(left);
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
3591 3591
3592 3592
3593 void HCheckFunction::Verify() { 3593 void HCheckFunction::Verify() {
3594 HInstruction::Verify(); 3594 HInstruction::Verify();
3595 ASSERT(HasNoUses()); 3595 ASSERT(HasNoUses());
3596 } 3596 }
3597 3597
3598 #endif 3598 #endif
3599 3599
3600 } } // namespace v8::internal 3600 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698