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

Side by Side Diff: src/parser.cc

Issue 692333006: Revert "Parser & internalizing: efficiency fixes." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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/ast-value-factory.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 // the main thread. 928 // the main thread.
929 HistogramTimerScope timer_scope(isolate()->counters()->parse_lazy()); 929 HistogramTimerScope timer_scope(isolate()->counters()->parse_lazy());
930 Handle<String> source(String::cast(script()->source())); 930 Handle<String> source(String::cast(script()->source()));
931 isolate()->counters()->total_parse_size()->Increment(source->length()); 931 isolate()->counters()->total_parse_size()->Increment(source->length());
932 base::ElapsedTimer timer; 932 base::ElapsedTimer timer;
933 if (FLAG_trace_parse) { 933 if (FLAG_trace_parse) {
934 timer.Start(); 934 timer.Start();
935 } 935 }
936 Handle<SharedFunctionInfo> shared_info = info()->shared_info(); 936 Handle<SharedFunctionInfo> shared_info = info()->shared_info();
937 937
938 // Lazy parsing is only done during runtime, when we're already using the
939 // heap. So make the AstValueFactory also internalize all values when it
940 // creates them (this is more efficient).
941 ast_value_factory()->Internalize(isolate());
942
943 // Initialize parser state. 938 // Initialize parser state.
944 source = String::Flatten(source); 939 source = String::Flatten(source);
945 FunctionLiteral* result; 940 FunctionLiteral* result;
946 if (source->IsExternalTwoByteString()) { 941 if (source->IsExternalTwoByteString()) {
947 ExternalTwoByteStringUtf16CharacterStream stream( 942 ExternalTwoByteStringUtf16CharacterStream stream(
948 Handle<ExternalTwoByteString>::cast(source), 943 Handle<ExternalTwoByteString>::cast(source),
949 shared_info->start_position(), 944 shared_info->start_position(),
950 shared_info->end_position()); 945 shared_info->end_position());
951 result = ParseLazy(&stream); 946 result = ParseLazy(&stream);
952 } else { 947 } else {
(...skipping 4007 matching lines...) Expand 10 before | Expand all | Expand 10 after
4960 4955
4961 // We cannot internalize on a background thread; a foreground task will take 4956 // We cannot internalize on a background thread; a foreground task will take
4962 // care of calling Parser::Internalize just before compilation. 4957 // care of calling Parser::Internalize just before compilation.
4963 4958
4964 if (compile_options() == ScriptCompiler::kProduceParserCache) { 4959 if (compile_options() == ScriptCompiler::kProduceParserCache) {
4965 if (result != NULL) *info_->cached_data() = recorder.GetScriptData(); 4960 if (result != NULL) *info_->cached_data() = recorder.GetScriptData();
4966 log_ = NULL; 4961 log_ = NULL;
4967 } 4962 }
4968 } 4963 }
4969 } } // namespace v8::internal 4964 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast-value-factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698