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

Side by Side Diff: src/factory.cc

Issue 1205783003: Simplify interface to optimized code map lookup. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_opt-code-map-1
Patch Set: Created 5 years, 5 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
« no previous file with comments | « src/compiler.cc ('k') | src/objects.h » ('j') | src/objects.cc » ('J')
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/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 Handle<JSFunction> result = NewFunction(map, info, context, pretenure); 1370 Handle<JSFunction> result = NewFunction(map, info, context, pretenure);
1371 1371
1372 if (info->ic_age() != isolate()->heap()->global_ic_age()) { 1372 if (info->ic_age() != isolate()->heap()->global_ic_age()) {
1373 info->ResetForNewContext(isolate()->heap()->global_ic_age()); 1373 info->ResetForNewContext(isolate()->heap()->global_ic_age());
1374 } 1374 }
1375 1375
1376 if (FLAG_always_opt && info->allows_lazy_compilation()) { 1376 if (FLAG_always_opt && info->allows_lazy_compilation()) {
1377 result->MarkForOptimization(); 1377 result->MarkForOptimization();
1378 } 1378 }
1379 1379
1380 int index = info->SearchOptimizedCodeMap(context->native_context(), 1380 CodeAndLiterals cached = info->SearchOptimizedCodeMap(
1381 BailoutId::None()); 1381 context->native_context(), BailoutId::None());
1382 if (!info->bound() && index < 0) { 1382 if (cached.code != nullptr) {
1383 // Caching of optimized code enabled and optimized code found.
1384 if (cached.literals != nullptr) result->set_literals(cached.literals);
1385 DCHECK(!cached.code->marked_for_deoptimization());
1386 DCHECK(result->shared()->is_compiled());
1387 result->ReplaceCode(cached.code);
1388 }
1389
1390 if (cached.literals == nullptr && !info->bound()) {
Jarin 2015/06/24 14:01:53 Any reason why not to say something like ... } el
Michael Starzinger 2015/06/24 14:36:42 I would like to get to an interface where the resu
1383 int number_of_literals = info->num_literals(); 1391 int number_of_literals = info->num_literals();
1384 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure); 1392 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure);
1385 result->set_literals(*literals); 1393 result->set_literals(*literals);
1386 } 1394 }
1387 1395
1388 if (index > 0) {
1389 // Caching of optimized code enabled and optimized code found.
1390 FixedArray* literals = info->GetLiteralsFromOptimizedCodeMap(index);
1391 if (literals != NULL) result->set_literals(literals);
1392 Code* code = info->GetCodeFromOptimizedCodeMap(index);
1393 DCHECK(!code->marked_for_deoptimization());
1394 DCHECK(result->shared()->is_compiled());
1395 result->ReplaceCode(code);
1396 }
1397
1398 return result; 1396 return result;
1399 } 1397 }
1400 1398
1401 1399
1402 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { 1400 Handle<ScopeInfo> Factory::NewScopeInfo(int length) {
1403 Handle<FixedArray> array = NewFixedArray(length, TENURED); 1401 Handle<FixedArray> array = NewFixedArray(length, TENURED);
1404 array->set_map_no_write_barrier(*scope_info_map()); 1402 array->set_map_no_write_barrier(*scope_info_map());
1405 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); 1403 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array);
1406 return scope_info; 1404 return scope_info;
1407 } 1405 }
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 } 2428 }
2431 2429
2432 2430
2433 Handle<Object> Factory::ToBoolean(bool value) { 2431 Handle<Object> Factory::ToBoolean(bool value) {
2434 return value ? true_value() : false_value(); 2432 return value ? true_value() : false_value();
2435 } 2433 }
2436 2434
2437 2435
2438 } // namespace internal 2436 } // namespace internal
2439 } // namespace v8 2437 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/objects.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698