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

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

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes Created 6 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « src/mksnapshot.cc ('k') | src/objects.h » ('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 20 matching lines...) Expand all
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 if (strcmp(name, native_names_[i].start()) == 0) {
38 return i; 38 return i;
39 } 39 }
40 } 40 }
41 ASSERT(false); 41 DCHECK(false);
42 return -1; 42 return -1;
43 } 43 }
44 44
45 int GetRawScriptsSize() { 45 int GetRawScriptsSize() {
46 ASSERT(false); // Used for compression. Doesn't really make sense here. 46 DCHECK(false); // Used for compression. Doesn't really make sense here.
47 return 0; 47 return 0;
48 } 48 }
49 49
50 Vector<const byte> GetScriptsSource() { 50 Vector<const byte> GetScriptsSource() {
51 ASSERT(false); // Used for compression. Doesn't really make sense here. 51 DCHECK(false); // Used for compression. Doesn't really make sense here.
52 return Vector<const byte>(); 52 return Vector<const byte>();
53 } 53 }
54 54
55 static NativesStore* MakeFromScriptsSource(SnapshotByteSource* source) { 55 static NativesStore* MakeFromScriptsSource(SnapshotByteSource* source) {
56 NativesStore* store = new NativesStore; 56 NativesStore* store = new NativesStore;
57 57
58 // We expect the libraries in the following format: 58 // We expect the libraries in the following format:
59 // int: # of debugger sources. 59 // int: # of debugger sources.
60 // 2N blobs: N pairs of source name + actual source. 60 // 2N blobs: N pairs of source name + actual source.
61 // then, repeat for non-debugger sources. 61 // then, repeat for non-debugger sources.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 int debugger_count_; 96 int debugger_count_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(NativesStore); 98 DISALLOW_COPY_AND_ASSIGN(NativesStore);
99 }; 99 };
100 100
101 101
102 template<NativeType type> 102 template<NativeType type>
103 class NativesHolder { 103 class NativesHolder {
104 public: 104 public:
105 static NativesStore* get() { 105 static NativesStore* get() {
106 ASSERT(holder_); 106 DCHECK(holder_);
107 return holder_; 107 return holder_;
108 } 108 }
109 static void set(NativesStore* store) { 109 static void set(NativesStore* store) {
110 ASSERT(store); 110 DCHECK(store);
111 holder_ = store; 111 holder_ = store;
112 } 112 }
113 113
114 private: 114 private:
115 static NativesStore* holder_; 115 static NativesStore* holder_;
116 }; 116 };
117 117
118 template<NativeType type> 118 template<NativeType type>
119 NativesStore* NativesHolder<type>::holder_ = NULL; 119 NativesStore* NativesHolder<type>::holder_ = NULL;
120 120
121 121
122 /** 122 /**
123 * Read the Natives (library sources) blob, as generated by js2c + the build 123 * Read the Natives (library sources) blob, as generated by js2c + the build
124 * system. 124 * system.
125 */ 125 */
126 void SetNativesFromFile(StartupData* natives_blob) { 126 void SetNativesFromFile(StartupData* natives_blob) {
127 ASSERT(natives_blob); 127 DCHECK(natives_blob);
128 ASSERT(natives_blob->data); 128 DCHECK(natives_blob->data);
129 ASSERT(natives_blob->raw_size > 0); 129 DCHECK(natives_blob->raw_size > 0);
130 130
131 SnapshotByteSource bytes( 131 SnapshotByteSource bytes(
132 reinterpret_cast<const byte*>(natives_blob->data), 132 reinterpret_cast<const byte*>(natives_blob->data),
133 natives_blob->raw_size); 133 natives_blob->raw_size);
134 NativesHolder<CORE>::set(NativesStore::MakeFromScriptsSource(&bytes)); 134 NativesHolder<CORE>::set(NativesStore::MakeFromScriptsSource(&bytes));
135 NativesHolder<EXPERIMENTAL>::set(NativesStore::MakeFromScriptsSource(&bytes)); 135 NativesHolder<EXPERIMENTAL>::set(NativesStore::MakeFromScriptsSource(&bytes));
136 ASSERT(!bytes.HasMore()); 136 DCHECK(!bytes.HasMore());
137 } 137 }
138 138
139 139
140 // Implement NativesCollection<T> bsaed on NativesHolder + NativesStore. 140 // Implement NativesCollection<T> bsaed on NativesHolder + NativesStore.
141 // 141 //
142 // (The callers expect a purely static interface, since this is how the 142 // (The callers expect a purely static interface, since this is how the
143 // natives are usually compiled in. Since we implement them based on 143 // natives are usually compiled in. Since we implement them based on
144 // runtime content, we have to implement this indirection to offer 144 // runtime content, we have to implement this indirection to offer
145 // a static interface.) 145 // a static interface.)
146 template<NativeType type> 146 template<NativeType type>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 // The compiler can't 'see' all uses of the static methods and hence 188 // 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. 189 // my chose to elide them. This we'll explicitly instantiate these.
190 template class NativesCollection<CORE>; 190 template class NativesCollection<CORE>;
191 template class NativesCollection<EXPERIMENTAL>; 191 template class NativesCollection<EXPERIMENTAL>;
192 template class NativesCollection<D8>; 192 template class NativesCollection<D8>;
193 template class NativesCollection<TEST>; 193 template class NativesCollection<TEST>;
194 194
195 } // namespace v8::internal 195 } // namespace v8::internal
196 } // namespace v8 196 } // namespace v8
OLDNEW
« no previous file with comments | « src/mksnapshot.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698