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

Side by Side Diff: dart/runtime/vm/simulator_arm.cc

Issue 119673004: Version 1.1.0-dev.5.2 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 11 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 | « dart/runtime/vm/service_test.cc ('k') | dart/runtime/vm/snapshot.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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 <math.h> // for isnan. 5 #include <math.h> // for isnan.
6 #include <setjmp.h> 6 #include <setjmp.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #if defined(TARGET_ARCH_ARM) 10 #if defined(TARGET_ARCH_ARM)
(...skipping 2925 matching lines...) Expand 10 before | Expand all | Expand 10 after
2936 } 2936 }
2937 } 2937 }
2938 } else { 2938 } else {
2939 UnimplementedInstruction(instr); 2939 UnimplementedInstruction(instr);
2940 } 2940 }
2941 } 2941 }
2942 2942
2943 2943
2944 static float arm_reciprocal_sqrt_estimate(float a) { 2944 static float arm_reciprocal_sqrt_estimate(float a) {
2945 // From the ARM Architecture Reference Manual A2-87. 2945 // From the ARM Architecture Reference Manual A2-87.
2946 if (isinf(a) || (abs(a) >= exp2f(126))) return 0.0; 2946 if (isinf(a) || (fabs(a) >= exp2f(126))) return 0.0;
2947 else if (a == 0.0) return INFINITY; 2947 else if (a == 0.0) return INFINITY;
2948 else if (isnan(a)) return a; 2948 else if (isnan(a)) return a;
2949 2949
2950 uint32_t a_bits = bit_cast<uint32_t, float>(a); 2950 uint32_t a_bits = bit_cast<uint32_t, float>(a);
2951 uint64_t scaled; 2951 uint64_t scaled;
2952 if (((a_bits >> 23) & 1) != 0) { 2952 if (((a_bits >> 23) & 1) != 0) {
2953 // scaled = '0 01111111101' : operand<22:0> : Zeros(29) 2953 // scaled = '0 01111111101' : operand<22:0> : Zeros(29)
2954 scaled = (static_cast<uint64_t>(0x3fd) << 52) | 2954 scaled = (static_cast<uint64_t>(0x3fd) << 52) |
2955 ((static_cast<uint64_t>(a_bits) & 0x7fffff) << 29); 2955 ((static_cast<uint64_t>(a_bits) & 0x7fffff) << 29);
2956 } else { 2956 } else {
(...skipping 30 matching lines...) Expand all
2987 2987
2988 // result = 0 : result_exp<7:0> : estimate<51:29> 2988 // result = 0 : result_exp<7:0> : estimate<51:29>
2989 int32_t result_bits = ((result_exp & 0xff) << 23) | 2989 int32_t result_bits = ((result_exp & 0xff) << 23) |
2990 ((bit_cast<uint64_t, double>(estimate) >> 29) & 0x7fffff); 2990 ((bit_cast<uint64_t, double>(estimate) >> 29) & 0x7fffff);
2991 return bit_cast<float, int32_t>(result_bits); 2991 return bit_cast<float, int32_t>(result_bits);
2992 } 2992 }
2993 2993
2994 2994
2995 static float arm_recip_estimate(float a) { 2995 static float arm_recip_estimate(float a) {
2996 // From the ARM Architecture Reference Manual A2-85. 2996 // From the ARM Architecture Reference Manual A2-85.
2997 if (isinf(a) || (abs(a) >= exp2f(126))) return 0.0; 2997 if (isinf(a) || (fabs(a) >= exp2f(126))) return 0.0;
2998 else if (a == 0.0) return INFINITY; 2998 else if (a == 0.0) return INFINITY;
2999 else if (isnan(a)) return a; 2999 else if (isnan(a)) return a;
3000 3000
3001 uint32_t a_bits = bit_cast<uint32_t, float>(a); 3001 uint32_t a_bits = bit_cast<uint32_t, float>(a);
3002 // scaled = '0011 1111 1110' : a<22:0> : Zeros(29) 3002 // scaled = '0011 1111 1110' : a<22:0> : Zeros(29)
3003 uint64_t scaled = (static_cast<uint64_t>(0x3fe) << 52) | 3003 uint64_t scaled = (static_cast<uint64_t>(0x3fe) << 52) |
3004 ((static_cast<uint64_t>(a_bits) & 0x7fffff) << 29); 3004 ((static_cast<uint64_t>(a_bits) & 0x7fffff) << 29);
3005 // result_exp = 253 - UInt(a<30:23>) 3005 // result_exp = 253 - UInt(a<30:23>)
3006 int32_t result_exp = 253 - ((a_bits >> 23) & 0xff); 3006 int32_t result_exp = 253 - ((a_bits >> 23) & 0xff);
3007 ASSERT((result_exp >= 1) && (result_exp <= 252)); 3007 ASSERT((result_exp >= 1) && (result_exp <= 252));
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
3724 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); 3724 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
3725 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); 3725 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
3726 buf->Longjmp(); 3726 buf->Longjmp();
3727 } 3727 }
3728 3728
3729 } // namespace dart 3729 } // namespace dart
3730 3730
3731 #endif // !defined(HOST_ARCH_ARM) 3731 #endif // !defined(HOST_ARCH_ARM)
3732 3732
3733 #endif // defined TARGET_ARCH_ARM 3733 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « dart/runtime/vm/service_test.cc ('k') | dart/runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698