Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: src/natives-external.cc

Issue 772853003: Cleanup: Remove NativesCollection<.>::*Raw* methods. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compile. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/natives.h ('k') | src/serialize.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 14 matching lines...) Expand all
25 public: 25 public:
26 ~NativesStore() { 26 ~NativesStore() {
27 for (int i = 0; i < native_names_.length(); i++) { 27 for (int i = 0; i < native_names_.length(); i++) {
28 native_names_[i].Dispose(); 28 native_names_[i].Dispose();
29 } 29 }
30 } 30 }
31 31
32 int GetBuiltinsCount() { return native_ids_.length(); } 32 int GetBuiltinsCount() { return native_ids_.length(); }
33 int GetDebuggerCount() { return debugger_count_; } 33 int GetDebuggerCount() { return debugger_count_; }
34 34
35 Vector<const char> GetScriptName(int index) { return native_names_[index]; } 35 Vector<const char> GetScriptSource(int index) {
36
37 Vector<const char> GetRawScriptSource(int index) {
38 return native_source_[index]; 36 return native_source_[index];
39 } 37 }
40 38
39 Vector<const char> GetScriptName(int index) { return native_names_[index]; }
40
41 int GetIndex(const char* id) { 41 int GetIndex(const char* id) {
42 for (int i = 0; i < native_ids_.length(); ++i) { 42 for (int i = 0; i < native_ids_.length(); ++i) {
43 int native_id_length = native_ids_[i].length(); 43 int native_id_length = native_ids_[i].length();
44 if ((static_cast<int>(strlen(id)) == native_id_length) && 44 if ((static_cast<int>(strlen(id)) == native_id_length) &&
45 (strncmp(id, native_ids_[i].start(), native_id_length) == 0)) { 45 (strncmp(id, native_ids_[i].start(), native_id_length) == 0)) {
46 return i; 46 return i;
47 } 47 }
48 } 48 }
49 DCHECK(false); 49 DCHECK(false);
50 return -1; 50 return -1;
51 } 51 }
52 52
53 int GetRawScriptsSize() { 53 Vector<const char> GetScriptsSource() {
54 DCHECK(false); // Used for compression. Doesn't really make sense here. 54 DCHECK(false); // Not implemented.
55 return 0; 55 return Vector<const char>();
56 }
57
58 Vector<const byte> GetScriptsSource() {
59 DCHECK(false); // Used for compression. Doesn't really make sense here.
60 return Vector<const byte>();
61 } 56 }
62 57
63 static NativesStore* MakeFromScriptsSource(SnapshotByteSource* source) { 58 static NativesStore* MakeFromScriptsSource(SnapshotByteSource* source) {
64 NativesStore* store = new NativesStore; 59 NativesStore* store = new NativesStore;
65 60
66 // We expect the libraries in the following format: 61 // We expect the libraries in the following format:
67 // int: # of debugger sources. 62 // int: # of debugger sources.
68 // 2N blobs: N pairs of source name + actual source. 63 // 2N blobs: N pairs of source name + actual source.
69 // then, repeat for non-debugger sources. 64 // then, repeat for non-debugger sources.
70 int debugger_count = source->GetInt(); 65 int debugger_count = source->GetInt();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 template<NativeType type> 165 template<NativeType type>
171 int NativesCollection<type>::GetDebuggerCount() { 166 int NativesCollection<type>::GetDebuggerCount() {
172 return NativesHolder<type>::get()->GetDebuggerCount(); 167 return NativesHolder<type>::get()->GetDebuggerCount();
173 } 168 }
174 169
175 template<NativeType type> 170 template<NativeType type>
176 int NativesCollection<type>::GetIndex(const char* name) { 171 int NativesCollection<type>::GetIndex(const char* name) {
177 return NativesHolder<type>::get()->GetIndex(name); 172 return NativesHolder<type>::get()->GetIndex(name);
178 } 173 }
179 174
180 template<NativeType type> 175 template <NativeType type>
181 int NativesCollection<type>::GetRawScriptsSize() { 176 Vector<const char> NativesCollection<type>::GetScriptSource(int index) {
182 return NativesHolder<type>::get()->GetRawScriptsSize(); 177 return NativesHolder<type>::get()->GetScriptSource(index);
183 } 178 }
184 179
185 template<NativeType type> 180 template<NativeType type>
186 Vector<const char> NativesCollection<type>::GetRawScriptSource(int index) {
187 return NativesHolder<type>::get()->GetRawScriptSource(index);
188 }
189
190 template<NativeType type>
191 Vector<const char> NativesCollection<type>::GetScriptName(int index) { 181 Vector<const char> NativesCollection<type>::GetScriptName(int index) {
192 return NativesHolder<type>::get()->GetScriptName(index); 182 return NativesHolder<type>::get()->GetScriptName(index);
193 } 183 }
194 184
195 template<NativeType type> 185 template <NativeType type>
196 Vector<const byte> NativesCollection<type>::GetScriptsSource() { 186 Vector<const char> NativesCollection<type>::GetScriptsSource() {
197 return NativesHolder<type>::get()->GetScriptsSource(); 187 return NativesHolder<type>::get()->GetScriptsSource();
198 } 188 }
199 189
200 template<NativeType type>
201 void NativesCollection<type>::SetRawScriptsSource(
202 Vector<const char> raw_source) {
203 CHECK(false); // Use SetNativesFromFile for this implementation.
204 }
205
206 190
207 // The compiler can't 'see' all uses of the static methods and hence 191 // The compiler can't 'see' all uses of the static methods and hence
208 // my chose to elide them. This we'll explicitly instantiate these. 192 // my chose to elide them. This we'll explicitly instantiate these.
209 template class NativesCollection<CORE>; 193 template class NativesCollection<CORE>;
210 template class NativesCollection<EXPERIMENTAL>; 194 template class NativesCollection<EXPERIMENTAL>;
211 195
212 } // namespace v8::internal 196 } // namespace v8::internal
213 } // namespace v8 197 } // namespace v8
OLDNEW
« no previous file with comments | « src/natives.h ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698