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

Side by Side Diff: src/parser.cc

Issue 6723014: Avoid TLS access for counters. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix lint Created 9 years, 9 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/objects.cc ('k') | src/runtime.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 if (scanner().is_literal_ascii()) { 277 if (scanner().is_literal_ascii()) {
278 result = isolate()->factory()->LookupAsciiSymbol( 278 result = isolate()->factory()->LookupAsciiSymbol(
279 scanner().literal_ascii_string()); 279 scanner().literal_ascii_string());
280 } else { 280 } else {
281 result = isolate()->factory()->LookupTwoByteSymbol( 281 result = isolate()->factory()->LookupTwoByteSymbol(
282 scanner().literal_uc16_string()); 282 scanner().literal_uc16_string());
283 } 283 }
284 symbol_cache_.at(symbol_id) = result; 284 symbol_cache_.at(symbol_id) = result;
285 return result; 285 return result;
286 } 286 }
287 COUNTERS->total_preparse_symbols_skipped()->Increment(); 287 isolate()->counters()->total_preparse_symbols_skipped()->Increment();
288 return result; 288 return result;
289 } 289 }
290 290
291 291
292 FunctionEntry ScriptDataImpl::GetFunctionEntry(int start) { 292 FunctionEntry ScriptDataImpl::GetFunctionEntry(int start) {
293 // The current pre-data entry must be a FunctionEntry with the given 293 // The current pre-data entry must be a FunctionEntry with the given
294 // start position. 294 // start position.
295 if ((function_index_ + FunctionEntry::kSize <= store_.length()) 295 if ((function_index_ + FunctionEntry::kSize <= store_.length())
296 && (static_cast<int>(store_[function_index_]) == start)) { 296 && (static_cast<int>(store_[function_index_]) == start)) {
297 int index = function_index_; 297 int index = function_index_;
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 parenthesized_function_(false) { 592 parenthesized_function_(false) {
593 AstNode::ResetIds(); 593 AstNode::ResetIds();
594 } 594 }
595 595
596 596
597 FunctionLiteral* Parser::ParseProgram(Handle<String> source, 597 FunctionLiteral* Parser::ParseProgram(Handle<String> source,
598 bool in_global_context, 598 bool in_global_context,
599 StrictModeFlag strict_mode) { 599 StrictModeFlag strict_mode) {
600 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); 600 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT);
601 601
602 HistogramTimerScope timer(COUNTERS->parse()); 602 HistogramTimerScope timer(isolate()->counters()->parse());
603 COUNTERS->total_parse_size()->Increment(source->length()); 603 isolate()->counters()->total_parse_size()->Increment(source->length());
604 fni_ = new FuncNameInferrer(); 604 fni_ = new FuncNameInferrer();
605 605
606 // Initialize parser state. 606 // Initialize parser state.
607 source->TryFlatten(); 607 source->TryFlatten();
608 if (source->IsExternalTwoByteString()) { 608 if (source->IsExternalTwoByteString()) {
609 // Notice that the stream is destroyed at the end of the branch block. 609 // Notice that the stream is destroyed at the end of the branch block.
610 // The last line of the blocks can't be moved outside, even though they're 610 // The last line of the blocks can't be moved outside, even though they're
611 // identical calls. 611 // identical calls.
612 ExternalTwoByteStringUC16CharacterStream stream( 612 ExternalTwoByteStringUC16CharacterStream stream(
613 Handle<ExternalTwoByteString>::cast(source), 0, source->length()); 613 Handle<ExternalTwoByteString>::cast(source), 0, source->length());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 ASSERT(target_stack_ == NULL); 674 ASSERT(target_stack_ == NULL);
675 675
676 // If there was a syntax error we have to get rid of the AST 676 // If there was a syntax error we have to get rid of the AST
677 // and it is not safe to do so before the scope has been deleted. 677 // and it is not safe to do so before the scope has been deleted.
678 if (result == NULL) zone_scope->DeleteOnExit(); 678 if (result == NULL) zone_scope->DeleteOnExit();
679 return result; 679 return result;
680 } 680 }
681 681
682 FunctionLiteral* Parser::ParseLazy(CompilationInfo* info) { 682 FunctionLiteral* Parser::ParseLazy(CompilationInfo* info) {
683 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT); 683 CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT);
684 HistogramTimerScope timer(COUNTERS->parse_lazy()); 684 HistogramTimerScope timer(isolate()->counters()->parse_lazy());
685 Handle<String> source(String::cast(script_->source())); 685 Handle<String> source(String::cast(script_->source()));
686 COUNTERS->total_parse_size()->Increment(source->length()); 686 isolate()->counters()->total_parse_size()->Increment(source->length());
687 687
688 Handle<SharedFunctionInfo> shared_info = info->shared_info(); 688 Handle<SharedFunctionInfo> shared_info = info->shared_info();
689 // Initialize parser state. 689 // Initialize parser state.
690 source->TryFlatten(); 690 source->TryFlatten();
691 if (source->IsExternalTwoByteString()) { 691 if (source->IsExternalTwoByteString()) {
692 ExternalTwoByteStringUC16CharacterStream stream( 692 ExternalTwoByteStringUC16CharacterStream stream(
693 Handle<ExternalTwoByteString>::cast(source), 693 Handle<ExternalTwoByteString>::cast(source),
694 shared_info->start_position(), 694 shared_info->start_position(),
695 shared_info->end_position()); 695 shared_info->end_position());
696 FunctionLiteral* result = ParseLazy(info, &stream, &zone_scope); 696 FunctionLiteral* result = ParseLazy(info, &stream, &zone_scope);
(...skipping 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after
3601 if (is_lazily_compiled && pre_data() != NULL) { 3601 if (is_lazily_compiled && pre_data() != NULL) {
3602 FunctionEntry entry = pre_data()->GetFunctionEntry(function_block_pos); 3602 FunctionEntry entry = pre_data()->GetFunctionEntry(function_block_pos);
3603 if (!entry.is_valid()) { 3603 if (!entry.is_valid()) {
3604 ReportInvalidPreparseData(name, CHECK_OK); 3604 ReportInvalidPreparseData(name, CHECK_OK);
3605 } 3605 }
3606 end_pos = entry.end_pos(); 3606 end_pos = entry.end_pos();
3607 if (end_pos <= function_block_pos) { 3607 if (end_pos <= function_block_pos) {
3608 // End position greater than end of stream is safe, and hard to check. 3608 // End position greater than end of stream is safe, and hard to check.
3609 ReportInvalidPreparseData(name, CHECK_OK); 3609 ReportInvalidPreparseData(name, CHECK_OK);
3610 } 3610 }
3611 COUNTERS->total_preparse_skipped()->Increment( 3611 isolate()->counters()->total_preparse_skipped()->Increment(
3612 end_pos - function_block_pos); 3612 end_pos - function_block_pos);
3613 // Seek to position just before terminal '}'. 3613 // Seek to position just before terminal '}'.
3614 scanner().SeekForward(end_pos - 1); 3614 scanner().SeekForward(end_pos - 1);
3615 materialized_literal_count = entry.literal_count(); 3615 materialized_literal_count = entry.literal_count();
3616 expected_property_count = entry.property_count(); 3616 expected_property_count = entry.property_count();
3617 only_simple_this_property_assignments = false; 3617 only_simple_this_property_assignments = false;
3618 this_property_assignments = isolate()->factory()->empty_fixed_array(); 3618 this_property_assignments = isolate()->factory()->empty_fixed_array();
3619 Expect(Token::RBRACE, CHECK_OK); 3619 Expect(Token::RBRACE, CHECK_OK);
3620 } else { 3620 } else {
3621 ParseSourceElements(body, Token::RBRACE, CHECK_OK); 3621 ParseSourceElements(body, Token::RBRACE, CHECK_OK);
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
5146 info->is_global(), 5146 info->is_global(),
5147 info->StrictMode()); 5147 info->StrictMode());
5148 } 5148 }
5149 } 5149 }
5150 5150
5151 info->SetFunction(result); 5151 info->SetFunction(result);
5152 return (result != NULL); 5152 return (result != NULL);
5153 } 5153 }
5154 5154
5155 } } // namespace v8::internal 5155 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698