Bug 914508 (attempt 2) - Move more stuff out of inlines.h/-inl.h files, and remove some unnecessary #include statements. r=terrence.

--HG--
extra : rebase_source : abf63fa6f680266c8c53a630174989f33be06a32
This commit is contained in:
Nicholas Nethercote 2013-09-11 09:23:22 +10:00
parent 4d616c626b
commit ad507345be
57 changed files with 176 additions and 268 deletions

View File

@ -38,6 +38,8 @@
#include "jsobjinlines.h"
#include "vm/ObjectImpl-inl.h"
using namespace js;
using mozilla::IsFinite;

View File

@ -19,8 +19,6 @@
#include "jsobjinlines.h"
#include "gc/Barrier-inl.h"
using namespace js;
using mozilla::DoubleIsInt32;

View File

@ -15,6 +15,8 @@
#include "jsobjinlines.h"
#include "vm/ObjectImpl-inl.h"
using namespace js;
using namespace js::types;

View File

@ -13,8 +13,6 @@
#include "jsobjinlines.h"
#include "vm/RegExpStatics-inl.h"
using namespace js;
using namespace js::types;

View File

@ -19,9 +19,11 @@
#include "jit/AsmJS.h"
#include "jit/AsmJSLink.h"
#include "vm/ForkJoin.h"
#include "vm/GlobalObject.h"
#include "vm/Interpreter.h"
#include "vm/ProxyObject.h"
#include "vm/ObjectImpl-inl.h"
#include "jscntxtinlines.h"
using namespace js;
using namespace JS;

View File

@ -19,7 +19,6 @@
#include "jsobjinlines.h"
#include "jsscriptinlines.h"
#include "frontend/ParseMaps-inl.h"
#include "frontend/Parser-inl.h"
using namespace js;

View File

@ -14,9 +14,6 @@
#include "frontend/SharedContext.h"
#include "vm/StringBuffer.h"
#include "jsfuninlines.h"
#include "jsscriptinlines.h"
using namespace js;
using namespace js::frontend;

View File

@ -33,17 +33,12 @@
#include "frontend/ParseMaps.h"
#include "frontend/TokenStream.h"
#include "jit/AsmJS.h"
#include "vm/RegExpStatics.h"
#include "vm/Shape.h"
#include "jsatominlines.h"
#include "jsfuninlines.h"
#include "jsobjinlines.h"
#include "jsscriptinlines.h"
#include "frontend/ParseMaps-inl.h"
#include "frontend/ParseNode-inl.h"
#include "vm/ScopeObject-inl.h"
using namespace js;
using namespace js::gc;

View File

@ -18,40 +18,6 @@
namespace js {
#ifdef JSGC_GENERATIONAL
class DenseRangeRef : public gc::BufferableRef
{
JSObject *owner;
uint32_t start;
uint32_t end;
public:
DenseRangeRef(JSObject *obj, uint32_t start, uint32_t end)
: owner(obj), start(start), end(end)
{
JS_ASSERT(start < end);
}
void mark(JSTracer *trc) {
/* Apply forwarding, if we have already visited owner. */
IsObjectMarked(&owner);
uint32_t initLen = owner->getDenseInitializedLength();
uint32_t clampedStart = Min(start, initLen);
gc::MarkArraySlots(trc, Min(end, initLen) - clampedStart,
owner->getDenseElements() + clampedStart, "element");
}
};
#endif
inline void
DenseRangeWriteBarrierPost(JSRuntime *rt, JSObject *obj, uint32_t start, uint32_t count)
{
#ifdef JSGC_GENERATIONAL
if (count > 0)
rt->gcStoreBuffer.putGeneric(DenseRangeRef(obj, start, start + count));
#endif
}
/*
* This is a post barrier for HashTables whose key is a GC pointer. Any
* insertion into a HashTable not marked as part of the runtime, with a GC

View File

@ -6,9 +6,10 @@
#include "gc/Barrier.h"
#include "jscompartment.h"
#include "jsobj.h"
#include "vm/ObjectImpl-inl.h"
#include "gc/Zone.h"
namespace js {

View File

@ -782,15 +782,6 @@ class HeapSlot : public EncapsulatedValue
}
};
/*
* NOTE: This is a placeholder for bug 619558.
*
* Run a post write barrier that encompasses multiple contiguous slots in a
* single step.
*/
inline void
DenseRangeWriteBarrierPost(JSRuntime *rt, JSObject *obj, uint32_t start, uint32_t count);
static inline const Value *
Valueify(const EncapsulatedValue *array)
{

View File

@ -19,7 +19,7 @@
#include "vm/Debugger.h"
#include "vm/TypedArrayObject.h"
#include "vm/ObjectImpl-inl.h"
#include "jsgcinlines.h"
using namespace js;
using namespace gc;

View File

@ -12,7 +12,7 @@
#include "vm/ForkJoin.h"
#include "vm/ObjectImpl-inl.h"
#include "jsgcinlines.h"
using namespace js;
using namespace js::gc;

View File

@ -18,8 +18,6 @@
#include "jsgcinlines.h"
#include "vm/ObjectImpl-inl.h"
using namespace js;
using namespace js::gc;

View File

@ -31,7 +31,6 @@
#include "frontend/ParseNode-inl.h"
#include "frontend/Parser-inl.h"
#include "gc/Barrier-inl.h"
using namespace js;
using namespace js::frontend;

View File

@ -19,9 +19,7 @@
#include "jit/Ion.h"
#include "jit/PerfSpewer.h"
#include "jsfuninlines.h"
#include "jsobjinlines.h"
#include "jsscriptinlines.h"
using namespace js;
using namespace js::jit;

View File

@ -9,8 +9,6 @@
#include "assembler/assembler/MacroAssembler.h"
#include "jit/AsmJSModule.h"
#include "vm/ObjectImpl-inl.h"
using namespace js;
using namespace js::jit;
using namespace mozilla;

View File

@ -14,8 +14,7 @@
#include "jit/IonSpewer.h"
#include "jit/SnapshotReader.h"
#include "jsobjinlines.h"
#include "jit/IonFrameIterator-inl.h"
#include "vm/Stack-inl.h"
using namespace js;

View File

@ -12,8 +12,6 @@
#include "vm/Debugger.h"
#include "vm/ScopeObject.h"
#include "jsobjinlines.h"
#include "jit/IonFrames-inl.h"
#include "vm/Stack-inl.h"

View File

@ -28,7 +28,6 @@
#include "vm/ForkJoin.h"
#include "jsboolinlines.h"
#include "jsscriptinlines.h"
#include "jit/shared/CodeGenerator-shared-inl.h"
#include "vm/Interpreter-inl.h"

View File

@ -53,9 +53,6 @@
#include "jscompartmentinlines.h"
#include "jsgcinlines.h"
#include "jsinferinlines.h"
#include "jsscriptinlines.h"
#include "vm/Shape-inl.h"
using namespace js;
using namespace js::jit;

View File

@ -16,7 +16,6 @@
#include "jit/MIRGraph.h"
#include "jsinferinlines.h"
#include "jsscriptinlines.h"
using namespace js;
using namespace js::jit;

View File

@ -25,7 +25,6 @@
#include "vm/Interpreter.h"
#include "jsfuninlines.h"
#include "jsscriptinlines.h"
#include "jit/IonFrameIterator-inl.h"
#include "vm/Probes-inl.h"

View File

@ -22,8 +22,6 @@
#include "jsgcinlines.h"
#include "jsinferinlines.h"
#include "vm/Shape-inl.h"
using namespace js;
using namespace js::jit;

View File

@ -24,8 +24,6 @@
#include "jsatominlines.h"
#include "jsinferinlines.h"
#include "vm/Shape-inl.h"
using namespace js;
using namespace js::jit;

View File

@ -9,10 +9,8 @@
#include "jit/IonSpewer.h"
#include "vm/ArrayObject.h"
#include "jsfuninlines.h"
#include "jsgcinlines.h"
#include "jsobjinlines.h"
#include "jsscriptinlines.h"
using namespace js;
using namespace jit;

View File

@ -70,6 +70,7 @@
#include "vm/ErrorObject.h"
#include "vm/Interpreter.h"
#include "vm/NumericConversions.h"
#include "vm/RegExpStatics.h"
#include "vm/Runtime.h"
#include "vm/Shape.h"
#include "vm/StopIterationObject.h"
@ -87,7 +88,6 @@
#include "vm/Interpreter-inl.h"
#include "vm/ObjectImpl-inl.h"
#include "vm/RegExpStatics-inl.h"
#include "vm/Shape-inl.h"
#include "vm/String-inl.h"

View File

@ -36,7 +36,6 @@
#include "vm/ArgumentsObject-inl.h"
#include "vm/ArrayObject-inl.h"
#include "vm/Interpreter-inl.h"
#include "vm/ObjectImpl-inl.h"
#include "vm/Runtime-inl.h"
using namespace js;

View File

@ -18,7 +18,7 @@
#include "vm/Interpreter.h"
#include "vm/ProxyObject.h"
#include "vm/ObjectImpl-inl.h"
#include "gc/Barrier-inl.h"
namespace js {

View File

@ -24,10 +24,10 @@
#include "vm/StopIterationObject.h"
#include "vm/WrapperObject.h"
#include "jsatominlines.h"
#include "jsfuninlines.h"
#include "jsgcinlines.h"
#include "jsinferinlines.h"
#include "jsscriptinlines.h"
#include "gc/Barrier-inl.h"

View File

@ -30,9 +30,7 @@
#include "vm/GlobalObject.h"
#include "vm/StringBuffer.h"
#include "jsfuninlines.h"
#include "jsobjinlines.h"
#include "jsscriptinlines.h"
using namespace js;
using namespace js::gc;

View File

@ -23,9 +23,7 @@
#include "builtin/TestingFunctions.h"
#include "vm/WrapperObject.h"
#include "jsfuninlines.h"
#include "jsobjinlines.h"
#include "jsscriptinlines.h"
using namespace js;
using namespace JS;

View File

@ -81,7 +81,6 @@
#include "jsobjinlines.h"
#include "jsscriptinlines.h"
#include "vm/Runtime-inl.h"
#include "vm/Stack-inl.h"
#include "vm/String-inl.h"

View File

@ -35,11 +35,9 @@
#include "js/MemoryMetrics.h"
#include "vm/Shape.h"
#include "jsanalyzeinlines.h"
#include "jsatominlines.h"
#include "jsgcinlines.h"
#include "jsobjinlines.h"
#include "jsopcodeinlines.h"
#include "jsscriptinlines.h"
using namespace js;

View File

@ -22,8 +22,6 @@
#include "vm/String.h"
#include "vm/WrapperObject.h"
#include "vm/ObjectImpl-inl.h"
using mozilla::DebugOnly;
using mozilla::OldMove;
using mozilla::MoveRef;

View File

@ -54,6 +54,7 @@
#include "vm/ArrayObject-inl.h"
#include "vm/BooleanObject-inl.h"
#include "vm/NumberObject-inl.h"
#include "vm/ObjectImpl-inl.h"
#include "vm/Runtime-inl.h"
#include "vm/Shape-inl.h"
#include "vm/StringObject-inl.h"

View File

@ -18,6 +18,7 @@
#include "mozilla/MemoryReporting.h"
#include "gc/Marking.h"
#include "vm/ObjectImpl.h"
#include "vm/Shape.h"
@ -163,6 +164,41 @@ class NormalArgumentsObject;
class SetObject;
class StrictArgumentsObject;
#ifdef JSGC_GENERATIONAL
class DenseRangeRef : public gc::BufferableRef
{
JSObject *owner;
uint32_t start;
uint32_t end;
public:
DenseRangeRef(JSObject *obj, uint32_t start, uint32_t end)
: owner(obj), start(start), end(end)
{
JS_ASSERT(start < end);
}
inline void mark(JSTracer *trc);
};
#endif
/*
* NOTE: This is a placeholder for bug 619558.
*
* Run a post write barrier that encompasses multiple contiguous slots in a
* single step.
*/
inline void
DenseRangeWriteBarrierPost(JSRuntime *rt, JSObject *obj, uint32_t start, uint32_t count)
{
#ifdef JSGC_GENERATIONAL
if (count > 0) {
JS::shadow::Runtime *shadowRuntime = JS::shadow::Runtime::asShadowRuntime(rt);
shadowRuntime->gcStoreBufferPtr()->putGeneric(DenseRangeRef(obj, start, start + count));
}
#endif
}
} /* namespace js */
/*
@ -599,7 +635,13 @@ class JSObject : public js::ObjectImpl
js::HandleObject obj, uint32_t index);
static inline void removeDenseElementForSparseIndex(js::ExclusiveContext *cx,
js::HandleObject obj, uint32_t index);
inline void copyDenseElements(uint32_t dstStart, const js::Value *src, uint32_t count);
void copyDenseElements(uint32_t dstStart, const js::Value *src, uint32_t count) {
JS_ASSERT(dstStart + count <= getDenseCapacity());
JS::Zone *zone = this->zone();
for (uint32_t i = 0; i < count; ++i)
elements[dstStart + i].set(zone, this, js::HeapSlot::Element, dstStart + i, src[i]);
}
void initDenseElements(uint32_t dstStart, const js::Value *src, uint32_t count) {
JS_ASSERT(dstStart + count <= getDenseCapacity());
@ -608,8 +650,50 @@ class JSObject : public js::ObjectImpl
elements[dstStart + i].init(rt, this, js::HeapSlot::Element, dstStart + i, src[i]);
}
inline void moveDenseElements(uint32_t dstStart, uint32_t srcStart, uint32_t count);
inline void moveDenseElementsUnbarriered(uint32_t dstStart, uint32_t srcStart, uint32_t count);
void moveDenseElements(uint32_t dstStart, uint32_t srcStart, uint32_t count) {
JS_ASSERT(dstStart + count <= getDenseCapacity());
JS_ASSERT(srcStart + count <= getDenseInitializedLength());
/*
* Using memmove here would skip write barriers. Also, we need to consider
* an array containing [A, B, C], in the following situation:
*
* 1. Incremental GC marks slot 0 of array (i.e., A), then returns to JS code.
* 2. JS code moves slots 1..2 into slots 0..1, so it contains [B, C, C].
* 3. Incremental GC finishes by marking slots 1 and 2 (i.e., C).
*
* Since normal marking never happens on B, it is very important that the
* write barrier is invoked here on B, despite the fact that it exists in
* the array before and after the move.
*/
JS::Zone *zone = this->zone();
JS::shadow::Zone *shadowZone = JS::shadow::Zone::asShadowZone(zone);
if (shadowZone->needsBarrier()) {
if (dstStart < srcStart) {
js::HeapSlot *dst = elements + dstStart;
js::HeapSlot *src = elements + srcStart;
for (uint32_t i = 0; i < count; i++, dst++, src++)
dst->set(zone, this, js::HeapSlot::Element, dst - elements, *src);
} else {
js::HeapSlot *dst = elements + dstStart + count - 1;
js::HeapSlot *src = elements + srcStart + count - 1;
for (uint32_t i = 0; i < count; i++, dst--, src--)
dst->set(zone, this, js::HeapSlot::Element, dst - elements, *src);
}
} else {
memmove(elements + dstStart, elements + srcStart, count * sizeof(js::HeapSlot));
DenseRangeWriteBarrierPost(runtimeFromMainThread(), this, dstStart, count);
}
}
void moveDenseElementsUnbarriered(uint32_t dstStart, uint32_t srcStart, uint32_t count) {
JS_ASSERT(!shadowZone()->needsBarrier());
JS_ASSERT(dstStart + count <= getDenseCapacity());
JS_ASSERT(srcStart + count <= getDenseCapacity());
memmove(elements + dstStart, elements + srcStart, count * sizeof(js::Value));
}
bool shouldConvertDoubleElements() {
JS_ASSERT(isNative());
@ -1088,6 +1172,19 @@ class ValueArray {
namespace js {
#ifdef JSGC_GENERATIONAL
inline void
DenseRangeRef::mark(JSTracer *trc)
{
/* Apply forwarding, if we have already visited owner. */
js::gc::IsObjectMarked(&owner);
uint32_t initLen = owner->getDenseInitializedLength();
uint32_t clampedStart = Min(start, initLen);
gc::MarkArraySlots(trc, Min(end, initLen) - clampedStart,
owner->getDenseElements() + clampedStart, "element");
}
#endif
template <AllowGC allowGC>
extern bool
HasOwnProperty(JSContext *cx, LookupGenericOp lookup,

View File

@ -171,63 +171,6 @@ JSObject::removeDenseElementForSparseIndex(js::ExclusiveContext *cx,
obj->setDenseElement(index, js::MagicValue(JS_ELEMENTS_HOLE));
}
inline void
JSObject::copyDenseElements(uint32_t dstStart, const js::Value *src, uint32_t count)
{
JS_ASSERT(dstStart + count <= getDenseCapacity());
JS::Zone *zone = this->zone();
for (uint32_t i = 0; i < count; ++i)
elements[dstStart + i].set(zone, this, js::HeapSlot::Element, dstStart + i, src[i]);
}
inline void
JSObject::moveDenseElements(uint32_t dstStart, uint32_t srcStart, uint32_t count)
{
JS_ASSERT(dstStart + count <= getDenseCapacity());
JS_ASSERT(srcStart + count <= getDenseInitializedLength());
/*
* Using memmove here would skip write barriers. Also, we need to consider
* an array containing [A, B, C], in the following situation:
*
* 1. Incremental GC marks slot 0 of array (i.e., A), then returns to JS code.
* 2. JS code moves slots 1..2 into slots 0..1, so it contains [B, C, C].
* 3. Incremental GC finishes by marking slots 1 and 2 (i.e., C).
*
* Since normal marking never happens on B, it is very important that the
* write barrier is invoked here on B, despite the fact that it exists in
* the array before and after the move.
*/
JS::Zone *zone = this->zone();
if (zone->needsBarrier()) {
if (dstStart < srcStart) {
js::HeapSlot *dst = elements + dstStart;
js::HeapSlot *src = elements + srcStart;
for (uint32_t i = 0; i < count; i++, dst++, src++)
dst->set(zone, this, js::HeapSlot::Element, dst - elements, *src);
} else {
js::HeapSlot *dst = elements + dstStart + count - 1;
js::HeapSlot *src = elements + srcStart + count - 1;
for (uint32_t i = 0; i < count; i++, dst--, src--)
dst->set(zone, this, js::HeapSlot::Element, dst - elements, *src);
}
} else {
memmove(elements + dstStart, elements + srcStart, count * sizeof(js::HeapSlot));
DenseRangeWriteBarrierPost(runtimeFromMainThread(), this, dstStart, count);
}
}
inline void
JSObject::moveDenseElementsUnbarriered(uint32_t dstStart, uint32_t srcStart, uint32_t count)
{
JS_ASSERT(!zone()->needsBarrier());
JS_ASSERT(dstStart + count <= getDenseCapacity());
JS_ASSERT(srcStart + count <= getDenseCapacity());
memmove(elements + dstStart, elements + srcStart, count * sizeof(js::Value));
}
inline void
JSObject::markDenseElementsNotPacked(js::ExclusiveContext *cx)
{

View File

@ -21,6 +21,8 @@
#include "jsinferinlines.h"
#include "jsobjinlines.h"
#include "vm/ObjectImpl-inl.h"
using namespace js;
using namespace js::gc;
using mozilla::ArrayLength;

View File

@ -33,7 +33,6 @@
#include "js/OldDebugAPI.h"
#include "vm/ArgumentsObject.h"
#include "vm/Debugger.h"
#include "vm/Interpreter.h"
#include "vm/Shape.h"
#include "vm/Xdr.h"
@ -41,7 +40,6 @@
#include "jsinferinlines.h"
#include "jsobjinlines.h"
#include "vm/Runtime-inl.h"
#include "vm/ScopeObject-inl.h"
#include "vm/Stack-inl.h"

View File

@ -15,7 +15,6 @@
#include "jsgcinlines.h"
#include "gc/Barrier-inl.h"
#include "vm/ObjectImpl-inl.h"
using namespace js;
using namespace js::gc;

View File

@ -32,18 +32,12 @@
#include "jsarray.h"
#include "jsatom.h"
#include "jscntxt.h"
#include "jsdate.h"
#include "jsfun.h"
#include "jsgc.h"
#include "jsiter.h"
#ifdef JS_THREADSAFE
#include "jslock.h"
#endif
#include "jsnum.h"
#include "jsobj.h"
#include "json.h"
#include "jsprf.h"
#include "jsreflect.h"
#include "jsscript.h"
#include "jstypes.h"
#include "jsutil.h"
@ -58,7 +52,6 @@
#endif
#include "builtin/TestingFunctions.h"
#include "frontend/BytecodeEmitter.h"
#include "frontend/Parser.h"
#include "jit/Ion.h"
#include "js/OldDebugAPI.h"
@ -66,15 +59,13 @@
#include "perf/jsperf.h"
#include "shell/jsheaptools.h"
#include "shell/jsoptparse.h"
#include "vm/ArgumentsObject.h"
#include "vm/Shape.h"
#include "vm/TypedArrayObject.h"
#include "vm/WrapperObject.h"
#include "jsfuninlines.h"
#include "jsinferinlines.h"
#include "jsscriptinlines.h"
#include "vm/Interpreter-inl.h"
#include "jscompartmentinlines.h"
#include "jsobjinlines.h"
#ifdef XP_WIN
# define PATH_MAX (MAX_PATH > _MAX_DIR ? MAX_PATH : _MAX_DIR)

View File

@ -16,7 +16,6 @@
#include "jsobjinlines.h"
#include "gc/Barrier-inl.h"
#include "vm/Stack-inl.h"
using namespace js;

View File

@ -20,12 +20,12 @@
#include "vm/ArgumentsObject.h"
#include "vm/WrapperObject.h"
#include "jsfuninlines.h"
#include "jsgcinlines.h"
#include "jsobjinlines.h"
#include "jsopcodeinlines.h"
#include "jsscriptinlines.h"
#include "vm/ObjectImpl-inl.h"
#include "vm/Stack-inl.h"
using namespace js;

View File

@ -26,6 +26,8 @@
#include "jsobjinlines.h"
#include "jsscriptinlines.h"
#include "vm/ObjectImpl-inl.h"
using namespace js;
JSObject *

View File

@ -9,12 +9,8 @@
#include "vm/ObjectImpl.h"
#include "mozilla/Assertions.h"
#include "jsgc.h"
#include "jsproxy.h"
#include "gc/Marking.h"
#include "vm/ProxyObject.h"
#include "gc/Barrier-inl.h"

View File

@ -12,8 +12,6 @@
#include "jsobjinlines.h"
#include "gc/Barrier-inl.h"
using namespace js;
PropDesc::PropDesc()

View File

@ -6,11 +6,9 @@
#include "vm/ProxyObject.h"
#include "jsgcinlines.h"
#include "jsobjinlines.h"
#include "jscompartment.h"
#include "gc/Barrier-inl.h"
#include "vm/ObjectImpl-inl.h"
#include "jsgcinlines.h"
using namespace js;

View File

@ -1,56 +0,0 @@
/* -*- 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/. */
#ifndef vm_RegExpStatics_inl_h
#define vm_RegExpStatics_inl_h
#include "vm/RegExpStatics.h"
#include "jsinferinlines.h"
namespace js {
inline void
RegExpStatics::setMultiline(JSContext *cx, bool enabled)
{
aboutToWrite();
if (enabled) {
flags = RegExpFlag(flags | MultilineFlag);
markFlagsSet(cx);
} else {
flags = RegExpFlag(flags & ~MultilineFlag);
}
}
inline void
RegExpStatics::markFlagsSet(JSContext *cx)
{
/*
* Flags set on the RegExp function get propagated to constructed RegExp
* objects, which interferes with optimizations that inline RegExp cloning
* or avoid cloning entirely. Scripts making this assumption listen to
* type changes on RegExp.prototype, so mark a state change to trigger
* recompilation of all such code (when recompiling, a stub call will
* always be performed).
*/
JS_ASSERT(this == cx->global()->getRegExpStatics());
types::MarkTypeObjectFlags(cx, cx->global(), types::OBJECT_FLAG_REGEXP_FLAGS_SET);
}
inline void
RegExpStatics::reset(JSContext *cx, JSString *newInput, bool newMultiline)
{
aboutToWrite();
clear();
pendingInput = newInput;
setMultiline(cx, newMultiline);
checkInvariants();
}
} /* namespace js */
#endif /* vm_RegExpStatics_inl_h */

View File

@ -4,7 +4,7 @@
* 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/. */
#include "vm/RegExpStatics-inl.h"
#include "vm/RegExpStatics.h"
#include "vm/RegExpStaticsObject.h"
@ -66,6 +66,20 @@ RegExpStatics::create(JSContext *cx, GlobalObject *parent)
return obj;
}
void
RegExpStatics::markFlagsSet(JSContext *cx)
{
// Flags set on the RegExp function get propagated to constructed RegExp
// objects, which interferes with optimizations that inline RegExp cloning
// or avoid cloning entirely. Scripts making this assumption listen to
// type changes on RegExp.prototype, so mark a state change to trigger
// recompilation of all such code (when recompiling, a stub call will
// always be performed).
JS_ASSERT(this == cx->global()->getRegExpStatics());
types::MarkTypeObjectFlags(cx, cx->global(), types::OBJECT_FLAG_REGEXP_FLAGS_SET);
}
bool
RegExpStatics::executeLazy(JSContext *cx)
{

View File

@ -88,12 +88,27 @@ class RegExpStatics
inline void updateLazily(JSContext *cx, JSLinearString *input,
RegExpShared *shared, size_t lastIndex);
inline bool updateFromMatchPairs(JSContext *cx, JSLinearString *input, MatchPairs &newPairs);
inline void setMultiline(JSContext *cx, bool enabled);
void setMultiline(JSContext *cx, bool enabled) {
aboutToWrite();
if (enabled) {
flags = RegExpFlag(flags | MultilineFlag);
markFlagsSet(cx);
} else {
flags = RegExpFlag(flags & ~MultilineFlag);
}
}
inline void clear();
/* Corresponds to JSAPI functionality to set the pending RegExp input. */
inline void reset(JSContext *cx, JSString *newInput, bool newMultiline);
void reset(JSContext *cx, JSString *newInput, bool newMultiline) {
aboutToWrite();
clear();
pendingInput = newInput;
setMultiline(cx, newMultiline);
checkInvariants();
}
inline void setPendingInput(JSString *newInput);

View File

@ -39,16 +39,6 @@ NewObjectCache::fillGlobal(EntryIndex entry, Class *clasp, js::GlobalObject *glo
return fill(entry, clasp, global, kind, obj);
}
inline void
NewObjectCache::copyCachedToObject(JSObject *dst, JSObject *src, gc::AllocKind kind)
{
js_memcpy(dst, src, gc::Arena::thingSize(kind));
#ifdef JSGC_GENERATIONAL
Shape::writeBarrierPost(dst->shape_, &dst->shape_);
types::TypeObject::writeBarrierPost(dst->type_, &dst->type_);
#endif
}
inline JSObject *
NewObjectCache::newObjectFromHit(JSContext *cx, EntryIndex entry_, js::gc::InitialHeap heap)
{
@ -68,17 +58,6 @@ NewObjectCache::newObjectFromHit(JSContext *cx, EntryIndex entry_, js::gc::Initi
return NULL;
}
inline
ThreadDataIter::ThreadDataIter(JSRuntime *rt)
{
#ifdef JS_WORKER_THREADS
// Only allow iteration over a runtime's threads when those threads are
// paused, to avoid racing when reading data from the PerThreadData.
JS_ASSERT(rt->exclusiveThreadsPaused);
#endif
iter = rt->threadList.getFirst();
}
} /* namespace js */
#endif /* vm_Runtime_inl_h */

View File

@ -386,7 +386,13 @@ class NewObjectCache
js_memcpy(&entry->templateObject, obj, entry->nbytes);
}
static inline void copyCachedToObject(JSObject *dst, JSObject *src, gc::AllocKind kind);
static void copyCachedToObject(JSObject *dst, JSObject *src, gc::AllocKind kind) {
js_memcpy(dst, src, gc::Arena::thingSize(kind));
#ifdef JSGC_GENERATIONAL
Shape::writeBarrierPost(dst->shape_, &dst->shape_);
types::TypeObject::writeBarrierPost(dst->type_, &dst->type_);
#endif
}
};
/*
@ -1870,7 +1876,14 @@ class ThreadDataIter {
PerThreadData *iter;
public:
explicit inline ThreadDataIter(JSRuntime *rt);
explicit ThreadDataIter(JSRuntime *rt) {
#ifdef JS_WORKER_THREADS
// Only allow iteration over a runtime's threads when those threads are
// paused, to avoid racing when reading data from the PerThreadData.
JS_ASSERT(rt->exclusiveThreadsPaused);
#endif
iter = rt->threadList.getFirst();
}
bool done() const {
return !iter;

View File

@ -22,6 +22,7 @@
#include "jscntxtinlines.h"
#include "jsobjinlines.h"
#include "vm/ObjectImpl-inl.h"
#include "vm/Runtime-inl.h"
using namespace js;

View File

@ -19,7 +19,6 @@
#include "jsobjinlines.h"
#include "jit/BaselineFrame-inl.h"
#include "jit/IonFrameIterator-inl.h"
namespace js {

View File

@ -16,6 +16,8 @@
#include "jit/BaselineFrame.h"
#include "jit/IonCompartment.h"
#endif
#include "jit/IonFrameIterator-inl.h"
#include "vm/Interpreter-inl.h"
#include "vm/Probes-inl.h"

View File

@ -13,8 +13,6 @@
#include "vm/Debugger.h"
#include "vm/ObjectImpl-inl.h"
using namespace js;
void