| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/snapshot/natives.h" | 5 #include "src/snapshot/natives.h" |
| 6 | 6 |
| 7 #include "src/base/logging.h" | 7 #include "src/base/logging.h" |
| 8 #include "src/list.h" | 8 #include "src/list.h" |
| 9 #include "src/list-inl.h" | 9 #include "src/list-inl.h" |
| 10 #include "src/snapshot/snapshot-source-sink.h" | 10 #include "src/snapshot/snapshot-source-sink.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 const char extension[] = ".js"; | 86 const char extension[] = ".js"; |
| 87 Vector<char> name(Vector<char>::New(id_length + sizeof(native) - 1 + | 87 Vector<char> name(Vector<char>::New(id_length + sizeof(native) - 1 + |
| 88 sizeof(extension) - 1)); | 88 sizeof(extension) - 1)); |
| 89 memcpy(name.start(), native, sizeof(native) - 1); | 89 memcpy(name.start(), native, sizeof(native) - 1); |
| 90 memcpy(name.start() + sizeof(native) - 1, id, id_length); | 90 memcpy(name.start() + sizeof(native) - 1, id, id_length); |
| 91 memcpy(name.start() + sizeof(native) - 1 + id_length, extension, | 91 memcpy(name.start() + sizeof(native) - 1 + id_length, extension, |
| 92 sizeof(extension) - 1); | 92 sizeof(extension) - 1); |
| 93 return Vector<const char>::cast(name); | 93 return Vector<const char>::cast(name); |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool ReadNameAndContentPair(SnapshotByteSource* bytes) { | 96 void ReadNameAndContentPair(SnapshotByteSource* bytes) { |
| 97 const byte* id; | 97 const byte* id; |
| 98 int id_length; | |
| 99 const byte* source; | 98 const byte* source; |
| 100 int source_length; | 99 int id_length = bytes->GetBlob(&id); |
| 101 bool success = bytes->GetBlob(&id, &id_length) && | 100 int source_length = bytes->GetBlob(&source); |
| 102 bytes->GetBlob(&source, &source_length); | 101 Vector<const char> id_vector(reinterpret_cast<const char*>(id), id_length); |
| 103 if (success) { | 102 Vector<const char> source_vector(reinterpret_cast<const char*>(source), |
| 104 Vector<const char> id_vector(reinterpret_cast<const char*>(id), | 103 source_length); |
| 105 id_length); | 104 native_ids_.Add(id_vector); |
| 106 Vector<const char> source_vector( | 105 native_source_.Add(source_vector); |
| 107 reinterpret_cast<const char*>(source), source_length); | 106 native_names_.Add(NameFromId(id, id_length)); |
| 108 native_ids_.Add(id_vector); | |
| 109 native_source_.Add(source_vector); | |
| 110 native_names_.Add(NameFromId(id, id_length)); | |
| 111 } | |
| 112 return success; | |
| 113 } | 107 } |
| 114 | 108 |
| 115 List<Vector<const char> > native_ids_; | 109 List<Vector<const char> > native_ids_; |
| 116 List<Vector<const char> > native_names_; | 110 List<Vector<const char> > native_names_; |
| 117 List<Vector<const char> > native_source_; | 111 List<Vector<const char> > native_source_; |
| 118 int debugger_count_; | 112 int debugger_count_; |
| 119 | 113 |
| 120 DISALLOW_COPY_AND_ASSIGN(NativesStore); | 114 DISALLOW_COPY_AND_ASSIGN(NativesStore); |
| 121 }; | 115 }; |
| 122 | 116 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 template Vector<const char> NativesCollection<T>::GetScriptName(int i); \ | 233 template Vector<const char> NativesCollection<T>::GetScriptName(int i); \ |
| 240 template Vector<const char> NativesCollection<T>::GetScriptsSource(); | 234 template Vector<const char> NativesCollection<T>::GetScriptsSource(); |
| 241 INSTANTIATE_TEMPLATES(CORE) | 235 INSTANTIATE_TEMPLATES(CORE) |
| 242 INSTANTIATE_TEMPLATES(EXPERIMENTAL) | 236 INSTANTIATE_TEMPLATES(EXPERIMENTAL) |
| 243 INSTANTIATE_TEMPLATES(EXTRAS) | 237 INSTANTIATE_TEMPLATES(EXTRAS) |
| 244 INSTANTIATE_TEMPLATES(EXPERIMENTAL_EXTRAS) | 238 INSTANTIATE_TEMPLATES(EXPERIMENTAL_EXTRAS) |
| 245 #undef INSTANTIATE_TEMPLATES | 239 #undef INSTANTIATE_TEMPLATES |
| 246 | 240 |
| 247 } // namespace internal | 241 } // namespace internal |
| 248 } // namespace v8 | 242 } // namespace v8 |
| OLD | NEW |