[cleanup] Replace more unique_ptr by Optional

And in one case just remove it since it is superflous.

R=mstarzinger@chromium.org
BUG=v8:6474

Change-Id: I60bfac75f5d65a56c7ca8d67923e9314ec703eac
Reviewed-on: https://chromium-review.googlesource.com/529244
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45816}
This commit is contained in:
Clemens Hammacher 2017-06-09 14:49:42 +02:00 committed by Commit Bot
parent 5ac26293f1
commit 8cb1af2ced
2 changed files with 8 additions and 7 deletions

View File

@ -12,6 +12,7 @@
#include "src/ast/ast-numbering.h"
#include "src/ast/prettyprinter.h"
#include "src/ast/scopes.h"
#include "src/base/optional.h"
#include "src/bootstrapper.h"
#include "src/codegen.h"
#include "src/compilation-cache.h"
@ -623,9 +624,9 @@ bool CompileUnoptimizedCode(CompilationInfo* info,
Compiler::EagerInnerFunctionLiterals inner_literals;
{
std::unique_ptr<CompilationHandleScope> compilation_handle_scope;
base::Optional<CompilationHandleScope> compilation_handle_scope;
if (inner_function_mode == Compiler::CONCURRENT) {
compilation_handle_scope.reset(new CompilationHandleScope(info));
compilation_handle_scope.emplace(info);
}
if (!Compiler::Analyze(info, &inner_literals)) {
if (!isolate->has_pending_exception()) isolate->StackOverflow();
@ -960,9 +961,9 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
// In case of concurrent recompilation, all handles below this point will be
// allocated in a deferred handle scope that is detached and handed off to
// the background thread when we return.
std::unique_ptr<CompilationHandleScope> compilation;
base::Optional<CompilationHandleScope> compilation;
if (mode == Compiler::CONCURRENT) {
compilation.reset(new CompilationHandleScope(info));
compilation.emplace(info);
}
// All handles below will be canonicalized.

View File

@ -405,10 +405,10 @@ bool ComputeLocation(Isolate* isolate, MessageLocation* target) {
Handle<String> RenderCallSite(Isolate* isolate, Handle<Object> object) {
MessageLocation location;
if (ComputeLocation(isolate, &location)) {
std::unique_ptr<ParseInfo> info(new ParseInfo(location.shared()));
if (parsing::ParseAny(info.get(), isolate)) {
ParseInfo info(location.shared());
if (parsing::ParseAny(&info, isolate)) {
CallPrinter printer(isolate, location.shared()->IsUserJavaScript());
Handle<String> str = printer.Print(info->literal(), location.start_pos());
Handle<String> str = printer.Print(info.literal(), location.start_pos());
if (str->length() > 0) return str;
} else {
isolate->clear_pending_exception();