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

Side by Side Diff: test/cctest/test-code-stubs.cc

Issue 22887053: Fix NaCl build after r16322. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 24 matching lines...) Expand all
35 #include "code-stubs.h" 35 #include "code-stubs.h"
36 #include "test-code-stubs.h" 36 #include "test-code-stubs.h"
37 #include "factory.h" 37 #include "factory.h"
38 #include "macro-assembler.h" 38 #include "macro-assembler.h"
39 #include "platform.h" 39 #include "platform.h"
40 40
41 using namespace v8::internal; 41 using namespace v8::internal;
42 42
43 43
44 int STDCALL ConvertDToICVersion(double d) { 44 int STDCALL ConvertDToICVersion(double d) {
45 Address double_ptr = reinterpret_cast<Address>(&d); 45 union { double d; uint32_t u[2]; } dbl;
46 uint32_t exponent_bits = Memory::uint32_at(double_ptr + kDoubleSize / 2); 46 dbl.d = d;
47 uint32_t exponent_bits = dbl.u[1];
47 int32_t shifted_mask = static_cast<int32_t>(Double::kExponentMask >> 32); 48 int32_t shifted_mask = static_cast<int32_t>(Double::kExponentMask >> 32);
48 int32_t exponent = (((exponent_bits & shifted_mask) >> 49 int32_t exponent = (((exponent_bits & shifted_mask) >>
49 (Double::kPhysicalSignificandSize - 32)) - 50 (Double::kPhysicalSignificandSize - 32)) -
50 HeapNumber::kExponentBias); 51 HeapNumber::kExponentBias);
51 uint32_t unsigned_exponent = static_cast<uint32_t>(exponent); 52 uint32_t unsigned_exponent = static_cast<uint32_t>(exponent);
52 int result = 0; 53 int result = 0;
53 uint32_t max_exponent = 54 uint32_t max_exponent =
54 static_cast<uint32_t>(Double::kPhysicalSignificandSize); 55 static_cast<uint32_t>(Double::kPhysicalSignificandSize);
55 if (unsigned_exponent >= max_exponent) { 56 if (unsigned_exponent >= max_exponent) {
56 if ((exponent - Double::kPhysicalSignificandSize) < 32) { 57 if ((exponent - Double::kPhysicalSignificandSize) < 32) {
57 result = Memory::uint32_at(double_ptr) << 58 result = dbl.u[0] << (exponent - Double::kPhysicalSignificandSize);
58 (exponent - Double::kPhysicalSignificandSize);
59 } 59 }
60 } else { 60 } else {
61 uint64_t big_result = 61 uint64_t big_result =
62 (BitCast<uint64_t>(d) & Double::kSignificandMask) | Double::kHiddenBit; 62 (BitCast<uint64_t>(d) & Double::kSignificandMask) | Double::kHiddenBit;
63 big_result = big_result >> (Double::kPhysicalSignificandSize - exponent); 63 big_result = big_result >> (Double::kPhysicalSignificandSize - exponent);
64 result = static_cast<uint32_t>(big_result); 64 result = static_cast<uint32_t>(big_result);
65 } 65 }
66 if (static_cast<int32_t>(exponent_bits) < 0) { 66 if (static_cast<int32_t>(exponent_bits) < 0) {
67 return (0 - result); 67 return (0 - result);
68 } else { 68 } else {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 RunOneTruncationTest(9.6714111686030497e+24, -2147483648.0); 137 RunOneTruncationTest(9.6714111686030497e+24, -2147483648.0);
138 RunOneTruncationTest(-9.6714111686030497e+24, -2147483648.0); 138 RunOneTruncationTest(-9.6714111686030497e+24, -2147483648.0);
139 RunOneTruncationTest(9.6714157802890681e+24, -2147483648.0); 139 RunOneTruncationTest(9.6714157802890681e+24, -2147483648.0);
140 RunOneTruncationTest(-9.6714157802890681e+24, -2147483648.0); 140 RunOneTruncationTest(-9.6714157802890681e+24, -2147483648.0);
141 } 141 }
142 142
143 #undef NaN 143 #undef NaN
144 #undef Infinity 144 #undef Infinity
145 #undef RunOneTruncationTest 145 #undef RunOneTruncationTest
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698