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

Unified Diff: src/runtime.js

Issue 389263003: Make ToPrimitive throw on symbol wrappers (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | test/mjsunit/es6/symbols.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index 1dee2e08f618e1defd8427438a7e4fa08f38829b..c070a1119e7bdadec9679c56e71b435538baa70e 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -607,35 +607,37 @@ function IsPrimitive(x) {
// ECMA-262, section 8.6.2.6, page 28.
function DefaultNumber(x) {
- var valueOf = x.valueOf;
- if (IS_SPEC_FUNCTION(valueOf)) {
- var v = %_CallFunction(x, valueOf);
- if (%IsPrimitive(v)) return v;
- }
+ if (!IS_SYMBOL_WRAPPER(x)) {
+ var valueOf = x.valueOf;
+ if (IS_SPEC_FUNCTION(valueOf)) {
+ var v = %_CallFunction(x, valueOf);
+ if (%IsPrimitive(v)) return v;
+ }
- var toString = x.toString;
- if (IS_SPEC_FUNCTION(toString)) {
- var s = %_CallFunction(x, toString);
- if (%IsPrimitive(s)) return s;
+ var toString = x.toString;
+ if (IS_SPEC_FUNCTION(toString)) {
+ var s = %_CallFunction(x, toString);
+ if (%IsPrimitive(s)) return s;
+ }
}
-
throw %MakeTypeError('cannot_convert_to_primitive', []);
}
// ECMA-262, section 8.6.2.6, page 28.
function DefaultString(x) {
- var toString = x.toString;
- if (IS_SPEC_FUNCTION(toString)) {
- var s = %_CallFunction(x, toString);
- if (%IsPrimitive(s)) return s;
- }
+ if (!IS_SYMBOL_WRAPPER(x)) {
+ var toString = x.toString;
+ if (IS_SPEC_FUNCTION(toString)) {
+ var s = %_CallFunction(x, toString);
+ if (%IsPrimitive(s)) return s;
+ }
- var valueOf = x.valueOf;
- if (IS_SPEC_FUNCTION(valueOf)) {
- var v = %_CallFunction(x, valueOf);
- if (%IsPrimitive(v)) return v;
+ var valueOf = x.valueOf;
+ if (IS_SPEC_FUNCTION(valueOf)) {
+ var v = %_CallFunction(x, valueOf);
+ if (%IsPrimitive(v)) return v;
+ }
}
-
throw %MakeTypeError('cannot_convert_to_primitive', []);
}
« no previous file with comments | « no previous file | test/mjsunit/es6/symbols.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698