Ignore:
Timestamp:
Aug 13, 2009, 2:51:50 PM (16 years ago)
Author:
Darin Adler
Message:

JavaScriptCore: JavaScriptCore tweaks to get ready for the parser arena
https://bugs.webkit.org/show_bug.cgi?id=28243

Patch by Darin Adler <Darin Adler> on 2009-08-13
Reviewed by David Levin.

Eliminate dependencies on Nodes.h outside JavaScriptCore,
and cut down on them inside JavaScriptCore.

Change regular expression parsing to use identifiers as
with other strings we parse.

Fix a couple things that are needed to use const Identifier
more, which will be part of the parser arena work.

CollectorHeapIterator.h to be project-internal.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitPushNewScope): Added const.

  • bytecompiler/BytecodeGenerator.h: Ditto.
  • debugger/Debugger.cpp:

(JSC::Debugger::recompileAllJSFunctions): Moved this function
here from WebCore. Here is better since it uses so many internals.
Removed unimportant optimization for the no listener case.

  • debugger/Debugger.h: Ditto. Also removed unneeded include

and tweaked formatting and comments.

  • debugger/DebuggerCallFrame.cpp:

(JSC::DebuggerCallFrame::functionName): Call asFunction instead
of doing the unchecked static_cast.
(JSC::DebuggerCallFrame::calculatedFunctionName): Ditto.

  • jit/JITStubs.cpp:

(JSC::op_call_JSFunction): Call isHostFunction on the body rather
than on the JSFunction.
(JSC::vm_lazyLinkCall): Ditto.
(JSC::op_construct_JSConstruct): Ditto.

  • parser/Grammar.y: Changed callers to use new scanRegExp with

out arguments instead of relying on state in the Lexer. And
callers that just want to skip a regular expression to use
skipRegExp.

  • parser/Lexer.cpp:

(JSC::Lexer::scanRegExp): Changed to use out arguments, and to
add a prefix argument so we can add in the "=" character as needed.
Also rewrote to streamline the logic a bit inspired by suggestions
by David Levin.
(JSC::Lexer::skipRegExp): Added. Version of the function above that
does not actually put the regular expression into a string.
(JSC::Lexer::clear): Removed code to clear m_pattern and m_flags.

  • parser/Lexer.h: Changed scanRegExp to have out arguments. Added

skipRegExp. Eliminated pattern, flags, m_pattern, and m_flags.

  • parser/NodeConstructors.h:

(JSC::RegExpNode::RegExpNode): Changed to take const Identifier&.

  • parser/Nodes.cpp:

(JSC::RegExpNode::emitBytecode): Changed since m_pattern and
m_flags are now Identifier instead of UString.
(JSC::FunctionBodyNode::make): Moved this function here instead
of putting it in the JSFunction.h header.

  • parser/Nodes.h: Changed RegExpNode to use Identifier.
  • profiler/Profiler.cpp:

(JSC::Profiler::createCallIdentifier): Changed to use isHostFunction
on the body instead of on the JSFunction object.

  • runtime/FunctionPrototype.cpp:

(JSC::functionProtoFuncToString): Ditto.

  • runtime/JSFunction.cpp:

(JSC::JSFunction::isHostFunction): Moved here from header.
(JSC::JSFunction::isHostFunctionNonInline): Added.
(JSC::JSFunction::JSFunction): Removed unneeded initialization of
m_body to 0.
(JSC::JSFunction::setBody): Moved here from header.

  • runtime/JSFunction.h: Removed unneeded includes. Moved private

constructor down to the private section. Made virtual functions
private. Removed unneeded overload of setBody and moved the body
of the function into the .cpp file. Changed assertions to use
the non-inline version of isHostFunction.

  • runtime/PropertySlot.cpp:

(JSC::PropertySlot::functionGetter): Use asFunction instead
of doing the unchecked static_cast.

  • wtf/SegmentedVector.h:

(WTF::SegmentedVector::isEmpty): Added.

WebCore: JavaScriptCore tweaks to get ready for the parser arena
https://bugs.webkit.org/show_bug.cgi?id=28243

Patch by Darin Adler <Darin Adler> on 2009-08-13
Reviewed by David Levin.

  • ForwardingHeaders/runtime/CollectorHeapIterator.h: Removed.
  • WebCore.xcodeproj/project.pbxproj: Exposed a couple header

files as Private that are now needed to compile Mac WebKit.

  • bindings/js/JSAudioConstructor.cpp:
  • bindings/js/JSDOMBinding.cpp:
  • bindings/js/JSDOMBinding.h:
  • bindings/js/JSDOMWindowCustom.cpp:
  • bindings/js/JSHTMLInputElementCustom.cpp:
  • bindings/js/JSHistoryCustom.cpp:
  • bindings/js/JSImageConstructor.cpp:
  • bindings/js/JSLazyEventListener.cpp:
  • bindings/js/JSLocationCustom.cpp:
  • bindings/js/JSMessageChannelConstructor.cpp:
  • bindings/js/JSOptionConstructor.cpp:
  • bindings/js/JSWebSocketConstructor.cpp:
  • bindings/js/JSWebSocketCustom.cpp:
  • bindings/js/JSWorkerConstructor.cpp:
  • bindings/js/JSXMLHttpRequestConstructor.cpp:
  • bridge/jni/jni_jsobject.mm:

Updated includes.

  • inspector/JavaScriptDebugServer.cpp:

(WebCore::JavaScriptDebugServer::sourceParsed):
Change to not assert if this is called with no listeners.
I don't think this was guaranteed before, and we now use
this code path when recompiling. Slightly less efficient,
but this is a one-time cost when turning on the debugger.
(WebCore::JavaScriptDebugServer::recompileAllJSFunctions):
Change to call Debugger::recompileAllJSFunctions.

WebKit/mac: * Plugins/Hosted/NetscapePluginInstanceProxy.mm: Updated includes.

  • WebView/WebScriptDebugger.mm: Ditto.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/debugger/Debugger.h

    r45733 r47236  
    22 *  Copyright (C) 1999-2001 Harri Porten ([email protected])
    33 *  Copyright (C) 2001 Peter Kelly ([email protected])
    4  *  Copyright (C) 2008 Apple Inc. All rights reserved.
     4 *  Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
    55 *
    66 *  This library is free software; you can redistribute it and/or
     
    2323#define Debugger_h
    2424
    25 #include "Protect.h"
     25#include <wtf/HashSet.h>
    2626
    2727namespace JSC {
     
    2929    class DebuggerCallFrame;
    3030    class ExecState;
     31    class JSGlobalData;
    3132    class JSGlobalObject;
     33    class JSValue;
    3234    class SourceCode;
    3335    class UString;
     
    3537    class Debugger {
    3638    public:
    37         Debugger();
    3839        virtual ~Debugger();
    3940
     
    4142        virtual void detach(JSGlobalObject*);
    4243
    43         virtual void sourceParsed(ExecState*, const SourceCode&, int errorLine, const UString& errorMsg) = 0;
    44         virtual void exception(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
    45         virtual void atStatement(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
    46         virtual void callEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
    47         virtual void returnEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
     44        virtual void sourceParsed(ExecState*, const SourceCode&, int errorLineNumber, const UString& errorMessage) = 0;
     45        virtual void exception(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
     46        virtual void atStatement(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
     47        virtual void callEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
     48        virtual void returnEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
    4849
    49         virtual void willExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
    50         virtual void didExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
    51         virtual void didReachBreakpoint(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
     50        virtual void willExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
     51        virtual void didExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
     52        virtual void didReachBreakpoint(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0;
     53
     54        void recompileAllJSFunctions(JSGlobalData*);
    5255
    5356    private:
     
    5558    };
    5659
    57     // This method exists only for backwards compatibility with existing
    58     // WebScriptDebugger clients
     60    // This function exists only for backwards compatibility with existing WebScriptDebugger clients.
    5961    JSValue evaluateInGlobalCallFrame(const UString&, JSValue& exception, JSGlobalObject*);
    6062
Note: See TracChangeset for help on using the changeset viewer.