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

Side by Side Diff: src/factory.cc

Issue 699143002: Revert "Optimize function across closures." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | « src/compiler.cc ('k') | src/hydrogen-instructions.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 Handle<JSObject> prototype = NewJSObjectFromMap(new_map); 1351 Handle<JSObject> prototype = NewJSObjectFromMap(new_map);
1352 1352
1353 if (!function->shared()->is_generator()) { 1353 if (!function->shared()->is_generator()) {
1354 JSObject::AddProperty(prototype, constructor_string(), function, DONT_ENUM); 1354 JSObject::AddProperty(prototype, constructor_string(), function, DONT_ENUM);
1355 } 1355 }
1356 1356
1357 return prototype; 1357 return prototype;
1358 } 1358 }
1359 1359
1360 1360
1361 static bool ShouldOptimizeNewClosure(Isolate* isolate,
1362 Handle<SharedFunctionInfo> info) {
1363 return isolate->use_crankshaft() && !info->is_toplevel() &&
1364 info->allows_lazy_compilation() && !info->optimization_disabled() &&
1365 !isolate->DebuggerHasBreakPoints();
1366 }
1367
1368
1369 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( 1361 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1370 Handle<SharedFunctionInfo> info, 1362 Handle<SharedFunctionInfo> info,
1371 Handle<Context> context, 1363 Handle<Context> context,
1372 PretenureFlag pretenure) { 1364 PretenureFlag pretenure) {
1373 int map_index = Context::FunctionMapIndex(info->strict_mode(), info->kind()); 1365 int map_index = Context::FunctionMapIndex(info->strict_mode(), info->kind());
1374 Handle<Map> map(Map::cast(context->native_context()->get(map_index))); 1366 Handle<Map> map(Map::cast(context->native_context()->get(map_index)));
1375 Handle<JSFunction> result = NewFunction(map, info, context, pretenure); 1367 Handle<JSFunction> result = NewFunction(map, info, context, pretenure);
1376 1368
1377 if (info->ic_age() != isolate()->heap()->global_ic_age()) { 1369 if (info->ic_age() != isolate()->heap()->global_ic_age()) {
1378 info->ResetForNewContext(isolate()->heap()->global_ic_age()); 1370 info->ResetForNewContext(isolate()->heap()->global_ic_age());
(...skipping 17 matching lines...) Expand all
1396 if (index > 0) { 1388 if (index > 0) {
1397 // Caching of optimized code enabled and optimized code found. 1389 // Caching of optimized code enabled and optimized code found.
1398 FixedArray* literals = info->GetLiteralsFromOptimizedCodeMap(index); 1390 FixedArray* literals = info->GetLiteralsFromOptimizedCodeMap(index);
1399 if (literals != NULL) result->set_literals(literals); 1391 if (literals != NULL) result->set_literals(literals);
1400 Code* code = info->GetCodeFromOptimizedCodeMap(index); 1392 Code* code = info->GetCodeFromOptimizedCodeMap(index);
1401 DCHECK(!code->marked_for_deoptimization()); 1393 DCHECK(!code->marked_for_deoptimization());
1402 result->ReplaceCode(code); 1394 result->ReplaceCode(code);
1403 return result; 1395 return result;
1404 } 1396 }
1405 1397
1406 if (FLAG_always_opt && ShouldOptimizeNewClosure(isolate(), info)) { 1398 if (isolate()->use_crankshaft() &&
1399 FLAG_always_opt &&
1400 result->is_compiled() &&
1401 !info->is_toplevel() &&
1402 info->allows_lazy_compilation() &&
1403 !info->optimization_disabled() &&
1404 !isolate()->DebuggerHasBreakPoints()) {
1407 result->MarkForOptimization(); 1405 result->MarkForOptimization();
1408 } else if (info->optimize_next_closure() &&
1409 ShouldOptimizeNewClosure(isolate(), info)) {
1410 if (isolate()->concurrent_recompilation_enabled()) {
1411 result->MarkForConcurrentOptimization();
1412 } else {
1413 result->MarkForOptimization();
1414 }
1415 } 1406 }
1416 return result; 1407 return result;
1417 } 1408 }
1418 1409
1419 1410
1420 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { 1411 Handle<ScopeInfo> Factory::NewScopeInfo(int length) {
1421 Handle<FixedArray> array = NewFixedArray(length, TENURED); 1412 Handle<FixedArray> array = NewFixedArray(length, TENURED);
1422 array->set_map_no_write_barrier(*scope_info_map()); 1413 array->set_map_no_write_barrier(*scope_info_map());
1423 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); 1414 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array);
1424 return scope_info; 1415 return scope_info;
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
2507 return Handle<Object>::null(); 2498 return Handle<Object>::null();
2508 } 2499 }
2509 2500
2510 2501
2511 Handle<Object> Factory::ToBoolean(bool value) { 2502 Handle<Object> Factory::ToBoolean(bool value) {
2512 return value ? true_value() : false_value(); 2503 return value ? true_value() : false_value();
2513 } 2504 }
2514 2505
2515 2506
2516 } } // namespace v8::internal 2507 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698