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

Side by Side Diff: src/symbol.js

Issue 1083083004: Reland "Migrate error messages, part 2." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix for layout test Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/string-iterator.js ('k') | src/typedarray.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Expects following symbols to be set in the bootstrapper during genesis: 5 // Expects following symbols to be set in the bootstrapper during genesis:
6 // - symbolHasInstance 6 // - symbolHasInstance
7 // - symbolIsConcatSpreadable 7 // - symbolIsConcatSpreadable
8 // - symbolIsRegExp 8 // - symbolIsRegExp
9 // - symbolIterator 9 // - symbolIterator
10 // - symbolToStringTag 10 // - symbolToStringTag
(...skipping 16 matching lines...) Expand all
27 if (%_IsConstructCall()) { 27 if (%_IsConstructCall()) {
28 throw MakeTypeError('not_constructor', ["Symbol"]); 28 throw MakeTypeError('not_constructor', ["Symbol"]);
29 } 29 }
30 // NOTE: Passing in a Symbol value will throw on ToString(). 30 // NOTE: Passing in a Symbol value will throw on ToString().
31 return %CreateSymbol(IS_UNDEFINED(x) ? x : ToString(x)); 31 return %CreateSymbol(IS_UNDEFINED(x) ? x : ToString(x));
32 } 32 }
33 33
34 34
35 function SymbolToString() { 35 function SymbolToString() {
36 if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) { 36 if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) {
37 throw MakeTypeError( 37 throw MakeTypeError(kIncompatibleMethodReceiver,
38 'incompatible_method_receiver', ["Symbol.prototype.toString", this]); 38 "Symbol.prototype.toString", this);
39 } 39 }
40 var description = %SymbolDescription(%_ValueOf(this)); 40 var description = %SymbolDescription(%_ValueOf(this));
41 return "Symbol(" + (IS_UNDEFINED(description) ? "" : description) + ")"; 41 return "Symbol(" + (IS_UNDEFINED(description) ? "" : description) + ")";
42 } 42 }
43 43
44 44
45 function SymbolValueOf() { 45 function SymbolValueOf() {
46 if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) { 46 if (!(IS_SYMBOL(this) || IS_SYMBOL_WRAPPER(this))) {
47 throw MakeTypeError( 47 throw MakeTypeError(kIncompatibleMethodReceiver,
48 'incompatible_method_receiver', ["Symbol.prototype.valueOf", this]); 48 "Symbol.prototype.valueOf", this);
49 } 49 }
50 return %_ValueOf(this); 50 return %_ValueOf(this);
51 } 51 }
52 52
53 53
54 function SymbolFor(key) { 54 function SymbolFor(key) {
55 key = TO_STRING_INLINE(key); 55 key = TO_STRING_INLINE(key);
56 var registry = %SymbolRegistry(); 56 var registry = %SymbolRegistry();
57 if (IS_UNDEFINED(registry.for[key])) { 57 if (IS_UNDEFINED(registry.for[key])) {
58 var symbol = %CreateSymbol(key); 58 var symbol = %CreateSymbol(key);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 "valueOf", SymbolValueOf 110 "valueOf", SymbolValueOf
111 ]); 111 ]);
112 112
113 InstallFunctions(GlobalObject, DONT_ENUM, [ 113 InstallFunctions(GlobalObject, DONT_ENUM, [
114 "getOwnPropertySymbols", ObjectGetOwnPropertySymbols 114 "getOwnPropertySymbols", ObjectGetOwnPropertySymbols
115 ]); 115 ]);
116 116
117 $symbolToString = SymbolToString; 117 $symbolToString = SymbolToString;
118 118
119 })(); 119 })();
OLDNEW
« no previous file with comments | « src/string-iterator.js ('k') | src/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698