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

Side by Side Diff: test/mjsunit/debug-evaluate-locals-optimized-double.js

Issue 9304001: Implement inlining of constructor calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed moar comments by Vyacheslav Egorov. Created 8 years, 9 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 | « test/mjsunit/debug-evaluate-locals-optimized.js ('k') | test/mjsunit/regress/regress-1229.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 // Flags: --expose-debug-as debug --allow-natives-syntax 28 // Flags: --expose-debug-as debug --allow-natives-syntax --inline-construct
29 // Get the Debug object exposed from the debug context global object. 29 // Get the Debug object exposed from the debug context global object.
30 Debug = debug.Debug 30 Debug = debug.Debug
31 31
32 var listenerComplete = false; 32 var listenerComplete = false;
33 var exception = false; 33 var exception = false;
34 34
35 var testingConstructCall = false; 35 var testingConstructCall = false;
36 36
37 var input = [ 37 var input = [
38 {a: 1, b: 2}, 38 {a: 1, b: 2},
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 case 0: assertEquals(h, frame.func().value()); break; 133 case 0: assertEquals(h, frame.func().value()); break;
134 case 1: assertEquals(g3, frame.func().value()); break; 134 case 1: assertEquals(g3, frame.func().value()); break;
135 case 2: assertEquals(g2, frame.func().value()); break; 135 case 2: assertEquals(g2, frame.func().value()); break;
136 case 3: assertEquals(g1, frame.func().value()); break; 136 case 3: assertEquals(g1, frame.func().value()); break;
137 case 4: assertEquals(f, frame.func().value()); break; 137 case 4: assertEquals(f, frame.func().value()); break;
138 case 5: break; 138 case 5: break;
139 default: assertUnreachable(); 139 default: assertUnreachable();
140 } 140 }
141 141
142 // Check for construct call. 142 // Check for construct call.
143 assertEquals(testingConstructCall && i == 4, frame.isConstructCall()); 143 if (i == 4) {
144 assertEquals(testingConstructCall, frame.isConstructCall());
145 } else if (i == 2) {
146 assertTrue(frame.isConstructCall());
147 } else {
148 assertFalse(frame.isConstructCall());
149 }
144 150
145 // When function f is optimized (1 means YES, see runtime.cc) we 151 // When function f is optimized (1 means YES, see runtime.cc) we
146 // expect an optimized frame for f with g1, g2 and g3 inlined. 152 // expect an optimized frame for f with g1, g2 and g3 inlined.
147 if (%GetOptimizationStatus(f) == 1) { 153 if (%GetOptimizationStatus(f) == 1) {
148 if (i == 1 || i == 2 || i == 3) { 154 if (i == 1 || i == 2 || i == 3) {
149 assertTrue(frame.isOptimizedFrame()); 155 assertTrue(frame.isOptimizedFrame());
150 assertTrue(frame.isInlinedFrame()); 156 assertTrue(frame.isInlinedFrame());
151 assertEquals(4 - i, frame.inlinedFrameIndex()); 157 assertEquals(4 - i, frame.inlinedFrameIndex());
152 } else if (i == 4) { 158 } else if (i == 4) {
153 assertTrue(frame.isOptimizedFrame()); 159 assertTrue(frame.isOptimizedFrame());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 a2 = a2 + a2 / 100; 203 a2 = a2 + a2 / 100;
198 b2 = b2 + b2 / 100; 204 b2 = b2 + b2 / 100;
199 g3(i - 1, a2, b2); 205 g3(i - 1, a2, b2);
200 }; 206 };
201 207
202 function g1(i, x3, y3, z3) { 208 function g1(i, x3, y3, z3) {
203 var a3 = input[i].a; 209 var a3 = input[i].a;
204 var b3 = input[i].b; 210 var b3 = input[i].b;
205 a3 = a3 + a3 / 100; 211 a3 = a3 + a3 / 100;
206 b3 = b3 + b3 / 100; 212 b3 = b3 + b3 / 100;
207 g2(i - 1, a3, b3); 213 new g2(i - 1, a3, b3);
208 }; 214 };
209 215
210 function f(i, x4, y4) { 216 function f(i, x4, y4) {
211 var a4 = input[i].a; 217 var a4 = input[i].a;
212 var b4 = input[i].b; 218 var b4 = input[i].b;
213 a4 = a4 + a4 / 100; 219 a4 = a4 + a4 / 100;
214 b4 = b4 + b4 / 100; 220 b4 = b4 + b4 / 100;
215 g1(i - 1, a4, b4); 221 g1(i - 1, a4, b4);
216 }; 222 };
217 223
218 // Test calling f normally and as a constructor. 224 // Test calling f normally and as a constructor.
219 f(input.length - 1, 11.11, 12.12); 225 f(input.length - 1, 11.11, 12.12);
220 f(input.length - 1, 11.11, 12.12, ""); 226 f(input.length - 1, 11.11, 12.12, "");
221 testingConstructCall = true; 227 testingConstructCall = true;
222 new f(input.length - 1, 11.11, 12.12); 228 new f(input.length - 1, 11.11, 12.12);
223 new f(input.length - 1, 11.11, 12.12, ""); 229 new f(input.length - 1, 11.11, 12.12, "");
224 230
225 // Make sure that the debug event listener vas invoked. 231 // Make sure that the debug event listener was invoked.
226 assertFalse(exception, "exception in listener " + exception) 232 assertFalse(exception, "exception in listener " + exception)
227 assertTrue(listenerComplete); 233 assertTrue(listenerComplete);
228 234
229 Debug.setListener(null); 235 Debug.setListener(null);
OLDNEW
« no previous file with comments | « test/mjsunit/debug-evaluate-locals-optimized.js ('k') | test/mjsunit/regress/regress-1229.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698