Index: src/runtime/runtime-strings.cc |
diff --git a/src/runtime/runtime-strings.cc b/src/runtime/runtime-strings.cc |
index 35e443acdb8f3c2894626250ec7e31552d4eea1c..03b8a08afa09bea3a5936e67eb9ca1fed08abc4f 100644 |
--- a/src/runtime/runtime-strings.cc |
+++ b/src/runtime/runtime-strings.cc |
@@ -1145,6 +1145,78 @@ RUNTIME_FUNCTION(Runtime_NewString) { |
return *result; |
} |
+RUNTIME_FUNCTION(Runtime_StringLessThan) { |
+ HandleScope handle_scope(isolate); |
+ DCHECK_EQ(2, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(String, x, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(String, y, 1); |
+ switch (String::Compare(x, y)) { |
+ case ComparisonResult::kLessThan: |
+ return isolate->heap()->true_value(); |
+ case ComparisonResult::kEqual: |
+ case ComparisonResult::kGreaterThan: |
+ return isolate->heap()->false_value(); |
+ case ComparisonResult::kUndefined: |
+ break; |
+ } |
+ UNREACHABLE(); |
+ return Smi::FromInt(0); |
+} |
+ |
+RUNTIME_FUNCTION(Runtime_StringLessThanOrEqual) { |
+ HandleScope handle_scope(isolate); |
+ DCHECK_EQ(2, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(String, x, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(String, y, 1); |
+ switch (String::Compare(x, y)) { |
+ case ComparisonResult::kEqual: |
+ case ComparisonResult::kLessThan: |
+ return isolate->heap()->true_value(); |
+ case ComparisonResult::kGreaterThan: |
+ return isolate->heap()->false_value(); |
+ case ComparisonResult::kUndefined: |
+ break; |
+ } |
+ UNREACHABLE(); |
+ return Smi::FromInt(0); |
+} |
+ |
+RUNTIME_FUNCTION(Runtime_StringGreaterThan) { |
+ HandleScope handle_scope(isolate); |
+ DCHECK_EQ(2, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(String, x, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(String, y, 1); |
+ switch (String::Compare(x, y)) { |
+ case ComparisonResult::kGreaterThan: |
+ return isolate->heap()->true_value(); |
+ case ComparisonResult::kEqual: |
+ case ComparisonResult::kLessThan: |
+ return isolate->heap()->false_value(); |
+ case ComparisonResult::kUndefined: |
+ break; |
+ } |
+ UNREACHABLE(); |
+ return Smi::FromInt(0); |
+} |
+ |
+RUNTIME_FUNCTION(Runtime_StringGreaterThanOrEqual) { |
+ HandleScope handle_scope(isolate); |
+ DCHECK_EQ(2, args.length()); |
+ CONVERT_ARG_HANDLE_CHECKED(String, x, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(String, y, 1); |
+ switch (String::Compare(x, y)) { |
+ case ComparisonResult::kEqual: |
+ case ComparisonResult::kGreaterThan: |
+ return isolate->heap()->true_value(); |
+ case ComparisonResult::kLessThan: |
+ return isolate->heap()->false_value(); |
+ case ComparisonResult::kUndefined: |
+ break; |
+ } |
+ UNREACHABLE(); |
+ return Smi::FromInt(0); |
+} |
+ |
RUNTIME_FUNCTION(Runtime_StringEqual) { |
HandleScope handle_scope(isolate); |
DCHECK_EQ(2, args.length()); |