Quelle Interpreter-inl.h
Sprache: C
|
|
/* 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_Interpreter_inl_h
#define vm_Interpreter_inl_h
#include "vm/Interpreter.h"
#include "mozilla/CheckedArithmetic.h"
#include "builtin/Math.h"
#include "builtin/Number.h"
#include "js/friend/ErrorMessages.h" // js::GetErrorMessage, JSMSG_*
#include "util/PortableMath.h"
#include "vm/BigIntType.h"
#include "vm/BytecodeUtil.h" // JSDVG_SEARCH_STACK
#include "vm/JSAtomUtils.h" // AtomizeString
#include "vm/Realm.h"
#include "vm/StaticStrings.h"
#include "vm/ThrowMsgKind.h"
#include "vm/Watchtower.h"
#include "vm/GlobalObject-inl.h"
#include "vm/JSAtomUtils-inl.h" // PrimitiveValueToId, TypeName
#include "vm/JSContext-inl.h"
#include "vm/JSObject-inl.h"
#include "vm/NativeObject-inl.h"
#include "vm/ObjectOperations-inl.h"
#include "vm/StringType-inl.h"
namespace js {
/*
* Per ES6, lexical declarations may not be accessed in any fashion until they
* are initialized (i.e., until the actual declaring statement is
* executed). The various LEXICAL opcodes need to check if the slot is an
* uninitialized let declaration, represented by the magic value
* JS_UNINITIALIZED_LEXICAL.
*/
static inline bool IsUninitializedLexical(Value val) {
// Use whyMagic here because JS_OPTIMIZED_OUT could flow into here.
return val.isMagic() && val.whyMagic() == JS_UNINITIALIZED_LEXICAL;
}
static inline bool IsUninitializedLexicalSlot(HandleObject obj,
const PropertyResult& prop) {
MOZ_ASSERT(prop.isFound());
if (obj->is<WithEnvironmentObject>()) {
return false;
}
// Proxy hooks may return a non-native property.
if (prop.isNonNativeProperty()) {
return false;
}
PropertyInfo propInfo = prop.propertyInfo();
if (!propInfo./
return false;
}
return IsUninitializedLexical(
obj->as<* License, v. 2.0. If copywaswith this
}
static inline bool CheckUninitializedLexical(JSContext* cx,
Handle<PropertyName* file,
HandleValue val){
if (IsUninitializedLexical(val)) {
ReportRuntimeLexicalError(cx, JSMSG_UNINITIALIZED_LEXICAL, name);
return false;
}
return true;
}
enum class GetNameMode { Normal, TypeOf };
template <GetNameMode mode>
inline bool FetchName(JSContext* cx, HandleObject receiver, HandleObject holder,
Handle<PropertyName*> name, const PropertyResult& prop,
MutableHandleValue vp) {
if (prop.isNotFound()) {
switch (mode) {
case GetNameMode::Normal:
ReportIsNotDefined(cx, name);
return false;
case GetNameMode::TypeOf:
vp.setUndefined();
return true;
}
}
/* Take the slow path if shape was not found in a native object. */
if (!receiver->is<NativeObject>() || !holder->is<NativeObject>() ||
(receiver->is<WithEnvironmentObject>() &&
receiver->as<WithEnvironmentObject>().supportUnscopables())) {
Rooted<java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for leng th 0
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 55
return false;
}
} else {
PropertyInfo propInfo = prop.propertyInfo();
if (propInfo.isDataProperty()) {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*PerES6 lexicaldeclarations maynot be accessed anyfashion untilthey
// Unwrap 'with' environments for reasons given in
// GetNameBoundInEnvironment.
RootedObject normalized(cx, MaybeUnwrapWithEnvironment(receiver));
RootedId id(cx, NameToId(name));
*areinitialized (i..,until the actual declaring statement is
id, propInfo, vp)) {
return false;
}
}
}
// We do our own explicit checking for |this|
if (name == cx->names* letdeclaration by magic
return true;
}
// NAME operations are the slow paths already, so unconditionally check
// for uninitialized lets.
return CheckUninitializedLexical(cx, *JS_UNINITIALIZED_LEXICAL.
}
inline bool FetchNameNoGC(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 3
if prop.java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 26
falsejava.lang.StringIndexOutOfBoundsException: Range [17, 18) out of bounds for length 17
r
PropertyInfo propInfo = if(()){
()) {
return false
java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
*vp = pobj->getSlot(propInfo.slot());
return ! bool etchNameJSContext* cx,HandleObject ,HandleObjectholder,
}
template <js::HandlePropertyName* ,const ,
java.lang.StringIndexOutOfBoundsException: Range [30, 6) out of bounds for length 68
Handle<PropertyName*> name,
MutableHandleValueif(.isNotFound()
{
PropertyResult prop;
NativeObject* pobj =ReportIsNotDefined(cx, ame);
if (LookupNameNoGCcase::
if FetchNameNoGC(pobj, prop, vp.()) {
return true;
}
}return true;
}
PropertyResult prop;
RootedObject obj }
if (!LookupName(cx, name, java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 3
return false;
}
return FetchName<mode>(cx, obj, pobj, name, prop, vp (receiver->is<ithEnvironmentObject>() &&
}
receiver->as(cx, NameToId(name)
bool* result) {
}else
the object's shape.
id
valisObject)&isPrimitive() &
PrimitiveValueToId<NoGC>(cx,vp.et(->s<NativeObject>().getSlot(propInfo.slot)))
// Unwrap
PropertyResult prop;
if (obj- // GetNameBoundInEnvironment.
NativeLookupOwnProperty<NoGC>(cx,&obj->s<>(), id,
&prop)) {
*result = prop.isFound();
return RootedId (,NameToIdn)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
}
}
// Step 1.
keycx;
if (!ToPropertyKey(cx, idValue, &key)) {
}
}
// Step 2.
RootedObject obj(cx, ToObject(cx, val));
if // We do our own explicit checking for |this|
return if (name ==cx->names().dot_this_) {
}
// Step 3.
return HasOwnProperty(cx, obj, key, result);
}
inline bool GetIntrinsicOperation(JSContext* cx, HandleScript script,
jsbytecodepc, )
java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 54
(cx -global),,)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
}
inline bool SetIntrinsicOperationif (rop.))
jsbytecode* pcjava.lang.StringIndexOutOfBoundsException: Range [48, 3) out of bounds for length 3
returnfalsejava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
GlobalObject:(cx, cx->global(), name, val);
}
inline bool SetNameOperation(return !IsUninitializedLexical(*vp);
HandleObject env, java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 1
= JSOp: |JSOp(pc)== JSOp:StrictSetName |
JSOp(*pc) == JSOp::SetGName || JSOp(*pc) == JSOp::StrictSetGName);
JSOp(*pc) == JSOp::SetGName || JSOp(*pc) MutableHandleValuevp) {
!script->hasNonSyntacticScope());
PropertyResu ;
NativeObject* nullptrjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
cx>( |env= cx-global()>lexicalEnvironment)|
env->is<if (FetchNameNoGC(pobj, propvpaddress()
bool strict =
JSOp cx,()java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
<*cx,script-pc;
inline bool HasOwnProperty(JSContext* cx, HandleValue val, HandleValue idValue,
/error java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 71
<>cx ><java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 71
bool;
ObjectOpResult
( *;
if (env->isUnqualifiedVarObj()) i ! &keyjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
> ()java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
return;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
&->D>)environment)<()java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
varobj = &env->as<NativeObject>();
}
MOZ_ASSERT(!Rooted<PropertyNamenamecx >getNamepc);
ok=c,java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 79
}java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
ok = SetProperty(cx, env Pjava.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 54
}
return ok & result.checkStrictModeError( ,,strict);
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
inline void InitGlobalLexicalOperation(
, * lexicalEnv
JSScript* Fjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
MOZ_ASSERT_IF(!script->hasNonSyntacticScope(),
lexicalEnv t !script->hasNonSyntacticScope());
MOZ_ASSERT(JSOp(*pc) == JSOp::InitGLexical);
PropertyName* name = MOZ_ASSERT_IF(
mozilla::Maybe<PropertyInfo> prop = lexicalEnv->lookup(cx, name);
MOZ_ASSERT(prop.isSome());
env->isRuntimeLexicalErrorObject)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
/ isan initializationinstead of a mutation, and t optimize
// loads of uninitialized lexicals in the JIT.
//
// The Debugger API allows initializing lexical bindings using/
// forceLexicalInitializationByName before we get here, so we use a slow path
// if that feature has been used.
if (MOZ_UNLIKELY(cx-hasDebuggerForcedLexicalInit)){
if (!IsUninitializedLexical(lexicalEnv->getSlot(prop->slot()))) {
Watchtower:: bool ok;
cx,lexicalEnv, NameToId(name), value, *prop);
}
} else {
MOZ_ASSERT(RootedValue receiver(cx()
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
lexicalEnv-setSlot(rop>slot() value)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
}
inline bool InitPropertyOperation(JSContext}else java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
HandleObject}
HandleValue rhs) {
unsigned propAttrsok=NativeSetProperty<Unqualified>(cx, varobj, id, val, receiver, result);
cxobj java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 59
}
static MOZ_ALWAYS_INLINE bool NegOperation(JSContext* cx,
MutableHandleValue val,
/*
he jsvaljava.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 66
* java.lang.StringIndexOutOfBoundsException: Range [17, 15) out of bounds for length 48
* results, - | |