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

Side by Side Diff: src/interpreter/interpreter.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/interpreter/interpreter.h ('k') | src/log.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/interpreter.h" 5 #include "src/interpreter/interpreter.h"
6 6
7 #include <fstream> 7 #include <fstream>
8 #include <memory>
8 9
9 #include "src/ast/prettyprinter.h" 10 #include "src/ast/prettyprinter.h"
10 #include "src/code-factory.h" 11 #include "src/code-factory.h"
11 #include "src/compiler.h" 12 #include "src/compiler.h"
12 #include "src/factory.h" 13 #include "src/factory.h"
13 #include "src/interpreter/bytecode-flags.h" 14 #include "src/interpreter/bytecode-flags.h"
14 #include "src/interpreter/bytecode-generator.h" 15 #include "src/interpreter/bytecode-generator.h"
15 #include "src/interpreter/bytecodes.h" 16 #include "src/interpreter/bytecodes.h"
16 #include "src/interpreter/interpreter-assembler.h" 17 #include "src/interpreter/interpreter-assembler.h"
17 #include "src/interpreter/interpreter-intrinsics.h" 18 #include "src/interpreter/interpreter-intrinsics.h"
(...skipping 14 matching lines...) Expand all
32 memset(dispatch_table_, 0, sizeof(dispatch_table_)); 33 memset(dispatch_table_, 0, sizeof(dispatch_table_));
33 } 34 }
34 35
35 void Interpreter::Initialize() { 36 void Interpreter::Initialize() {
36 if (IsDispatchTableInitialized()) return; 37 if (IsDispatchTableInitialized()) return;
37 Zone zone(isolate_->allocator()); 38 Zone zone(isolate_->allocator());
38 HandleScope scope(isolate_); 39 HandleScope scope(isolate_);
39 40
40 if (FLAG_trace_ignition_dispatches) { 41 if (FLAG_trace_ignition_dispatches) {
41 static const int kBytecodeCount = static_cast<int>(Bytecode::kLast) + 1; 42 static const int kBytecodeCount = static_cast<int>(Bytecode::kLast) + 1;
42 bytecode_dispatch_counters_table_.Reset( 43 bytecode_dispatch_counters_table_.reset(
43 new uintptr_t[kBytecodeCount * kBytecodeCount]); 44 new uintptr_t[kBytecodeCount * kBytecodeCount]);
44 memset(bytecode_dispatch_counters_table_.get(), 0, 45 memset(bytecode_dispatch_counters_table_.get(), 0,
45 sizeof(uintptr_t) * kBytecodeCount * kBytecodeCount); 46 sizeof(uintptr_t) * kBytecodeCount * kBytecodeCount);
46 } 47 }
47 48
48 // Generate bytecode handlers for all bytecodes and scales. 49 // Generate bytecode handlers for all bytecodes and scales.
49 const OperandScale kOperandScales[] = { 50 const OperandScale kOperandScales[] = {
50 #define VALUE(Name, _) OperandScale::k##Name, 51 #define VALUE(Name, _) OperandScale::k##Name,
51 OPERAND_SCALE_LIST(VALUE) 52 OPERAND_SCALE_LIST(VALUE)
52 #undef VALUE 53 #undef VALUE
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 134 }
134 135
135 bool Interpreter::MakeBytecode(CompilationInfo* info) { 136 bool Interpreter::MakeBytecode(CompilationInfo* info) {
136 RuntimeCallTimerScope runtimeTimer(info->isolate(), 137 RuntimeCallTimerScope runtimeTimer(info->isolate(),
137 &RuntimeCallStats::CompileIgnition); 138 &RuntimeCallStats::CompileIgnition);
138 TimerEventScope<TimerEventCompileIgnition> timer(info->isolate()); 139 TimerEventScope<TimerEventCompileIgnition> timer(info->isolate());
139 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileIgnition"); 140 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileIgnition");
140 141
141 if (FLAG_print_bytecode || FLAG_print_ast) { 142 if (FLAG_print_bytecode || FLAG_print_ast) {
142 OFStream os(stdout); 143 OFStream os(stdout);
143 base::SmartArrayPointer<char> name = info->GetDebugName(); 144 std::unique_ptr<char[]> name = info->GetDebugName();
144 os << "[generating bytecode for function: " << info->GetDebugName().get() 145 os << "[generating bytecode for function: " << info->GetDebugName().get()
145 << "]" << std::endl 146 << "]" << std::endl
146 << std::flush; 147 << std::flush;
147 } 148 }
148 149
149 #ifdef DEBUG 150 #ifdef DEBUG
150 if (info->parse_info() && FLAG_print_ast) { 151 if (info->parse_info() && FLAG_print_ast) {
151 OFStream os(stdout); 152 OFStream os(stdout);
152 os << "--- AST ---" << std::endl 153 os << "--- AST ---" << std::endl
153 << AstPrinter(info->isolate()).PrintProgram(info->literal()) << std::endl 154 << AstPrinter(info->isolate()).PrintProgram(info->literal()) << std::endl
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 2128 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
2128 __ SmiTag(new_state)); 2129 __ SmiTag(new_state));
2129 __ SetAccumulator(old_state); 2130 __ SetAccumulator(old_state);
2130 2131
2131 __ Dispatch(); 2132 __ Dispatch();
2132 } 2133 }
2133 2134
2134 } // namespace interpreter 2135 } // namespace interpreter
2135 } // namespace internal 2136 } // namespace internal
2136 } // namespace v8 2137 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698