summaryrefslogtreecommitdiff
path: root/gi/repo.cpp
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2018-09-05 21:07:07 -0400
committerPhilip Chimento <philip.chimento@gmail.com>2018-11-05 23:18:30 -0500
commit74693dfc2ba5e6430e896a053780b9ba9274f624 (patch)
tree8755859f685cfe483c2c39b999301545173d72a8 /gi/repo.cpp
parentac94032fd2d93a8dfa41607d893ac0744706945a (diff)
downloadgjs-74693dfc2ba5e6430e896a053780b9ba9274f624.tar.gz
js: Compare jsid in some resolve hooks instead of strings
It's faster to compare jsids because they can compare directly by value. Now that we atomize common strings, we can do this in the resolve hooks of Ns, Repo, and Importer.
Diffstat (limited to 'gi/repo.cpp')
-rw-r--r--gi/repo.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 98aa3dbb..e5284000 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -171,10 +171,9 @@ repo_resolve(JSContext *context,
return true; /* not resolved, but no error */
}
- JSFlatString *str = JSID_TO_FLAT_STRING(id);
/* let Object.prototype resolve these */
- if (JS_FlatStringEqualsAscii(str, "valueOf") ||
- JS_FlatStringEqualsAscii(str, "toString")) {
+ const GjsAtoms& atoms = GjsContextPrivate::atoms(context);
+ if (id == atoms.to_string() || id == atoms.value_of()) {
*resolved = false;
return true;
}