OLD | NEW |
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 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 | 1339 |
1340 if (cached.literals != nullptr) { | 1340 if (cached.literals != nullptr) { |
1341 result->set_literals(cached.literals); | 1341 result->set_literals(cached.literals); |
1342 | 1342 |
1343 } else if (!info->bound()) { | 1343 } else if (!info->bound()) { |
1344 int number_of_literals = info->num_literals(); | 1344 int number_of_literals = info->num_literals(); |
1345 Handle<LiteralsArray> literals = | 1345 Handle<LiteralsArray> literals = |
1346 LiteralsArray::New(isolate(), handle(info->feedback_vector()), | 1346 LiteralsArray::New(isolate(), handle(info->feedback_vector()), |
1347 number_of_literals, pretenure); | 1347 number_of_literals, pretenure); |
1348 result->set_literals(*literals); | 1348 result->set_literals(*literals); |
| 1349 |
1349 // Cache context-specific literals. | 1350 // Cache context-specific literals. |
1350 if (FLAG_cache_optimized_code) { | 1351 Handle<Context> native_context(context->native_context()); |
1351 Handle<Context> native_context(context->native_context()); | 1352 SharedFunctionInfo::AddToOptimizedCodeMap( |
1352 SharedFunctionInfo::AddToOptimizedCodeMap( | 1353 info, native_context, undefined_value(), literals, BailoutId::None()); |
1353 info, native_context, undefined_value(), literals, BailoutId::None()); | |
1354 } | |
1355 } | 1354 } |
1356 | 1355 |
1357 return result; | 1356 return result; |
1358 } | 1357 } |
1359 | 1358 |
1360 | 1359 |
1361 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { | 1360 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { |
1362 Handle<FixedArray> array = NewFixedArray(length, TENURED); | 1361 Handle<FixedArray> array = NewFixedArray(length, TENURED); |
1363 array->set_map_no_write_barrier(*scope_info_map()); | 1362 array->set_map_no_write_barrier(*scope_info_map()); |
1364 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); | 1363 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); |
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2385 } | 2384 } |
2386 | 2385 |
2387 | 2386 |
2388 Handle<Object> Factory::ToBoolean(bool value) { | 2387 Handle<Object> Factory::ToBoolean(bool value) { |
2389 return value ? true_value() : false_value(); | 2388 return value ? true_value() : false_value(); |
2390 } | 2389 } |
2391 | 2390 |
2392 | 2391 |
2393 } // namespace internal | 2392 } // namespace internal |
2394 } // namespace v8 | 2393 } // namespace v8 |
OLD | NEW |