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

Side by Side Diff: runtime/lib/math.cc

Issue 23129005: Remove int.pow and double.pow from VM library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed Math.pow to not use int.pow,double.pow. Created 7 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 | « runtime/lib/integers.dart ('k') | runtime/lib/math_patch.dart » ('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 (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <ctype.h> // isspace. 5 #include <ctype.h> // isspace.
6 6
7 #include "vm/bootstrap_natives.h" 7 #include "vm/bootstrap_natives.h"
8 8
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/exceptions.h" 10 #include "vm/exceptions.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 DEFINE_NATIVE_ENTRY(Math_exp, 1) { 59 DEFINE_NATIVE_ENTRY(Math_exp, 1) {
60 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0)); 60 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
61 return Double::New(exp(operand.value())); 61 return Double::New(exp(operand.value()));
62 } 62 }
63 63
64 DEFINE_NATIVE_ENTRY(Math_log, 1) { 64 DEFINE_NATIVE_ENTRY(Math_log, 1) {
65 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0)); 65 GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
66 return Double::New(log(operand.value())); 66 return Double::New(log(operand.value()));
67 } 67 }
68 68
69 DEFINE_NATIVE_ENTRY(Math_doublePow, 2) {
70 const double operand =
71 Double::CheckedHandle(arguments->NativeArgAt(0)).value();
72 GET_NON_NULL_NATIVE_ARGUMENT(
73 Double, exponent_object, arguments->NativeArgAt(1));
74 const double exponent = exponent_object.value();
75 return Double::New(pow(operand, exponent));
76 }
77
69 78
70 // Returns the typed-data array store in '_Random._state' field. 79 // Returns the typed-data array store in '_Random._state' field.
71 static RawTypedData* GetRandomStateArray(const Instance& receiver) { 80 static RawTypedData* GetRandomStateArray(const Instance& receiver) {
72 const Class& random_class = Class::Handle(receiver.clazz()); 81 const Class& random_class = Class::Handle(receiver.clazz());
73 const Field& state_field = 82 const Field& state_field =
74 Field::Handle(random_class.LookupField(Symbols::_state())); 83 Field::Handle(random_class.LookupField(Symbols::_state()));
75 ASSERT(!state_field.IsNull()); 84 ASSERT(!state_field.IsNull());
76 const Instance& state_field_value = 85 const Instance& state_field_value =
77 Instance::Cast(Object::Handle(receiver.GetField(state_field))); 86 Instance::Cast(Object::Handle(receiver.GetField(state_field)));
78 ASSERT(!state_field_value.IsNull()); 87 ASSERT(!state_field_value.IsNull());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 do { 128 do {
120 seed = seed + 0x5A17; 129 seed = seed + 0x5A17;
121 } while (seed == 0); 130 } while (seed == 0);
122 array.SetUint32(0, static_cast<uint32_t>(seed)); 131 array.SetUint32(0, static_cast<uint32_t>(seed));
123 array.SetUint32(array.ElementSizeInBytes(), 132 array.SetUint32(array.ElementSizeInBytes(),
124 static_cast<uint32_t>(seed >> 32)); 133 static_cast<uint32_t>(seed >> 32));
125 return Object::null(); 134 return Object::null();
126 } 135 }
127 136
128 } // namespace dart 137 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/integers.dart ('k') | runtime/lib/math_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698