| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/assert.h" | 8 #include "vm/assert.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 5023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5034 if (norm_value.IsNull()) { | 5034 if (norm_value.IsNull()) { |
| 5035 break; | 5035 break; |
| 5036 } | 5036 } |
| 5037 if (this->Equals(norm_value)) { | 5037 if (this->Equals(norm_value)) { |
| 5038 return norm_value.raw(); | 5038 return norm_value.raw(); |
| 5039 } | 5039 } |
| 5040 index++; | 5040 index++; |
| 5041 } | 5041 } |
| 5042 // The value needs to be added to the list. Grow the list if | 5042 // The value needs to be added to the list. Grow the list if |
| 5043 // it is full. | 5043 // it is full. |
| 5044 // TODO(srdjan): Copy instance into old space if canonicalized? |
| 5044 if (index == constants_len) { | 5045 if (index == constants_len) { |
| 5045 const intptr_t kInitialConstLength = 4; | 5046 const intptr_t kInitialConstLength = 4; |
| 5046 const intptr_t old_length = constants.Length(); | 5047 const intptr_t old_length = constants.Length(); |
| 5047 const intptr_t new_length = | 5048 const intptr_t new_length = |
| 5048 (old_length == 0) ? kInitialConstLength : old_length * 2; | 5049 (old_length == 0) ? kInitialConstLength : old_length * 2; |
| 5049 const Array& new_constants = | 5050 const Array& new_constants = |
| 5050 Array::Handle(Array::Grow(constants, new_length, Heap::kOld)); | 5051 Array::Handle(Array::Grow(constants, new_length, Heap::kOld)); |
| 5051 cls.set_constants(new_constants); | 5052 cls.set_constants(new_constants); |
| 5052 new_constants.SetAt(index, *this); | 5053 new_constants.SetAt(index, *this); |
| 5053 } else { | 5054 } else { |
| (...skipping 2278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7332 const String& str = String::Handle(pattern()); | 7333 const String& str = String::Handle(pattern()); |
| 7333 const char* format = "JSRegExp: pattern=%s flags=%s"; | 7334 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 7334 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 7335 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 7335 char* chars = reinterpret_cast<char*>( | 7336 char* chars = reinterpret_cast<char*>( |
| 7336 Isolate::Current()->current_zone()->Allocate(len + 1)); | 7337 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 7337 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 7338 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 7338 return chars; | 7339 return chars; |
| 7339 } | 7340 } |
| 7340 | 7341 |
| 7341 } // namespace dart | 7342 } // namespace dart |
| OLD | NEW |