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

Side by Side Diff: src/compiler.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/compiler.h ('k') | src/compiler/graph-visualizer.h » ('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/compiler.h" 5 #include "src/compiler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory>
8 9
9 #include "src/asmjs/asm-js.h" 10 #include "src/asmjs/asm-js.h"
10 #include "src/asmjs/asm-typer.h" 11 #include "src/asmjs/asm-typer.h"
11 #include "src/ast/ast-numbering.h" 12 #include "src/ast/ast-numbering.h"
12 #include "src/ast/prettyprinter.h" 13 #include "src/ast/prettyprinter.h"
13 #include "src/ast/scopeinfo.h" 14 #include "src/ast/scopeinfo.h"
14 #include "src/ast/scopes.h" 15 #include "src/ast/scopes.h"
15 #include "src/bootstrapper.h" 16 #include "src/bootstrapper.h"
16 #include "src/codegen.h" 17 #include "src/codegen.h"
17 #include "src/compilation-cache.h" 18 #include "src/compilation-cache.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 !literal()->dont_optimize() && 175 !literal()->dont_optimize() &&
175 literal()->scope()->AllowsLazyCompilation() && 176 literal()->scope()->AllowsLazyCompilation() &&
176 !shared_info()->optimization_disabled(); 177 !shared_info()->optimization_disabled();
177 } 178 }
178 179
179 180
180 bool CompilationInfo::has_simple_parameters() { 181 bool CompilationInfo::has_simple_parameters() {
181 return scope()->has_simple_parameters(); 182 return scope()->has_simple_parameters();
182 } 183 }
183 184
184 185 std::unique_ptr<char[]> CompilationInfo::GetDebugName() const {
185 base::SmartArrayPointer<char> CompilationInfo::GetDebugName() const {
186 if (parse_info() && parse_info()->literal()) { 186 if (parse_info() && parse_info()->literal()) {
187 AllowHandleDereference allow_deref; 187 AllowHandleDereference allow_deref;
188 return parse_info()->literal()->debug_name()->ToCString(); 188 return parse_info()->literal()->debug_name()->ToCString();
189 } 189 }
190 if (parse_info() && !parse_info()->shared_info().is_null()) { 190 if (parse_info() && !parse_info()->shared_info().is_null()) {
191 return parse_info()->shared_info()->DebugName()->ToCString(); 191 return parse_info()->shared_info()->DebugName()->ToCString();
192 } 192 }
193 Vector<const char> name_vec = debug_name_; 193 Vector<const char> name_vec = debug_name_;
194 if (name_vec.is_empty()) name_vec = ArrayVector("unknown"); 194 if (name_vec.is_empty()) name_vec = ArrayVector("unknown");
195 base::SmartArrayPointer<char> name(new char[name_vec.length() + 1]); 195 std::unique_ptr<char[]> name(new char[name_vec.length() + 1]);
196 memcpy(name.get(), name_vec.start(), name_vec.length()); 196 memcpy(name.get(), name_vec.start(), name_vec.length());
197 name[name_vec.length()] = '\0'; 197 name[name_vec.length()] = '\0';
198 return name; 198 return name;
199 } 199 }
200 200
201 StackFrame::Type CompilationInfo::GetOutputStackFrameType() const { 201 StackFrame::Type CompilationInfo::GetOutputStackFrameType() const {
202 switch (output_code_kind()) { 202 switch (output_code_kind()) {
203 case Code::STUB: 203 case Code::STUB:
204 case Code::BYTECODE_HANDLER: 204 case Code::BYTECODE_HANDLER:
205 case Code::HANDLER: 205 case Code::HANDLER:
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 DCHECK(shared->is_compiled()); 1889 DCHECK(shared->is_compiled());
1890 function->set_literals(cached.literals); 1890 function->set_literals(cached.literals);
1891 } else if (shared->is_compiled()) { 1891 } else if (shared->is_compiled()) {
1892 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1892 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1893 JSFunction::EnsureLiterals(function); 1893 JSFunction::EnsureLiterals(function);
1894 } 1894 }
1895 } 1895 }
1896 1896
1897 } // namespace internal 1897 } // namespace internal
1898 } // namespace v8 1898 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/compiler/graph-visualizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698