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> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 result = | 877 result = |
878 DoParseLazy(info, ast_value_factory()->GetString(name), stream.get()); | 878 DoParseLazy(info, ast_value_factory()->GetString(name), stream.get()); |
879 if (result != nullptr) { | 879 if (result != nullptr) { |
880 Handle<String> inferred_name(shared_info->inferred_name()); | 880 Handle<String> inferred_name(shared_info->inferred_name()); |
881 result->set_inferred_name(inferred_name); | 881 result->set_inferred_name(inferred_name); |
882 } | 882 } |
883 } | 883 } |
884 | 884 |
885 if (FLAG_trace_parse && result != NULL) { | 885 if (FLAG_trace_parse && result != NULL) { |
886 double ms = timer.Elapsed().InMillisecondsF(); | 886 double ms = timer.Elapsed().InMillisecondsF(); |
| 887 // We need to make sure that the debug-name is available. |
| 888 ast_value_factory()->Internalize(isolate); |
887 std::unique_ptr<char[]> name_chars = result->debug_name()->ToCString(); | 889 std::unique_ptr<char[]> name_chars = result->debug_name()->ToCString(); |
888 PrintF("[parsing function: %s - took %0.3f ms]\n", name_chars.get(), ms); | 890 PrintF("[parsing function: %s - took %0.3f ms]\n", name_chars.get(), ms); |
889 } | 891 } |
890 return result; | 892 return result; |
891 } | 893 } |
892 | 894 |
893 static FunctionLiteral::FunctionType ComputeFunctionType(ParseInfo* info) { | 895 static FunctionLiteral::FunctionType ComputeFunctionType(ParseInfo* info) { |
894 if (info->is_declaration()) { | 896 if (info->is_declaration()) { |
895 return FunctionLiteral::kDeclaration; | 897 return FunctionLiteral::kDeclaration; |
896 } else if (info->is_named_expression()) { | 898 } else if (info->is_named_expression()) { |
(...skipping 4936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5833 node->Print(Isolate::Current()); | 5835 node->Print(Isolate::Current()); |
5834 } | 5836 } |
5835 #endif // DEBUG | 5837 #endif // DEBUG |
5836 | 5838 |
5837 #undef CHECK_OK | 5839 #undef CHECK_OK |
5838 #undef CHECK_OK_VOID | 5840 #undef CHECK_OK_VOID |
5839 #undef CHECK_FAILED | 5841 #undef CHECK_FAILED |
5840 | 5842 |
5841 } // namespace internal | 5843 } // namespace internal |
5842 } // namespace v8 | 5844 } // namespace v8 |
OLD | NEW |