Author: [email protected]
Date: Fri Feb 20 01:07:06 2009
New Revision: 1325

Modified:
    branches/experimental/toiger/   (props changed)
    branches/experimental/toiger/include/v8-debug.h
    branches/experimental/toiger/src/api.cc
    branches/experimental/toiger/src/bytecodes-irregexp.h
    branches/experimental/toiger/src/debug.cc
    branches/experimental/toiger/src/debug.h
    branches/experimental/toiger/src/interpreter-irregexp.cc
    branches/experimental/toiger/src/jsregexp.cc
    branches/experimental/toiger/src/jsregexp.h
    branches/experimental/toiger/src/regexp-macro-assembler-irregexp-inl.h    
(contents, props changed)
    branches/experimental/toiger/src/regexp-macro-assembler-irregexp.cc
    branches/experimental/toiger/src/regexp-macro-assembler-irregexp.h
    branches/experimental/toiger/src/scopes.cc
    branches/experimental/toiger/test/cctest/test-debug.cc
     
branches/experimental/toiger/test/mjsunit/global-load-from-eval-in-with.js    
(props changed)
    branches/experimental/toiger/test/mjsunit/local-load-from-eval.js    
(contents, props changed)
    branches/experimental/toiger/test/mjsunit/property-load-across-eval.js    
(props changed)
    branches/experimental/toiger/tools/tickprocessor.py

Log:
Experimental: merge from bleeding_edge to the code generator branch.
Merge bleeding edge up to and including r1324.

Modified: branches/experimental/toiger/include/v8-debug.h
==============================================================================
--- branches/experimental/toiger/include/v8-debug.h     (original)
+++ branches/experimental/toiger/include/v8-debug.h     Fri Feb 20 01:07:06 2009
@@ -99,12 +99,23 @@
   *
   * \param message the debug message
   * \param length length of the message
+ * \param data the data value passed when registering the message handler
   * A DebugMessageHandler does not take posession of the message string,
   * and must not rely on the data persisting after the handler returns.
   */
  typedef void (*DebugMessageHandler)(const uint16_t* message, int length,
                                      void* data);

+/**
+ * Debug host dispatch callback function.
+ *
+ * \param dispatch the dispatch value
+ * \param data the data value passed when registering the dispatch handler
+ */
+typedef void (*DebugHostDispatchHandler)(void* dispatch,
+                                         void* data);
+
+

  class EXPORT Debug {
   public:
@@ -122,6 +133,11 @@
    // Message based interface. The message protocol is JSON.
    static void SetMessageHandler(DebugMessageHandler handler, void* data =  
NULL);
    static void SendCommand(const uint16_t* command, int length);
+
+  // Dispatch interface.
+  static void SetHostDispatchHandler(DebugHostDispatchHandler handler,
+                                     void* data = NULL);
+  static void SendHostDispatch(void* dispatch);

   /**
    * Run a JavaScript function in the debugger.

Modified: branches/experimental/toiger/src/api.cc
==============================================================================
--- branches/experimental/toiger/src/api.cc     (original)
+++ branches/experimental/toiger/src/api.cc     Fri Feb 20 01:07:06 2009
@@ -2924,6 +2924,19 @@
  }


+void Debug::SetHostDispatchHandler(v8::DebugHostDispatchHandler handler,
+                                   void* data) {
+  EnsureInitialized("v8::Debug::SetHostDispatchHandler");
+  i::Debugger::SetHostDispatchHandler(handler, data);
+}
+
+
+void Debug::SendHostDispatch(void* dispatch) {
+  if (!i::V8::HasBeenSetup()) return;
+  i::Debugger::ProcessHostDispatch(dispatch);
+}
+
+
  Handle<Value> Debug::Call(v8::Handle<v8::Function> fun,
                            v8::Handle<v8::Value> data) {
    if (!i::V8::HasBeenSetup()) return Handle<Value>();

Modified: branches/experimental/toiger/src/bytecodes-irregexp.h
==============================================================================
--- branches/experimental/toiger/src/bytecodes-irregexp.h       (original)
+++ branches/experimental/toiger/src/bytecodes-irregexp.h       Fri Feb 20  
01:07:06 2009
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2008-2009 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:
@@ -86,7 +86,8 @@
  V(CHECK_REGISTER_EQ_POS, 43, 8) /* bc8 reg_idx24  
addr32                     */ \
  V(CHECK_AT_START,    44, 8)   /* bc8 pad24  
addr32                           */ \
  V(CHECK_NOT_AT_START, 45, 8)  /* bc8 pad24  
addr32                           */ \
-V(CHECK_GREEDY,      46, 8)   /* bc8 pad24  
addr32                           */
+V(CHECK_GREEDY,      46, 8)   /* bc8 pad24  
addr32                           */ \
+V(ADVANCE_CP_AND_GOTO, 47, 8) /* bc8 offset24  
addr32                        */

  #define DECLARE_BYTECODES(name, code, length) \
    static const int BC_##name = code;

Modified: branches/experimental/toiger/src/debug.cc
==============================================================================
--- branches/experimental/toiger/src/debug.cc   (original)
+++ branches/experimental/toiger/src/debug.cc   Fri Feb 20 01:07:06 2009
@@ -1359,8 +1359,10 @@
  bool Debugger::compiling_natives_ = false;
  bool Debugger::is_loading_debugger_ = false;
  DebugMessageThread* Debugger::message_thread_ = NULL;
-v8::DebugMessageHandler Debugger::debug_message_handler_ = NULL;
-void* Debugger::debug_message_handler_data_ = NULL;
+v8::DebugMessageHandler Debugger::message_handler_ = NULL;
+void* Debugger::message_handler_data_ = NULL;
+v8::DebugHostDispatchHandler Debugger::host_dispatch_handler_ = NULL;
+void* Debugger::host_dispatch_handler_data_ = NULL;


  Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name,
@@ -1717,8 +1719,8 @@


  void Debugger::SetMessageHandler(v8::DebugMessageHandler handler, void*  
data) {
-  debug_message_handler_ = handler;
-  debug_message_handler_data_ = data;
+  message_handler_ = handler;
+  message_handler_data_ = data;
    if (!message_thread_) {
      message_thread_ = new DebugMessageThread();
      message_thread_->Start();
@@ -1727,14 +1729,20 @@
  }


+void Debugger::SetHostDispatchHandler(v8::DebugHostDispatchHandler handler,
+                                      void* data) {
+  host_dispatch_handler_ = handler;
+  host_dispatch_handler_data_ = data;
+}
+
+
  // Posts an output message from the debugger to the debug_message_handler
  // callback.  This callback is part of the public API.  Messages are
  // kept internally as Vector<uint16_t> strings, which are allocated in  
various
  // places and deallocated by the calling function sometime after this call.
  void Debugger::SendMessage(Vector< uint16_t> message) {
-  if (debug_message_handler_ != NULL) {
-    debug_message_handler_(message.start(), message.length(),
-                           debug_message_handler_data_);
+  if (message_handler_ != NULL) {
+    message_handler_(message.start(), message.length(),  
message_handler_data_);
    }
  }

@@ -1748,9 +1756,16 @@
  }


+void Debugger::ProcessHostDispatch(void* dispatch) {
+  if (message_thread_ != NULL) {
+    message_thread_->ProcessHostDispatch(dispatch);
+  }
+}
+
+
  void Debugger::UpdateActiveDebugger() {
    set_debugger_active((message_thread_ != NULL &&
-                       debug_message_handler_ != NULL) ||
+                       message_handler_ != NULL) ||
                         !event_listener_.is_null());
    if (!debugger_active() && message_thread_) {
      message_thread_->OnDebuggerInactive();
@@ -1922,6 +1937,16 @@
        return;
      }

+    // Check if the command is a host dispatch.
+    if (command[0] == 0) {
+      if (Debugger::host_dispatch_handler_) {
+        int32_t dispatch = (command[1] << 16) | command[2];
+        Debugger::host_dispatch_handler_(reinterpret_cast<void*>(dispatch),
+                                          
Debugger::host_dispatch_handler_data_);
+      }
+      continue;
+    }
+
      // Invoke the JavaScript to process the debug request.
      v8::Local<v8::String> fun_name;
      v8::Local<v8::Function> fun;
@@ -1995,6 +2020,18 @@
    Vector<uint16_t> command_copy = command.Clone();
    Logger::DebugTag("Put command on command_queue.");
    command_queue_.Put(command_copy);
+  command_received_->Signal();
+}
+
+
+// Puts a host dispatch comming from the public API on the queue.
+void DebugMessageThread::ProcessHostDispatch(void* dispatch) {
+  uint16_t hack[3];
+  hack[0] = 0;
+  hack[1] = reinterpret_cast<uint32_t>(dispatch) >> 16;
+  hack[2] = reinterpret_cast<uint32_t>(dispatch) & 0xFFFF;
+  Logger::DebugTag("Put dispatch on command_queue.");
+  command_queue_.Put(Vector<uint16_t>(hack, 3).Clone());
    command_received_->Signal();
  }


Modified: branches/experimental/toiger/src/debug.h
==============================================================================
--- branches/experimental/toiger/src/debug.h    (original)
+++ branches/experimental/toiger/src/debug.h    Fri Feb 20 01:07:06 2009
@@ -382,8 +382,11 @@
                                  Handle<Object> event_data);
    static void SetEventListener(Handle<Object> callback, Handle<Object>  
data);
    static void SetMessageHandler(v8::DebugMessageHandler handler, void*  
data);
+  static void SetHostDispatchHandler(v8::DebugHostDispatchHandler handler,
+                                     void* data);
    static void SendMessage(Vector<uint16_t> message);
    static void ProcessCommand(Vector<const uint16_t> command);
+  static void ProcessHostDispatch(void* dispatch);
    static void UpdateActiveDebugger();
    static Handle<Object> Call(Handle<JSFunction> fun,
                               Handle<Object> data,
@@ -412,8 +415,12 @@
    static bool compiling_natives_;  // Are we compiling natives?
    static bool is_loading_debugger_;  // Are we loading the debugger?
    static DebugMessageThread* message_thread_;
-  static v8::DebugMessageHandler debug_message_handler_;
-  static void* debug_message_handler_data_;
+  static v8::DebugMessageHandler message_handler_;
+  static void* message_handler_data_;
+  static v8::DebugHostDispatchHandler host_dispatch_handler_;
+  static void* host_dispatch_handler_data_;
+
+  friend class DebugMessageThread;
  };


@@ -482,6 +489,7 @@
    // by the API client thread.  This is where the API client hands off
    // processing of the command to the DebugMessageThread thread.
    void ProcessCommand(Vector<uint16_t> command);
+  void ProcessHostDispatch(void* dispatch);
    void OnDebuggerInactive();

    // Main function of DebugMessageThread thread.

Modified: branches/experimental/toiger/src/interpreter-irregexp.cc
==============================================================================
--- branches/experimental/toiger/src/interpreter-irregexp.cc    (original)
+++ branches/experimental/toiger/src/interpreter-irregexp.cc    Fri Feb 20  
01:07:06 2009
@@ -238,6 +238,10 @@
        BYTECODE(GOTO)
          pc = code_base + Load32Aligned(pc + 4);
          break;
+      BYTECODE(ADVANCE_CP_AND_GOTO)
+        current += insn >> BYTECODE_SHIFT;
+        pc = code_base + Load32Aligned(pc + 4);
+        break;
        BYTECODE(CHECK_GREEDY)
          if (current == backtrack_sp[-1]) {
            backtrack_sp--;

Modified: branches/experimental/toiger/src/jsregexp.cc
==============================================================================
--- branches/experimental/toiger/src/jsregexp.cc        (original)
+++ branches/experimental/toiger/src/jsregexp.cc        Fri Feb 20 01:07:06 2009
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2006-2009 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:
@@ -1527,6 +1527,13 @@
    // Generate deferred actions here along with code to undo them again.
    OutSet affected_registers;

+  if (backtrack() != NULL) {
+    // Here we have a concrete backtrack location.  These are set up by  
choice
+    // nodes and so they indicate that we have a deferred save of the  
current
+    // position which we may need to emit here.
+    assembler->PushCurrentPosition();
+  }
+
    int max_register = FindAffectedRegisters(&affected_registers);
    OutSet registers_to_pop;
    OutSet registers_to_clear;
@@ -1535,12 +1542,6 @@
                           affected_registers,
                           &registers_to_pop,
                           &registers_to_clear);
-  if (backtrack() != NULL) {
-    // Here we have a concrete backtrack location.  These are set up by  
choice
-    // nodes and so they indicate that we have a deferred save of the  
current
-    // position which we may need to emit here.
-    assembler->PushCurrentPosition();
-  }
    if (cp_offset_ != 0) {
      assembler->AdvanceCurrentPosition(cp_offset_);
    }
@@ -1553,9 +1554,6 @@

    // On backtrack we need to restore state.
    assembler->Bind(&undo);
-  if (backtrack() != NULL) {
-    assembler->PopCurrentPosition();
-  }
    RestoreAffectedRegisters(assembler,
                             max_register,
                             registers_to_pop,
@@ -1563,6 +1561,7 @@
    if (backtrack() == NULL) {
      assembler->Backtrack();
    } else {
+    assembler->PopCurrentPosition();
      assembler->GoTo(backtrack());
    }
  }
@@ -3053,10 +3052,6 @@
      }
    }
    ~AlternativeGenerationList() {
-    for (int i = 0; i < alt_gens_.length(); i++) {
-      alt_gens_[i]->possible_success.Unuse();
-      alt_gens_[i]->after.Unuse();
-    }
      for (int i = kAFew; i < alt_gens_.length(); i++) {
        delete alt_gens_[i];
        alt_gens_[i] = NULL;
@@ -3170,6 +3165,12 @@
    if (limit_result == DONE) return;
    ASSERT(limit_result == CONTINUE);

+  int new_flush_budget = trace->flush_budget() / choice_count;
+  if (trace->flush_budget() == 0 && trace->actions() != NULL) {
+    trace->Flush(compiler, this);
+    return;
+  }
+
    RecursionCheck rc(compiler);

    Trace* current_trace = trace;
@@ -3278,6 +3279,9 @@
        generate_full_check_inline = true;
      }
      if (generate_full_check_inline) {
+      if (new_trace.actions() != NULL) {
+        new_trace.set_flush_budget(new_flush_budget);
+      }
        for (int j = 0; j < guard_count; j++) {
          GenerateGuard(macro_assembler, guards->at(j), &new_trace);
        }
@@ -3294,13 +3298,21 @@
      macro_assembler->AdvanceCurrentPosition(-text_length);
      macro_assembler->GoTo(&second_choice);
    }
+
    // At this point we need to generate slow checks for the alternatives  
where
    // the quick check was inlined.  We can recognize these because the  
associated
    // label was bound.
    for (int i = first_normal_choice; i < choice_count - 1; i++) {
      AlternativeGeneration* alt_gen = alt_gens.at(i);
+    Trace new_trace(*current_trace);
+    // If there are actions to be flushed we have to limit how many times
+    // they are flushed.  Take the budget of the parent trace and  
distribute
+    // it fairly amongst the children.
+    if (new_trace.actions() != NULL) {
+      new_trace.set_flush_budget(new_flush_budget);
+    }
      EmitOutOfLineContinuation(compiler,
-                              current_trace,
+                              &new_trace,
                                alternatives_->at(i),
                                alt_gen,
                                preload_characters,

Modified: branches/experimental/toiger/src/jsregexp.h
==============================================================================
--- branches/experimental/toiger/src/jsregexp.h (original)
+++ branches/experimental/toiger/src/jsregexp.h Fri Feb 20 01:07:06 2009
@@ -1180,6 +1180,7 @@
          loop_label_(NULL),
          characters_preloaded_(0),
          bound_checked_up_to_(0),
+        flush_budget_(100),
          at_start_(UNKNOWN) { }

    // End the trace.  This involves flushing the deferred actions in the  
trace
@@ -1215,6 +1216,7 @@
    RegExpNode* stop_node() { return stop_node_; }
    int characters_preloaded() { return characters_preloaded_; }
    int bound_checked_up_to() { return bound_checked_up_to_; }
+  int flush_budget() { return flush_budget_; }
    QuickCheckDetails* quick_check_performed() { return  
&quick_check_performed_; }
    bool mentions_reg(int reg);
    // Returns true if a deferred position store exists to the specified
@@ -1233,6 +1235,7 @@
    void set_loop_label(Label* label) { loop_label_ = label; }
    void set_characters_preloaded(int cpre) { characters_preloaded_ = cpre; }
    void set_bound_checked_up_to(int to) { bound_checked_up_to_ = to; }
+  void set_flush_budget(int to) { flush_budget_ = to; }
    void set_quick_check_performed(QuickCheckDetails* d) {
      quick_check_performed_ = *d;
    }
@@ -1257,6 +1260,7 @@
    int characters_preloaded_;
    int bound_checked_up_to_;
    QuickCheckDetails quick_check_performed_;
+  int flush_budget_;
    TriBool at_start_;
  };


Modified:  
branches/experimental/toiger/src/regexp-macro-assembler-irregexp-inl.h
==============================================================================
--- branches/experimental/toiger/src/regexp-macro-assembler-irregexp-inl.h      
 
(original)
+++ branches/experimental/toiger/src/regexp-macro-assembler-irregexp-inl.h      
 
Fri Feb 20 01:07:06 2009
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2008-2009 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:

Modified:  
branches/experimental/toiger/src/regexp-macro-assembler-irregexp.cc
==============================================================================
--- branches/experimental/toiger/src/regexp-macro-assembler-irregexp.cc  
(original)
+++ branches/experimental/toiger/src/regexp-macro-assembler-irregexp.cc Fri  
Feb 20 01:07:06 2009
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2008-2009 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:
@@ -39,7 +39,8 @@
  RegExpMacroAssemblerIrregexp::RegExpMacroAssemblerIrregexp(Vector<byte>  
buffer)
      : buffer_(buffer),
        pc_(0),
-      own_buffer_(false) {
+      own_buffer_(false),
+      advance_current_end_(kInvalidPC) {
  }


@@ -55,6 +56,7 @@


  void RegExpMacroAssemblerIrregexp::Bind(Label* l) {
+  advance_current_end_ = kInvalidPC;
    ASSERT(!l->is_bound());
    if (l->is_linked()) {
      int pos = l->pos();
@@ -172,8 +174,17 @@


  void RegExpMacroAssemblerIrregexp::GoTo(Label* l) {
-  Emit(BC_GOTO, 0);
-  EmitOrLink(l);
+  if (advance_current_end_ == pc_) {
+    // Combine advance current and goto.
+    pc_ = advance_current_start_;
+    Emit(BC_ADVANCE_CP_AND_GOTO, advance_current_offset_);
+    EmitOrLink(l);
+    advance_current_end_ = kInvalidPC;
+  } else {
+    // Regular goto.
+    Emit(BC_GOTO, 0);
+    EmitOrLink(l);
+  }
  }


@@ -196,7 +207,10 @@
  void RegExpMacroAssemblerIrregexp::AdvanceCurrentPosition(int by) {
    ASSERT(by >= kMinCPOffset);
    ASSERT(by <= kMaxCPOffset);
+  advance_current_start_ = pc_;
+  advance_current_offset_ = by;
    Emit(BC_ADVANCE_CP, by);
+  advance_current_end_ = pc_;
  }



Modified: branches/experimental/toiger/src/regexp-macro-assembler-irregexp.h
==============================================================================
--- branches/experimental/toiger/src/regexp-macro-assembler-irregexp.h   
(original)
+++ branches/experimental/toiger/src/regexp-macro-assembler-irregexp.h  Fri  
Feb 20 01:07:06 2009
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2008-2009 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:
@@ -132,6 +132,12 @@
    // True if the assembler owns the buffer, false if buffer is external.
    bool own_buffer_;
    Label backtrack_;
+
+  int advance_current_start_;
+  int advance_current_offset_;
+  int advance_current_end_;
+
+  static const int kInvalidPC = -1;

    DISALLOW_IMPLICIT_CONSTRUCTORS(RegExpMacroAssemblerIrregexp);
  };

Modified: branches/experimental/toiger/src/scopes.cc
==============================================================================
--- branches/experimental/toiger/src/scopes.cc  (original)
+++ branches/experimental/toiger/src/scopes.cc  Fri Feb 20 01:07:06 2009
@@ -608,25 +608,9 @@
        // a local or outer eval() call, or an outer 'with' statement),
        // or we don't know about the outer scope (because we are
        // in an eval scope).
-      if (!is_global_scope() &&
-          (scope_inside_with_ || outer_scope_is_eval_scope_)) {
-        // If we are inside a with statement or the code is executed
-        // using eval, we give up and look up the variable at runtime.
-        var = NonLocal(proxy->name(), Variable::DYNAMIC);
-
-      } else if (!is_global_scope() &&
-                 (scope_calls_eval_ || outer_scope_calls_eval_)) {
-        // If the code is not executed using eval and there are no
-        // with scopes, either we have a local or a global variable
-        // that might be shadowed by an eval-introduced variable.
-        if (invalidated_local != NULL) {
-          var = NonLocal(proxy->name(), Variable::DYNAMIC_LOCAL);
-          var->set_local_if_not_shadowed(invalidated_local);
-        } else {
-          var = NonLocal(proxy->name(), Variable::DYNAMIC_GLOBAL);
-        }
-
-      } else {
+      if (is_global_scope() ||
+          !(scope_inside_with_ || outer_scope_is_eval_scope_ ||
+            scope_calls_eval_ || outer_scope_calls_eval_)) {
          // We must have a global variable.
          ASSERT(global_scope != NULL);
          var = new Variable(global_scope, proxy->name(),
@@ -639,6 +623,32 @@
          // latter returns undefined. Sigh...
          // var->rewrite_ = new Property(new Literal(env_->global()),
          //                              new Literal(proxy->name()));
+
+      } else if (scope_inside_with_) {
+        // If we are inside a with statement we give up and look up
+        // the variable at runtime.
+        var = NonLocal(proxy->name(), Variable::DYNAMIC);
+
+      } else if (invalidated_local != NULL) {
+        // No with statements are involved and we found a local
+        // variable that might be shadowed by eval introduced
+        // variables.
+        var = NonLocal(proxy->name(), Variable::DYNAMIC_LOCAL);
+        var->set_local_if_not_shadowed(invalidated_local);
+
+      } else if (outer_scope_is_eval_scope_) {
+        // No with statements and we did not find a local and the code
+        // is executed with a call to eval.  We don't know anything
+        // because we do not have information about the scopes
+        // surrounding the eval call.
+        var = NonLocal(proxy->name(), Variable::DYNAMIC);
+
+      } else {
+        // No with statements and we did not find a local and the code
+        // is not executed with a call to eval.  We know that this
+        // variable is global unless it is shadowed by eval-introduced
+        // variables.
+        var = NonLocal(proxy->name(), Variable::DYNAMIC_GLOBAL);
        }
      }
    }

Modified: branches/experimental/toiger/test/cctest/test-debug.cc
==============================================================================
--- branches/experimental/toiger/test/cctest/test-debug.cc      (original)
+++ branches/experimental/toiger/test/cctest/test-debug.cc      Fri Feb 20  
01:07:06 2009
@@ -3660,3 +3660,39 @@
    v8::Debug::SetDebugEventListener(NULL);
    CheckDebuggerUnloaded(true);
  }
+
+
+int host_dispatch_hit_count = 0;
+static void HostDispatchHandlerHitCount(void* dispatch, void *data) {
+  host_dispatch_hit_count++;
+}
+
+
+// Test that clearing the debug event listener actually clears all break  
points
+// and related information.
+TEST(DebuggerHostDispatch) {
+  v8::HandleScope scope;
+  DebugLocalContext env;
+
+  const int kBufferSize = 1000;
+  uint16_t buffer[kBufferSize];
+  const char* command_continue =
+    "{\"seq\":106,"
+     "\"type\":\"request\","
+     "\"command\":\"continue\"}";
+
+  // Setup message and host dispatch handlers.
+  v8::Debug::SetMessageHandler(DummyMessageHandler);
+  v8::Debug::SetHostDispatchHandler(HostDispatchHandlerHitCount,
+                                    NULL);
+
+  // Fill a host dispatch and a continue command on the command queue  
before
+  // generating a debug break.
+  v8::Debug::SendHostDispatch(NULL);
+  v8::Debug::SendCommand(buffer, AsciiToUtf16(command_continue, buffer));
+  CompileRun("debugger");
+
+  // The host dispatch callback should be called.
+  CHECK_EQ(1, host_dispatch_hit_count);
+}
+

Modified: branches/experimental/toiger/test/mjsunit/local-load-from-eval.js
==============================================================================
--- branches/experimental/toiger/test/mjsunit/local-load-from-eval.js    
(original)
+++ branches/experimental/toiger/test/mjsunit/local-load-from-eval.js   Fri  
Feb 20 01:07:06 2009
@@ -34,4 +34,6 @@

  test("assertEquals(27, x);");
  test("(function() { assertEquals(27, x) })();");
+test("(function() { var y = 42; eval('1'); assertEquals(42, y); })();");
+test("(function() { var y = 42; eval('var y = 2; var z = 2;');  
assertEquals(2, y); })();");


Modified: branches/experimental/toiger/tools/tickprocessor.py
==============================================================================
--- branches/experimental/toiger/tools/tickprocessor.py (original)
+++ branches/experimental/toiger/tools/tickprocessor.py Fri Feb 20 01:07:06  
2009
@@ -341,7 +341,7 @@

    def PrintHeader(self, header_title):
      print('\n [%s]:' % header_title)
-    print('   total  nonlib   name')
+    print('   ticks  total  nonlib   name')

    def PrintEntries(self, entries, condition):
      # If ignoring unaccounted ticks don't include these in percentage
@@ -359,7 +359,8 @@
            non_library_percentage = 0
          else:
            non_library_percentage = entry.tick_count * 100.0 /  
number_of_non_library_ticks
-        print('  %(total)5.1f%% %(nonlib)6.1f%%   %(name)s' % {
+        print('  %(ticks)5d  %(total)5.1f%% %(nonlib)6.1f%%  %(name)s' % {
+          'ticks' : entry.tick_count,
            'total' : total_percentage,
            'nonlib' : non_library_percentage,
            'name' : entry.ToString()

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to