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

Side by Side Diff: test/mjsunit/function-prototype.js

Issue 14829005: Remove separate maps for function instances (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove outdated comment Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 assertEquals(p, GetPrototypeOf(NoInitialMap)); 83 assertEquals(p, GetPrototypeOf(NoInitialMap));
84 84
85 // Check the standard fast case. 85 // Check the standard fast case.
86 assertEquals(F.prototype, GetPrototypeOf(F)); 86 assertEquals(F.prototype, GetPrototypeOf(F));
87 87
88 // Check that getting the prototype of a non-function works. This must 88 // Check that getting the prototype of a non-function works. This must
89 // be the last thing we do because this will clobber the optimizations 89 // be the last thing we do because this will clobber the optimizations
90 // in GetPrototypeOf and go to a monomorphic IC load instead. 90 // in GetPrototypeOf and go to a monomorphic IC load instead.
91 assertEquals(87, GetPrototypeOf({prototype:87})); 91 assertEquals(87, GetPrototypeOf({prototype:87}));
92 92
93 // Check the prototype is not enumerable, for compatibility with 93 // Check the prototype is not enumerable, as per ES5 section 15.3.5.2. Note
94 // safari. This is deliberately incompatible with ECMA262, 15.3.5.2. 94 // that this is in difference to ES3, which specified that function instances
95 // would have enumerable prototypes (section 15.3.5.2 also).
95 var foo = new Function("return x"); 96 var foo = new Function("return x");
96 var result = "" 97 var result = ""
97 for (var n in foo) result += n; 98 for (var n in foo) result += n;
98 assertEquals(result, ""); 99 assertEquals(result, "");
100
101 f = new Function('return 1;')
102 var desc = Object.getOwnPropertyDescriptor(f, "prototype");
103 assertFalse(desc.configurable);
104 assertFalse(desc.enumerable);
105 assertTrue(desc.writable);
106
107 f = Function('return 1;')
108 var desc = Object.getOwnPropertyDescriptor(f, "prototype");
109 assertFalse(desc.configurable);
110 assertFalse(desc.enumerable);
111 assertTrue(desc.writable);
112
113 f = function () { return 1; }
114 var desc = Object.getOwnPropertyDescriptor(f, "prototype");
115 assertFalse(desc.configurable);
116 assertFalse(desc.enumerable);
117 assertTrue(desc.writable);
OLDNEW
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698