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

Side by Side Diff: test/cctest/test-deoptimization.cc

Issue 444883006: Initial shot at deoptimizing JSCallFunction in Turbofan. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove debug print 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/compiler/test-scheduler.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
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
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 static Handle<JSFunction> GetJSFunction(v8::Handle<v8::Object> obj, 107 static Handle<JSFunction> GetJSFunction(v8::Handle<v8::Object> obj,
108 const char* property_name) { 108 const char* property_name) {
109 v8::Local<v8::Function> fun = 109 v8::Local<v8::Function> fun =
110 v8::Local<v8::Function>::Cast(obj->Get(v8_str(property_name))); 110 v8::Local<v8::Function>::Cast(obj->Get(v8_str(property_name)));
111 return v8::Utils::OpenHandle(*fun); 111 return v8::Utils::OpenHandle(*fun);
112 } 112 }
113 113
114 114
115 TEST(DeoptimizeSimple) { 115 TEST(DeoptimizeSimple) {
116 i::FLAG_turbo_deoptimization = true;
117
116 LocalContext env; 118 LocalContext env;
117 v8::HandleScope scope(env->GetIsolate()); 119 v8::HandleScope scope(env->GetIsolate());
118 120
119 // Test lazy deoptimization of a simple function. 121 // Test lazy deoptimization of a simple function.
120 { 122 {
121 AlwaysOptimizeAllowNativesSyntaxNoInlining options; 123 AlwaysOptimizeAllowNativesSyntaxNoInlining options;
122 CompileRun( 124 CompileRun(
123 "var count = 0;" 125 "var count = 0;"
124 "function h() { %DeoptimizeFunction(f); }" 126 "function h() { %DeoptimizeFunction(f); }"
125 "function g() { count++; h(); }" 127 "function g() { count++; h(); }"
(...skipping 18 matching lines...) Expand all
144 } 146 }
145 NonIncrementalGC(); 147 NonIncrementalGC();
146 148
147 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 149 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
148 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); 150 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized());
149 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 151 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
150 } 152 }
151 153
152 154
153 TEST(DeoptimizeSimpleWithArguments) { 155 TEST(DeoptimizeSimpleWithArguments) {
156 i::FLAG_turbo_deoptimization = true;
157
154 LocalContext env; 158 LocalContext env;
155 v8::HandleScope scope(env->GetIsolate()); 159 v8::HandleScope scope(env->GetIsolate());
156 160
157 // Test lazy deoptimization of a simple function with some arguments. 161 // Test lazy deoptimization of a simple function with some arguments.
158 { 162 {
159 AlwaysOptimizeAllowNativesSyntaxNoInlining options; 163 AlwaysOptimizeAllowNativesSyntaxNoInlining options;
160 CompileRun( 164 CompileRun(
161 "var count = 0;" 165 "var count = 0;"
162 "function h(x) { %DeoptimizeFunction(f); }" 166 "function h(x) { %DeoptimizeFunction(f); }"
163 "function g(x, y) { count++; h(x); }" 167 "function g(x, y) { count++; h(x); }"
(...skipping 19 matching lines...) Expand all
183 } 187 }
184 NonIncrementalGC(); 188 NonIncrementalGC();
185 189
186 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 190 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
187 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized()); 191 CHECK(!GetJSFunction(env->Global(), "f")->IsOptimized());
188 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate())); 192 CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
189 } 193 }
190 194
191 195
192 TEST(DeoptimizeSimpleNested) { 196 TEST(DeoptimizeSimpleNested) {
197 i::FLAG_turbo_deoptimization = true;
198
193 LocalContext env; 199 LocalContext env;
194 v8::HandleScope scope(env->GetIsolate()); 200 v8::HandleScope scope(env->GetIsolate());
195 201
196 // Test lazy deoptimization of a simple function. Have a nested function call 202 // Test lazy deoptimization of a simple function. Have a nested function call
197 // do the deoptimization. 203 // do the deoptimization.
198 { 204 {
199 AlwaysOptimizeAllowNativesSyntaxNoInlining options; 205 AlwaysOptimizeAllowNativesSyntaxNoInlining options;
200 CompileRun( 206 CompileRun(
201 "var count = 0;" 207 "var count = 0;"
202 "var result = 0;" 208 "var result = 0;"
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 } 694 }
689 NonIncrementalGC(); 695 NonIncrementalGC();
690 696
691 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized()); 697 CHECK(!GetJSFunction(env->Global(), "f1")->IsOptimized());
692 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized()); 698 CHECK(!GetJSFunction(env->Global(), "g1")->IsOptimized());
693 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized()); 699 CHECK(!GetJSFunction(env->Global(), "f2")->IsOptimized());
694 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized()); 700 CHECK(!GetJSFunction(env->Global(), "g2")->IsOptimized());
695 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value()); 701 CHECK_EQ(1, env->Global()->Get(v8_str("count"))->Int32Value());
696 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value()); 702 CHECK_EQ(13, env->Global()->Get(v8_str("result"))->Int32Value());
697 } 703 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698