Opened 4 years ago

Closed 4 years ago

#3873 closed change (fixed)

Replace more occurrences of __proto__ with Object.create(null)

Reported by: sebastian Assignee:
Priority: Unknown Milestone:
Module: Core Keywords:
Cc: Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29339071

Description (last modified by sebastian)

Background

The special property __proto__ has only recently been added to the ES standard as a legacy feature. Moreover, object literals using __proto__ causes the whole function to be deoptimized on V8.

Anyway, for a while we avoid using __proto__ now where easily possible, in particular for objects used as a hash-table. With #656, we even migrated most existing code where possible to use Object.create(null) instead. But it seems some bits have been overlooked or got reintroduced later.

Most notably, ActiveFilter.domains is currently using __proto__ in an object literal, triggering a deoptimization on V8, that effects filter matching performance on Chrome.

What to change

Replace object literals using __proto__: null with Object.create(null).

Change History (5)

comment:1 Changed 4 years ago by sebastian

  • Description modified (diff)

comment:2 Changed 4 years ago by sebastian

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:3 Changed 4 years ago by sebastian

  • Description modified (diff)

comment:4 Changed 4 years ago by abpbot

A commit referencing this issue has landed:
https://hg.adblockplus.org/adblockpluscore/rev/655248eac773

comment:5 Changed 4 years ago by sebastian

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.