Skip to content

Commit

Permalink
Remove -ES6Unscopables feature switch
Browse files Browse the repository at this point in the history
Re issue chakra-core#6
  • Loading branch information
Ian Halliday committed Feb 11, 2016
1 parent b855430 commit b142f22
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 43 deletions.
1 change: 0 additions & 1 deletion lib/Runtime/Base/ThreadConfigFlagsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ FLAG_RELEASE(IsES6ToLengthEnabled, ES6ToLength)
FLAG_RELEASE(IsES6ToStringTagEnabled, ES6ToStringTag)
FLAG_RELEASE(IsES6TypedArrayExtensionsEnabled, ES6TypedArrayExtensions)
FLAG_RELEASE(IsES6UnicodeExtensionsEnabled, ES6Unicode)
FLAG_RELEASE(IsES6UnscopablesEnabled, ES6Unscopables)
FLAG_RELEASE(IsES6RegExStickyEnabled, ES6RegExSticky)
FLAG_RELEASE(IsES6RegExPrototypePropertiesEnabled, ES6RegExPrototypeProperties)
FLAG_RELEASE(IsES6RegExSymbolsEnabled, ES6RegExSymbols)
Expand Down
22 changes: 8 additions & 14 deletions lib/Runtime/ByteCode/ByteCodeEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4178,7 +4178,7 @@ void ByteCodeGenerator::EmitLoadInstance(Symbol *sym, IdentPtr pid, Js::RegSlot
Js::ByteCodeLabel nextLabel = this->m_writer.DefineLabel();
Js::PropertyId propertyId = sym ? sym->EnsurePosition(this) : pid->GetPropertyId();

bool unwrapWithObj = scope->GetScopeType() == ScopeType_With && scriptContext->GetConfig()->IsES6UnscopablesEnabled();
bool unwrapWithObj = scope->GetScopeType() == ScopeType_With;
if (envIndex != -1)
{
this->m_writer.BrEnvProperty(
Expand Down Expand Up @@ -4530,7 +4530,7 @@ void ByteCodeGenerator::EmitPropStore(Js::RegSlot rhsLocation, Symbol *sym, Iden
Js::PropertyId propertyId = sym ? sym->EnsurePosition(this) : pid->GetPropertyId();

Js::RegSlot unwrappedScopeLocation = scopeLocation;
bool unwrapWithObj = scope->GetScopeType() == ScopeType_With && scriptContext->GetConfig()->IsES6UnscopablesEnabled();
bool unwrapWithObj = scope->GetScopeType() == ScopeType_With;
if (envIndex != -1)
{
this->m_writer.BrEnvProperty(
Expand Down Expand Up @@ -4804,7 +4804,7 @@ void ByteCodeGenerator::EmitPropLoad(Js::RegSlot lhsLocation, Symbol *sym, Ident
Js::PropertyId propertyId = sym ? sym->EnsurePosition(this) : pid->GetPropertyId();

Js::RegSlot unwrappedScopeLocation = Js::Constants::NoRegister;
bool unwrapWithObj = scope->GetScopeType() == ScopeType_With && scriptContext->GetConfig()->IsES6UnscopablesEnabled();
bool unwrapWithObj = scope->GetScopeType() == ScopeType_With;
if (envIndex != -1)
{
this->m_writer.BrEnvProperty(
Expand Down Expand Up @@ -5046,7 +5046,7 @@ void ByteCodeGenerator::EmitPropDelete(Js::RegSlot lhsLocation, Symbol *sym, Ide

Js::ByteCodeLabel nextLabel = this->m_writer.DefineLabel();
Js::PropertyId propertyId = sym ? sym->EnsurePosition(this) : pid->GetPropertyId();
bool unwrapWithObj = scope->GetScopeType() == ScopeType_With && scriptContext->GetConfig()->IsES6UnscopablesEnabled();
bool unwrapWithObj = scope->GetScopeType() == ScopeType_With;
if (envIndex != -1)
{
this->m_writer.BrEnvProperty(
Expand Down Expand Up @@ -5208,7 +5208,7 @@ void ByteCodeGenerator::EmitPropTypeof(Js::RegSlot lhsLocation, Symbol *sym, Ide
Js::ByteCodeLabel nextLabel = this->m_writer.DefineLabel();
Js::PropertyId propertyId = sym ? sym->EnsurePosition(this) : pid->GetPropertyId();

bool unwrapWithObj = scope->GetScopeType() == ScopeType_With && scriptContext->GetConfig()->IsES6UnscopablesEnabled();
bool unwrapWithObj = scope->GetScopeType() == ScopeType_With;
if (envIndex != -1)
{
this->m_writer.BrEnvProperty(Js::OpCode::BrOnNoEnvProperty, nextLabel,
Expand Down Expand Up @@ -10338,12 +10338,9 @@ void Emit(ParseNode *pnode, ByteCodeGenerator *byteCodeGenerator, FuncInfo *func
funcInfo->AcquireLoc(pnode);
Emit(pnode->sxWith.pnodeObj, byteCodeGenerator, funcInfo, false);

Js::RegSlot regVal = (byteCodeGenerator->GetScriptContext()->GetConfig()->IsES6UnscopablesEnabled()) ? funcInfo->AcquireTmpRegister() : pnode->location;
Js::RegSlot regVal = funcInfo->AcquireTmpRegister();
byteCodeGenerator->Writer()->Reg2(Js::OpCode::Conv_Obj, regVal, pnode->sxWith.pnodeObj->location);
if (byteCodeGenerator->GetScriptContext()->GetConfig()->IsES6UnscopablesEnabled())
{
byteCodeGenerator->Writer()->Reg2(Js::OpCode::NewWithObject, pnode->location, regVal);
}
byteCodeGenerator->Writer()->Reg2(Js::OpCode::NewWithObject, pnode->location, regVal);
byteCodeGenerator->EndStatement(pnode);

#ifdef PERF_HINT
Expand Down Expand Up @@ -10375,10 +10372,7 @@ void Emit(ParseNode *pnode, ByteCodeGenerator *byteCodeGenerator, FuncInfo *func
{
byteCodeGenerator->Writer()->MarkLabel(pnode->sxStmt.breakLabel);
}
if (byteCodeGenerator->GetScriptContext()->GetConfig()->IsES6UnscopablesEnabled())
{
funcInfo->ReleaseTmpRegister(regVal);
}
funcInfo->ReleaseTmpRegister(regVal);
funcInfo->ReleaseLoc(pnode->sxWith.pnodeObj);
break;
}
Expand Down
29 changes: 11 additions & 18 deletions lib/Runtime/Library/JavascriptLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,6 @@ namespace Js
uriErrorType = DynamicType::New(scriptContext, TypeIds_Error, uriErrorPrototype, nullptr,
SimplePathTypeHandler::New(scriptContext, scriptContext->GetRootPath(), 0, 0, 0, true, true), true, true);

withType = nullptr;
proxyType = nullptr;
javascriptEnumeratorIteratorType = nullptr;

Expand All @@ -572,10 +571,7 @@ namespace Js
symbolTypeStatic = StaticType::New(scriptContext, TypeIds_Symbol, symbolPrototype, nullptr);
symbolTypeDynamic = DynamicType::New(scriptContext, TypeIds_SymbolObject, symbolPrototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);

if (config->IsES6UnscopablesEnabled())
{
withType = StaticType::New(scriptContext, TypeIds_WithScopeObject, GetNull(), nullptr);
}
withType = StaticType::New(scriptContext, TypeIds_WithScopeObject, GetNull(), nullptr);

if (config->IsES6SpreadEnabled())
{
Expand Down Expand Up @@ -1650,19 +1646,16 @@ namespace Js
/* No inlining Array_Values */ library->AddMember(arrayPrototype, PropertyIds::values, values);
/* No inlining Array_SymbolIterator */ library->AddMember(arrayPrototype, PropertyIds::_symbolIterator, values);

if (scriptContext->GetConfig()->IsES6UnscopablesEnabled())
{
DynamicType* dynamicType = DynamicType::New(scriptContext, TypeIds_Object, library->nullValue, nullptr, NullTypeHandler<false>::GetDefaultInstance(), false);
DynamicObject* unscopables_blacklist = DynamicObject::New(library->GetRecycler(), dynamicType);
unscopables_blacklist->SetProperty(PropertyIds::find, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
unscopables_blacklist->SetProperty(PropertyIds::findIndex, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
unscopables_blacklist->SetProperty(PropertyIds::fill, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
unscopables_blacklist->SetProperty(PropertyIds::copyWithin, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
unscopables_blacklist->SetProperty(PropertyIds::entries, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
unscopables_blacklist->SetProperty(PropertyIds::keys, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
unscopables_blacklist->SetProperty(PropertyIds::values, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
library->AddMember(arrayPrototype, PropertyIds::_symbolUnscopables, unscopables_blacklist, PropertyConfigurable);
}
DynamicObject* unscopables_blacklist = DynamicObject::New(library->GetRecycler(),
DynamicType::New(scriptContext, TypeIds_Object, library->nullValue, nullptr, NullTypeHandler<false>::GetDefaultInstance(), false));
unscopables_blacklist->SetProperty(PropertyIds::find, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
unscopables_blacklist->SetProperty(PropertyIds::findIndex, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
unscopables_blacklist->SetProperty(PropertyIds::fill, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
unscopables_blacklist->SetProperty(PropertyIds::copyWithin, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
unscopables_blacklist->SetProperty(PropertyIds::entries, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
unscopables_blacklist->SetProperty(PropertyIds::keys, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
unscopables_blacklist->SetProperty(PropertyIds::values, JavascriptBoolean::ToVar(true, scriptContext), PropertyOperation_None, nullptr);
library->AddMember(arrayPrototype, PropertyIds::_symbolUnscopables, unscopables_blacklist, PropertyConfigurable);

if (scriptContext->GetConfig()->IsES6TypedArrayExtensionsEnabled()) // This is not a typo, Array.prototype.fill and .copyWithin are part of the ES6 TypedArray feature
{
Expand Down
2 changes: 0 additions & 2 deletions lib/common/ConfigFlagsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ PHASE(All)
#define DEFAULT_CONFIG_ES6TypedArrayExtensions (true)
#define DEFAULT_CONFIG_ES6Unicode (true)
#define DEFAULT_CONFIG_ES6UnicodeVerbose (true)
#define DEFAULT_CONFIG_ES6Unscopables (true)
#define DEFAULT_CONFIG_ES6RegExSticky (true)
#define DEFAULT_CONFIG_ES6RegExPrototypeProperties (false)
#define DEFAULT_CONFIG_ES6RegExSymbols (false)
Expand Down Expand Up @@ -873,7 +872,6 @@ FLAGPR (Boolean, ES6, ES6ToStringTag , "Enable ES6 ToStringTag
FLAGPR (Boolean, ES6, ES6TypedArrayExtensions, "Enable ES6 TypedArray extensions" , DEFAULT_CONFIG_ES6TypedArrayExtensions)
FLAGPR (Boolean, ES6, ES6Unicode , "Enable ES6 Unicode 6.0 extensions" , DEFAULT_CONFIG_ES6Unicode)
FLAGPR (Boolean, ES6, ES6UnicodeVerbose , "Enable ES6 Unicode 6.0 verbose failure output" , DEFAULT_CONFIG_ES6UnicodeVerbose)
FLAGPR (Boolean, ES6, ES6Unscopables , "Enable ES6 With Statement Unscopables" , DEFAULT_CONFIG_ES6Unscopables)
FLAGPR (Boolean, ES6, ES6RegExSticky , "Enable ES6 RegEx sticky flag" , DEFAULT_CONFIG_ES6RegExSticky)
FLAGPR_REGOVR_EXP(Boolean, ES6, ES6RegExPrototypeProperties, "Enable ES6 properties on the RegEx prototype" , DEFAULT_CONFIG_ES6RegExPrototypeProperties)
FLAGPR_REGOVR_EXP(Boolean, ES6, ES6RegExSymbols , "Enable ES6 RegExp symbols" , DEFAULT_CONFIG_ES6RegExSymbols)
Expand Down
2 changes: 0 additions & 2 deletions test/es6/es6_all.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ FLAG ES6 = 1 - setting child flag ES6Unicode = 1
FLAG ES6Unicode = 1
FLAG ES6 = 1 - setting child flag ES6UnicodeVerbose = 1
FLAG ES6UnicodeVerbose = 1
FLAG ES6 = 1 - setting child flag ES6Unscopables = 1
FLAG ES6Unscopables = 1
FLAG ES6 = 1 - setting child flag ES6RegExSticky = 1
FLAG ES6RegExSticky = 1
FLAG ES6 = 1 - setting child flag ES6RegExPrototypeProperties = 1
Expand Down
2 changes: 0 additions & 2 deletions test/es6/es6_stable.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ FLAG ES6 = 1 - setting child flag ES6Unicode = 1
FLAG ES6Unicode = 1
FLAG ES6 = 1 - setting child flag ES6UnicodeVerbose = 1
FLAG ES6UnicodeVerbose = 1
FLAG ES6 = 1 - setting child flag ES6Unscopables = 1
FLAG ES6Unscopables = 1
FLAG ES6 = 1 - setting child flag ES6RegExSticky = 1
FLAG ES6RegExSticky = 1
FLAG ES6 = 1 - setting child flag ES6RegExPrototypeProperties = 0
Expand Down
4 changes: 0 additions & 4 deletions test/es6/es6_stable.enable_disable.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ FLAG ES6 = 1 - setting child flag ES6Unicode = 1
FLAG ES6Unicode = 1
FLAG ES6 = 1 - setting child flag ES6UnicodeVerbose = 1
FLAG ES6UnicodeVerbose = 1
FLAG ES6 = 1 - setting child flag ES6Unscopables = 1
FLAG ES6Unscopables = 1
FLAG ES6 = 1 - setting child flag ES6RegExSticky = 1
FLAG ES6RegExSticky = 1
FLAG ES6 = 1 - setting child flag ES6RegExPrototypeProperties = 0
Expand Down Expand Up @@ -122,8 +120,6 @@ FLAG ES6 = 0 - setting child flag ES6Unicode = 0
FLAG ES6Unicode = 0
FLAG ES6 = 0 - setting child flag ES6UnicodeVerbose = 0
FLAG ES6UnicodeVerbose = 0
FLAG ES6 = 0 - setting child flag ES6Unscopables = 0
FLAG ES6Unscopables = 0
FLAG ES6 = 0 - setting child flag ES6RegExSticky = 0
FLAG ES6RegExSticky = 0
FLAG ES6 = 0 - setting child flag ES6RegExPrototypeProperties = 0
Expand Down

0 comments on commit b142f22

Please sign in to comment.