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 6681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6692 if (other.IsNull() || !other.IsSmi()) { | 6692 if (other.IsNull() || !other.IsSmi()) { |
6693 return false; | 6693 return false; |
6694 } | 6694 } |
6695 | 6695 |
6696 Smi& other_smi = Smi::Handle(); | 6696 Smi& other_smi = Smi::Handle(); |
6697 other_smi ^= other.raw(); | 6697 other_smi ^= other.raw(); |
6698 return (this->Value() == other_smi.Value()); | 6698 return (this->Value() == other_smi.Value()); |
6699 } | 6699 } |
6700 | 6700 |
6701 | 6701 |
6702 bool Smi::IsValid(intptr_t value) { | |
6703 return (value >= kMinValue) && (value <= kMaxValue); | |
6704 } | |
6705 | |
6706 | |
6707 bool Smi::IsValid64(int64_t value) { | |
6708 return (value >= kMinValue) && (value <= kMaxValue); | |
6709 } | |
6710 | |
6711 | |
6712 double Smi::AsDoubleValue() const { | 6702 double Smi::AsDoubleValue() const { |
6713 return static_cast<double>(this->Value()); | 6703 return static_cast<double>(this->Value()); |
6714 } | 6704 } |
6715 | 6705 |
6716 | 6706 |
6717 int64_t Smi::AsInt64Value() const { | 6707 int64_t Smi::AsInt64Value() const { |
6718 return this->Value(); | 6708 return this->Value(); |
6719 } | 6709 } |
6720 | 6710 |
6721 | 6711 |
(...skipping 2418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9140 const String& str = String::Handle(pattern()); | 9130 const String& str = String::Handle(pattern()); |
9141 const char* format = "JSRegExp: pattern=%s flags=%s"; | 9131 const char* format = "JSRegExp: pattern=%s flags=%s"; |
9142 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 9132 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
9143 char* chars = reinterpret_cast<char*>( | 9133 char* chars = reinterpret_cast<char*>( |
9144 Isolate::Current()->current_zone()->Allocate(len + 1)); | 9134 Isolate::Current()->current_zone()->Allocate(len + 1)); |
9145 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 9135 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
9146 return chars; | 9136 return chars; |
9147 } | 9137 } |
9148 | 9138 |
9149 } // namespace dart | 9139 } // namespace dart |
OLD | NEW |