1 // Copyright 2016 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "src/extensions/ignition-statistics-extension.h" 6 7 #include "src/base/logging.h" 8 #include "src/interpreter/bytecodes.h" 9 #include "src/interpreter/interpreter.h" 10 #include "src/isolate.h" 11 12 namespace v8 { 13 namespace internal { 14 15 v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(v8::Isolate * isolate,v8::Local<v8::String> name)16IgnitionStatisticsExtension::GetNativeFunctionTemplate( 17 v8::Isolate* isolate, v8::Local<v8::String> name) { 18 DCHECK_EQ(strcmp(*v8::String::Utf8Value(isolate, name), 19 "getIgnitionDispatchCounters"), 20 0); 21 return v8::FunctionTemplate::New( 22 isolate, IgnitionStatisticsExtension::GetIgnitionDispatchCounters); 23 } 24 25 const char* const IgnitionStatisticsExtension::kSource = 26 "native function getIgnitionDispatchCounters();"; 27 GetIgnitionDispatchCounters(const v8::FunctionCallbackInfo<v8::Value> & args)28void IgnitionStatisticsExtension::GetIgnitionDispatchCounters( 29 const v8::FunctionCallbackInfo<v8::Value>& args) { 30 DCHECK(FLAG_trace_ignition_dispatches); 31 args.GetReturnValue().Set(reinterpret_cast<Isolate*>(args.GetIsolate()) 32 ->interpreter() 33 ->GetDispatchCountersObject()); 34 } 35 36 } // namespace internal 37 } // namespace v8 38