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/natives.h" | 5 #include "src/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-source-sink.h" | 10 #include "src/snapshot-source-sink.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 int GetBuiltinsCount() { return native_names_.length(); } | 28 int GetBuiltinsCount() { return native_names_.length(); } |
29 int GetDebuggerCount() { return debugger_count_; } | 29 int GetDebuggerCount() { return debugger_count_; } |
30 Vector<const char> GetScriptName(int index) { return native_names_[index]; } | 30 Vector<const char> GetScriptName(int index) { return native_names_[index]; } |
31 Vector<const char> GetRawScriptSource(int index) { | 31 Vector<const char> GetRawScriptSource(int index) { |
32 return native_source_[index]; | 32 return native_source_[index]; |
33 } | 33 } |
34 | 34 |
35 int GetIndex(const char* name) { | 35 int GetIndex(const char* name) { |
36 for (int i = 0; i < native_names_.length(); ++i) { | 36 for (int i = 0; i < native_names_.length(); ++i) { |
37 if (strcmp(name, native_names_[i].start()) == 0) { | 37 int native_name_length = native_names_[i].length(); |
| 38 if ((static_cast<int>(strlen(name)) == native_name_length) && |
| 39 (strncmp(name, native_names_[i].start(), native_name_length) == 0)) { |
38 return i; | 40 return i; |
39 } | 41 } |
40 } | 42 } |
41 DCHECK(false); | 43 DCHECK(false); |
42 return -1; | 44 return -1; |
43 } | 45 } |
44 | 46 |
45 int GetRawScriptsSize() { | 47 int GetRawScriptsSize() { |
46 DCHECK(false); // Used for compression. Doesn't really make sense here. | 48 DCHECK(false); // Used for compression. Doesn't really make sense here. |
47 return 0; | 49 return 0; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 189 |
188 // The compiler can't 'see' all uses of the static methods and hence | 190 // The compiler can't 'see' all uses of the static methods and hence |
189 // my chose to elide them. This we'll explicitly instantiate these. | 191 // my chose to elide them. This we'll explicitly instantiate these. |
190 template class NativesCollection<CORE>; | 192 template class NativesCollection<CORE>; |
191 template class NativesCollection<EXPERIMENTAL>; | 193 template class NativesCollection<EXPERIMENTAL>; |
192 template class NativesCollection<D8>; | 194 template class NativesCollection<D8>; |
193 template class NativesCollection<TEST>; | 195 template class NativesCollection<TEST>; |
194 | 196 |
195 } // namespace v8::internal | 197 } // namespace v8::internal |
196 } // namespace v8 | 198 } // namespace v8 |
OLD | NEW |