Skip to content

Commit

Permalink
Remove -ES6Symbol feature switch
Browse files Browse the repository at this point in the history
Re issue chakra-core#6
  • Loading branch information
Ian Halliday committed Jan 25, 2016
1 parent 9d6e9cb commit c5ef002
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 75 deletions.
1 change: 0 additions & 1 deletion lib/Runtime/Base/ThreadConfigFlagsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ FLAG_RELEASE(IsES6SpreadEnabled, ES6Spread)
FLAG_RELEASE(IsES6StringExtensionsEnabled, ES6String)
FLAG_RELEASE(IsES6StringPrototypeFixEnabled, ES6StringPrototypeFixes)
FLAG_RELEASE(IsES6PrototypeChain, ES6PrototypeChain)
FLAG_RELEASE(IsES6SymbolEnabled, ES6Symbol)
FLAG_RELEASE(IsES6ToPrimitiveEnabled, ES6ToPrimitive)
FLAG_RELEASE(IsES6ToLengthEnabled, ES6ToLength)
FLAG_RELEASE(IsES6ToStringTagEnabled, ES6ToStringTag)
Expand Down
85 changes: 23 additions & 62 deletions lib/Runtime/Library/JavascriptLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,19 +410,15 @@ namespace Js
DynamicType::New(scriptContext, TypeIds_Function, objectPrototype, JavascriptFunction::PrototypeEntryPoint,
DeferredTypeHandler<InitializeFunctionPrototype>::GetDefaultInstance()), &JavascriptFunction::EntryInfo::PrototypeEntryPoint);

symbolPrototype = nullptr;
promisePrototype = nullptr;
javascriptEnumeratorIteratorPrototype = nullptr;
generatorFunctionPrototype = nullptr;
generatorPrototype = nullptr;
asyncFunctionPrototype = nullptr;

if (scriptContext->GetConfig()->IsES6SymbolEnabled())
{
symbolPrototype = DynamicObject::New(recycler,
DynamicType::New(scriptContext, TypeIds_Object, objectPrototype, nullptr,
DeferredTypeHandler<InitializeSymbolPrototype>::GetDefaultInstance()));
}
symbolPrototype = DynamicObject::New(recycler,
DynamicType::New(scriptContext, TypeIds_Object, objectPrototype, nullptr,
DeferredTypeHandler<InitializeSymbolPrototype>::GetDefaultInstance()));

mapPrototype = DynamicObject::New(recycler,
DynamicType::New(scriptContext, TypeIds_Object, objectPrototype, nullptr,
Expand Down Expand Up @@ -561,8 +557,6 @@ namespace Js
uriErrorType = DynamicType::New(scriptContext, TypeIds_Error, uriErrorPrototype, nullptr,
SimplePathTypeHandler::New(scriptContext, scriptContext->GetRootPath(), 0, 0, 0, true, true), true, true);

symbolTypeStatic = nullptr;
symbolTypeDynamic = nullptr;
withType = nullptr;
proxyType = nullptr;
promiseType = nullptr;
Expand All @@ -572,12 +566,9 @@ namespace Js
booleanTypeStatic = StaticType::New(scriptContext, TypeIds_Boolean, booleanPrototype, nullptr);
booleanTypeDynamic = DynamicType::New(scriptContext, TypeIds_BooleanObject, booleanPrototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);

if (config->IsES6SymbolEnabled())
{
// Initialize symbol types
symbolTypeStatic = StaticType::New(scriptContext, TypeIds_Symbol, symbolPrototype, nullptr);
symbolTypeDynamic = DynamicType::New(scriptContext, TypeIds_SymbolObject, symbolPrototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);
}
// Initialize symbol types
symbolTypeStatic = StaticType::New(scriptContext, TypeIds_Symbol, symbolPrototype, nullptr);
symbolTypeDynamic = DynamicType::New(scriptContext, TypeIds_SymbolObject, symbolPrototype, nullptr, NullTypeHandler<false>::GetDefaultInstance(), true, true);

if (config->IsES6UnscopablesEnabled())
{
Expand Down Expand Up @@ -1093,29 +1084,15 @@ namespace Js
simdInt32x4DisplayString = CreateStringFromCppLiteral(L"Int32x4");
}

if (scriptContext->GetConfig()->IsES6SymbolEnabled())
{
symbolTypeDisplayString = CreateStringFromCppLiteral(L"symbol");
symbolTypeDisplayString = CreateStringFromCppLiteral(L"symbol");

symbolHasInstance = CreateSymbol(BuiltInPropertyRecords::_symbolHasInstance);
symbolIsConcatSpreadable = CreateSymbol(BuiltInPropertyRecords::_symbolIsConcatSpreadable);
symbolIterator = CreateSymbol(BuiltInPropertyRecords::_symbolIterator);
symbolSpecies = CreateSymbol(BuiltInPropertyRecords::_symbolSpecies);
symbolToPrimitive = CreateSymbol(BuiltInPropertyRecords::_symbolToPrimitive);
symbolToStringTag = CreateSymbol(BuiltInPropertyRecords::_symbolToStringTag);
symbolUnscopables = CreateSymbol(BuiltInPropertyRecords::_symbolUnscopables);
}
else
{
symbolTypeDisplayString = nullptr;
symbolHasInstance = nullptr;
symbolIsConcatSpreadable = nullptr;
symbolIterator = nullptr;
symbolSpecies = nullptr;
symbolToPrimitive = nullptr;
symbolToStringTag = nullptr;
symbolUnscopables = nullptr;
}
symbolHasInstance = CreateSymbol(BuiltInPropertyRecords::_symbolHasInstance);
symbolIsConcatSpreadable = CreateSymbol(BuiltInPropertyRecords::_symbolIsConcatSpreadable);
symbolIterator = CreateSymbol(BuiltInPropertyRecords::_symbolIterator);
symbolSpecies = CreateSymbol(BuiltInPropertyRecords::_symbolSpecies);
symbolToPrimitive = CreateSymbol(BuiltInPropertyRecords::_symbolToPrimitive);
symbolToStringTag = CreateSymbol(BuiltInPropertyRecords::_symbolToStringTag);
symbolUnscopables = CreateSymbol(BuiltInPropertyRecords::_symbolUnscopables);

debuggerDeadZoneBlockVariableString = CreateStringFromCppLiteral(L"[Uninitialized block variable]");
defaultAccessorFunction = CreateNonProfiledFunction(&JavascriptOperators::EntryInfo::DefaultAccessor);
Expand Down Expand Up @@ -1214,12 +1191,9 @@ namespace Js
promiseConstructor = nullptr;
reflectObject = nullptr;

if (scriptContext->GetConfig()->IsES6SymbolEnabled())
{
symbolConstructor = CreateBuiltinConstructor(&JavascriptSymbol::EntryInfo::NewInstance,
DeferredTypeHandler<InitializeSymbolConstructor>::GetDefaultInstance());
AddFunction(globalObject, PropertyIds::Symbol, symbolConstructor);
}
symbolConstructor = CreateBuiltinConstructor(&JavascriptSymbol::EntryInfo::NewInstance,
DeferredTypeHandler<InitializeSymbolConstructor>::GetDefaultInstance());
AddFunction(globalObject, PropertyIds::Symbol, symbolConstructor);

if (scriptContext->GetConfig()->IsES6ProxyEnabled())
{
Expand Down Expand Up @@ -3453,11 +3427,7 @@ namespace Js
// so that the update is in sync with profiler
JavascriptLibrary* library = objectConstructor->GetLibrary();
ScriptContext* scriptContext = objectConstructor->GetScriptContext();
int propertyCount = 17;
if (scriptContext->GetConfig()->IsES6SymbolEnabled())
{
propertyCount += 1;
}
int propertyCount = 18;
if (scriptContext->GetConfig()->IsES6ObjectExtensionsEnabled())
{
propertyCount += 2;
Expand Down Expand Up @@ -3499,11 +3469,8 @@ namespace Js
library->AddFunctionToLibraryObject(objectConstructor, PropertyIds::getOwnPropertyNames, &JavascriptObject::EntryInfo::GetOwnPropertyNames, 1));
scriptContext->SetBuiltInLibraryFunction(JavascriptObject::EntryInfo::SetPrototypeOf.GetOriginalEntryPoint(),
library->AddFunctionToLibraryObject(objectConstructor, PropertyIds::setPrototypeOf, &JavascriptObject::EntryInfo::SetPrototypeOf, 2));
if (scriptContext->GetConfig()->IsES6SymbolEnabled())
{
scriptContext->SetBuiltInLibraryFunction(JavascriptObject::EntryInfo::GetOwnPropertySymbols.GetOriginalEntryPoint(),
library->AddFunctionToLibraryObject(objectConstructor, PropertyIds::getOwnPropertySymbols, &JavascriptObject::EntryInfo::GetOwnPropertySymbols, 1));
}
scriptContext->SetBuiltInLibraryFunction(JavascriptObject::EntryInfo::GetOwnPropertySymbols.GetOriginalEntryPoint(),
library->AddFunctionToLibraryObject(objectConstructor, PropertyIds::getOwnPropertySymbols, &JavascriptObject::EntryInfo::GetOwnPropertySymbols, 1));
if (scriptContext->GetConfig()->IsES6ObjectExtensionsEnabled())
{
scriptContext->SetBuiltInLibraryFunction(JavascriptObject::EntryInfo::Is.GetOriginalEntryPoint(),
Expand Down Expand Up @@ -5949,10 +5916,7 @@ namespace Js
REGISTER_OBJECT(WeakMap);
REGISTER_OBJECT(WeakSet);

if (config.IsES6SymbolEnabled())
{
REGISTER_OBJECT(Symbol);
}
REGISTER_OBJECT(Symbol);

REGISTER_OBJECT(Iterator);
REGISTER_OBJECT(ArrayIterator);
Expand Down Expand Up @@ -6028,11 +5992,7 @@ namespace Js

REG_OBJECTS_LIB_FUNC(setPrototypeOf, JavascriptObject::EntrySetPrototypeOf);

ScriptConfiguration const& config = *(scriptContext->GetConfig());
if (config.IsES6SymbolEnabled())
{
REG_OBJECTS_LIB_FUNC(getOwnPropertySymbols, JavascriptObject::EntryGetOwnPropertySymbols);
}
REG_OBJECTS_LIB_FUNC(getOwnPropertySymbols, JavascriptObject::EntryGetOwnPropertySymbols);

REG_OBJECTS_LIB_FUNC(hasOwnProperty, JavascriptObject::EntryHasOwnProperty);
REG_OBJECTS_LIB_FUNC(propertyIsEnumerable, JavascriptObject::EntryPropertyIsEnumerable);
Expand All @@ -6044,6 +6004,7 @@ namespace Js
REG_OBJECTS_LIB_FUNC(__defineGetter__, JavascriptObject::EntryDefineGetter);
REG_OBJECTS_LIB_FUNC(__defineSetter__, JavascriptObject::EntryDefineSetter);

ScriptConfiguration const& config = *(scriptContext->GetConfig());
if (config.IsES6ObjectExtensionsEnabled())
{
REG_OBJECTS_LIB_FUNC(is, JavascriptObject::EntryIs);
Expand Down
2 changes: 0 additions & 2 deletions lib/common/ConfigFlagsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@ PHASE(All)
#define DEFAULT_CONFIG_ES6String (true)
#define DEFAULT_CONFIG_ES6StringPrototypeFixes (true)
#define DEFAULT_CONFIG_ES6PrototypeChain (false)
#define DEFAULT_CONFIG_ES6Symbol (true)
#define DEFAULT_CONFIG_ES6ToPrimitive (false)
#define DEFAULT_CONFIG_ES6ToLength (false)
#define DEFAULT_CONFIG_ES6ToStringTag (false)
Expand Down Expand Up @@ -884,7 +883,6 @@ FLAGPR (Boolean, ES6, ES6Spread , "Enable ES6 Spread supp
FLAGPR (Boolean, ES6, ES6String , "Enable ES6 String extensions" , DEFAULT_CONFIG_ES6String)
FLAGPR (Boolean, ES6, ES6StringPrototypeFixes, "Enable ES6 String.prototype fixes" , DEFAULT_CONFIG_ES6StringPrototypeFixes)
FLAGPR_REGOVR_EXP(Boolean, ES6, ES6PrototypeChain , "Enable ES6 prototypes (Example: Date prototype is object)", DEFAULT_CONFIG_ES6PrototypeChain)
FLAGPR (Boolean, ES6, ES6Symbol , "Enable ES6 Symbol feature" , DEFAULT_CONFIG_ES6Symbol)
FLAGPR (Boolean, ES6, ES6ToPrimitive , "Enable ES6 ToPrimitve symbol" , DEFAULT_CONFIG_ES6ToPrimitive)
FLAGPR (Boolean, ES6, ES6ToLength , "Enable ES6 ToLength fixes" , DEFAULT_CONFIG_ES6ToLength)
FLAGPR (Boolean, ES6, ES6ToStringTag , "Enable ES6 ToStringTag symbol" , DEFAULT_CONFIG_ES6ToStringTag)
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 ES6StringPrototypeFixes = 1
FLAG ES6StringPrototypeFixes = 1
FLAG ES6 = 1 - setting child flag ES6PrototypeChain = 1
FLAG ES6PrototypeChain = 1
FLAG ES6 = 1 - setting child flag ES6Symbol = 1
FLAG ES6Symbol = 1
FLAG ES6 = 1 - setting child flag ES6ToPrimitive = 1
FLAG ES6ToPrimitive = 1
FLAG ES6 = 1 - setting child flag ES6ToLength = 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 ES6StringPrototypeFixes = 1
FLAG ES6StringPrototypeFixes = 1
FLAG ES6 = 1 - setting child flag ES6PrototypeChain = 0
FLAG ES6PrototypeChain = 0
FLAG ES6 = 1 - setting child flag ES6Symbol = 1
FLAG ES6Symbol = 1
FLAG ES6 = 1 - setting child flag ES6ToPrimitive = 0
FLAG ES6ToPrimitive = 0
FLAG ES6 = 1 - setting child flag ES6ToLength = 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 ES6StringPrototypeFixes = 1
FLAG ES6StringPrototypeFixes = 1
FLAG ES6 = 1 - setting child flag ES6PrototypeChain = 0
FLAG ES6PrototypeChain = 0
FLAG ES6 = 1 - setting child flag ES6Symbol = 1
FLAG ES6Symbol = 1
FLAG ES6 = 1 - setting child flag ES6ToPrimitive = 0
FLAG ES6ToPrimitive = 0
FLAG ES6 = 1 - setting child flag ES6ToLength = 0
Expand Down Expand Up @@ -134,8 +132,6 @@ FLAG ES6 = 0 - setting child flag ES6StringPrototypeFixes = 0
FLAG ES6StringPrototypeFixes = 0
FLAG ES6 = 0 - setting child flag ES6PrototypeChain = 0
FLAG ES6PrototypeChain = 0
FLAG ES6 = 0 - setting child flag ES6Symbol = 0
FLAG ES6Symbol = 0
FLAG ES6 = 0 - setting child flag ES6ToPrimitive = 0
FLAG ES6ToPrimitive = 0
FLAG ES6 = 0 - setting child flag ES6ToLength = 0
Expand Down
4 changes: 2 additions & 2 deletions test/es6/rlexe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,13 @@
<test>
<default>
<files>ES6Symbol.js</files>
<compile-flags> -ES6Symbol -ES6ObjectLiterals -es6toprimitive -es6isConcatSpreadable -es6tostringtag -ES6Species -ES6HasInstance -args summary -endargs</compile-flags>
<compile-flags>-ES6ObjectLiterals -es6toprimitive -es6isConcatSpreadable -es6tostringtag -ES6Species -ES6HasInstance -args summary -endargs</compile-flags>
</default>
</test>
<test>
<default>
<files>ES6Symbol_540238.js</files>
<compile-flags> -ES6Symbol -RecyclerStress</compile-flags>
<compile-flags>-RecyclerStress</compile-flags>
<tags>exclude_fre</tags>
</default>
</test>
Expand Down

0 comments on commit c5ef002

Please sign in to comment.