8015684: FieldObjectCreator.putField ignores getValueType

Reviewed-by: jlaskey, lagergren
This commit is contained in:
Attila Szegedi 2013-05-31 12:57:25 +02:00
parent 8bcbbe70de
commit 9617ee41ca
2 changed files with 1 additions and 28 deletions

View File

@ -60,7 +60,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.TreeMap;
import jdk.nashorn.internal.codegen.ClassEmitter.Flag;
import jdk.nashorn.internal.codegen.CompilerConstants.Call;
import jdk.nashorn.internal.codegen.RuntimeCallSite.SpecializedRuntimeNode;
@ -80,11 +79,11 @@ import jdk.nashorn.internal.ir.EmptyNode;
import jdk.nashorn.internal.ir.ExecuteNode;
import jdk.nashorn.internal.ir.ForNode;
import jdk.nashorn.internal.ir.FunctionNode;
import jdk.nashorn.internal.ir.LexicalContext;
import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
import jdk.nashorn.internal.ir.IdentNode;
import jdk.nashorn.internal.ir.IfNode;
import jdk.nashorn.internal.ir.IndexNode;
import jdk.nashorn.internal.ir.LexicalContext;
import jdk.nashorn.internal.ir.LexicalContextNode;
import jdk.nashorn.internal.ir.LiteralNode;
import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
@ -941,11 +940,6 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
* bootstrap code for object
*/
final FieldObjectCreator<Symbol> foc = new FieldObjectCreator<Symbol>(this, nameList, newSymbols, values, true, hasArguments) {
@Override
protected Type getValueType(final Symbol value) {
return value.getSymbolType();
}
@Override
protected void loadValue(final Symbol value) {
method.load(value);
@ -1356,11 +1350,6 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
}
new FieldObjectCreator<Node>(this, keys, symbols, values) {
@Override
protected Type getValueType(final Node node) {
return node.getType();
}
@Override
protected void loadValue(final Node node) {
load(node);

View File

@ -144,15 +144,6 @@ public abstract class FieldObjectCreator<T> extends ObjectCreator {
*/
protected abstract void loadValue(T value);
/**
* Determine the type of a value. Defined by anonymous subclasses in code gen.
*
* @param value Value to inspect.
*
* @return Value type.
*/
protected abstract Type getValueType(T value);
/**
* Store a value in a field of the generated class object.
*
@ -165,13 +156,6 @@ public abstract class FieldObjectCreator<T> extends ObjectCreator {
method.dup();
loadValue(value);
final Type valueType = getValueType(value);
// for example when we have a with scope
if (valueType.isObject() || valueType.isBoolean()) {
method.convert(OBJECT);
}
method.convert(OBJECT);
method.putField(getClassName(), ObjectClassGenerator.getFieldName(fieldIndex, Type.OBJECT), typeDescriptor(Object.class));
}