| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HYDROGEN_UNIQUE_H_ | 5 #ifndef V8_HYDROGEN_UNIQUE_H_ |
| 6 #define V8_HYDROGEN_UNIQUE_H_ | 6 #define V8_HYDROGEN_UNIQUE_H_ |
| 7 | 7 |
| 8 #include "src/handles.h" | 8 #include "src/handles.h" |
| 9 #include "src/objects.h" | 9 #include "src/objects.h" |
| 10 #include "src/string-stream.h" | 10 #include "src/string-stream.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 const char* string_; | 180 const char* string_; |
| 181 | 181 |
| 182 void InitializeString(Zone* zone) { | 182 void InitializeString(Zone* zone) { |
| 183 // The stringified version of the parameter must be calculated when the | 183 // The stringified version of the parameter must be calculated when the |
| 184 // Operator is constructed to avoid accessing the heap. | 184 // Operator is constructed to avoid accessing the heap. |
| 185 HeapStringAllocator temp_allocator; | 185 HeapStringAllocator temp_allocator; |
| 186 StringStream stream(&temp_allocator); | 186 StringStream stream(&temp_allocator); |
| 187 this->handle_->ShortPrint(&stream); | 187 this->handle_->ShortPrint(&stream); |
| 188 SmartArrayPointer<const char> desc_string = stream.ToCString(); | 188 SmartArrayPointer<const char> desc_string = stream.ToCString(); |
| 189 const char* desc_chars = desc_string.get(); | 189 const char* desc_chars = desc_string.get(); |
| 190 int length = strlen(desc_chars); | 190 int length = static_cast<int>(strlen(desc_chars)); |
| 191 char* desc_copy = zone->NewArray<char>(length + 1); | 191 char* desc_copy = zone->NewArray<char>(length + 1); |
| 192 memcpy(desc_copy, desc_chars, length + 1); | 192 memcpy(desc_copy, desc_chars, length + 1); |
| 193 string_ = desc_copy; | 193 string_ = desc_copy; |
| 194 } | 194 } |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 | 197 |
| 198 template <typename T> | 198 template <typename T> |
| 199 class UniqueSet V8_FINAL : public ZoneObject { | 199 class UniqueSet V8_FINAL : public ZoneObject { |
| 200 public: | 200 public: |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 } | 404 } |
| 405 capacity_ = new_capacity; | 405 capacity_ = new_capacity; |
| 406 array_ = new_array; | 406 array_ = new_array; |
| 407 } | 407 } |
| 408 } | 408 } |
| 409 }; | 409 }; |
| 410 | 410 |
| 411 } } // namespace v8::internal | 411 } } // namespace v8::internal |
| 412 | 412 |
| 413 #endif // V8_HYDROGEN_UNIQUE_H_ | 413 #endif // V8_HYDROGEN_UNIQUE_H_ |
| OLD | NEW |