v8/src/d8-console.h
Camillo Bruni 08dba83aa4 [d8] Support more console functions
- console.assert now fails properly
- console.trace dumps a low-level stack trace
- console.time/End dumps a timer event to the log file
- console.timeStamp dumps a timer event to the log

Drive-by-fixes:
- simplify test-log.cc
- fix test-log.cc log parser JS helper
- always start the default timer int the logger

Change-Id: I0bb26b9410a4e0d1d5bc8621d8b2243922fe3f29
Reviewed-on: https://chromium-review.googlesource.com/702459
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48531}
2017-10-13 10:44:17 +00:00

48 lines
1.7 KiB
C++

// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_D8_CONSOLE_H_
#define V8_D8_CONSOLE_H_
#include "src/base/platform/time.h"
#include "src/debug/debug-interface.h"
#include "src/debug/interface-types.h"
namespace v8 {
class D8Console : public debug::ConsoleDelegate {
public:
explicit D8Console(Isolate* isolate);
private:
void Assert(const debug::ConsoleCallArguments& args,
const v8::debug::ConsoleContext&) override;
void Log(const debug::ConsoleCallArguments& args,
const v8::debug::ConsoleContext&) override;
void Error(const debug::ConsoleCallArguments& args,
const v8::debug::ConsoleContext&) override;
void Warn(const debug::ConsoleCallArguments& args,
const v8::debug::ConsoleContext&) override;
void Info(const debug::ConsoleCallArguments& args,
const v8::debug::ConsoleContext&) override;
void Debug(const debug::ConsoleCallArguments& args,
const v8::debug::ConsoleContext&) override;
void Time(const debug::ConsoleCallArguments& args,
const v8::debug::ConsoleContext&) override;
void TimeEnd(const debug::ConsoleCallArguments& args,
const v8::debug::ConsoleContext&) override;
void TimeStamp(const debug::ConsoleCallArguments& args,
const v8::debug::ConsoleContext&) override;
void Trace(const debug::ConsoleCallArguments& args,
const v8::debug::ConsoleContext&) override;
Isolate* isolate_;
std::map<std::string, base::TimeTicks> timers_;
base::TimeTicks default_timer_;
};
} // namespace v8
#endif // V8_D8_CONSOLE_H_