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

Side by Side Diff: src/runtime.cc

Issue 429603003: Check for negative zero in floor when compiling with MSVC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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.cc ('k') | src/utils.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 <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 24 matching lines...) Expand all
35 #include "src/misc-intrinsics.h" 35 #include "src/misc-intrinsics.h"
36 #include "src/parser.h" 36 #include "src/parser.h"
37 #include "src/prototype.h" 37 #include "src/prototype.h"
38 #include "src/runtime.h" 38 #include "src/runtime.h"
39 #include "src/runtime-profiler.h" 39 #include "src/runtime-profiler.h"
40 #include "src/scopeinfo.h" 40 #include "src/scopeinfo.h"
41 #include "src/smart-pointers.h" 41 #include "src/smart-pointers.h"
42 #include "src/string-search.h" 42 #include "src/string-search.h"
43 #include "src/stub-cache.h" 43 #include "src/stub-cache.h"
44 #include "src/uri.h" 44 #include "src/uri.h"
45 #include "src/utils.h"
45 #include "src/v8threads.h" 46 #include "src/v8threads.h"
46 #include "src/vm-state-inl.h" 47 #include "src/vm-state-inl.h"
47 48
48 #ifdef V8_I18N_SUPPORT 49 #ifdef V8_I18N_SUPPORT
49 #include "src/i18n.h" 50 #include "src/i18n.h"
50 #include "unicode/brkiter.h" 51 #include "unicode/brkiter.h"
51 #include "unicode/calendar.h" 52 #include "unicode/calendar.h"
52 #include "unicode/coll.h" 53 #include "unicode/coll.h"
53 #include "unicode/curramt.h" 54 #include "unicode/curramt.h"
54 #include "unicode/datefmt.h" 55 #include "unicode/datefmt.h"
(...skipping 7650 matching lines...) Expand 10 before | Expand all | Expand 10 after
7705 return *isolate->factory()->NewNumber(fast_exp(x)); 7706 return *isolate->factory()->NewNumber(fast_exp(x));
7706 } 7707 }
7707 7708
7708 7709
7709 RUNTIME_FUNCTION(Runtime_MathFloorRT) { 7710 RUNTIME_FUNCTION(Runtime_MathFloorRT) {
7710 HandleScope scope(isolate); 7711 HandleScope scope(isolate);
7711 ASSERT(args.length() == 1); 7712 ASSERT(args.length() == 1);
7712 isolate->counters()->math_floor()->Increment(); 7713 isolate->counters()->math_floor()->Increment();
7713 7714
7714 CONVERT_DOUBLE_ARG_CHECKED(x, 0); 7715 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
7715 return *isolate->factory()->NewNumber(std::floor(x)); 7716 return *isolate->factory()->NewNumber(Floor(x));
7716 } 7717 }
7717 7718
7718 7719
7719 // Slow version of Math.pow. We check for fast paths for special cases. 7720 // Slow version of Math.pow. We check for fast paths for special cases.
7720 // Used if VFP3 is not available. 7721 // Used if VFP3 is not available.
7721 RUNTIME_FUNCTION(Runtime_MathPowSlow) { 7722 RUNTIME_FUNCTION(Runtime_MathPowSlow) {
7722 HandleScope scope(isolate); 7723 HandleScope scope(isolate);
7723 ASSERT(args.length() == 2); 7724 ASSERT(args.length() == 2);
7724 isolate->counters()->math_pow()->Increment(); 7725 isolate->counters()->math_pow()->Increment();
7725 7726
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
7790 7791
7791 // If the magnitude is big enough, there's no place for fraction part. If we 7792 // If the magnitude is big enough, there's no place for fraction part. If we
7792 // try to add 0.5 to this number, 1.0 will be added instead. 7793 // try to add 0.5 to this number, 1.0 will be added instead.
7793 if (exponent >= 52) { 7794 if (exponent >= 52) {
7794 return *number; 7795 return *number;
7795 } 7796 }
7796 7797
7797 if (sign && value >= -0.5) return isolate->heap()->minus_zero_value(); 7798 if (sign && value >= -0.5) return isolate->heap()->minus_zero_value();
7798 7799
7799 // Do not call NumberFromDouble() to avoid extra checks. 7800 // Do not call NumberFromDouble() to avoid extra checks.
7800 return *isolate->factory()->NewNumber(std::floor(value + 0.5)); 7801 return *isolate->factory()->NewNumber(Floor(value + 0.5));
7801 } 7802 }
7802 7803
7803 7804
7804 RUNTIME_FUNCTION(Runtime_MathSqrtRT) { 7805 RUNTIME_FUNCTION(Runtime_MathSqrtRT) {
7805 HandleScope scope(isolate); 7806 HandleScope scope(isolate);
7806 ASSERT(args.length() == 1); 7807 ASSERT(args.length() == 1);
7807 isolate->counters()->math_sqrt()->Increment(); 7808 isolate->counters()->math_sqrt()->Increment();
7808 7809
7809 CONVERT_DOUBLE_ARG_CHECKED(x, 0); 7810 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
7810 return *isolate->factory()->NewNumber(fast_sqrt(x)); 7811 return *isolate->factory()->NewNumber(fast_sqrt(x));
(...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after
9515 ASSERT(args.length() == 0); 9516 ASSERT(args.length() == 0);
9516 if (FLAG_log_timer_events) LOG(isolate, CurrentTimeEvent()); 9517 if (FLAG_log_timer_events) LOG(isolate, CurrentTimeEvent());
9517 9518
9518 // According to ECMA-262, section 15.9.1, page 117, the precision of 9519 // According to ECMA-262, section 15.9.1, page 117, the precision of
9519 // the number in a Date object representing a particular instant in 9520 // the number in a Date object representing a particular instant in
9520 // time is milliseconds. Therefore, we floor the result of getting 9521 // time is milliseconds. Therefore, we floor the result of getting
9521 // the OS time. 9522 // the OS time.
9522 double millis; 9523 double millis;
9523 if (FLAG_verify_predictable) { 9524 if (FLAG_verify_predictable) {
9524 millis = 1388534400000.0; // Jan 1 2014 00:00:00 GMT+0000 9525 millis = 1388534400000.0; // Jan 1 2014 00:00:00 GMT+0000
9525 millis += std::floor(isolate->heap()->synthetic_time()); 9526 millis += Floor(isolate->heap()->synthetic_time());
9526 } else { 9527 } else {
9527 millis = std::floor(base::OS::TimeCurrentMillis()); 9528 millis = Floor(base::OS::TimeCurrentMillis());
9528 } 9529 }
9529 return *isolate->factory()->NewNumber(millis); 9530 return *isolate->factory()->NewNumber(millis);
9530 } 9531 }
9531 9532
9532 9533
9533 RUNTIME_FUNCTION(Runtime_DateParseString) { 9534 RUNTIME_FUNCTION(Runtime_DateParseString) {
9534 HandleScope scope(isolate); 9535 HandleScope scope(isolate);
9535 ASSERT(args.length() == 2); 9536 ASSERT(args.length() == 2);
9536 CONVERT_ARG_HANDLE_CHECKED(String, str, 0); 9537 CONVERT_ARG_HANDLE_CHECKED(String, str, 0);
9537 CONVERT_ARG_HANDLE_CHECKED(JSArray, output, 1); 9538 CONVERT_ARG_HANDLE_CHECKED(JSArray, output, 1);
(...skipping 5546 matching lines...) Expand 10 before | Expand all | Expand 10 after
15084 } 15085 }
15085 return NULL; 15086 return NULL;
15086 } 15087 }
15087 15088
15088 15089
15089 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15090 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15090 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15091 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15091 } 15092 }
15092 15093
15093 } } // namespace v8::internal 15094 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698