mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
0bfce2ba30
Layout: js/src/vm/Symbol.h defines the new class JS::Symbol. JS::Symbol is the same size as JSString on all platforms, because the allocator does not support smaller allocations. Allocation: Since the purpose of symbols is to serve as property keys, they are always allocated in the atoms compartment. We take a lock when allocating. This could probably be replaced with a main-thread-only assertion. However, if atom allocation is not already a bottleneck, symbol allocation probably never will be. Symbols are given their own finalize-class in the GC. This means we allocate a page per zone for symbols, even though they are only ever allocated in the atoms zone. Terrence thought this could be easily fixed later. It should be; we never touch the page, but a 32-bit virtual address space does not just have infinite pages to spare. A jsapi-test exercises the new symbol allocation code. A few oddities in jsapi-tests are fixed in passing. Discussion after review led to some new assertions about minimum object size in AllocateObject and AllocateNonObject. --HG-- extra : rebase_source : 45abb651d3b1b493d77a5dd0eb554f96b058c63a
82 lines
2.6 KiB
C++
82 lines
2.6 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
// This file contains public type declarations that are used *frequently*. If
|
|
// it doesn't occur at least 10 times in Gecko, it probably shouldn't be in
|
|
// here.
|
|
//
|
|
// It includes only:
|
|
// - forward declarations of structs and classes;
|
|
// - typedefs;
|
|
// - enums (maybe).
|
|
// It does *not* contain any struct or class definitions.
|
|
|
|
#ifndef js_TypeDecls_h
|
|
#define js_TypeDecls_h
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#include "js-config.h"
|
|
|
|
struct JSContext;
|
|
class JSFunction;
|
|
class JSObject;
|
|
class JSScript;
|
|
class JSString;
|
|
class JSAddonId;
|
|
|
|
struct jsid;
|
|
|
|
typedef char16_t jschar;
|
|
|
|
namespace JS {
|
|
|
|
typedef unsigned char Latin1Char;
|
|
|
|
class Symbol;
|
|
class Value;
|
|
template <typename T> class Handle;
|
|
template <typename T> class MutableHandle;
|
|
template <typename T> class Rooted;
|
|
template <typename T> class PersistentRooted;
|
|
|
|
typedef Handle<JSFunction*> HandleFunction;
|
|
typedef Handle<jsid> HandleId;
|
|
typedef Handle<JSObject*> HandleObject;
|
|
typedef Handle<JSScript*> HandleScript;
|
|
typedef Handle<JSString*> HandleString;
|
|
typedef Handle<JS::Symbol*> HandleSymbol;
|
|
typedef Handle<Value> HandleValue;
|
|
|
|
typedef MutableHandle<JSFunction*> MutableHandleFunction;
|
|
typedef MutableHandle<jsid> MutableHandleId;
|
|
typedef MutableHandle<JSObject*> MutableHandleObject;
|
|
typedef MutableHandle<JSScript*> MutableHandleScript;
|
|
typedef MutableHandle<JSString*> MutableHandleString;
|
|
typedef MutableHandle<JS::Symbol*> MutableHandleSymbol;
|
|
typedef MutableHandle<Value> MutableHandleValue;
|
|
|
|
typedef Rooted<JSObject*> RootedObject;
|
|
typedef Rooted<JSFunction*> RootedFunction;
|
|
typedef Rooted<JSScript*> RootedScript;
|
|
typedef Rooted<JSString*> RootedString;
|
|
typedef Rooted<JS::Symbol*> RootedSymbol;
|
|
typedef Rooted<jsid> RootedId;
|
|
typedef Rooted<JS::Value> RootedValue;
|
|
|
|
typedef PersistentRooted<JSFunction*> PersistentRootedFunction;
|
|
typedef PersistentRooted<jsid> PersistentRootedId;
|
|
typedef PersistentRooted<JSObject*> PersistentRootedObject;
|
|
typedef PersistentRooted<JSScript*> PersistentRootedScript;
|
|
typedef PersistentRooted<JSString*> PersistentRootedString;
|
|
typedef PersistentRooted<JS::Symbol*> PersistentRootedSymbol;
|
|
typedef PersistentRooted<Value> PersistentRootedValue;
|
|
|
|
} // namespace JS
|
|
|
|
#endif /* js_TypeDecls_h */
|