Skip to content

Commit

Permalink
[MERGE #5693 @sharmasuraj0123] Fixes #5690: Add trimStart and trimEnd
Browse files Browse the repository at this point in the history
Merge pull request #5693 from sharmasuraj0123:trimStart_trimEnd

Fixes #5690
  • Loading branch information
sharmasuraj0123 committed Sep 15, 2018
2 parents c666aa4 + ae77032 commit be2b997
Show file tree
Hide file tree
Showing 20 changed files with 4,745 additions and 4,659 deletions.
4 changes: 2 additions & 2 deletions lib/Backend/JnHelperMethodList.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ HELPERCALL(String_ToLocaleUpperCase, Js::JavascriptString::EntryToLocaleUpperCas
HELPERCALL(String_ToLowerCase, Js::JavascriptString::EntryToLowerCase, 0)
HELPERCALL(String_ToUpperCase, Js::JavascriptString::EntryToUpperCase, 0)
HELPERCALL(String_Trim, Js::JavascriptString::EntryTrim, 0)
HELPERCALL(String_TrimLeft, Js::JavascriptString::EntryTrimLeft, 0)
HELPERCALL(String_TrimRight, Js::JavascriptString::EntryTrimRight, 0)
HELPERCALL(String_TrimLeft, Js::JavascriptString::EntryTrimStart, 0)
HELPERCALL(String_TrimRight, Js::JavascriptString::EntryTrimEnd, 0)
HELPERCALL(String_GetSz, Js::JavascriptString::GetSzHelper, 0)
HELPERCALL(String_PadStart, Js::JavascriptString::EntryPadStart, 0)
HELPERCALL(String_PadEnd, Js::JavascriptString::EntryPadEnd, 0)
Expand Down
2 changes: 2 additions & 0 deletions lib/Runtime/Base/JnDirectFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,9 @@ ENTRY(toUpperCase)
ENTRY(toUTCString)
ENTRY(trim)
ENTRY(trimLeft)
ENTRY(trimStart)
ENTRY(trimRight)
ENTRY(trimEnd)
ENTRY2(true_, _u("true")) // "true_" cannot be an identifier in C++ so using "true_" instead
ENTRY(TypeError)
ENTRY(undefined)
Expand Down
4 changes: 2 additions & 2 deletions lib/Runtime/ByteCode/ByteCodeCacheReleaseFileVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
//-------------------------------------------------------------------------------------------------------
// NOTE: If there is a merge conflict the correct fix is to make a new GUID.

// {FFAB17C6-6AD9-41BC-AFDA-2DC8E1D4C594}
// {A7B3E50E-9870-4A74-A155-58021B9B2202}
const GUID byteCodeCacheReleaseFileVersion =
{ 0xFFAB17C6, 0x6AD9, 0x41BC, { 0xAF, 0xDA, 0x2D, 0xC8, 0xE1, 0xD4, 0xC5, 0x94 } };
{ 0xA7B3E50E, 0x9870, 0x4A74, { 0xA1, 0x55, 0x58, 0x02, 0x1B, 0x9B, 0x22, 0x02 } };
2,056 changes: 1,028 additions & 1,028 deletions lib/Runtime/Library/InJavascript/Intl.js.bc.32b.h

Large diffs are not rendered by default.

2,038 changes: 1,019 additions & 1,019 deletions lib/Runtime/Library/InJavascript/Intl.js.bc.64b.h

Large diffs are not rendered by default.

2,048 changes: 1,024 additions & 1,024 deletions lib/Runtime/Library/InJavascript/Intl.js.nojit.bc.32b.h

Large diffs are not rendered by default.

2,074 changes: 1,037 additions & 1,037 deletions lib/Runtime/Library/InJavascript/Intl.js.nojit.bc.64b.h

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions lib/Runtime/Library/JavascriptBuiltInFunctionList.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,10 @@ BUILTIN(JavascriptString, ToLowerCase, EntryToLowerCase, FunctionInfo::ErrorOnNe
BUILTIN(JavascriptString, ToString, EntryToString, FunctionInfo::ErrorOnNew | FunctionInfo::HasNoSideEffect)
BUILTIN(JavascriptString, ToUpperCase, EntryToUpperCase, FunctionInfo::ErrorOnNew)
BUILTIN(JavascriptString, Trim, EntryTrim, FunctionInfo::ErrorOnNew)
BUILTIN(JavascriptString, TrimLeft, EntryTrimLeft, FunctionInfo::ErrorOnNew)
BUILTIN(JavascriptString, TrimRight, EntryTrimRight, FunctionInfo::ErrorOnNew)
BUILTIN(JavascriptString, TrimLeft, EntryTrimStart, FunctionInfo::ErrorOnNew)
BUILTIN(JavascriptString, TrimStart, EntryTrimStart, FunctionInfo::ErrorOnNew)
BUILTIN(JavascriptString, TrimRight, EntryTrimEnd, FunctionInfo::ErrorOnNew)
BUILTIN(JavascriptString, TrimEnd, EntryTrimEnd, FunctionInfo::ErrorOnNew)
BUILTIN(JavascriptString, Repeat, EntryRepeat, FunctionInfo::ErrorOnNew)
BUILTIN(JavascriptString, StartsWith, EntryStartsWith, FunctionInfo::ErrorOnNew)
BUILTIN(JavascriptString, EndsWith, EntryEndsWith, FunctionInfo::ErrorOnNew)
Expand Down
16 changes: 12 additions & 4 deletions lib/Runtime/Library/JavascriptLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3405,9 +3405,15 @@ namespace Js
case PropertyIds::trimLeft:
return BuiltinFunction::JavascriptString_TrimLeft;

case PropertyIds::trimStart:
return BuiltinFunction::JavascriptString_TrimStart;

case PropertyIds::trimRight:
return BuiltinFunction::JavascriptString_TrimRight;

case PropertyIds::trimEnd:
return BuiltinFunction::JavascriptString_TrimEnd;

case PropertyIds::padStart:
return BuiltinFunction::JavascriptString_PadStart;

Expand Down Expand Up @@ -3993,8 +3999,10 @@ namespace Js
/* No inlining String_StartsWith */ library->AddFunctionToLibraryObject(stringPrototype, PropertyIds::startsWith, &JavascriptString::EntryInfo::StartsWith, 1);
/* No inlining String_EndsWith */ library->AddFunctionToLibraryObject(stringPrototype, PropertyIds::endsWith, &JavascriptString::EntryInfo::EndsWith, 1);
/* No inlining String_Includes */ library->AddFunctionToLibraryObject(stringPrototype, PropertyIds::includes, &JavascriptString::EntryInfo::Includes, 1);
builtinFuncs[BuiltinFunction::JavascriptString_TrimLeft] = library->AddFunctionToLibraryObject(stringPrototype, PropertyIds::trimLeft, &JavascriptString::EntryInfo::TrimLeft, 0);
builtinFuncs[BuiltinFunction::JavascriptString_TrimRight] = library->AddFunctionToLibraryObject(stringPrototype, PropertyIds::trimRight, &JavascriptString::EntryInfo::TrimRight, 0);
builtinFuncs[BuiltinFunction::JavascriptString_TrimStart] = library->AddFunctionToLibraryObject(stringPrototype, PropertyIds::trimStart, &JavascriptString::EntryInfo::TrimStart, 0);
library->AddMember(stringPrototype, PropertyIds::trimLeft, builtinFuncs[BuiltinFunction::JavascriptString_TrimStart], PropertyBuiltInMethodDefaults);
builtinFuncs[BuiltinFunction::JavascriptString_TrimEnd] = library->AddFunctionToLibraryObject(stringPrototype, PropertyIds::trimEnd, &JavascriptString::EntryInfo::TrimEnd, 0);
library->AddMember(stringPrototype, PropertyIds::trimRight, builtinFuncs[BuiltinFunction::JavascriptString_TrimEnd], PropertyBuiltInMethodDefaults);
}

library->AddFunctionToLibraryObjectWithName(stringPrototype, PropertyIds::_symbolIterator, PropertyIds::_RuntimeFunctionNameId_iterator, &JavascriptString::EntryInfo::SymbolIterator, 0);
Expand Down Expand Up @@ -7460,8 +7468,8 @@ namespace Js
REG_OBJECTS_LIB_FUNC(startsWith, JavascriptString::EntryStartsWith);
REG_OBJECTS_LIB_FUNC(endsWith, JavascriptString::EntryEndsWith);
REG_OBJECTS_LIB_FUNC(includes, JavascriptString::EntryIncludes);
REG_OBJECTS_LIB_FUNC(trimLeft, JavascriptString::EntryTrimLeft);
REG_OBJECTS_LIB_FUNC(trimRight, JavascriptString::EntryTrimRight);
REG_OBJECTS_LIB_FUNC(trimLeft, JavascriptString::EntryTrimStart);
REG_OBJECTS_LIB_FUNC(trimRight, JavascriptString::EntryTrimEnd);

}

Expand Down
5 changes: 2 additions & 3 deletions lib/Runtime/Library/JavascriptString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2384,7 +2384,7 @@ namespace Js
return TrimLeftRightHelper<true /*trimLeft*/, true /*trimRight*/>(pThis, scriptContext);
}

Var JavascriptString::EntryTrimLeft(RecyclableObject* function, CallInfo callInfo, ...)
Var JavascriptString::EntryTrimStart(RecyclableObject* function, CallInfo callInfo, ...)
{
PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);

Expand All @@ -2405,8 +2405,7 @@ namespace Js
return TrimLeftRightHelper< true /*trimLeft*/, false /*trimRight*/>(pThis, scriptContext);
}


Var JavascriptString::EntryTrimRight(RecyclableObject* function, CallInfo callInfo, ...)
Var JavascriptString::EntryTrimEnd(RecyclableObject* function, CallInfo callInfo, ...)
{
PROBE_STACK(function->GetScriptContext(), Js::Constants::MinStackDefault);

Expand Down
6 changes: 4 additions & 2 deletions lib/Runtime/Library/JavascriptString.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ namespace Js
static FunctionInfo ToUpperCase;
static FunctionInfo Trim;
static FunctionInfo TrimLeft;
static FunctionInfo TrimStart;
static FunctionInfo TrimRight;
static FunctionInfo TrimEnd;
static FunctionInfo Repeat;
static FunctionInfo StartsWith;
static FunctionInfo EndsWith;
Expand Down Expand Up @@ -287,8 +289,8 @@ namespace Js
static Var EntryToString(RecyclableObject* function, CallInfo callInfo, ...);
static Var EntryToUpperCase(RecyclableObject* function, CallInfo callInfo, ...);
static Var EntryTrim(RecyclableObject* function, CallInfo callInfo, ...);
static Var EntryTrimLeft(RecyclableObject* function, CallInfo callInfo, ...);
static Var EntryTrimRight(RecyclableObject* function, CallInfo callInfo, ...);
static Var EntryTrimStart(RecyclableObject* function, CallInfo callInfo, ...);
static Var EntryTrimEnd(RecyclableObject* function, CallInfo callInfo, ...);
static Var EntryRepeat(RecyclableObject* function, CallInfo callInfo, ...);
static Var EntryStartsWith(RecyclableObject* function, CallInfo callInfo, ...);
static Var EntryEndsWith(RecyclableObject* function, CallInfo callInfo, ...);
Expand Down
Loading

0 comments on commit be2b997

Please sign in to comment.