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

Side by Side Diff: src/objects.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/json-stringifier.h ('k') | src/objects-debug.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 944
945 bool Object::SameValue(Object* other) { 945 bool Object::SameValue(Object* other) {
946 if (other == this) return true; 946 if (other == this) return true;
947 947
948 // The object is either a number, a name, an odd-ball, 948 // The object is either a number, a name, an odd-ball,
949 // a real JS object, or a Harmony proxy. 949 // a real JS object, or a Harmony proxy.
950 if (IsNumber() && other->IsNumber()) { 950 if (IsNumber() && other->IsNumber()) {
951 double this_value = Number(); 951 double this_value = Number();
952 double other_value = other->Number(); 952 double other_value = other->Number();
953 return (this_value == other_value) || 953 return (this_value == other_value) ||
954 (isnan(this_value) && isnan(other_value)); 954 (std::isnan(this_value) && std::isnan(other_value));
955 } 955 }
956 if (IsString() && other->IsString()) { 956 if (IsString() && other->IsString()) {
957 return String::cast(this)->Equals(String::cast(other)); 957 return String::cast(this)->Equals(String::cast(other));
958 } 958 }
959 return false; 959 return false;
960 } 960 }
961 961
962 962
963 void Object::ShortPrint(FILE* out) { 963 void Object::ShortPrint(FILE* out) {
964 HeapStringAllocator allocator; 964 HeapStringAllocator allocator;
(...skipping 13419 matching lines...) Expand 10 before | Expand all | Expand 10 after
14384 case kSecond: return sec(); 14384 case kSecond: return sec();
14385 default: UNREACHABLE(); 14385 default: UNREACHABLE();
14386 } 14386 }
14387 } 14387 }
14388 14388
14389 if (index >= kFirstUTCField) { 14389 if (index >= kFirstUTCField) {
14390 return GetUTCField(index, value()->Number(), date_cache); 14390 return GetUTCField(index, value()->Number(), date_cache);
14391 } 14391 }
14392 14392
14393 double time = value()->Number(); 14393 double time = value()->Number();
14394 if (isnan(time)) return GetIsolate()->heap()->nan_value(); 14394 if (std::isnan(time)) return GetIsolate()->heap()->nan_value();
14395 14395
14396 int64_t local_time_ms = date_cache->ToLocal(static_cast<int64_t>(time)); 14396 int64_t local_time_ms = date_cache->ToLocal(static_cast<int64_t>(time));
14397 int days = DateCache::DaysFromTime(local_time_ms); 14397 int days = DateCache::DaysFromTime(local_time_ms);
14398 14398
14399 if (index == kDays) return Smi::FromInt(days); 14399 if (index == kDays) return Smi::FromInt(days);
14400 14400
14401 int time_in_day_ms = DateCache::TimeInDay(local_time_ms, days); 14401 int time_in_day_ms = DateCache::TimeInDay(local_time_ms, days);
14402 if (index == kMillisecond) return Smi::FromInt(time_in_day_ms % 1000); 14402 if (index == kMillisecond) return Smi::FromInt(time_in_day_ms % 1000);
14403 ASSERT(index == kTimeInDay); 14403 ASSERT(index == kTimeInDay);
14404 return Smi::FromInt(time_in_day_ms); 14404 return Smi::FromInt(time_in_day_ms);
14405 } 14405 }
14406 14406
14407 14407
14408 Object* JSDate::GetUTCField(FieldIndex index, 14408 Object* JSDate::GetUTCField(FieldIndex index,
14409 double value, 14409 double value,
14410 DateCache* date_cache) { 14410 DateCache* date_cache) {
14411 ASSERT(index >= kFirstUTCField); 14411 ASSERT(index >= kFirstUTCField);
14412 14412
14413 if (isnan(value)) return GetIsolate()->heap()->nan_value(); 14413 if (std::isnan(value)) return GetIsolate()->heap()->nan_value();
14414 14414
14415 int64_t time_ms = static_cast<int64_t>(value); 14415 int64_t time_ms = static_cast<int64_t>(value);
14416 14416
14417 if (index == kTimezoneOffset) { 14417 if (index == kTimezoneOffset) {
14418 return Smi::FromInt(date_cache->TimezoneOffset(time_ms)); 14418 return Smi::FromInt(date_cache->TimezoneOffset(time_ms));
14419 } 14419 }
14420 14420
14421 int days = DateCache::DaysFromTime(time_ms); 14421 int days = DateCache::DaysFromTime(time_ms);
14422 14422
14423 if (index == kWeekdayUTC) return Smi::FromInt(date_cache->Weekday(days)); 14423 if (index == kWeekdayUTC) return Smi::FromInt(date_cache->Weekday(days));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
14478 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 14478 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
14479 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 14479 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
14480 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 14480 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
14481 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 14481 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
14482 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 14482 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
14483 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 14483 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
14484 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 14484 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
14485 } 14485 }
14486 14486
14487 } } // namespace v8::internal 14487 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/json-stringifier.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698