| Index: src/code-events.h
|
| diff --git a/src/code.h b/src/code-events.h
|
| similarity index 58%
|
| copy from src/code.h
|
| copy to src/code-events.h
|
| index 766c932e0f6182697670996180f5f66829751245..09e7711739e8a1b6d524772f40e0dc8255c2d00c 100644
|
| --- a/src/code.h
|
| +++ b/src/code-events.h
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2006-2008 the V8 project authors. All rights reserved.
|
| +// Copyright 2012 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -25,46 +25,52 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -#ifndef V8_CODE_H_
|
| -#define V8_CODE_H_
|
| +#ifndef V8_CODE_EVENTS_H_
|
| +#define V8_CODE_EVENTS_H_
|
|
|
| #include "allocation.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
|
|
| +class CompilationInfo;
|
|
|
| -// Wrapper class for passing expected and actual parameter counts as
|
| -// either registers or immediate values. Used to make sure that the
|
| -// caller provides exactly the expected number of parameters to the
|
| -// callee.
|
| -class ParameterCount BASE_EMBEDDED {
|
| +class CodeEvents : public AllStatic {
|
| public:
|
| - explicit ParameterCount(Register reg)
|
| - : reg_(reg), immediate_(0) { }
|
| - explicit ParameterCount(int immediate)
|
| - : reg_(no_reg), immediate_(immediate) { }
|
| -
|
| - bool is_reg() const { return !reg_.is(no_reg); }
|
| - bool is_immediate() const { return !is_reg(); }
|
| -
|
| - Register reg() const {
|
| - ASSERT(is_reg());
|
| - return reg_;
|
| + static bool is_active() {
|
| + return event_handler_ != NULL;
|
| }
|
| - int immediate() const {
|
| - ASSERT(is_immediate());
|
| - return immediate_;
|
| +
|
| + static void set_handler(JitCodeEventHandler event_handler) {
|
| + event_handler_ = event_handler;
|
| }
|
|
|
| - private:
|
| - const Register reg_;
|
| - const int immediate_;
|
| + // Code added notifications.
|
| + static void AddCode(const char* name,
|
| + Code* code,
|
| + Script* script,
|
| + CompilationInfo* info);
|
| + static void AddCode(Handle<String> name,
|
| + Handle<Script> script,
|
| + Handle<Code> code,
|
| + CompilationInfo* info);
|
| + static void AddCode(String* name, Code* code);
|
| + static void AddCode(const char* name, Code* code);
|
| + static void AddCode(Code* code);
|
|
|
| - DISALLOW_IMPLICIT_CONSTRUCTORS(ParameterCount);
|
| + // Code moved notification.
|
| + static void MoveCode(Address src, Address dst);
|
| +
|
| + // Code removed notification.
|
| + static void RemoveCode(Code* code);
|
| +
|
| + private:
|
| + static JitCodeEventHandler event_handler_;
|
| };
|
|
|
| +#define JIT_CODE_EVENT(action) \
|
| + do { if (CodeEvents::is_active()) CodeEvents::action; } while(0)
|
|
|
| } } // namespace v8::internal
|
|
|
| -#endif // V8_CODE_H_
|
| +#endif // V8_CODE_EVENTS_H_
|
|
|