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

Side by Side Diff: src/parsing/parser.cc

Issue 2173403002: Replace SmartArrayPointer<T> with unique_ptr<T[]> (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 5 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
« no previous file with comments | « src/objects-printer.cc ('k') | src/perf-jit.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 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-literal-reindexer.h" 12 #include "src/ast/ast-literal-reindexer.h"
11 #include "src/ast/ast-traversal-visitor.h" 13 #include "src/ast/ast-traversal-visitor.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
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
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 6003 matching lines...) Expand 10 before | Expand all | Expand 10 after
7080 node->Print(Isolate::Current()); 7081 node->Print(Isolate::Current());
7081 } 7082 }
7082 #endif // DEBUG 7083 #endif // DEBUG
7083 7084
7084 #undef CHECK_OK 7085 #undef CHECK_OK
7085 #undef CHECK_OK_VOID 7086 #undef CHECK_OK_VOID
7086 #undef CHECK_FAILED 7087 #undef CHECK_FAILED
7087 7088
7088 } // namespace internal 7089 } // namespace internal
7089 } // namespace v8 7090 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/perf-jit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698