Java Code Examples for jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor#isStrict()

The following examples show how to use jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor#isStrict() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScriptObject.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused")
private static void setSpillWithNew(final CallSiteDescriptor desc, final PropertyMap oldMap, final PropertyMap newMap, final int index, final Object self, final Object value) {
    final ScriptObject obj      = (ScriptObject)self;
    final boolean      isStrict = NashornCallSiteDescriptor.isStrict(desc);

    if (!obj.isExtensible()) {
        if (isStrict) {
            throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(obj));
        }
    } else if (obj.compareAndSetMap(oldMap, newMap)) {
        obj.spill = new Object[SPILL_RATE];
        obj.spill[index] = value;
    } else {
        obj.set(desc.getNameToken(2), value, isStrict);
    }
}
 
Example 2
Source File: ScriptObject.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused")
private static void setSpillWithGrow(final CallSiteDescriptor desc, final PropertyMap oldMap, final PropertyMap newMap, final int index, final int newLength, final Object self, final Object value) {
    final ScriptObject obj      = (ScriptObject)self;
    final boolean      isStrict = NashornCallSiteDescriptor.isStrict(desc);

    if (!obj.isExtensible()) {
        if (isStrict) {
            throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(obj));
        }
    } else if (obj.compareAndSetMap(oldMap, newMap)) {
        final int oldLength = obj.spill.length;
        final Object[] newSpill = new Object[newLength];
        System.arraycopy(obj.spill, 0, newSpill, 0, oldLength);
        obj.spill = newSpill;
        obj.spill[index] = value;
    } else {
        obj.set(desc.getNameToken(2), value, isStrict);
    }
}
 
Example 3
Source File: ScriptObject.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused")
private static void setSpillWithNew(final CallSiteDescriptor desc, final PropertyMap oldMap, final PropertyMap newMap, final int index, final Object self, final Object value) {
    final ScriptObject obj      = (ScriptObject)self;
    final boolean      isStrict = NashornCallSiteDescriptor.isStrict(desc);

    if (!obj.isExtensible()) {
        if (isStrict) {
            throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(obj));
        }
    } else if (obj.compareAndSetMap(oldMap, newMap)) {
        obj.spill = new Object[SPILL_RATE];
        obj.spill[index] = value;
    } else {
        obj.set(desc.getNameToken(2), value, isStrict);
    }
}
 
Example 4
Source File: ScriptObject.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused")
private static void setSpillWithGrow(final CallSiteDescriptor desc, final PropertyMap oldMap, final PropertyMap newMap, final int index, final int newLength, final Object self, final Object value) {
    final ScriptObject obj      = (ScriptObject)self;
    final boolean      isStrict = NashornCallSiteDescriptor.isStrict(desc);

    if (!obj.isExtensible()) {
        if (isStrict) {
            throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(obj));
        }
    } else if (obj.compareAndSetMap(oldMap, newMap)) {
        final int oldLength = obj.spill.length;
        final Object[] newSpill = new Object[newLength];
        System.arraycopy(obj.spill, 0, newSpill, 0, oldLength);
        obj.spill = newSpill;
        obj.spill[index] = value;
    } else {
        obj.set(desc.getNameToken(2), value, isStrict);
    }
}
 
Example 5
Source File: ScriptObject.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unused")
private static void setSpillWithGrow(final CallSiteDescriptor desc, final PropertyMap oldMap, final PropertyMap newMap, final int index, final int newLength, final Object self, final Object value) {
    final ScriptObject obj      = (ScriptObject)self;
    final boolean      isStrict = NashornCallSiteDescriptor.isStrict(desc);

    if (!obj.isExtensible()) {
        if (isStrict) {
            throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(obj));
        }
    } else if (obj.compareAndSetMap(oldMap, newMap)) {
        final int oldLength = obj.spill.length;
        final Object[] newSpill = new Object[newLength];
        System.arraycopy(obj.spill, 0, newSpill, 0, oldLength);
        obj.spill = newSpill;
        obj.spill[index] = value;
    } else {
        obj.set(desc.getNameToken(2), value, isStrict);
    }
}
 
Example 6
Source File: SetMethodCreator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void checkStrictCreateNewVariable() {
    // In strict mode, assignment can not create a new variable.
    // See also ECMA Annex C item 4. ReferenceError is thrown.
    if (NashornCallSiteDescriptor.isScope(desc) && NashornCallSiteDescriptor.isStrict(desc)) {
        throw referenceError("not.defined", getName());
    }
}
 
Example 7
Source File: ScriptObject.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private boolean trySetSpill(final CallSiteDescriptor desc, final PropertyMap oldMap, final PropertyMap newMap, final Object value) {
    final boolean isStrict = NashornCallSiteDescriptor.isStrict(desc);
    if (!isExtensible() && isStrict) {
        throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(this));
    } else if (compareAndSetMap(oldMap, newMap)) {
        return true;
    } else {
        set(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND), value, isStrict);
        return false;
    }
}
 
Example 8
Source File: ScriptObject.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unused")
private static void setField(final CallSiteDescriptor desc, final PropertyMap oldMap, final PropertyMap newMap, final MethodHandle setter, final Object self, final Object value) throws Throwable {
    final ScriptObject obj = (ScriptObject)self;
    final boolean isStrict = NashornCallSiteDescriptor.isStrict(desc);
    if (!obj.isExtensible()) {
        throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(obj));
    } else if (obj.compareAndSetMap(oldMap, newMap)) {
        setter.invokeExact(self, value);
    } else {
        obj.set(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND), value, isStrict);
    }
}
 
Example 9
Source File: SetMethodCreator.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
private void checkStrictCreateNewVariable() {
    // In strict mode, assignment can not create a new variable.
    // See also ECMA Annex C item 4. ReferenceError is thrown.
    if (NashornCallSiteDescriptor.isScope(desc) && NashornCallSiteDescriptor.isStrict(desc)) {
        throw referenceError("not.defined", getName());
    }
}
 
Example 10
Source File: SetMethodCreator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void checkStrictCreateNewVariable() {
    // In strict mode, assignment can not create a new variable.
    // See also ECMA Annex C item 4. ReferenceError is thrown.
    if (NashornCallSiteDescriptor.isScope(desc) && NashornCallSiteDescriptor.isStrict(desc)) {
        throw referenceError("not.defined", getName());
    }
}
 
Example 11
Source File: ScriptObject.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean trySetSpill(final CallSiteDescriptor desc, final PropertyMap oldMap, final PropertyMap newMap, final Object value) {
    final boolean isStrict = NashornCallSiteDescriptor.isStrict(desc);
    if (!isExtensible() && isStrict) {
        throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(this));
    } else if (compareAndSetMap(oldMap, newMap)) {
        return true;
    } else {
        set(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND), value, isStrict);
        return false;
    }
}
 
Example 12
Source File: ScriptObject.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unused")
private static void setField(final CallSiteDescriptor desc, final PropertyMap oldMap, final PropertyMap newMap, final MethodHandle setter, final Object self, final Object value) throws Throwable {
    final ScriptObject obj = (ScriptObject)self;
    final boolean isStrict = NashornCallSiteDescriptor.isStrict(desc);
    if (!obj.isExtensible()) {
        throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(obj));
    } else if (obj.compareAndSetMap(oldMap, newMap)) {
        setter.invokeExact(self, value);
    } else {
        obj.set(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND), value, isStrict);
    }
}
 
Example 13
Source File: SetMethodCreator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void checkStrictCreateNewVariable() {
    // In strict mode, assignment can not create a new variable.
    // See also ECMA Annex C item 4. ReferenceError is thrown.
    if (NashornCallSiteDescriptor.isScope(desc) && NashornCallSiteDescriptor.isStrict(desc)) {
        throw referenceError("not.defined", getName());
    }
}
 
Example 14
Source File: ScriptObject.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private boolean trySetSpill(final CallSiteDescriptor desc, final PropertyMap oldMap, final PropertyMap newMap, final Object value) {
    final boolean isStrict = NashornCallSiteDescriptor.isStrict(desc);
    if (!isExtensible() && isStrict) {
        throw typeError("object.non.extensible", desc.getNameToken(2), ScriptRuntime.safeToString(this));
    } else if (compareAndSetMap(oldMap, newMap)) {
        return true;
    } else {
        set(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND), value, isStrict);
        return false;
    }
}
 
Example 15
Source File: SetMethodCreator.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private void checkStrictCreateNewVariable() {
    // In strict mode, assignment can not create a new variable.
    // See also ECMA Annex C item 4. ReferenceError is thrown.
    if (NashornCallSiteDescriptor.isScope(desc) && NashornCallSiteDescriptor.isStrict(desc)) {
        throw referenceError("not.defined", getName());
    }
}
 
Example 16
Source File: SetMethodCreator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void checkStrictCreateNewVariable() {
    // In strict mode, assignment can not create a new variable.
    // See also ECMA Annex C item 4. ReferenceError is thrown.
    if (NashornCallSiteDescriptor.isScope(desc) && NashornCallSiteDescriptor.isStrict(desc)) {
        throw referenceError("not.defined", getName());
    }
}
 
Example 17
Source File: SetMethodCreator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void checkStrictCreateNewVariable() {
    // In strict mode, assignment can not create a new variable.
    // See also ECMA Annex C item 4. ReferenceError is thrown.
    if (NashornCallSiteDescriptor.isScope(desc) && NashornCallSiteDescriptor.isStrict(desc)) {
        throw referenceError("not.defined", getName());
    }
}
 
Example 18
Source File: SetMethodCreator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void checkStrictCreateNewVariable() {
    // In strict mode, assignment can not create a new variable.
    // See also ECMA Annex C item 4. ReferenceError is thrown.
    if (NashornCallSiteDescriptor.isScope(desc) && NashornCallSiteDescriptor.isStrict(desc)) {
        throw referenceError("not.defined", getName());
    }
}
 
Example 19
Source File: SetMethodCreator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void checkStrictCreateNewVariable() {
    // In strict mode, assignment can not create a new variable.
    // See also ECMA Annex C item 4. ReferenceError is thrown.
    if (NashornCallSiteDescriptor.isScope(desc) && NashornCallSiteDescriptor.isStrict(desc)) {
        throw referenceError("not.defined", getName());
    }
}
 
Example 20
Source File: SetMethodCreator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void checkStrictCreateNewVariable() {
    // In strict mode, assignment can not create a new variable.
    // See also ECMA Annex C item 4. ReferenceError is thrown.
    if (NashornCallSiteDescriptor.isScope(desc) && NashornCallSiteDescriptor.isStrict(desc)) {
        throw referenceError("not.defined", getName());
    }
}