Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: pkg/compiler/lib/src/js_model/js_strategy.dart

Issue 3007743002: Add boxing for modified variables (Closed)
Patch Set: merged with master Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.js_model.strategy; 5 library dart2js.js_model.strategy;
6 6
7 import 'package:kernel/ast.dart' as ir; 7 import 'package:kernel/ast.dart' as ir;
8 8
9 import '../closure.dart' show ClosureConversionTask; 9 import '../closure.dart' show ClosureConversionTask;
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 typesImplementedBySubclasses, 412 typesImplementedBySubclasses,
413 classHierarchyNodes, 413 classHierarchyNodes,
414 classSets); 414 classSets);
415 415
416 /// Construct a closure class and set up the necessary class inference 416 /// Construct a closure class and set up the necessary class inference
417 /// hierarchy. 417 /// hierarchy.
418 KernelClosureClass buildClosureClass( 418 KernelClosureClass buildClosureClass(
419 MemberEntity member, 419 MemberEntity member,
420 ir.FunctionNode originalClosureFunctionNode, 420 ir.FunctionNode originalClosureFunctionNode,
421 JLibrary enclosingLibrary, 421 JLibrary enclosingLibrary,
422 Map<Local, JRecordField> boxedVariables,
422 KernelScopeInfo info, 423 KernelScopeInfo info,
423 ir.Location location, 424 ir.Location location,
424 KernelToLocalsMap localsMap) { 425 KernelToLocalsMap localsMap) {
425 ClassEntity superclass = commonElements.closureClass; 426 ClassEntity superclass = commonElements.closureClass;
426 427
427 KernelClosureClass cls = elementMap.constructClosureClass( 428 KernelClosureClass cls = elementMap.constructClosureClass(
428 member, 429 member,
429 originalClosureFunctionNode, 430 originalClosureFunctionNode,
430 enclosingLibrary, 431 enclosingLibrary,
432 boxedVariables,
431 info, 433 info,
432 location, 434 location,
433 localsMap, 435 localsMap,
434 new InterfaceType(superclass, const [])); 436 new InterfaceType(superclass, const []));
435 437
436 // Tell the hierarchy that this is the super class. then we can use 438 // Tell the hierarchy that this is the super class. then we can use
437 // .getSupertypes(class) 439 // .getSupertypes(class)
438 ClassHierarchyNode parentNode = getClassHierarchyNode(superclass); 440 ClassHierarchyNode parentNode = getClassHierarchyNode(superclass);
439 ClassHierarchyNode node = new ClassHierarchyNode( 441 ClassHierarchyNode node = new ClassHierarchyNode(
440 parentNode, cls.closureClassEntity, getHierarchyDepth(superclass) + 1); 442 parentNode, cls.closureClassEntity, getHierarchyDepth(superclass) + 1);
441 addClassHierarchyNode(cls.closureClassEntity, node); 443 addClassHierarchyNode(cls.closureClassEntity, node);
442 for (InterfaceType type in getOrderedTypeSet(superclass).types) { 444 for (InterfaceType type in getOrderedTypeSet(superclass).types) {
443 // TODO(efortuna): assert that the FunctionClass is in this ordered set. 445 // TODO(efortuna): assert that the FunctionClass is in this ordered set.
444 // If not, we need to explicitly add node as a subtype of FunctionClass. 446 // If not, we need to explicitly add node as a subtype of FunctionClass.
445 ClassSet subtypeSet = getClassSet(type.element); 447 ClassSet subtypeSet = getClassSet(type.element);
446 subtypeSet.addSubtype(node); 448 subtypeSet.addSubtype(node);
447 } 449 }
448 addClassSet(cls.closureClassEntity, new ClassSet(node)); 450 addClassSet(cls.closureClassEntity, new ClassSet(node));
449 node.isDirectlyInstantiated = true; 451 node.isDirectlyInstantiated = true;
450 452
451 return cls; 453 return cls;
452 } 454 }
453 455
454 @override 456 @override
455 void registerClosureClass(ClassEntity cls) { 457 void registerClosureClass(ClassEntity cls) {
456 throw new UnsupportedError('JsClosedWorld.registerClosureClass'); 458 throw new UnsupportedError('JsClosedWorld.registerClosureClass');
457 } 459 }
458 } 460 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_model/closure_visitors.dart ('k') | pkg/compiler/lib/src/kernel/element_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698