Chromium Code Reviews| Index: src/builtins/builtins-string.cc |
| diff --git a/src/builtins/builtins-string.cc b/src/builtins/builtins-string.cc |
| index d38f6b069d50f5e751d7dfb3147f602a25b2d4f6..3dd3cacf89f1b0e23aaa716c88c5963501e1c1e9 100644 |
| --- a/src/builtins/builtins-string.cc |
| +++ b/src/builtins/builtins-string.cc |
| @@ -477,6 +477,40 @@ void Builtins::Generate_StringPrototypeCharCodeAt( |
| assembler->Return(result); |
| } |
| +// ECMA-262 v6, section 21.1.3.12 String.prototype.normalize ( [form] ) |
| +// |
| +// For now we do nothing, as proper normalization requires big tables. |
| +// If Intl is enabled, then i18n.js will override it and provide the the |
|
Franzi
2016/09/09 12:51:04
There's a double "the" in there.
Can we change t
petermarshall
2016/09/09 13:23:01
Done
|
| +// proper functionality. |
| +BUILTIN(StringPrototypeNormalize) { |
| + HandleScope handle_scope(isolate); |
| + TO_THIS_STRING(string, "String.prototype.normalize"); |
| + |
| + Handle<Object> form = args.atOrUndefined(isolate, 1); |
| + if (form->IsUndefined(isolate)) return *string; |
| + |
| + Handle<String> form_string; |
|
Franzi
2016/09/09 12:51:04
I usually try to avoid variable names that indicat
petermarshall
2016/09/09 13:23:02
Hmm String::Equals complains because it needs Stri
|
| + ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, form_string, |
| + Object::ToString(isolate, form)); |
| + |
| + if (!(String::Equals(form_string, |
| + isolate->factory()->NewStringFromStaticChars("NFC")) || |
| + String::Equals(form_string, |
| + isolate->factory()->NewStringFromStaticChars("NFD")) || |
| + String::Equals(form_string, |
| + isolate->factory()->NewStringFromStaticChars("NFKC")) || |
| + String::Equals(form_string, |
| + isolate->factory()->NewStringFromStaticChars("NFKD")))) { |
| + Handle<String> valid_forms = |
| + isolate->factory()->NewStringFromStaticChars("NFC, NFD, NFKC, NFKD"); |
| + THROW_NEW_ERROR_RETURN_FAILURE( |
| + isolate, |
| + NewRangeError(MessageTemplate::kNormalizationForm, valid_forms)); |
| + } |
| + |
| + return *string; |
| +} |
| + |
| // ES6 section 21.1.3.25 String.prototype.toString () |
| void Builtins::Generate_StringPrototypeToString(CodeStubAssembler* assembler) { |
| typedef compiler::Node Node; |