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

Side by Side Diff: src/compilation-cache.cc

Issue 3970005: Make Failure inherit from MaybeObject instead of Object. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 2 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/code-stubs.cc ('k') | src/debug.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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 explicit CompilationCacheScript(int generations) 103 explicit CompilationCacheScript(int generations)
104 : CompilationSubCache(generations) { } 104 : CompilationSubCache(generations) { }
105 105
106 Handle<SharedFunctionInfo> Lookup(Handle<String> source, 106 Handle<SharedFunctionInfo> Lookup(Handle<String> source,
107 Handle<Object> name, 107 Handle<Object> name,
108 int line_offset, 108 int line_offset,
109 int column_offset); 109 int column_offset);
110 void Put(Handle<String> source, Handle<SharedFunctionInfo> function_info); 110 void Put(Handle<String> source, Handle<SharedFunctionInfo> function_info);
111 111
112 private: 112 private:
113 MUST_USE_RESULT Object* TryTablePut( 113 MUST_USE_RESULT MaybeObject* TryTablePut(
114 Handle<String> source, Handle<SharedFunctionInfo> function_info); 114 Handle<String> source, Handle<SharedFunctionInfo> function_info);
115 115
116 // Note: Returns a new hash table if operation results in expansion. 116 // Note: Returns a new hash table if operation results in expansion.
117 Handle<CompilationCacheTable> TablePut( 117 Handle<CompilationCacheTable> TablePut(
118 Handle<String> source, Handle<SharedFunctionInfo> function_info); 118 Handle<String> source, Handle<SharedFunctionInfo> function_info);
119 119
120 bool HasOrigin(Handle<SharedFunctionInfo> function_info, 120 bool HasOrigin(Handle<SharedFunctionInfo> function_info,
121 Handle<Object> name, 121 Handle<Object> name,
122 int line_offset, 122 int line_offset,
123 int column_offset); 123 int column_offset);
124 124
125 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript); 125 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript);
126 }; 126 };
127 127
128 128
129 // Sub-cache for eval scripts. 129 // Sub-cache for eval scripts.
130 class CompilationCacheEval: public CompilationSubCache { 130 class CompilationCacheEval: public CompilationSubCache {
131 public: 131 public:
132 explicit CompilationCacheEval(int generations) 132 explicit CompilationCacheEval(int generations)
133 : CompilationSubCache(generations) { } 133 : CompilationSubCache(generations) { }
134 134
135 Handle<SharedFunctionInfo> Lookup(Handle<String> source, 135 Handle<SharedFunctionInfo> Lookup(Handle<String> source,
136 Handle<Context> context); 136 Handle<Context> context);
137 137
138 void Put(Handle<String> source, 138 void Put(Handle<String> source,
139 Handle<Context> context, 139 Handle<Context> context,
140 Handle<SharedFunctionInfo> function_info); 140 Handle<SharedFunctionInfo> function_info);
141 141
142 private: 142 private:
143 MUST_USE_RESULT Object* TryTablePut( 143 MUST_USE_RESULT MaybeObject* TryTablePut(
144 Handle<String> source, 144 Handle<String> source,
145 Handle<Context> context, 145 Handle<Context> context,
146 Handle<SharedFunctionInfo> function_info); 146 Handle<SharedFunctionInfo> function_info);
147 147
148 148
149 // Note: Returns a new hash table if operation results in expansion. 149 // Note: Returns a new hash table if operation results in expansion.
150 Handle<CompilationCacheTable> TablePut( 150 Handle<CompilationCacheTable> TablePut(
151 Handle<String> source, 151 Handle<String> source,
152 Handle<Context> context, 152 Handle<Context> context,
153 Handle<SharedFunctionInfo> function_info); 153 Handle<SharedFunctionInfo> function_info);
154 154
155 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheEval); 155 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheEval);
156 }; 156 };
157 157
158 158
159 // Sub-cache for regular expressions. 159 // Sub-cache for regular expressions.
160 class CompilationCacheRegExp: public CompilationSubCache { 160 class CompilationCacheRegExp: public CompilationSubCache {
161 public: 161 public:
162 explicit CompilationCacheRegExp(int generations) 162 explicit CompilationCacheRegExp(int generations)
163 : CompilationSubCache(generations) { } 163 : CompilationSubCache(generations) { }
164 164
165 Handle<FixedArray> Lookup(Handle<String> source, JSRegExp::Flags flags); 165 Handle<FixedArray> Lookup(Handle<String> source, JSRegExp::Flags flags);
166 166
167 void Put(Handle<String> source, 167 void Put(Handle<String> source,
168 JSRegExp::Flags flags, 168 JSRegExp::Flags flags,
169 Handle<FixedArray> data); 169 Handle<FixedArray> data);
170 private: 170 private:
171 MUST_USE_RESULT Object* TryTablePut(Handle<String> source, 171 MUST_USE_RESULT MaybeObject* TryTablePut(Handle<String> source,
172 JSRegExp::Flags flags, 172 JSRegExp::Flags flags,
173 Handle<FixedArray> data); 173 Handle<FixedArray> data);
174 174
175 // Note: Returns a new hash table if operation results in expansion. 175 // Note: Returns a new hash table if operation results in expansion.
176 Handle<CompilationCacheTable> TablePut(Handle<String> source, 176 Handle<CompilationCacheTable> TablePut(Handle<String> source,
177 JSRegExp::Flags flags, 177 JSRegExp::Flags flags,
178 Handle<FixedArray> data); 178 Handle<FixedArray> data);
179 179
180 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheRegExp); 180 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheRegExp);
181 }; 181 };
182 182
183 183
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 if (generation != 0) Put(source, shared); 326 if (generation != 0) Put(source, shared);
327 Counters::compilation_cache_hits.Increment(); 327 Counters::compilation_cache_hits.Increment();
328 return shared; 328 return shared;
329 } else { 329 } else {
330 Counters::compilation_cache_misses.Increment(); 330 Counters::compilation_cache_misses.Increment();
331 return Handle<SharedFunctionInfo>::null(); 331 return Handle<SharedFunctionInfo>::null();
332 } 332 }
333 } 333 }
334 334
335 335
336 Object* CompilationCacheScript::TryTablePut( 336 MaybeObject* CompilationCacheScript::TryTablePut(
337 Handle<String> source, 337 Handle<String> source,
338 Handle<SharedFunctionInfo> function_info) { 338 Handle<SharedFunctionInfo> function_info) {
339 Handle<CompilationCacheTable> table = GetFirstTable(); 339 Handle<CompilationCacheTable> table = GetFirstTable();
340 return table->Put(*source, *function_info); 340 return table->Put(*source, *function_info);
341 } 341 }
342 342
343 343
344 Handle<CompilationCacheTable> CompilationCacheScript::TablePut( 344 Handle<CompilationCacheTable> CompilationCacheScript::TablePut(
345 Handle<String> source, 345 Handle<String> source,
346 Handle<SharedFunctionInfo> function_info) { 346 Handle<SharedFunctionInfo> function_info) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 } 379 }
380 Counters::compilation_cache_hits.Increment(); 380 Counters::compilation_cache_hits.Increment();
381 return function_info; 381 return function_info;
382 } else { 382 } else {
383 Counters::compilation_cache_misses.Increment(); 383 Counters::compilation_cache_misses.Increment();
384 return Handle<SharedFunctionInfo>::null(); 384 return Handle<SharedFunctionInfo>::null();
385 } 385 }
386 } 386 }
387 387
388 388
389 Object* CompilationCacheEval::TryTablePut( 389 MaybeObject* CompilationCacheEval::TryTablePut(
390 Handle<String> source, 390 Handle<String> source,
391 Handle<Context> context, 391 Handle<Context> context,
392 Handle<SharedFunctionInfo> function_info) { 392 Handle<SharedFunctionInfo> function_info) {
393 Handle<CompilationCacheTable> table = GetFirstTable(); 393 Handle<CompilationCacheTable> table = GetFirstTable();
394 return table->PutEval(*source, *context, *function_info); 394 return table->PutEval(*source, *context, *function_info);
395 } 395 }
396 396
397 397
398 Handle<CompilationCacheTable> CompilationCacheEval::TablePut( 398 Handle<CompilationCacheTable> CompilationCacheEval::TablePut(
399 Handle<String> source, 399 Handle<String> source,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 } 435 }
436 Counters::compilation_cache_hits.Increment(); 436 Counters::compilation_cache_hits.Increment();
437 return data; 437 return data;
438 } else { 438 } else {
439 Counters::compilation_cache_misses.Increment(); 439 Counters::compilation_cache_misses.Increment();
440 return Handle<FixedArray>::null(); 440 return Handle<FixedArray>::null();
441 } 441 }
442 } 442 }
443 443
444 444
445 Object* CompilationCacheRegExp::TryTablePut( 445 MaybeObject* CompilationCacheRegExp::TryTablePut(
446 Handle<String> source, 446 Handle<String> source,
447 JSRegExp::Flags flags, 447 JSRegExp::Flags flags,
448 Handle<FixedArray> data) { 448 Handle<FixedArray> data) {
449 Handle<CompilationCacheTable> table = GetFirstTable(); 449 Handle<CompilationCacheTable> table = GetFirstTable();
450 return table->PutRegExp(*source, flags, *data); 450 return table->PutRegExp(*source, flags, *data);
451 } 451 }
452 452
453 453
454 Handle<CompilationCacheTable> CompilationCacheRegExp::TablePut( 454 Handle<CompilationCacheTable> CompilationCacheRegExp::TablePut(
455 Handle<String> source, 455 Handle<String> source,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 } 577 }
578 578
579 579
580 void CompilationCache::Disable() { 580 void CompilationCache::Disable() {
581 enabled = false; 581 enabled = false;
582 Clear(); 582 Clear();
583 } 583 }
584 584
585 585
586 } } // namespace v8::internal 586 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698