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

Side by Side Diff: test/mjsunit/compiler/simple-inlining.js

Issue 8888006: Make more JS files beter match the coding standard. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 9 years 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 | « test/mjsunit/compiler/simple-global-access.js ('k') | test/mjsunit/compiler/thisfunction.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // Value context. 122 // Value context.
123 var x = o.h(); 123 var x = o.h();
124 assertEquals(42, x); 124 assertEquals(42, x);
125 assertEquals(42, o.h()); 125 assertEquals(42, o.h());
126 // Test context. 126 // Test context.
127 if (!o.h()) { 127 if (!o.h()) {
128 assertTrue(false); // Should not happen. 128 assertTrue(false); // Should not happen.
129 } 129 }
130 } 130 }
131 131
132 var o6 = {y:42} 132 var o6 = {y:42};
133 var o5 = {e:o6}; 133 var o5 = {e:o6};
134 o5.h = function() { return this.e.y; }; 134 o5.h = function() { return this.e.y; };
135 for (var i = 0; i < 5; i++) TestInlineThisXY(o5); 135 for (var i = 0; i < 5; i++) TestInlineThisXY(o5);
136 %OptimizeFunctionOnNextCall(TestInlineThisXY); 136 %OptimizeFunctionOnNextCall(TestInlineThisXY);
137 TestInlineThisXY(o5); 137 TestInlineThisXY(o5);
138 TestInlineThisXY({h: o5.h, e:o6}); 138 TestInlineThisXY({h: o5.h, e:o6});
139 139
140 140
141 // Test that we can inline a function that returns 'this.x.length'. 141 // Test that we can inline a function that returns 'this.x.length'.
142 function TestInlineThisX0(o) { 142 function TestInlineThisX0(o) {
143 // Effect context. 143 // Effect context.
144 o.foo(); 144 o.foo();
145 // Value context. 145 // Value context.
146 var x = o.foo(); 146 var x = o.foo();
147 assertEquals(42, x); 147 assertEquals(42, x);
148 assertEquals(42, o.foo()); 148 assertEquals(42, o.foo());
149 // Test context. 149 // Test context.
150 if (!o.foo()) { 150 if (!o.foo()) {
151 assertTrue(false); // Should not happen. 151 assertTrue(false); // Should not happen.
152 } 152 }
153 } 153 }
154 154
155 var o7 = {x:[42,43,44]}; 155 var o7 = {x:[42,43,44]};
156 o7.foo = function() { return this.x[0]; }; 156 o7.foo = function() { return this.x[0]; };
157 for (var i = 0; i < 5; i++) TestInlineThisX0(o7); 157 for (var i = 0; i < 5; i++) TestInlineThisX0(o7);
158 %OptimizeFunctionOnNextCall(TestInlineThisX0); 158 %OptimizeFunctionOnNextCall(TestInlineThisX0);
159 TestInlineThisX0(o7); 159 TestInlineThisX0(o7);
160 TestInlineThisX0({foo: o7.foo, x:[42,0,0]}); 160 TestInlineThisX0({foo: o7.foo, x:[42,0,0]});
OLDNEW
« no previous file with comments | « test/mjsunit/compiler/simple-global-access.js ('k') | test/mjsunit/compiler/thisfunction.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698