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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "src/api.h" | 9 #include "src/api.h" |
8 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
9 #include "src/ast/ast-expression-rewriter.h" | 11 #include "src/ast/ast-expression-rewriter.h" |
10 #include "src/ast/ast-expression-visitor.h" | 12 #include "src/ast/ast-expression-visitor.h" |
11 #include "src/ast/ast-literal-reindexer.h" | 13 #include "src/ast/ast-literal-reindexer.h" |
12 #include "src/ast/scopeinfo.h" | 14 #include "src/ast/scopeinfo.h" |
13 #include "src/bailout-reason.h" | 15 #include "src/bailout-reason.h" |
14 #include "src/base/platform/platform.h" | 16 #include "src/base/platform/platform.h" |
15 #include "src/bootstrapper.h" | 17 #include "src/bootstrapper.h" |
16 #include "src/char-predicates-inl.h" | 18 #include "src/char-predicates-inl.h" |
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 DCHECK_EQ(scanner_.peek_location().beg_pos, source->length()); | 905 DCHECK_EQ(scanner_.peek_location().beg_pos, source->length()); |
904 } | 906 } |
905 HandleSourceURLComments(isolate, info->script()); | 907 HandleSourceURLComments(isolate, info->script()); |
906 | 908 |
907 if (FLAG_trace_parse && result != NULL) { | 909 if (FLAG_trace_parse && result != NULL) { |
908 double ms = timer.Elapsed().InMillisecondsF(); | 910 double ms = timer.Elapsed().InMillisecondsF(); |
909 if (info->is_eval()) { | 911 if (info->is_eval()) { |
910 PrintF("[parsing eval"); | 912 PrintF("[parsing eval"); |
911 } else if (info->script()->name()->IsString()) { | 913 } else if (info->script()->name()->IsString()) { |
912 String* name = String::cast(info->script()->name()); | 914 String* name = String::cast(info->script()->name()); |
913 base::SmartArrayPointer<char> name_chars = name->ToCString(); | 915 std::unique_ptr<char[]> name_chars = name->ToCString(); |
914 PrintF("[parsing script: %s", name_chars.get()); | 916 PrintF("[parsing script: %s", name_chars.get()); |
915 } else { | 917 } else { |
916 PrintF("[parsing script"); | 918 PrintF("[parsing script"); |
917 } | 919 } |
918 PrintF(" - took %0.3f ms]\n", ms); | 920 PrintF(" - took %0.3f ms]\n", ms); |
919 } | 921 } |
920 if (produce_cached_parse_data()) { | 922 if (produce_cached_parse_data()) { |
921 if (result != NULL) *info->cached_data() = recorder.GetScriptData(); | 923 if (result != NULL) *info->cached_data() = recorder.GetScriptData(); |
922 log_ = NULL; | 924 log_ = NULL; |
923 } | 925 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 result = ParseLazy(isolate, info, &stream); | 1057 result = ParseLazy(isolate, info, &stream); |
1056 } else { | 1058 } else { |
1057 GenericStringUtf16CharacterStream stream(source, | 1059 GenericStringUtf16CharacterStream stream(source, |
1058 shared_info->start_position(), | 1060 shared_info->start_position(), |
1059 shared_info->end_position()); | 1061 shared_info->end_position()); |
1060 result = ParseLazy(isolate, info, &stream); | 1062 result = ParseLazy(isolate, info, &stream); |
1061 } | 1063 } |
1062 | 1064 |
1063 if (FLAG_trace_parse && result != NULL) { | 1065 if (FLAG_trace_parse && result != NULL) { |
1064 double ms = timer.Elapsed().InMillisecondsF(); | 1066 double ms = timer.Elapsed().InMillisecondsF(); |
1065 base::SmartArrayPointer<char> name_chars = | 1067 std::unique_ptr<char[]> name_chars = result->debug_name()->ToCString(); |
1066 result->debug_name()->ToCString(); | |
1067 PrintF("[parsing function: %s - took %0.3f ms]\n", name_chars.get(), ms); | 1068 PrintF("[parsing function: %s - took %0.3f ms]\n", name_chars.get(), ms); |
1068 } | 1069 } |
1069 return result; | 1070 return result; |
1070 } | 1071 } |
1071 | 1072 |
1072 static FunctionLiteral::FunctionType ComputeFunctionType( | 1073 static FunctionLiteral::FunctionType ComputeFunctionType( |
1073 Handle<SharedFunctionInfo> shared_info) { | 1074 Handle<SharedFunctionInfo> shared_info) { |
1074 if (shared_info->is_declaration()) { | 1075 if (shared_info->is_declaration()) { |
1075 return FunctionLiteral::kDeclaration; | 1076 return FunctionLiteral::kDeclaration; |
1076 } else if (shared_info->is_named_expression()) { | 1077 } else if (shared_info->is_named_expression()) { |
(...skipping 6010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7087 node->Print(Isolate::Current()); | 7088 node->Print(Isolate::Current()); |
7088 } | 7089 } |
7089 #endif // DEBUG | 7090 #endif // DEBUG |
7090 | 7091 |
7091 #undef CHECK_OK | 7092 #undef CHECK_OK |
7092 #undef CHECK_OK_VOID | 7093 #undef CHECK_OK_VOID |
7093 #undef CHECK_FAILED | 7094 #undef CHECK_FAILED |
7094 | 7095 |
7095 } // namespace internal | 7096 } // namespace internal |
7096 } // namespace v8 | 7097 } // namespace v8 |
OLD | NEW |