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

Commit 5f833ab

Browse files
sigatrevchakrabot
authored andcommitted
deps: update ChakraCore to chakra-core/ChakraCore@abd18d0bde
[1.8>1.9] [MERGE #4598 @sigatrev] OS#15490382: assign string value type to the result of TypeofElem Merge pull request #4598 from sigatrev:typeOfElem Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
1 parent 6464e70 commit 5f833ab

File tree

11 files changed

+21
-185
lines changed

11 files changed

+21
-185
lines changed

deps/chakrashim/core/lib/Jsrt/Jsrt.cpp

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -178,27 +178,17 @@ JsErrorCode CreateContextCore(_In_ JsRuntimeHandle runtimeHandle, _In_ TTDRecord
178178

179179
if(jsrtDebugManager != nullptr)
180180
{
181-
// JsDiagStartDebugging was called
182-
threadContext->GetDebugManager()->SetLocalsDisplayFlags(Js::DebugManager::LocalsDisplayFlags::LocalsDisplayFlags_NoGroupMethods);
183-
184181
Js::ScriptContext* scriptContext = context->GetScriptContext();
182+
scriptContext->InitializeDebugging();
185183

186184
Js::DebugContext* debugContext = scriptContext->GetDebugContext();
187185
debugContext->SetHostDebugContext(jsrtDebugManager);
188186

189-
if (!jsrtDebugManager->IsDebugEventCallbackSet())
190-
{
191-
// JsDiagStopDebugging was called so we need to be in SourceRunDownMode
192-
debugContext->SetDebuggerMode(Js::DebuggerMode::SourceRundown);
193-
}
194-
else
195-
{
196-
// Set Debugging mode
197-
scriptContext->InitializeDebugging();
198-
Js::ProbeContainer* probeContainer = debugContext->GetProbeContainer();
199-
probeContainer->InitializeInlineBreakEngine(jsrtDebugManager);
200-
probeContainer->InitializeDebuggerScriptOptionCallback(jsrtDebugManager);
201-
}
187+
Js::ProbeContainer* probeContainer = debugContext->GetProbeContainer();
188+
probeContainer->InitializeInlineBreakEngine(jsrtDebugManager);
189+
probeContainer->InitializeDebuggerScriptOptionCallback(jsrtDebugManager);
190+
191+
threadContext->GetDebugManager()->SetLocalsDisplayFlags(Js::DebugManager::LocalsDisplayFlags::LocalsDisplayFlags_NoGroupMethods);
202192
}
203193
#endif
204194

@@ -2890,28 +2880,9 @@ CHAKRA_API JsCreateNamedFunction(_In_ JsValueRef name, _In_ JsNativeFunction nat
28902880
return JsCreateEnhancedFunctionHelper<true>(nativeFunction, name, callbackState, function);
28912881
}
28922882

2893-
void SetErrorMessage(Js::ScriptContext *scriptContext, Js::JavascriptError *newError, JsValueRef message)
2883+
void SetErrorMessage(Js::ScriptContext *scriptContext, JsValueRef newError, JsValueRef message)
28942884
{
2895-
// ECMA262 #sec-error-message
2896-
if (!Js::JavascriptOperators::IsUndefined(message))
2897-
{
2898-
Js::JavascriptString *messageStr = nullptr;
2899-
if (Js::JavascriptString::Is(message))
2900-
{
2901-
messageStr = Js::JavascriptString::FromVar(message);
2902-
}
2903-
else
2904-
{
2905-
messageStr = Js::JavascriptConversion::ToString(message, scriptContext);
2906-
}
2907-
2908-
Js::PropertyDescriptor desc;
2909-
desc.SetValue(messageStr);
2910-
desc.SetWritable(true);
2911-
desc.SetEnumerable(false);
2912-
desc.SetConfigurable(true);
2913-
Js::JavascriptOperators::SetPropertyDescriptor(newError, Js::PropertyIds::message, desc);
2914-
}
2885+
Js::JavascriptOperators::OP_SetProperty(newError, Js::PropertyIds::message, message, scriptContext);
29152886
}
29162887

29172888
CHAKRA_API JsCreateError(_In_ JsValueRef message, _Out_ JsValueRef *error)
@@ -2923,7 +2894,7 @@ CHAKRA_API JsCreateError(_In_ JsValueRef message, _Out_ JsValueRef *error)
29232894
PARAM_NOT_NULL(error);
29242895
*error = nullptr;
29252896

2926-
Js::JavascriptError *newError = scriptContext->GetLibrary()->CreateError();
2897+
JsValueRef newError = scriptContext->GetLibrary()->CreateError();
29272898
SetErrorMessage(scriptContext, newError, message);
29282899
*error = newError;
29292900

@@ -2942,7 +2913,7 @@ CHAKRA_API JsCreateRangeError(_In_ JsValueRef message, _Out_ JsValueRef *error)
29422913
PARAM_NOT_NULL(error);
29432914
*error = nullptr;
29442915

2945-
Js::JavascriptError *newError = scriptContext->GetLibrary()->CreateRangeError();
2916+
JsValueRef newError = scriptContext->GetLibrary()->CreateRangeError();
29462917
SetErrorMessage(scriptContext, newError, message);
29472918
*error = newError;
29482919

@@ -2961,7 +2932,7 @@ CHAKRA_API JsCreateReferenceError(_In_ JsValueRef message, _Out_ JsValueRef *err
29612932
PARAM_NOT_NULL(error);
29622933
*error = nullptr;
29632934

2964-
Js::JavascriptError *newError = scriptContext->GetLibrary()->CreateReferenceError();
2935+
JsValueRef newError = scriptContext->GetLibrary()->CreateReferenceError();
29652936
SetErrorMessage(scriptContext, newError, message);
29662937
*error = newError;
29672938

@@ -2980,7 +2951,7 @@ CHAKRA_API JsCreateSyntaxError(_In_ JsValueRef message, _Out_ JsValueRef *error)
29802951
PARAM_NOT_NULL(error);
29812952
*error = nullptr;
29822953

2983-
Js::JavascriptError *newError = scriptContext->GetLibrary()->CreateSyntaxError();
2954+
JsValueRef newError = scriptContext->GetLibrary()->CreateSyntaxError();
29842955
SetErrorMessage(scriptContext, newError, message);
29852956
*error = newError;
29862957

@@ -2999,7 +2970,7 @@ CHAKRA_API JsCreateTypeError(_In_ JsValueRef message, _Out_ JsValueRef *error)
29992970
PARAM_NOT_NULL(error);
30002971
*error = nullptr;
30012972

3002-
Js::JavascriptError *newError = scriptContext->GetLibrary()->CreateTypeError();
2973+
JsValueRef newError = scriptContext->GetLibrary()->CreateTypeError();
30032974
SetErrorMessage(scriptContext, newError, message);
30042975
*error = newError;
30052976

@@ -3018,7 +2989,7 @@ CHAKRA_API JsCreateURIError(_In_ JsValueRef message, _Out_ JsValueRef *error)
30182989
PARAM_NOT_NULL(error);
30192990
*error = nullptr;
30202991

3021-
Js::JavascriptError *newError = scriptContext->GetLibrary()->CreateURIError();
2992+
JsValueRef newError = scriptContext->GetLibrary()->CreateURIError();
30222993
SetErrorMessage(scriptContext, newError, message);
30232994
*error = newError;
30242995

deps/chakrashim/core/lib/Jsrt/JsrtDiag.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,9 @@ CHAKRA_API JsDiagStartDebugging(
9999
return JsErrorFatal;
100100
}
101101

102-
// ScriptContext might get closed in OnDebuggerAttached
103-
if (!scriptContext->IsClosed())
104-
{
105-
Js::ProbeContainer* probeContainer = debugContext->GetProbeContainer();
106-
probeContainer->InitializeInlineBreakEngine(jsrtDebugManager);
107-
probeContainer->InitializeDebuggerScriptOptionCallback(jsrtDebugManager);
108-
}
102+
Js::ProbeContainer* probeContainer = debugContext->GetProbeContainer();
103+
probeContainer->InitializeInlineBreakEngine(jsrtDebugManager);
104+
probeContainer->InitializeDebuggerScriptOptionCallback(jsrtDebugManager);
109105
}
110106

111107
return JsNoError;

deps/chakrashim/core/lib/Runtime/Library/JavascriptRegExpConstructor.cpp

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ namespace Js
1717
JavascriptRegExpConstructor::JavascriptRegExpConstructor(DynamicType * type) :
1818
RuntimeFunction(type, &JavascriptRegExp::EntryInfo::NewInstance),
1919
reset(false),
20-
invalidatedLastMatch(false),
2120
lastPattern(nullptr),
2221
lastMatch() // undefined
2322
{
@@ -54,44 +53,17 @@ namespace Js
5453
this->lastInput = lastInput;
5554
this->lastMatch = lastMatch;
5655
this->reset = true;
57-
this->invalidatedLastMatch = false;
58-
}
59-
60-
void JavascriptRegExpConstructor::InvalidateLastMatch(UnifiedRegex::RegexPattern* lastPattern, JavascriptString* lastInput)
61-
{
62-
AssertMsg(lastPattern != nullptr, "lastPattern should not be null");
63-
AssertMsg(lastInput != nullptr, "lastInput should not be null");
64-
AssertMsg(JavascriptOperators::GetTypeId(lastInput) != TypeIds_Null, "lastInput should not be JavaScript null");
65-
66-
this->lastPattern = lastPattern;
67-
this->lastInput = lastInput;
68-
this->lastMatch.Reset();
69-
this->reset = true;
70-
this->invalidatedLastMatch = true;
7156
}
7257

7358
void JavascriptRegExpConstructor::EnsureValues()
7459
{
7560
if (reset)
7661
{
62+
Assert(!lastMatch.IsUndefined());
7763
ScriptContext* scriptContext = this->GetScriptContext();
78-
const CharCount lastInputLen = lastInput->GetLength();
79-
const char16* lastInputStr = lastInput->GetString();
8064
UnifiedRegex::RegexPattern* pattern = lastPattern;
81-
82-
// When we perform a regex test operation it's possible the result of the operation will be loaded from a cache and the match will not be computed and updated in the ctor.
83-
// In that case we invalidate the last match stored in the ctor and will need to compute it before it will be accessible via $1 etc.
84-
// Since we only do this for the case of RegExp.prototype.test cache hit, we know several things:
85-
// - The regex is not global or sticky
86-
// - There was a match (test returned true)
87-
if (invalidatedLastMatch)
88-
{
89-
this->lastMatch = RegexHelper::SimpleMatch(scriptContext, pattern, lastInputStr, lastInputLen, 0);
90-
invalidatedLastMatch = false;
91-
}
92-
93-
Assert(!lastMatch.IsUndefined());
9465
JavascriptString* emptyString = scriptContext->GetLibrary()->GetEmptyString();
66+
const CharCount lastInputLen = lastInput->GetLength();
9567
// IE8 quirk: match of length 0 is regarded as length 1
9668
CharCount lastIndexVal = lastMatch.EndOffset();
9769
this->index = JavascriptNumber::ToVar(lastMatch.offset, scriptContext);
@@ -110,7 +82,7 @@ namespace Js
11082
// every match is prohibitively slow. Instead, run the match again using the known last input string.
11183
if (!pattern->WasLastMatchSuccessful())
11284
{
113-
RegexHelper::SimpleMatch(scriptContext, pattern, lastInputStr, lastInputLen, lastMatch.offset);
85+
RegexHelper::SimpleMatch(scriptContext, pattern, lastInput->GetString(), lastInputLen, lastMatch.offset);
11486
}
11587
Assert(pattern->WasLastMatchSuccessful());
11688
for (int groupId = 1; groupId < min(numGroups, NumCtorCaptures); groupId++)
@@ -128,11 +100,6 @@ namespace Js
128100
captures[groupId] = emptyString;
129101
reset = false;
130102
}
131-
else
132-
{
133-
// If we are not resetting the values, the last match cannot be invalidated.
134-
Assert(!invalidatedLastMatch);
135-
}
136103
}
137104

138105
/*static*/

deps/chakrashim/core/lib/Runtime/Library/JavascriptRegExpConstructor.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,12 @@ namespace Js
5353
bool GetPropertyBuiltIns(PropertyId propertyId, Var* value, BOOL* result);
5454
bool SetPropertyBuiltIns(PropertyId propertyId, Var value, BOOL* result);
5555
void SetLastMatch(UnifiedRegex::RegexPattern* lastPattern, JavascriptString* lastInput, UnifiedRegex::GroupInfo lastMatch);
56-
void InvalidateLastMatch(UnifiedRegex::RegexPattern* lastPattern, JavascriptString* lastInput);
5756

5857
void EnsureValues();
5958

6059
Field(UnifiedRegex::RegexPattern*) lastPattern;
6160
Field(JavascriptString*) lastInput;
6261
Field(UnifiedRegex::GroupInfo) lastMatch;
63-
Field(bool) invalidatedLastMatch; // true if last match must be recalculated before use
6462
Field(bool) reset; // true if following fields must be recalculated from above before first use
6563
Field(Var) lastParen;
6664
Field(Var) lastIndex;

deps/chakrashim/core/lib/Runtime/Library/RegexHelper.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -691,20 +691,13 @@ namespace Js
691691
{
692692
Assert(useCache);
693693
cachedResult = (cache->resultBV.Test(cacheIndex) != 0);
694-
695-
// If our cache says this test should produce a match (which we aren't going to compute),
696-
// notify the Ctor to invalidate the last match so it must be recomputed before access.
697-
if (cachedResult)
698-
{
699-
InvalidateLastMatchOnCtor(scriptContext, regularExpression, input);
700-
}
701-
702694
// for debug builds, let's still do the real test so we can validate values in the cache
703695
#if !DBG
704696
return JavascriptBoolean::ToVar(cachedResult, scriptContext);
705697
#endif
706698
}
707699

700+
708701
CharCount offset;
709702
if (!GetInitialOffset(isGlobal, isSticky, regularExpression, inputLength, offset))
710703
{
@@ -2094,16 +2087,6 @@ namespace Js
20942087
}
20952088
}
20962089

2097-
void RegexHelper::InvalidateLastMatchOnCtor(ScriptContext* scriptContext, JavascriptRegExp* regularExpression, JavascriptString* lastInput, bool useSplitPattern)
2098-
{
2099-
Assert(lastInput);
2100-
2101-
UnifiedRegex::RegexPattern* pattern = useSplitPattern
2102-
? regularExpression->GetSplitPattern()
2103-
: regularExpression->GetPattern();
2104-
scriptContext->GetLibrary()->GetRegExpConstructor()->InvalidateLastMatch(pattern, lastInput);
2105-
}
2106-
21072090
bool RegexHelper::GetInitialOffset(bool isGlobal, bool isSticky, JavascriptRegExp* regularExpression, CharCount inputLength, CharCount& offset)
21082091
{
21092092
if (isGlobal || isSticky)

deps/chakrashim/core/lib/Runtime/Library/RegexHelper.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ namespace Js
5858
, UnifiedRegex::GroupInfo lastSuccessfulMatch
5959
, bool useSplitPattern );
6060

61-
static void InvalidateLastMatchOnCtor(ScriptContext* scriptContext, JavascriptRegExp* regularExpression, JavascriptString* lastInput, bool useSplitPattern = false);
62-
6361
static bool GetInitialOffset(bool isGlobal, bool isSticky, JavascriptRegExp* regularExpression, CharCount inputLength, CharCount& offset);
6462
static JavascriptArray* CreateMatchResult(void *const stackAllocationPointer, ScriptContext* scriptContext, bool isGlobal, int numGroups, JavascriptString* input);
6563
static void FinalizeMatchResult(ScriptContext* scriptContext, bool isGlobal, JavascriptArray* arr, UnifiedRegex::GroupInfo match);

deps/chakrashim/core/test/Debugger/emptyJson.dbg.baseline

Lines changed: 0 additions & 1 deletion
This file was deleted.

deps/chakrashim/core/test/Debugger/loadscript_after_detach.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

deps/chakrashim/core/test/Debugger/rlexe.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,4 @@
8080
<files>dumpFunctionProperties.js</files>
8181
</default>
8282
</test>
83-
<test>
84-
<default>
85-
<compile-flags>-dbgbaseline:emptyJson.dbg.baseline</compile-flags>
86-
<files>loadscript_after_detach.js</files>
87-
</default>
88-
</test>
8983
</regress-exe>

deps/chakrashim/core/test/Regex/bug_OS14763260.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)