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

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

Issue 1110513002: Reland "Lazily register prototype users..." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: assert trumps comment Created 5 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
« no previous file with comments | « test/cctest/test-heap.cc ('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
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax
6
7 function A() {
8 this.a = "a";
9 }
10 var a = new A();
11
12 function B() {
13 this.b = "b";
14 }
15 B.prototype = a;
16
17 function C() {
18 this.c = "c";
19 }
20 C.prototype = new B();
21
22 var c = new C();
23
24 function f(expected) {
25 var result = c.z;
26 assertEquals(expected, result);
27 }
28 f(undefined);
29 f(undefined);
30 %OptimizeFunctionOnNextCall(f);
31 f(undefined);
32 a.z = "z";
33 f("z");
34 f("z");
35
36 // Test updating .__proto__ pointers.
37 var p1 = {foo: 1.5};
38 var p2 = {}; p2.__proto__ = p1;
39 var p3 = {}; p3.__proto__ = p2;
40 var o = {}; o.__proto__ = p3;
41
42 for (var i = 0; i < 2; i++) o.foo; // Force registration.
43
44 var p1a = {foo: 1.7};
45 p2.__proto__ = p1a;
46
47 function g(o, expected) {
48 var result = o.foo;
49 assertEquals(expected, result);
50 }
51
52 g(o, 1.7);
53 g(o, 1.7);
54 g(o, 1.7);
55 Object.defineProperty(p1a, "foo", {get: function() { return "foo"}});
56 g(o, "foo");
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698