| OLD | NEW |
| 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/base/platform/platform.h" |
| 9 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| 10 #include "src/char-predicates-inl.h" | 11 #include "src/char-predicates-inl.h" |
| 11 #include "src/codegen.h" | 12 #include "src/codegen.h" |
| 12 #include "src/compiler.h" | 13 #include "src/compiler.h" |
| 13 #include "src/messages.h" | 14 #include "src/messages.h" |
| 14 #include "src/parser.h" | 15 #include "src/parser.h" |
| 15 #include "src/platform.h" | |
| 16 #include "src/preparser.h" | 16 #include "src/preparser.h" |
| 17 #include "src/runtime.h" | 17 #include "src/runtime.h" |
| 18 #include "src/scanner-character-streams.h" | 18 #include "src/scanner-character-streams.h" |
| 19 #include "src/scopeinfo.h" | 19 #include "src/scopeinfo.h" |
| 20 #include "src/string-stream.h" | 20 #include "src/string-stream.h" |
| 21 | 21 |
| 22 namespace v8 { | 22 namespace v8 { |
| 23 namespace internal { | 23 namespace internal { |
| 24 | 24 |
| 25 RegExpBuilder::RegExpBuilder(Zone* zone) | 25 RegExpBuilder::RegExpBuilder(Zone* zone) |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); | 785 set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); |
| 786 } | 786 } |
| 787 | 787 |
| 788 | 788 |
| 789 FunctionLiteral* Parser::ParseProgram() { | 789 FunctionLiteral* Parser::ParseProgram() { |
| 790 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, | 790 // TODO(bmeurer): We temporarily need to pass allow_nesting = true here, |
| 791 // see comment for HistogramTimerScope class. | 791 // see comment for HistogramTimerScope class. |
| 792 HistogramTimerScope timer_scope(isolate()->counters()->parse(), true); | 792 HistogramTimerScope timer_scope(isolate()->counters()->parse(), true); |
| 793 Handle<String> source(String::cast(script_->source())); | 793 Handle<String> source(String::cast(script_->source())); |
| 794 isolate()->counters()->total_parse_size()->Increment(source->length()); | 794 isolate()->counters()->total_parse_size()->Increment(source->length()); |
| 795 ElapsedTimer timer; | 795 base::ElapsedTimer timer; |
| 796 if (FLAG_trace_parse) { | 796 if (FLAG_trace_parse) { |
| 797 timer.Start(); | 797 timer.Start(); |
| 798 } | 798 } |
| 799 fni_ = new(zone()) FuncNameInferrer(ast_value_factory_, zone()); | 799 fni_ = new(zone()) FuncNameInferrer(ast_value_factory_, zone()); |
| 800 | 800 |
| 801 // Initialize parser state. | 801 // Initialize parser state. |
| 802 CompleteParserRecorder recorder; | 802 CompleteParserRecorder recorder; |
| 803 if (cached_data_mode_ == PRODUCE_CACHED_DATA) { | 803 if (cached_data_mode_ == PRODUCE_CACHED_DATA) { |
| 804 log_ = &recorder; | 804 log_ = &recorder; |
| 805 } else if (cached_data_mode_ == CONSUME_CACHED_DATA) { | 805 } else if (cached_data_mode_ == CONSUME_CACHED_DATA) { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 ASSERT(target_stack_ == NULL); | 940 ASSERT(target_stack_ == NULL); |
| 941 | 941 |
| 942 return result; | 942 return result; |
| 943 } | 943 } |
| 944 | 944 |
| 945 | 945 |
| 946 FunctionLiteral* Parser::ParseLazy() { | 946 FunctionLiteral* Parser::ParseLazy() { |
| 947 HistogramTimerScope timer_scope(isolate()->counters()->parse_lazy()); | 947 HistogramTimerScope timer_scope(isolate()->counters()->parse_lazy()); |
| 948 Handle<String> source(String::cast(script_->source())); | 948 Handle<String> source(String::cast(script_->source())); |
| 949 isolate()->counters()->total_parse_size()->Increment(source->length()); | 949 isolate()->counters()->total_parse_size()->Increment(source->length()); |
| 950 ElapsedTimer timer; | 950 base::ElapsedTimer timer; |
| 951 if (FLAG_trace_parse) { | 951 if (FLAG_trace_parse) { |
| 952 timer.Start(); | 952 timer.Start(); |
| 953 } | 953 } |
| 954 Handle<SharedFunctionInfo> shared_info = info()->shared_info(); | 954 Handle<SharedFunctionInfo> shared_info = info()->shared_info(); |
| 955 | 955 |
| 956 // Initialize parser state. | 956 // Initialize parser state. |
| 957 source = String::Flatten(source); | 957 source = String::Flatten(source); |
| 958 FunctionLiteral* result; | 958 FunctionLiteral* result; |
| 959 if (source->IsExternalTwoByteString()) { | 959 if (source->IsExternalTwoByteString()) { |
| 960 ExternalTwoByteStringUtf16CharacterStream stream( | 960 ExternalTwoByteStringUtf16CharacterStream stream( |
| (...skipping 3876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4837 ASSERT(ast_value_factory_->IsInternalized()); | 4837 ASSERT(ast_value_factory_->IsInternalized()); |
| 4838 // info takes ownership of ast_value_factory_. | 4838 // info takes ownership of ast_value_factory_. |
| 4839 if (info()->ast_value_factory() == NULL) { | 4839 if (info()->ast_value_factory() == NULL) { |
| 4840 info()->SetAstValueFactory(ast_value_factory_); | 4840 info()->SetAstValueFactory(ast_value_factory_); |
| 4841 } | 4841 } |
| 4842 ast_value_factory_ = NULL; | 4842 ast_value_factory_ = NULL; |
| 4843 return (result != NULL); | 4843 return (result != NULL); |
| 4844 } | 4844 } |
| 4845 | 4845 |
| 4846 } } // namespace v8::internal | 4846 } } // namespace v8::internal |
| OLD | NEW |