| OLD | NEW |
| 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 #include <memory> |
| 9 | 9 |
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
| 11 #include "src/code-factory.h" | 11 #include "src/code-factory.h" |
| 12 #include "src/compilation-info.h" | 12 #include "src/compilation-info.h" |
| 13 #include "src/compiler.h" | 13 #include "src/compiler.h" |
| 14 #include "src/factory.h" | 14 #include "src/factory.h" |
| 15 #include "src/interpreter/bytecode-array-iterator.h" |
| 15 #include "src/interpreter/bytecode-flags.h" | 16 #include "src/interpreter/bytecode-flags.h" |
| 16 #include "src/interpreter/bytecode-generator.h" | 17 #include "src/interpreter/bytecode-generator.h" |
| 17 #include "src/interpreter/bytecodes.h" | 18 #include "src/interpreter/bytecodes.h" |
| 18 #include "src/interpreter/interpreter-assembler.h" | 19 #include "src/interpreter/interpreter-assembler.h" |
| 19 #include "src/interpreter/interpreter-intrinsics.h" | 20 #include "src/interpreter/interpreter-intrinsics.h" |
| 20 #include "src/log.h" | 21 #include "src/log.h" |
| 21 #include "src/zone/zone.h" | 22 #include "src/zone/zone.h" |
| 22 | 23 |
| 23 namespace v8 { | 24 namespace v8 { |
| 24 namespace internal { | 25 namespace internal { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 return nullptr; | 255 return nullptr; |
| 255 } | 256 } |
| 256 | 257 |
| 257 uintptr_t Interpreter::GetDispatchCounter(Bytecode from, Bytecode to) const { | 258 uintptr_t Interpreter::GetDispatchCounter(Bytecode from, Bytecode to) const { |
| 258 int from_index = Bytecodes::ToByte(from); | 259 int from_index = Bytecodes::ToByte(from); |
| 259 int to_index = Bytecodes::ToByte(to); | 260 int to_index = Bytecodes::ToByte(to); |
| 260 return bytecode_dispatch_counters_table_[from_index * kNumberOfBytecodes + | 261 return bytecode_dispatch_counters_table_[from_index * kNumberOfBytecodes + |
| 261 to_index]; | 262 to_index]; |
| 262 } | 263 } |
| 263 | 264 |
| 265 // static |
| 266 int Interpreter::AdvanceBytecodeOffset(BytecodeArray* bytecode_array, |
| 267 int bytecode_offset) { |
| 268 DisallowHeapAllocation no_gc; |
| 269 HandleScope scope(bytecode_array->GetIsolate()); |
| 270 BytecodeArrayIterator it(handle(bytecode_array)); |
| 271 int offset = bytecode_offset - BytecodeArray::kHeaderSize + kHeapObjectTag; |
| 272 while (it.current_offset() < offset) it.Advance(); |
| 273 DCHECK_EQ(offset, it.current_offset()); |
| 274 it.Advance(); // Advance by one bytecode. |
| 275 return it.current_offset() + BytecodeArray::kHeaderSize - kHeapObjectTag; |
| 276 } |
| 277 |
| 264 Local<v8::Object> Interpreter::GetDispatchCountersObject() { | 278 Local<v8::Object> Interpreter::GetDispatchCountersObject() { |
| 265 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(isolate_); | 279 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(isolate_); |
| 266 Local<v8::Context> context = isolate->GetCurrentContext(); | 280 Local<v8::Context> context = isolate->GetCurrentContext(); |
| 267 | 281 |
| 268 Local<v8::Object> counters_map = v8::Object::New(isolate); | 282 Local<v8::Object> counters_map = v8::Object::New(isolate); |
| 269 | 283 |
| 270 // Output is a JSON-encoded object of objects. | 284 // Output is a JSON-encoded object of objects. |
| 271 // | 285 // |
| 272 // The keys on the top level object are source bytecodes, | 286 // The keys on the top level object are source bytecodes, |
| 273 // and corresponding value are objects. Keys on these last are the | 287 // and corresponding value are objects. Keys on these last are the |
| (...skipping 2468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2742 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2756 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 2743 __ SmiTag(new_state)); | 2757 __ SmiTag(new_state)); |
| 2744 __ SetAccumulator(old_state); | 2758 __ SetAccumulator(old_state); |
| 2745 | 2759 |
| 2746 __ Dispatch(); | 2760 __ Dispatch(); |
| 2747 } | 2761 } |
| 2748 | 2762 |
| 2749 } // namespace interpreter | 2763 } // namespace interpreter |
| 2750 } // namespace internal | 2764 } // namespace internal |
| 2751 } // namespace v8 | 2765 } // namespace v8 |
| OLD | NEW |