Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
[Merge chakra-core/ChakraCore@d19bf32818] [MERGE #3724 @dilijev] Reve…
Browse files Browse the repository at this point in the history
…rt non-optimal pattern in Intl.js

Merge pull request #3724 from dilijev:intl-revert
  • Loading branch information
chakrabot authored and kfarnung committed Jan 9, 2018
1 parent acf5d9e commit c0c0d2b
Show file tree
Hide file tree
Showing 5 changed files with 12,871 additions and 12,748 deletions.
24 changes: 18 additions & 6 deletions deps/chakrashim/core/lib/Runtime/Library/InJavascript/Intl.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,8 +758,12 @@

function Collator() {
// The function should have length of 0, hence we are getting arguments this way.
let locales = arguments[0];
let options = arguments[1];
// While it's true that we could just do e.g. arguments[0] and get undefined if it is not present,
// that makes assumptions that the JIT must check. This pattern is marginally more efficient.
var locales = undefined;
var options = undefined;
if (arguments.length >= 1) locales = arguments[0];
if (arguments.length >= 2) options = arguments[1];

if (this === Intl || this === undefined) {
return new Collator(locales, options);
Expand Down Expand Up @@ -999,8 +1003,12 @@
if (InitType === 'Intl') {
function NumberFormat() {
// The function should have length of 0, hence we are getting arguments this way.
let locales = arguments[0];
let options = arguments[1];
// While it's true that we could just do e.g. arguments[0] and get undefined if it is not present,
// that makes assumptions that the JIT must check. This pattern is marginally more efficient.
var locales = undefined;
var options = undefined;
if (arguments.length >= 1) locales = arguments[0];
if (arguments.length >= 2) options = arguments[1];

if (this === Intl || this === undefined) {
return new NumberFormat(locales, options);
Expand Down Expand Up @@ -1497,8 +1505,12 @@
if (InitType === 'Intl') {
function DateTimeFormat() {
// The function should have length of 0, hence we are getting arguments this way.
let locales = arguments[0];
let options = arguments[1];
// While it's true that we could just do e.g. arguments[0] and get undefined if it is not present,
// that makes assumptions that the JIT must check. This pattern is marginally more efficient.
var locales = undefined;
var options = undefined;
if (arguments.length >= 1) locales = arguments[0];
if (arguments.length >= 2) options = arguments[1];

if (this === Intl || this === undefined) {
return new DateTimeFormat(locales, options);
Expand Down
Loading

0 comments on commit c0c0d2b

Please sign in to comment.