summaryrefslogtreecommitdiff
path: root/deps/v8/src/builtins/builtins-string.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/builtins/builtins-string.cc')
-rw-r--r--deps/v8/src/builtins/builtins-string.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/deps/v8/src/builtins/builtins-string.cc b/deps/v8/src/builtins/builtins-string.cc
index e52fbd577d..0dafa230b5 100644
--- a/deps/v8/src/builtins/builtins-string.cc
+++ b/deps/v8/src/builtins/builtins-string.cc
@@ -2,13 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/builtins/builtins-utils.h"
+#include "src/builtins/builtins-utils-inl.h"
#include "src/builtins/builtins.h"
#include "src/conversions.h"
#include "src/counters.h"
#include "src/objects-inl.h"
+#ifdef V8_INTL_SUPPORT
+#include "src/objects/intl-objects.h"
+#endif
#include "src/regexp/regexp-utils.h"
-#include "src/string-builder.h"
+#include "src/string-builder-inl.h"
#include "src/string-case.h"
#include "src/unicode-inl.h"
#include "src/unicode.h"
@@ -190,10 +193,18 @@ BUILTIN(StringPrototypeLastIndexOf) {
//
// This function is implementation specific. For now, we do not
// do anything locale specific.
-// If internationalization is enabled, then intl.js will override this function
-// and provide the proper functionality, so this is just a fallback.
BUILTIN(StringPrototypeLocaleCompare) {
HandleScope handle_scope(isolate);
+#ifdef V8_INTL_SUPPORT
+ TO_THIS_STRING(str1, "String.prototype.localeCompare");
+ Handle<String> str2;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, str2, Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
+ RETURN_RESULT_OR_FAILURE(
+ isolate, Intl::StringLocaleCompare(isolate, str1, str2,
+ args.atOrUndefined(isolate, 2),
+ args.atOrUndefined(isolate, 3)));
+#else
DCHECK_EQ(2, args.length());
TO_THIS_STRING(str1, "String.prototype.localeCompare");
@@ -235,6 +246,7 @@ BUILTIN(StringPrototypeLocaleCompare) {
}
return Smi::FromInt(str1_length - str2_length);
+#endif // !V8_INTL_SUPPORT
}
#ifndef V8_INTL_SUPPORT