OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 return %_ValueOf(this); | 47 return %_ValueOf(this); |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 function SymbolToString() { | 51 function SymbolToString() { |
52 if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) { | 52 if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) { |
53 throw MakeTypeError(kIncompatibleMethodReceiver, | 53 throw MakeTypeError(kIncompatibleMethodReceiver, |
54 "Symbol.prototype.toString", this); | 54 "Symbol.prototype.toString", this); |
55 } | 55 } |
56 var description = %SymbolDescription(%_ValueOf(this)); | 56 return %SymbolDescriptiveString(%_ValueOf(this)); |
57 return "Symbol(" + (IS_UNDEFINED(description) ? "" : description) + ")"; | |
58 } | 57 } |
59 | 58 |
60 | 59 |
61 function SymbolValueOf() { | 60 function SymbolValueOf() { |
62 if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) { | 61 if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) { |
63 throw MakeTypeError(kIncompatibleMethodReceiver, | 62 throw MakeTypeError(kIncompatibleMethodReceiver, |
64 "Symbol.prototype.valueOf", this); | 63 "Symbol.prototype.valueOf", this); |
65 } | 64 } |
66 return %_ValueOf(this); | 65 return %_ValueOf(this); |
67 } | 66 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 ]); | 135 ]); |
137 | 136 |
138 // ------------------------------------------------------------------- | 137 // ------------------------------------------------------------------- |
139 // Exports | 138 // Exports |
140 | 139 |
141 utils.Export(function(to) { | 140 utils.Export(function(to) { |
142 to.SymbolToString = SymbolToString; | 141 to.SymbolToString = SymbolToString; |
143 }) | 142 }) |
144 | 143 |
145 }) | 144 }) |
OLD | NEW |