Chromium Code Reviews| Index: src/natives-external.cc |
| diff --git a/src/natives-external.cc b/src/natives-external.cc |
| index 138abe1e5ca8258853162382d7f3e31d5484a063..e601808fe8182055683d32133081b36e46c9938f 100644 |
| --- a/src/natives-external.cc |
| +++ b/src/natives-external.cc |
| @@ -82,15 +82,14 @@ class NativesStore { |
| NativesStore() : debugger_count_(0) {} |
| Vector<const char> NameFromId(const byte* id, int id_length) { |
| - Vector<char> name(Vector<char>::New(id_length + 11)); |
| - SimpleStringBuilder builder(name.start(), name.length()); |
| - builder.AddString("native "); |
| - builder.AddSubstring(reinterpret_cast<const char*>(id), id_length); |
| - builder.AddString(".js"); |
| - builder.Finalize(); |
| - // SimpleStringBuilder wants zero-byte; the caller does not. |
| - DCHECK(name[name.length() - 1] == '\0'); |
| - name.Truncate(name.length() - 1); |
| + const char native[] = "native "; |
|
Sven Panne
2014/12/18 10:32:32
Probably not a big deal here, but note that GCC ac
|
| + const char extension[] = ".js"; |
| + Vector<char> name(Vector<char>::New(id_length + sizeof(native) - 1 + |
| + sizeof(extension) - 1)); |
| + memcpy(name.start(), native, sizeof(native) - 1); |
| + memcpy(name.start() + sizeof(native) - 1, id, id_length); |
| + memcpy(name.start() + sizeof(native) - 1 + id_length, extension, |
| + sizeof(extension) - 1); |
| return Vector<const char>::cast(name); |
| } |