- fix a storage leak where we ref the UString every time we replace
a ResolveNode with a LocalVarAccessNode
* kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
that takes PlacementNewAdopt.
* kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
with PlacementNewAdopt instead of the old value of ident.
* kjs/ustring.h: (KJS::UString::UString): Added a constructor that
takes PlacementNewAdopt.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27206
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-10-28 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix a storage leak where we ref the UString every time we replace
+ a ResolveNode with a LocalVarAccessNode
+
+ * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
+ that takes PlacementNewAdopt.
+
+ * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
+ with PlacementNewAdopt instead of the old value of ident.
+
+ * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
+ takes PlacementNewAdopt.
+
2007-10-28 Darin Adler <darin@apple.com>
- Windows build fix; get rid of unused parameter
/*
- * This file is part of the KDE libraries
- * Copyright (C) 2003 Apple Computer, Inc
+ * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
Identifier(const UChar* s, int length) : _ustring(add(s, length)) { }
explicit Identifier(UString::Rep* rep) : _ustring(add(rep)) { }
explicit Identifier(const UString& s) : _ustring(add(s.rep())) { }
+
+ // Special constructor for cases where we overwrite an object in place.
+ Identifier(PlacementNewAdoptType) : _ustring(PlacementNewAdopt) { }
const UString& ustring() const { return _ustring; }
DOM::DOMString domString() const;
PrecExpression
};
- // Specifies that a Node should adopt the memory layout it was initialized into.
- // We use this to swap a pre-existing base class node with a more optimized
- // subclass node.
- enum PlacementNewAdoptTag { PlacementNewAdopt };
-
struct DeclarationStacks {
typedef Vector<Node*, 16> NodeStack;
typedef Vector<VarDeclNode*, 16> VarStack;
class Node {
public:
Node() KJS_FAST_CALL;
- Node(PlacementNewAdoptTag) KJS_FAST_CALL { }
+ Node(PlacementNewAdoptType) KJS_FAST_CALL { }
virtual ~Node();
virtual JSValue *evaluate(ExecState *exec) KJS_FAST_CALL = 0;
{
}
- ResolveNode(PlacementNewAdoptTag) KJS_FAST_CALL
+ // Special constructor for cases where we overwrite an object in place.
+ ResolveNode(PlacementNewAdoptType) KJS_FAST_CALL
: Node(PlacementNewAdopt)
- , ident(ident)
+ , ident(PlacementNewAdopt)
{
}
class LocalVarAccessNode : public ResolveNode {
public:
+ // Overwrites a ResolveNode in place.
LocalVarAccessNode(size_t i)
: ResolveNode(PlacementNewAdopt)
{
// -*- c-basic-offset: 2 -*-
/*
- * This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
- * Copyright (C) 2004 Apple Computer, Inc.
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
namespace KJS {
+ enum PlacementNewAdoptType { PlacementNewAdopt };
+
class UString;
/**
*/
~UString() {}
+ // Special constructor for cases where we overwrite an object in place.
+ UString(PlacementNewAdoptType) { }
+
/**
* Constructs a string from an int.
*/