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

Side by Side Diff: src/runtime.cc

Issue 411263004: Implement trigonometric functions using a fdlibm port. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment 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
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 17 matching lines...) Expand all
28 #include "src/global-handles.h" 28 #include "src/global-handles.h"
29 #include "src/isolate-inl.h" 29 #include "src/isolate-inl.h"
30 #include "src/json-parser.h" 30 #include "src/json-parser.h"
31 #include "src/json-stringifier.h" 31 #include "src/json-stringifier.h"
32 #include "src/jsregexp-inl.h" 32 #include "src/jsregexp-inl.h"
33 #include "src/jsregexp.h" 33 #include "src/jsregexp.h"
34 #include "src/liveedit.h" 34 #include "src/liveedit.h"
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/rempio2.h"
38 #include "src/runtime.h" 39 #include "src/runtime.h"
39 #include "src/runtime-profiler.h" 40 #include "src/runtime-profiler.h"
40 #include "src/scopeinfo.h" 41 #include "src/scopeinfo.h"
41 #include "src/smart-pointers.h" 42 #include "src/smart-pointers.h"
42 #include "src/string-search.h" 43 #include "src/string-search.h"
43 #include "src/stub-cache.h" 44 #include "src/stub-cache.h"
44 #include "src/uri.h" 45 #include "src/uri.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
(...skipping 7574 matching lines...) Expand 10 before | Expand all | Expand 10 after
7622 RUNTIME_FUNCTION(Runtime_ConstructDouble) { 7623 RUNTIME_FUNCTION(Runtime_ConstructDouble) {
7623 HandleScope scope(isolate); 7624 HandleScope scope(isolate);
7624 ASSERT(args.length() == 2); 7625 ASSERT(args.length() == 2);
7625 CONVERT_NUMBER_CHECKED(uint32_t, hi, Uint32, args[0]); 7626 CONVERT_NUMBER_CHECKED(uint32_t, hi, Uint32, args[0]);
7626 CONVERT_NUMBER_CHECKED(uint32_t, lo, Uint32, args[1]); 7627 CONVERT_NUMBER_CHECKED(uint32_t, lo, Uint32, args[1]);
7627 uint64_t result = (static_cast<uint64_t>(hi) << 32) | lo; 7628 uint64_t result = (static_cast<uint64_t>(hi) << 32) | lo;
7628 return *isolate->factory()->NewNumber(uint64_to_double(result)); 7629 return *isolate->factory()->NewNumber(uint64_to_double(result));
7629 } 7630 }
7630 7631
7631 7632
7633 RUNTIME_FUNCTION(Runtime_RemPiO2) {
7634 HandleScope handle_scope(isolate);
7635 ASSERT(args.length() == 1);
7636 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
7637 Factory* factory = isolate->factory();
7638 double y[2];
7639 int n = rempio2(x, y);
7640 Handle<FixedArray> array = factory->NewFixedArray(3);
7641 array->set(0, Smi::FromInt(n));
7642 array->set(1, *factory->NewHeapNumber(y[0]));
7643 array->set(2, *factory->NewHeapNumber(y[1]));
7644 return *factory->NewJSArrayWithElements(array);
7645 }
7646
7647
7632 static const double kPiDividedBy4 = 0.78539816339744830962; 7648 static const double kPiDividedBy4 = 0.78539816339744830962;
7633 7649
7634 7650
7635 RUNTIME_FUNCTION(Runtime_MathAtan2) { 7651 RUNTIME_FUNCTION(Runtime_MathAtan2) {
7636 HandleScope scope(isolate); 7652 HandleScope scope(isolate);
7637 ASSERT(args.length() == 2); 7653 ASSERT(args.length() == 2);
7638 isolate->counters()->math_atan2()->Increment(); 7654 isolate->counters()->math_atan2()->Increment();
7639 7655
7640 CONVERT_DOUBLE_ARG_CHECKED(x, 0); 7656 CONVERT_DOUBLE_ARG_CHECKED(x, 0);
7641 CONVERT_DOUBLE_ARG_CHECKED(y, 1); 7657 CONVERT_DOUBLE_ARG_CHECKED(y, 1);
(...skipping 7353 matching lines...) Expand 10 before | Expand all | Expand 10 after
14995 } 15011 }
14996 return NULL; 15012 return NULL;
14997 } 15013 }
14998 15014
14999 15015
15000 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15016 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15001 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15017 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15002 } 15018 }
15003 15019
15004 } } // namespace v8::internal 15020 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698