| 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 7799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7810 return "Integer"; | 7810 return "Integer"; |
| 7811 } | 7811 } |
| 7812 | 7812 |
| 7813 | 7813 |
| 7814 RawInteger* Integer::New(const String& str, Heap::Space space) { | 7814 RawInteger* Integer::New(const String& str, Heap::Space space) { |
| 7815 // We are not supposed to have integers represented as two byte or | 7815 // We are not supposed to have integers represented as two byte or |
| 7816 // four byte strings. | 7816 // four byte strings. |
| 7817 ASSERT(str.IsOneByteString()); | 7817 ASSERT(str.IsOneByteString()); |
| 7818 const OneByteString& onestr = OneByteString::Cast(str); | 7818 const OneByteString& onestr = OneByteString::Cast(str); |
| 7819 int64_t value; | 7819 int64_t value; |
| 7820 if (!OS::StringToInteger(onestr.ToCString(), &value)) { | 7820 if (!OS::StringToInt64(onestr.ToCString(), &value)) { |
| 7821 const Bigint& big = Bigint::Handle(Bigint::New(onestr, space)); | 7821 const Bigint& big = Bigint::Handle(Bigint::New(onestr, space)); |
| 7822 ASSERT(!BigintOperations::FitsIntoSmi(big)); | 7822 ASSERT(!BigintOperations::FitsIntoSmi(big)); |
| 7823 ASSERT(!BigintOperations::FitsIntoMint(big)); | 7823 ASSERT(!BigintOperations::FitsIntoMint(big)); |
| 7824 return big.raw(); | 7824 return big.raw(); |
| 7825 } | 7825 } |
| 7826 return Integer::New(value, space); | 7826 return Integer::New(value, space); |
| 7827 } | 7827 } |
| 7828 | 7828 |
| 7829 | 7829 |
| 7830 RawInteger* Integer::New(int64_t value, Heap::Space space) { | 7830 RawInteger* Integer::New(int64_t value, Heap::Space space) { |
| (...skipping 2956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10787 const String& str = String::Handle(pattern()); | 10787 const String& str = String::Handle(pattern()); |
| 10788 const char* format = "JSRegExp: pattern=%s flags=%s"; | 10788 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 10789 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 10789 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 10790 char* chars = reinterpret_cast<char*>( | 10790 char* chars = reinterpret_cast<char*>( |
| 10791 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10791 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 10792 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10792 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 10793 return chars; | 10793 return chars; |
| 10794 } | 10794 } |
| 10795 | 10795 |
| 10796 } // namespace dart | 10796 } // namespace dart |
| OLD | NEW |