src/jdk/nashorn/internal/codegen/CodeGenerator.java

Print this page




 324         node.accept(new NodeVisitor(compileUnit, method) {
 325             @Override
 326             public Node enter(final IdentNode identNode) {
 327                 loadIdent(identNode);
 328                 return null;
 329             }
 330 
 331             @Override
 332             public Node enter(final AccessNode accessNode) {
 333                 if (!baseAlreadyOnStack) {
 334                     load(accessNode.getBase()).convert(Type.OBJECT);
 335                 }
 336                 assert method.peekType().isObject();
 337                 method.dynamicGet(node.getType(), accessNode.getProperty().getName(), getCallSiteFlags(), accessNode.isFunction());
 338                 return null;
 339             }
 340 
 341             @Override
 342             public Node enter(final IndexNode indexNode) {
 343                 if (!baseAlreadyOnStack) {
 344                     load(indexNode.getBase());
 345                     load(indexNode.getIndex());
 346                 }
 347                 method.dynamicGetIndex(node.getType(), getCallSiteFlags(), indexNode.isFunction());
 348                 return null;
 349             }
 350 
 351             @Override
 352             public Node enterDefault(final Node otherNode) {
 353                 otherNode.accept(codegen); // generate code for whatever we are looking at.
 354                 method.load(symbol); // load the final symbol to the stack (or nop if no slot, then result is already there)
 355                 return null;
 356             }
 357         });
 358 
 359         return method;
 360     }
 361 
 362     @Override
 363     public Node enter(final AccessNode accessNode) {
 364         if (accessNode.testResolved()) {




 324         node.accept(new NodeVisitor(compileUnit, method) {
 325             @Override
 326             public Node enter(final IdentNode identNode) {
 327                 loadIdent(identNode);
 328                 return null;
 329             }
 330 
 331             @Override
 332             public Node enter(final AccessNode accessNode) {
 333                 if (!baseAlreadyOnStack) {
 334                     load(accessNode.getBase()).convert(Type.OBJECT);
 335                 }
 336                 assert method.peekType().isObject();
 337                 method.dynamicGet(node.getType(), accessNode.getProperty().getName(), getCallSiteFlags(), accessNode.isFunction());
 338                 return null;
 339             }
 340 
 341             @Override
 342             public Node enter(final IndexNode indexNode) {
 343                 if (!baseAlreadyOnStack) {
 344                     load(indexNode.getBase()).convert(Type.OBJECT);
 345                     load(indexNode.getIndex());
 346                 }
 347                 method.dynamicGetIndex(node.getType(), getCallSiteFlags(), indexNode.isFunction());
 348                 return null;
 349             }
 350 
 351             @Override
 352             public Node enterDefault(final Node otherNode) {
 353                 otherNode.accept(codegen); // generate code for whatever we are looking at.
 354                 method.load(symbol); // load the final symbol to the stack (or nop if no slot, then result is already there)
 355                 return null;
 356             }
 357         });
 358 
 359         return method;
 360     }
 361 
 362     @Override
 363     public Node enter(final AccessNode accessNode) {
 364         if (accessNode.testResolved()) {