Commit Graph

311 Commits

Author SHA1 Message Date
Jan de Mooij
e5f8a28c84 Bug 1461292 part 1 - Rename JSAutoCompartment to JSAutoRealm. r=bz,luke 2018-05-16 10:53:16 +02:00
Boris Zbarsky
599ef690cf Bug 1455674 part 16. Remove most use of nsIDOMElement in dom. r=qdot 2018-04-26 23:37:34 -04:00
Tom Schuster
6698b9aad3 Bug 1255800 - Remove JS_THIS_OBJECT from dom/xpconnect. r=bz 2018-03-07 14:35:22 +01:00
Jason Orendorff
d640df5146 Bug 1439063 - Part 1: Move several public headers from js/src to js/public. r=jandem.
js/src/jsalloc.h -> js/public/AllocPolicy.h
jsalloc.cpp -> js/src/util/AllocPolicy.cpp
jsbytecode.h -> merge into js/public/TypeDecls.h
jsprf.h -> js/public/Printf.h
jsprf.cpp -> js/src/util/Printf.cpp
jsprototypes.h -> public/ProtoKey.h
jswrapper.h -> js/Wrapper.h
2018-02-21 10:30:19 -06:00
Jon Coppeard
dc1f965f41 Bug 1428515 - Check for dying JSObjects when accessing plugin wrapper table r=bz
The sNPObjWrappers table can contain entries for dead JSObjects that have not yet been finalised.  We need to take care not to trigger mJSObj's read barrier for such entries since that will attempt to expose the object to JS and cause this assertion.

The patch does this by calling unbarrieredGetPtr() which avoids the barrier.

Note converting a TenuredHeap to bool and testing equality against a pointer don't trigger the barrier.
2018-01-12 10:36:23 +00:00
Jon Coppeard
038756407d Bug 1396613 - Make proxy objects override handler's objectMoved method rather than using class hook r=sfink r=mccr8 r=peterv 2017-09-19 12:31:30 +01:00
Jon Coppeard
92628b5345 Bug 1396613 - Update the object moved hook to allow it to be called when tenuring nursery objects r=sfink r=mccr8 2017-09-19 12:31:30 +01:00
Steve Fink
0474bc3680 Bug 1389974 - Rooting fixes for nsJSNPRuntime.cpp, r=froydnj 2017-09-01 08:28:38 -07:00
Jan de Mooij
f9f0443c9f Bug 1389510 part 3 - Remove getProperty/setProperty hooks from ClassOps. r=evilpie 2017-08-25 10:12:16 +02:00
Jan de Mooij
9f9e5ffb6d Bug 1389949 - Make NPObjWrapper a JS proxy object. r=billm 2017-08-18 10:22:20 +02:00
Jan de Mooij
9036483d3c Bug 1390074 - Remove unused nsJSObjWrapper::HasOwnProperty method. r=njn 2017-08-15 16:14:21 +02:00
Jan de Mooij
b1dcc4dfa0 Bug 1390068 - Define Symbol.toPrimitive property when creating NPObjectMember instead of using a getProperty hook. r=evilpie 2017-08-14 15:54:56 +02:00
Nicholas Nethercote
bcf030f06d Bug 1352575 (part 14) - Remove more surrogate use when casting. r=jimm. 2017-04-18 16:56:44 +10:00
Nicholas Nethercote
fcd4f4fa21 Bug 1376638 - Minimize uses of prmem.h. r=glandium.
It's silly to use prmem.h within Firefox code given that in our configuration
its functions are just wrappers for malloc() et al. (Indeed, in some places we
mix PR_Malloc() with free(), or malloc() with PR_Free().)

This patch removes all uses, except for the places where we need to use
PR_Free() to free something allocated by another NSPR function; in those cases
I've added a comment explaining which function did the allocation.
2017-06-30 19:05:41 -07:00
Nicholas Nethercote
a58025002f Bug 1375392 - Tweak the PROFILER_LABEL* macros. r=mstange.
This patch makes the following changes to the macros.

- Removes PROFILER_LABEL_FUNC. It's only suitable for use in functions outside
  classes, due to PROFILER_FUNCTION_NAME not getting class names, and it was
  mostly misused.

- Removes PROFILER_FUNCTION_NAME. It's no longer used, and __func__ is
  universally available now anyway.

- Combines the first two string literal arguments of PROFILER_LABEL and
  PROFILER_LABEL_DYNAMIC into a single argument. There was no good reason for
  them to be separate, and it forced a '::' in the label, which isn't always
  appropriate. Also, the meaning of the "name_space" argument was interpreted
  in an interesting variety of ways.

- Adds an "AUTO_" prefix to PROFILER_LABEL and PROFILER_LABEL_DYNAMIC, to make
  it clearer they construct RAII objects rather than just being function calls.
  (I myself have screwed up the scoping because of this in the past.)

- Fills in the 'js::ProfileEntry::Category::' qualifier within the macro, so
  the caller doesn't need to. This makes a *lot* more of the uses fit onto a
  single line.

The patch also makes the following changes to the macro uses (beyond those
required by the changes described above).

- Fixes a bunch of labels that had gotten out of sync with the name of the
  class and/or function that encloses them.

- Removes a useless PROFILER_LABEL use within a trivial scope in
  EventStateManager::DispatchMouseOrPointerEvent(). It clearly wasn't serving
  any useful purpose. It also serves as extra evidence that the AUTO_ prefix is
  a good idea.

- Tweaks DecodePool::SyncRunIf{Preferred,Possible} so that the labelling is
  done within them, instead of at their callsites, because that's a more
  standard way of doing things.
2017-06-22 17:08:53 +10:00
Jan de Mooij
5e5e72f23f Bug 1370608 part 1 - Move newEnumerate hook from ObjectOps to ClassOps. r=evilpie,bz 2017-06-14 10:37:44 +02:00
Jon Coppeard
c04c4e7cb6 Bug 1360961 - Fix spurious rooting hazard r=me 2017-05-04 09:38:43 +01:00
Jon Coppeard
37ca18f7a1 Bug 1360961 - Add a barrier to the plugin object wrapper table to handle incrementally finalized JSObjects r=bz 2017-05-04 08:17:39 +01:00
Brian Hackett
6a2580c190 Bug 1324002 - Mark atoms separately in each zone, r=jonco,mccr8,peterv. 2017-01-30 06:31:47 -07:00
Steve Fink
ba86250240 Bug 1308236 - Don't trigger read barriers when comparing wrapped pointers types r=sfink r=mccr8 2016-10-28 15:11:56 -07:00
Jan de Mooij
833523746d Bug 1319524 - Add JSAutoCompartment to GetNPObjectWrapper. r=bholley 2016-11-29 11:59:25 +01:00
Jon Coppeard
c3228b08de Bug 1313098 - Assert we only access heap state on the main thread r=sfink r=mccr8 2016-11-04 17:32:36 +00:00
Tom Tromey
fad2c810d6 Bug 553032 - use MOZ_FORMAT_PRINTF in js; r=evilpie
MozReview-Commit-ID: DD3DJRkOxmC
2016-10-11 12:44:40 -06:00
Sebastian Hengst
ac4e31ada2 Backed out changeset 2bfd163f23f9 (bug 553032) 2016-10-19 18:29:36 +02:00
Tom Tromey
371584f1db Bug 553032 - use MOZ_FORMAT_PRINTF in js; r=evilpie
MozReview-Commit-ID: DD3DJRkOxmC
2016-10-11 12:44:40 -06:00
Tooru Fujisawa
11c4b51a67 Bug 1290337 - Part 16: Replace Value parameter to const Value& in dom. r=smaug 2016-09-11 18:15:24 +09:00
Tooru Fujisawa
a0fab7f564 Bug 1289050 - Part 8: Use ASCII or UTF8 variant of JS_ReportErrorNumber in non-simple cases. r=jwalden 2016-08-15 23:05:04 +09:00
Tooru Fujisawa
e2afbe3471 Bug 1289050 - Part 2: Use ASCII or Latin1 variants of JS_ReportError in not-simple cases. r=jwalden 2016-08-15 19:20:01 +09:00
Tom Schuster
7dce728a6a Bug 1114580 - Return a fixed name for @@toString on plugins. r=billm 2016-08-31 00:13:10 +02:00
Jon Coppeard
66a80788eb Bug 1296688 - Add JSCLASS_FOREGROUND_FINALIZE flag r=sfink r=smaug 2016-08-24 14:18:10 +01:00
Jan de Mooij
bd0f1c9018 Bug 1292892 part 1 - Stop using JSRuntime outside SpiderMonkey. r=bz,terrence,fitzgen,kanru 2016-08-11 14:39:22 +02:00
Jan de Mooij
24d5a9da4c Bug 1283855 part 11 - Make some GC callback APIs take JSContext instead of JSRuntime. r=terrence,mccr8 2016-07-05 14:35:19 +02:00
Jonathan Watt
9c5b8de022 Bug 1279451 - Remove a lot of unnecessary includes of nsAutoPtr.h. rs=sparky 2016-06-07 21:10:18 +01:00
Boris Zbarsky
08984b43d3 Bug 1276286. Remove the unused JSContext stuff in nsJSObjWrapper::GetNewOrUsed. r=mccr8 2016-05-27 13:30:10 -04:00
Terrence Cole
315ff1f2c2 Bug 1267699 - Move some public types to the right namespace; r=sfink 2016-04-26 09:18:48 -07:00
Nicholas Nethercote
a35143c546 Bug 1261723 (part 2) - Separate class ops from js::Class. code=njn,h4writer. r=efaust,bz.
js::Class op are often all null. And when they're not all null, they're often
duplicated among classes. By pulling them out into their own struct, and using a
(possibly null) pointer in js::Class, we can save 114 KiB per process on
64-bit, and half that on 32-bit.
* * *
imported patch separate-ClassOps-2
2016-04-01 11:00:01 +11:00
Nicholas Nethercote
ea5ce3931c Bug 1261720 (part 2) - Move ClassExtension::isWrappedNative into js::Class::flags. r=jorendorff.
This saves 10 KiB of static data on 64-bit, and half that on 32-bit.
2016-04-04 08:47:15 +10:00
Nicholas Nethercote
a34f03aa34 Bug 1261720 (part 1) - Separate js::ClassExtension from js::Class. r=jorendorff,bz.
js::ClassExtension is often all null. When it's not all null, it's often
duplicated among classes. By pulling it out into its own struct, and using a
(possibly null) pointer in js::Class, we can save 17 KiB per process on
64-bit, and half that on 32-bit.
2016-04-04 08:45:07 +10:00
Nicholas Nethercote
8fb8d0f2ff Bug 1259194 (part 4) - Separate js::ObjectOps from js::Class. r=efaust,mrbkap,bz.
js::ObjectOps is often all null. When it's not all null, it's often duplicated
many times among classes. By pulling it out into its own struct, and using a
(possibly null) pointer in js::Class, we can save 208 KiB per process on
64-bit, and half that on 32-bit.
2016-03-24 07:00:29 +11:00
Boris Zbarsky
a50c6aa31a Bug 1255817 part 2. Get rid of AutoJSAPI::OwnsErrorReporting and AutoJSAPI::TakeOwnershipOfErrorReporting. r=bholley 2016-03-23 11:44:54 -04:00
Boris Zbarsky
63091385d1 Bug 1254847 part 3. Make AutoEntryScript always take ownership of error reporting. r=bholley 2016-03-09 19:02:03 -05:00
Boris Zbarsky
2fd4be7bc7 Bug 1254847 part 2. Change nsJSNPRuntime to always use AutoEntryScript and always take ownership of error reporting. r=bholley
The main change is that we move AutoJSExceptionReporter up to before the first
place where we might throw an exception, so we report those exceptions before
returning.  The change to use AutoEntryScript consistently is because all of
these callsites can run JS in practice, and it seems reasonable to allow them
to.
2016-03-09 19:02:03 -05:00
Nicholas Nethercote
82fdd0f23b Bug 1246054 - Fix an erroneous nsNPObjWrapper assertion. r=froydnj. 2016-02-05 16:36:05 +11:00
Terrence Cole
01a8cf9876 Bug 1234862 - Part 5: Rename DefaultGCPolicy to GCPolicy; r=sfink 2016-01-26 12:53:35 -08:00
David Rajchenbach-Teller
323ccee44c Bug 1224374 - Profiler labels for the top 26-100 chrome hangs;r=BenWa 2016-01-15 11:38:03 +01:00
Sebastian Hengst
2e241e7e5e Backed out 2 changesets (bug 1224374) for Windows bustage. r=bustage on a CLOSED TREE
Backed out changeset 5f458e6e4997 (bug 1224374)
Backed out changeset 0dc02cb0b604 (bug 1224374)
2016-01-19 21:30:41 +01:00
David Rajchenbach-Teller
f7045cd073 Bug 1224374 - Profiler labels for the top 26-100 chrome hangs;r=BenWa 2016-01-15 11:38:03 +01:00
Terrence Cole
0084fa1308 Bug 1239494 - Followup to fix a spurious hazard analysis failure; r=meow 2016-01-14 14:43:03 -08:00
Terrence Cole
914888fc6b Bug 1239494 - Use GCHashMap to simplify nsWrapperCache; r=jonco 2016-01-14 09:43:03 -08:00
Terrence Cole
2a68224fb0 Bug 1238786 - Part 2: We no longer need to null check before using trace APIs; r=smaug 2016-01-12 13:07:54 -08:00