src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
Print this page
@@ -463,14 +463,14 @@
@Override
void consumeStack() {
// If this is either __FILE__, __DIR__, or __LINE__ then load the property initially as Object as we'd convert
// it anyway for replaceLocationPropertyPlaceholder.
if(identNode.isCompileTimePropertyName()) {
- method.dynamicGet(Type.OBJECT, identNode.getSymbol().getName(), flags, identNode.isFunction());
+ method.dynamicGet(Type.OBJECT, identNode.getSymbol().getName(), flags, identNode.isFunction(), false);
replaceCompileTimeProperty();
} else {
- dynamicGet(identNode.getSymbol().getName(), flags, identNode.isFunction());
+ dynamicGet(identNode.getSymbol().getName(), flags, identNode.isFunction(), false);
}
}
}
private class LoadFastScopeVar extends LoadScopeVar {
@@ -484,11 +484,11 @@
}
}
private MethodEmitter storeFastScopeVar(final Symbol symbol, final int flags) {
loadFastScopeProto(symbol, true);
- method.dynamicSet(symbol.getName(), flags | CALLSITE_FAST_SCOPE);
+ method.dynamicSet(symbol.getName(), flags | CALLSITE_FAST_SCOPE, false);
return method;
}
private int getScopeProtoDepth(final Block startingBlock, final Symbol symbol) {
//walk up the chain from starting block and when we bump into the current function boundary, add the external
@@ -737,11 +737,11 @@
assert method.peekType().isObject();
}
@Override
void consumeStack() {
final int flags = getCallSiteFlags();
- dynamicGet(accessNode.getProperty(), flags, accessNode.isFunction());
+ dynamicGet(accessNode.getProperty(), flags, accessNode.isFunction(), accessNode.isIndex());
}
}.emit(baseAlreadyOnStack ? 1 : 0);
return false;
}
@@ -1441,11 +1441,11 @@
loadExpressionAsObject(node.getBase());
method.dup();
// NOTE: not using a nested OptimisticOperation on this dynamicGet, as we expect to get back
// a callable object. Nobody in their right mind would optimistically type this call site.
assert !node.isOptimistic();
- method.dynamicGet(node.getType(), node.getProperty(), flags, true);
+ method.dynamicGet(node.getType(), node.getProperty(), flags, true, node.isIndex());
method.swap();
argCount = loadArgs(args);
}
@Override
void consumeStack() {
@@ -3144,11 +3144,11 @@
// block scoped variables need a DECLARE flag to signal end of temporal dead zone (TDZ)
final int flags = CALLSITE_SCOPE | getCallSiteFlags() | (varNode.isBlockScoped() ? CALLSITE_DECLARE : 0);
if (isFastScope(identSymbol)) {
storeFastScopeVar(identSymbol, flags);
} else {
- method.dynamicSet(identNode.getName(), flags);
+ method.dynamicSet(identNode.getName(), flags, false);
}
} else {
final Type identType = identNode.getType();
if(identType == Type.UNDEFINED) {
// The symbol must not be slotted; the initializer is either itself undefined (explicit assignment of
@@ -4250,11 +4250,11 @@
if (symbol.isScope()) {
final int flags = CALLSITE_SCOPE | getCallSiteFlags();
if (isFastScope(symbol)) {
storeFastScopeVar(symbol, flags);
} else {
- method.dynamicSet(node.getName(), flags);
+ method.dynamicSet(node.getName(), flags, false);
}
} else {
final Type storeType = assignNode.getType();
if (symbol.hasSlotFor(storeType)) {
// Only emit a convert for a store known to be live; converts for dead stores can
@@ -4267,11 +4267,11 @@
}
@Override
public boolean enterAccessNode(final AccessNode node) {
- method.dynamicSet(node.getProperty(), getCallSiteFlags());
+ method.dynamicSet(node.getProperty(), getCallSiteFlags(), node.isIndex());
return false;
}
@Override
public boolean enterIndexNode(final IndexNode node) {
@@ -4605,15 +4605,15 @@
* @param name the name of the property being get
* @param flags call site flags
* @param isMethod whether we're preferrably retrieving a function
* @return the current method emitter
*/
- MethodEmitter dynamicGet(final String name, final int flags, final boolean isMethod) {
+ MethodEmitter dynamicGet(final String name, final int flags, final boolean isMethod, final boolean isIndex) {
if(isOptimistic) {
- return method.dynamicGet(getOptimisticCoercedType(), name, getOptimisticFlags(flags), isMethod);
+ return method.dynamicGet(getOptimisticCoercedType(), name, getOptimisticFlags(flags), isMethod, isIndex);
}
- return method.dynamicGet(resultBounds.within(expression.getType()), name, nonOptimisticFlags(flags), isMethod);
+ return method.dynamicGet(resultBounds.within(expression.getType()), name, nonOptimisticFlags(flags), isMethod, isIndex);
}
MethodEmitter dynamicGetIndex(final int flags, final boolean isMethod) {
if(isOptimistic) {
return method.dynamicGetIndex(getOptimisticCoercedType(), getOptimisticFlags(flags), isMethod);