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

Unified Diff: tools/turbolizer/selection.js

Issue 2066313002: [turbolizer] Performance improvements for selection in graph & schedule (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/turbolizer/graph-view.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/turbolizer/selection.js
diff --git a/tools/turbolizer/selection.js b/tools/turbolizer/selection.js
index eb7a0b094faa379cad31a1d149d4d9334c4b56f7..e9c02dda9e70e4883ce133c29dd1751c94fe5b59 100644
--- a/tools/turbolizer/selection.js
+++ b/tools/turbolizer/selection.js
@@ -27,20 +27,29 @@ Selection.prototype.clear = function() {
count = 0;
-Selection.prototype.select = function(s, selected) {
+Selection.prototype.select = function(s, isSelected) {
var handler = this.handler;
- if (this.selection.has(s) && !selected) {
- handler.select([s], false);
- this.selection.delete(s);
- return;
- }
-
- if (selected) {
- this.selection.add(s);
- this.selectionBase = s;
- this.lastSelection = s;
- handler.select(this.selection, selected);
+ if (!(Symbol.iterator in Object(s))) { s = [s]; }
+ if (isSelected) {
+ let first = true;
+ for (let i of s) {
+ if (first) {
+ this.selectionBase = i;
+ this.lastSelection = i;
+ first = false;
+ }
+ this.selection.add(i);
+ }
+ } else {
+ let unselectSet = new Set();
+ for (let i of s) {
+ if (this.selection.has(i)) {
+ unselectSet.add(i);
+ this.selection.delete(i);
+ }
+ }
}
+ handler.select(this.selection, isSelected);
}
« no previous file with comments | « tools/turbolizer/graph-view.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698