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

Side by Side Diff: src/runtime-profiler.cc

Issue 5753005: Make closures optimizable by Crankshaft compiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Minor fix in hash function Created 10 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
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 129
130 130
131 void PendingListNode::WeakCallback(v8::Persistent<v8::Value>, void* data) { 131 void PendingListNode::WeakCallback(v8::Persistent<v8::Value>, void* data) {
132 reinterpret_cast<PendingListNode*>(data)->Destroy(); 132 reinterpret_cast<PendingListNode*>(data)->Destroy();
133 } 133 }
134 134
135 135
136 static bool IsOptimizable(JSFunction* function) { 136 static bool IsOptimizable(JSFunction* function) {
137 Code* code = function->code(); 137 Code* code = function->code();
138 return code->kind() == Code::FUNCTION && code->optimizable(); 138 return code->kind() == Code::FUNCTION && code->optimizable()
139 && function->shared()->code() == code;
139 } 140 }
140 141
141 142
142 static void Optimize(JSFunction* function, bool eager, int delay) { 143 static void Optimize(JSFunction* function, bool eager, int delay) {
143 ASSERT(IsOptimizable(function)); 144 ASSERT(IsOptimizable(function));
144 if (FLAG_trace_opt) { 145 if (FLAG_trace_opt) {
145 PrintF("[marking (%s) ", eager ? "eagerly" : "lazily"); 146 PrintF("[marking (%s) ", eager ? "eagerly" : "lazily");
146 function->PrintName(); 147 function->PrintName();
147 PrintF(" for recompilation"); 148 PrintF(" for recompilation");
148 if (delay > 0) { 149 if (delay > 0) {
149 PrintF(" (delayed %0.3f ms)", static_cast<double>(delay) / 1000); 150 PrintF(" (delayed %0.3f ms)", static_cast<double>(delay) / 1000);
150 } 151 }
151 PrintF("]\n"); 152 PrintF("]\n");
152 } 153 }
153 154
154 // The next call to the function will trigger optimization. 155 // The next call to the function will trigger optimization.
155 function->MarkForLazyRecompilation(); 156 function->MarkForLazyRecompilation();
156 } 157 }
157 158
158 159
159 static void AttemptOnStackReplacement(JSFunction* function) { 160 static void AttemptOnStackReplacement(JSFunction* function) {
160 // See AlwaysFullCompiler (in compiler.cc) comment on why we need 161 // See AlwaysFullCompiler (in compiler.cc) comment on why we need
161 // Debug::has_break_points(). 162 // Debug::has_break_points().
162 ASSERT(function->IsMarkedForLazyRecompilation()); 163 ASSERT(function->IsMarkedForLazyRecompilation());
163 if (!FLAG_use_osr || Debug::has_break_points() || function->IsBuiltin()) { 164 if (!FLAG_use_osr || Debug::has_break_points() || function->IsBuiltin()
165 || !function->shared()->allows_lazy_compilation()) {
164 return; 166 return;
165 } 167 }
166 168
167 SharedFunctionInfo* shared = function->shared(); 169 SharedFunctionInfo* shared = function->shared();
168 // If the code is not optimizable, don't try OSR. 170 // If the code is not optimizable, don't try OSR.
169 if (!shared->code()->optimizable()) return; 171 if (!shared->code()->optimizable()) return;
170 172
171 // We are not prepared to do OSR for a function that already has an 173 // We are not prepared to do OSR for a function that already has an
172 // allocated arguments object. The optimized code would bypass it for 174 // allocated arguments object. The optimized code would bypass it for
173 // arguments accesses, which is unsound. Don't try OSR. 175 // arguments accesses, which is unsound. Don't try OSR.
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } else { 445 } else {
444 if (Top::WaitForJSState()) return true; 446 if (Top::WaitForJSState()) return true;
445 } 447 }
446 } 448 }
447 } 449 }
448 return false; 450 return false;
449 } 451 }
450 452
451 453
452 } } // namespace v8::internal 454 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698