Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(895)

Unified Diff: src/symbol.js

Issue 1349643002: [builtins] Also simplify the Symbol constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@StringConstructor
Patch Set: Fix off-by-1 in DCHECK. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/builtins.cc ('K') | « src/builtins.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/symbol.js
diff --git a/src/symbol.js b/src/symbol.js
index c65cda7c475e5b75adff206a08ea5126d29d6cd3..600d4fd9ed6b2473259b8ba82cf818de61550bab 100644
--- a/src/symbol.js
+++ b/src/symbol.js
@@ -20,24 +20,15 @@ var isRegExpSymbol = utils.ImportNow("is_regexp_symbol");
var iteratorSymbol = utils.ImportNow("iterator_symbol");
var ObjectGetOwnPropertyKeys;
var toPrimitiveSymbol = utils.ImportNow("to_primitive_symbol");
-var ToString;
var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
var unscopablesSymbol = utils.ImportNow("unscopables_symbol");
utils.Import(function(from) {
ObjectGetOwnPropertyKeys = from.ObjectGetOwnPropertyKeys;
- ToString = from.ToString;
});
// -------------------------------------------------------------------
-function SymbolConstructor(x) {
- if (%_IsConstructCall()) throw MakeTypeError(kNotConstructor, "Symbol");
- // NOTE: Passing in a Symbol value will throw on ToString().
- return %CreateSymbol(IS_UNDEFINED(x) ? x : ToString(x));
-}
-
-
// 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint )
function SymbolToPrimitive(hint) {
if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) {
@@ -95,7 +86,6 @@ function ObjectGetOwnPropertySymbols(obj) {
// -------------------------------------------------------------------
-%SetCode(GlobalSymbol, SymbolConstructor);
%FunctionSetPrototype(GlobalSymbol, new GlobalObject());
utils.InstallConstants(GlobalSymbol, [
« src/builtins.cc ('K') | « src/builtins.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698