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

Unified Diff: src/v8natives.js

Issue 458753004: ToNumber(Symbol) should throw TypeError (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use IS_SYMBOL instead Created 6 years, 4 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 | « src/runtime.js ('k') | test/mjsunit/es6/symbols.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index 4c56fd16efb66a224a94cad9357bd246e3d9b073..9612f16f961a5996d9c93f26b87c63b23fd32075 100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -925,34 +925,36 @@ function DefineArrayProperty(obj, p, desc, should_throw) {
}
// Step 4 - Special handling for array index.
- var index = ToUint32(p);
- var emit_splice = false;
- if (ToString(index) == p && index != 4294967295) {
- var length = obj.length;
- if (index >= length && %IsObserved(obj)) {
- emit_splice = true;
- BeginPerformSplice(obj);
- }
+ if (!IS_SYMBOL(p)) {
+ var index = ToUint32(p);
+ var emit_splice = false;
+ if (ToString(index) == p && index != 4294967295) {
+ var length = obj.length;
+ if (index >= length && %IsObserved(obj)) {
+ emit_splice = true;
+ BeginPerformSplice(obj);
+ }
- var length_desc = GetOwnPropertyJS(obj, "length");
- if ((index >= length && !length_desc.isWritable()) ||
- !DefineObjectProperty(obj, p, desc, true)) {
- if (emit_splice)
+ var length_desc = GetOwnPropertyJS(obj, "length");
+ if ((index >= length && !length_desc.isWritable()) ||
+ !DefineObjectProperty(obj, p, desc, true)) {
+ if (emit_splice)
+ EndPerformSplice(obj);
+ if (should_throw) {
+ throw MakeTypeError("define_disallowed", [p]);
+ } else {
+ return false;
+ }
+ }
+ if (index >= length) {
+ obj.length = index + 1;
+ }
+ if (emit_splice) {
EndPerformSplice(obj);
- if (should_throw) {
- throw MakeTypeError("define_disallowed", [p]);
- } else {
- return false;
+ EnqueueSpliceRecord(obj, length, [], index + 1 - length);
}
+ return true;
}
- if (index >= length) {
- obj.length = index + 1;
- }
- if (emit_splice) {
- EndPerformSplice(obj);
- EnqueueSpliceRecord(obj, length, [], index + 1 - length);
- }
- return true;
}
// Step 5 - Fallback to default implementation.
« no previous file with comments | « src/runtime.js ('k') | test/mjsunit/es6/symbols.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698