| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 11270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11281 return Mint::NewCanonical(value); | 11281 return Mint::NewCanonical(value); |
| 11282 } | 11282 } |
| 11283 | 11283 |
| 11284 | 11284 |
| 11285 // dart2js represents integers as double precision floats. It does this using | 11285 // dart2js represents integers as double precision floats. It does this using |
| 11286 // a sign bit and 53 fraction bits. This gives us the range | 11286 // a sign bit and 53 fraction bits. This gives us the range |
| 11287 // -2^54 - 1 ... 2^54 - 1, i.e. the same as a 54-bit signed integer | 11287 // -2^54 - 1 ... 2^54 - 1, i.e. the same as a 54-bit signed integer |
| 11288 // without the most negative number. Thus, here we check if the value is | 11288 // without the most negative number. Thus, here we check if the value is |
| 11289 // a 54-bit signed integer and not -2^54 | 11289 // a 54-bit signed integer and not -2^54 |
| 11290 static bool Is54BitNoMinInt(int64_t value) { | 11290 static bool Is54BitNoMinInt(int64_t value) { |
| 11291 return (Utils::IsInt(54, value)) && (value != (-0x1FFFFFFFFFFFFF - 1)); | 11291 return (Utils::IsInt(54, value)) && (value != (-0x1FFFFFFFFFFFFFLL - 1)); |
| 11292 } | 11292 } |
| 11293 | 11293 |
| 11294 | 11294 |
| 11295 RawInteger* Integer::New(int64_t value, Heap::Space space) { | 11295 RawInteger* Integer::New(int64_t value, Heap::Space space) { |
| 11296 if ((value <= Smi::kMaxValue) && (value >= Smi::kMinValue)) { | 11296 if ((value <= Smi::kMaxValue) && (value >= Smi::kMinValue)) { |
| 11297 return Smi::New(value); | 11297 return Smi::New(value); |
| 11298 } | 11298 } |
| 11299 if (FLAG_throw_on_javascript_int_overflow && !Is54BitNoMinInt(value)) { | 11299 if (FLAG_throw_on_javascript_int_overflow && !Is54BitNoMinInt(value)) { |
| 11300 const Integer &i = Integer::Handle(Mint::New(value)); | 11300 const Integer &i = Integer::Handle(Mint::New(value)); |
| 11301 ThrowJavascriptIntegerOverflow(i); | 11301 ThrowJavascriptIntegerOverflow(i); |
| (...skipping 3099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14401 } | 14401 } |
| 14402 | 14402 |
| 14403 | 14403 |
| 14404 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14404 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14405 stream->OpenObject(); | 14405 stream->OpenObject(); |
| 14406 stream->CloseObject(); | 14406 stream->CloseObject(); |
| 14407 } | 14407 } |
| 14408 | 14408 |
| 14409 | 14409 |
| 14410 } // namespace dart | 14410 } // namespace dart |
| OLD | NEW |