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

Side by Side Diff: src/compilation-cache.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/compilation-cache.h ('k') | src/compiler.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/assembler.h" 7 #include "src/assembler.h"
8 #include "src/compilation-cache.h" 8 #include "src/compilation-cache.h"
9 #include "src/serialize.h" 9 #include "src/serialize.h"
10 10
(...skipping 25 matching lines...) Expand all
36 for (int i = 0; i < kSubCacheCount; ++i) { 36 for (int i = 0; i < kSubCacheCount; ++i) {
37 subcaches_[i] = subcaches[i]; 37 subcaches_[i] = subcaches[i];
38 } 38 }
39 } 39 }
40 40
41 41
42 CompilationCache::~CompilationCache() {} 42 CompilationCache::~CompilationCache() {}
43 43
44 44
45 Handle<CompilationCacheTable> CompilationSubCache::GetTable(int generation) { 45 Handle<CompilationCacheTable> CompilationSubCache::GetTable(int generation) {
46 ASSERT(generation < generations_); 46 DCHECK(generation < generations_);
47 Handle<CompilationCacheTable> result; 47 Handle<CompilationCacheTable> result;
48 if (tables_[generation]->IsUndefined()) { 48 if (tables_[generation]->IsUndefined()) {
49 result = CompilationCacheTable::New(isolate(), kInitialCacheSize); 49 result = CompilationCacheTable::New(isolate(), kInitialCacheSize);
50 tables_[generation] = *result; 50 tables_[generation] = *result;
51 } else { 51 } else {
52 CompilationCacheTable* table = 52 CompilationCacheTable* table =
53 CompilationCacheTable::cast(tables_[generation]); 53 CompilationCacheTable::cast(tables_[generation]);
54 result = Handle<CompilationCacheTable>(table, isolate()); 54 result = Handle<CompilationCacheTable>(table, isolate());
55 } 55 }
56 return result; 56 return result;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // The level NUMBER_OF_SCRIPT_GENERATIONS is equivalent to a cache miss. 186 // The level NUMBER_OF_SCRIPT_GENERATIONS is equivalent to a cache miss.
187 isolate()->stats_table()->AddHistogramSample(script_histogram_, generation); 187 isolate()->stats_table()->AddHistogramSample(script_histogram_, generation);
188 } 188 }
189 189
190 // Once outside the manacles of the handle scope, we need to recheck 190 // Once outside the manacles of the handle scope, we need to recheck
191 // to see if we actually found a cached script. If so, we return a 191 // to see if we actually found a cached script. If so, we return a
192 // handle created in the caller's handle scope. 192 // handle created in the caller's handle scope.
193 if (result != NULL) { 193 if (result != NULL) {
194 Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(result), 194 Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(result),
195 isolate()); 195 isolate());
196 ASSERT(HasOrigin(shared, 196 DCHECK(HasOrigin(shared,
197 name, 197 name,
198 line_offset, 198 line_offset,
199 column_offset, 199 column_offset,
200 is_shared_cross_origin)); 200 is_shared_cross_origin));
201 // If the script was found in a later generation, we promote it to 201 // If the script was found in a later generation, we promote it to
202 // the first generation to let it survive longer in the cache. 202 // the first generation to let it survive longer in the cache.
203 if (generation != 0) Put(source, context, shared); 203 if (generation != 0) Put(source, context, shared);
204 isolate()->counters()->compilation_cache_hits()->Increment(); 204 isolate()->counters()->compilation_cache_hits()->Increment();
205 return shared; 205 return shared;
206 } else { 206 } else {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 Handle<Context> context, 328 Handle<Context> context,
329 StrictMode strict_mode, 329 StrictMode strict_mode,
330 int scope_position) { 330 int scope_position) {
331 if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>(); 331 if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>();
332 332
333 MaybeHandle<SharedFunctionInfo> result; 333 MaybeHandle<SharedFunctionInfo> result;
334 if (context->IsNativeContext()) { 334 if (context->IsNativeContext()) {
335 result = eval_global_.Lookup( 335 result = eval_global_.Lookup(
336 source, context, strict_mode, scope_position); 336 source, context, strict_mode, scope_position);
337 } else { 337 } else {
338 ASSERT(scope_position != RelocInfo::kNoPosition); 338 DCHECK(scope_position != RelocInfo::kNoPosition);
339 result = eval_contextual_.Lookup( 339 result = eval_contextual_.Lookup(
340 source, context, strict_mode, scope_position); 340 source, context, strict_mode, scope_position);
341 } 341 }
342 return result; 342 return result;
343 } 343 }
344 344
345 345
346 MaybeHandle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, 346 MaybeHandle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source,
347 JSRegExp::Flags flags) { 347 JSRegExp::Flags flags) {
348 if (!IsEnabled()) return MaybeHandle<FixedArray>(); 348 if (!IsEnabled()) return MaybeHandle<FixedArray>();
(...skipping 14 matching lines...) Expand all
363 void CompilationCache::PutEval(Handle<String> source, 363 void CompilationCache::PutEval(Handle<String> source,
364 Handle<Context> context, 364 Handle<Context> context,
365 Handle<SharedFunctionInfo> function_info, 365 Handle<SharedFunctionInfo> function_info,
366 int scope_position) { 366 int scope_position) {
367 if (!IsEnabled()) return; 367 if (!IsEnabled()) return;
368 368
369 HandleScope scope(isolate()); 369 HandleScope scope(isolate());
370 if (context->IsNativeContext()) { 370 if (context->IsNativeContext()) {
371 eval_global_.Put(source, context, function_info, scope_position); 371 eval_global_.Put(source, context, function_info, scope_position);
372 } else { 372 } else {
373 ASSERT(scope_position != RelocInfo::kNoPosition); 373 DCHECK(scope_position != RelocInfo::kNoPosition);
374 eval_contextual_.Put(source, context, function_info, scope_position); 374 eval_contextual_.Put(source, context, function_info, scope_position);
375 } 375 }
376 } 376 }
377 377
378 378
379 379
380 void CompilationCache::PutRegExp(Handle<String> source, 380 void CompilationCache::PutRegExp(Handle<String> source,
381 JSRegExp::Flags flags, 381 JSRegExp::Flags flags,
382 Handle<FixedArray> data) { 382 Handle<FixedArray> data) {
383 if (!IsEnabled()) { 383 if (!IsEnabled()) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 421 }
422 422
423 423
424 void CompilationCache::Disable() { 424 void CompilationCache::Disable() {
425 enabled_ = false; 425 enabled_ = false;
426 Clear(); 426 Clear();
427 } 427 }
428 428
429 429
430 } } // namespace v8::internal 430 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compilation-cache.h ('k') | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698