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

Side by Side Diff: src/runtime.cc

Issue 66703005: Increase precision when finding the remainder after division by pi/2. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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
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 6856 matching lines...) Expand 10 before | Expand all | Expand 10 after
6867 } 6867 }
6868 6868
6869 6869
6870 RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateHeapNumber) { 6870 RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateHeapNumber) {
6871 SealHandleScope shs(isolate); 6871 SealHandleScope shs(isolate);
6872 ASSERT(args.length() == 0); 6872 ASSERT(args.length() == 0);
6873 return isolate->heap()->AllocateHeapNumber(0); 6873 return isolate->heap()->AllocateHeapNumber(0);
6874 } 6874 }
6875 6875
6876 6876
6877 static int HexToInt(uint16_t c) {
6878 if (c >= '0' && c <= '9') return c - '0';
6879 ASSERT(c >= 'a' && c <= 'f');
6880 return c - 'a' + 10;
6881 }
6882
6883
6884 RUNTIME_FUNCTION(MaybeObject*, Runtime_HeapNumberFromHex) {
6885 SealHandleScope shs(isolate);
6886 ASSERT(args.length() == 1);
6887 CONVERT_ARG_CHECKED(String, input, 0);
6888 RUNTIME_ASSERT(input->length() == 16);
6889 // Only used during bootstrapping.
6890 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive());
6891 double result = 0;
6892 uint8_t* bytes = reinterpret_cast<uint8_t*>(&result);
Jakob Kummerow 2013/11/19 17:49:54 Are you sure this compiles? AFAIK this is what we
6893 // Input string is a little-endian hex representation of the double value.
6894 for (int i = 0; i < 8; i++) {
6895 bytes[i] = HexToInt(input->Get(2 * i)) * 16 +
6896 HexToInt(input->Get(2 * i + 1));
6897 }
6898 return isolate->heap()->AllocateHeapNumber(result);
6899 }
6900
6901
6877 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberAdd) { 6902 RUNTIME_FUNCTION(MaybeObject*, Runtime_NumberAdd) {
6878 SealHandleScope shs(isolate); 6903 SealHandleScope shs(isolate);
6879 ASSERT(args.length() == 2); 6904 ASSERT(args.length() == 2);
6880 6905
6881 CONVERT_DOUBLE_ARG_CHECKED(x, 0); 6906 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
6882 CONVERT_DOUBLE_ARG_CHECKED(y, 1); 6907 CONVERT_DOUBLE_ARG_CHECKED(y, 1);
6883 return isolate->heap()->NumberFromDouble(x + y); 6908 return isolate->heap()->NumberFromDouble(x + y);
6884 } 6909 }
6885 6910
6886 6911
(...skipping 8019 matching lines...) Expand 10 before | Expand all | Expand 10 after
14906 // Handle last resort GC and make sure to allow future allocations 14931 // Handle last resort GC and make sure to allow future allocations
14907 // to grow the heap without causing GCs (if possible). 14932 // to grow the heap without causing GCs (if possible).
14908 isolate->counters()->gc_last_resort_from_js()->Increment(); 14933 isolate->counters()->gc_last_resort_from_js()->Increment();
14909 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14934 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14910 "Runtime::PerformGC"); 14935 "Runtime::PerformGC");
14911 } 14936 }
14912 } 14937 }
14913 14938
14914 14939
14915 } } // namespace v8::internal 14940 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698