Ignore:
Timestamp:
Jul 27, 2005, 4:10:48 PM (20 years ago)
Author:
mjs
Message:

Changes by Michael Kahl, reviewed by me.

  • fixed <rdar://problem/4194278> Need better debugging support in JavaScriptCore
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • kjs/debugger.cpp: (KJS::AttachedInterpreter::AttachedInterpreter): (KJS::AttachedInterpreter::~AttachedInterpreter): (Debugger::~Debugger): (Debugger::attach): (Debugger::detach): (Debugger::sourceParsed):
  • kjs/debugger.h:
  • kjs/function.cpp: (KJS::FunctionImp::call): (KJS::GlobalFuncImp::call):
  • kjs/function_object.cpp: (FunctionObjectImp::construct):
  • kjs/grammar.y:
  • kjs/internal.cpp: (Parser::parse): (InterpreterImp::evaluate):
  • kjs/internal.h: (KJS::InterpreterImp::setDebugger):
  • kjs/interpreter.cpp:
  • kjs/interpreter.h: (KJS::Interpreter::imp):
  • kjs/nodes.cpp:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/function.cpp

    r9889 r9929  
    7878  Object &globalObj = exec->dynamicInterpreter()->globalObject();
    7979
     80  // enter a new execution context
     81  ContextImp ctx(globalObj, exec->dynamicInterpreter()->imp(), thisObj, codeType(),
     82                 exec->context().imp(), this, &args);
     83  ExecState newExec(exec->dynamicInterpreter(), &ctx);
     84  newExec.setException(exec->exception()); // could be null
     85
     86  // assign user supplied arguments to parameters
     87  processParameters(&newExec, args);
     88  // add variable declarations (initialized to undefined)
     89  processVarDecls(&newExec);
     90
    8091  Debugger *dbg = exec->dynamicInterpreter()->imp()->debugger();
    8192  int sid = -1;
     
    8899
    89100    Object func(this);
    90     bool cont = dbg->callEvent(exec,sid,lineno,func,args);
     101    bool cont = dbg->callEvent(&newExec,sid,lineno,func,args);
    91102    if (!cont) {
    92103      dbg->imp()->abort();
     
    95106  }
    96107
    97   // enter a new execution context
    98   ContextImp ctx(globalObj, exec->dynamicInterpreter()->imp(), thisObj, codeType(),
    99                  exec->context().imp(), this, &args);
    100   ExecState newExec(exec->dynamicInterpreter(), &ctx);
    101   newExec.setException(exec->exception()); // could be null
    102 
    103   // assign user supplied arguments to parameters
    104   processParameters(&newExec, args);
    105   // add variable declarations (initialized to undefined)
    106   processVarDecls(&newExec);
    107 
    108108  Completion comp = execute(&newExec);
    109109
    110110  // if an exception occured, propogate it back to the previous execution object
    111111  if (newExec.hadException())
    112     exec->setException(newExec.exception());
     112    comp = Completion(Throw, newExec.exception());
    113113
    114114#ifdef KJS_VERBOSE
     
    122122
    123123  if (dbg) {
     124    if (inherits(&DeclaredFunctionImp::info))
     125      lineno = static_cast<DeclaredFunctionImp*>(this)->body->lastLine();
     126
     127    if (comp.complType() == Throw)
     128        newExec.setException(comp.value());
     129
    124130    Object func(this);
    125     int cont = dbg->returnEvent(exec,sid,lineno,func);
     131    int cont = dbg->returnEvent(&newExec,sid,lineno,func);
    126132    if (!cont) {
    127133      dbg->imp()->abort();
     
    790796        UString errMsg;
    791797        ProgramNode *progNode = Parser::parse(UString(), 0, s.data(),s.size(),&sid,&errLine,&errMsg);
    792        
     798
     799        Debugger *dbg = exec->dynamicInterpreter()->imp()->debugger();
     800        if (dbg) {
     801          bool cont = dbg->sourceParsed(exec, sid, UString(), s, errLine);
     802          if (!cont)
     803            return Undefined();
     804        }
     805
    793806        // no program node means a syntax occurred
    794807        if (!progNode) {
Note: See TracChangeset for help on using the changeset viewer.