| 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 "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 7812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7823 return "Integer"; | 7823 return "Integer"; |
| 7824 } | 7824 } |
| 7825 | 7825 |
| 7826 | 7826 |
| 7827 RawInteger* Integer::New(const String& str, Heap::Space space) { | 7827 RawInteger* Integer::New(const String& str, Heap::Space space) { |
| 7828 // We are not supposed to have integers represented as two byte or | 7828 // We are not supposed to have integers represented as two byte or |
| 7829 // four byte strings. | 7829 // four byte strings. |
| 7830 ASSERT(str.IsOneByteString()); | 7830 ASSERT(str.IsOneByteString()); |
| 7831 const OneByteString& onestr = OneByteString::Cast(str); | 7831 const OneByteString& onestr = OneByteString::Cast(str); |
| 7832 int64_t value; | 7832 int64_t value; |
| 7833 if (!OS::StringToInteger(onestr.ToCString(), &value)) { | 7833 if (!OS::StringToInt64(onestr.ToCString(), &value)) { |
| 7834 const Bigint& big = Bigint::Handle(Bigint::New(onestr, space)); | 7834 const Bigint& big = Bigint::Handle(Bigint::New(onestr, space)); |
| 7835 ASSERT(!BigintOperations::FitsIntoSmi(big)); | 7835 ASSERT(!BigintOperations::FitsIntoSmi(big)); |
| 7836 ASSERT(!BigintOperations::FitsIntoMint(big)); | 7836 ASSERT(!BigintOperations::FitsIntoMint(big)); |
| 7837 return big.raw(); | 7837 return big.raw(); |
| 7838 } | 7838 } |
| 7839 return Integer::New(value, space); | 7839 return Integer::New(value, space); |
| 7840 } | 7840 } |
| 7841 | 7841 |
| 7842 | 7842 |
| 7843 RawInteger* Integer::New(int64_t value, Heap::Space space) { | 7843 RawInteger* Integer::New(int64_t value, Heap::Space space) { |
| (...skipping 2956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10800 const String& str = String::Handle(pattern()); | 10800 const String& str = String::Handle(pattern()); |
| 10801 const char* format = "JSRegExp: pattern=%s flags=%s"; | 10801 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 10802 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 10802 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 10803 char* chars = reinterpret_cast<char*>( | 10803 char* chars = reinterpret_cast<char*>( |
| 10804 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10804 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 10805 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10805 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 10806 return chars; | 10806 return chars; |
| 10807 } | 10807 } |
| 10808 | 10808 |
| 10809 } // namespace dart | 10809 } // namespace dart |
| OLD | NEW |