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

Side by Side Diff: src/factory.cc

Issue 1019293003: Fix broken JSFunction::is_compiled predicate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove stray assert. Created 5 years, 9 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 | « no previous file | src/objects.cc » ('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 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 Handle<JSObject> prototype = NewJSObjectFromMap(new_map); 1339 Handle<JSObject> prototype = NewJSObjectFromMap(new_map);
1340 1340
1341 if (!function->shared()->is_generator()) { 1341 if (!function->shared()->is_generator()) {
1342 JSObject::AddProperty(prototype, constructor_string(), function, DONT_ENUM); 1342 JSObject::AddProperty(prototype, constructor_string(), function, DONT_ENUM);
1343 } 1343 }
1344 1344
1345 return prototype; 1345 return prototype;
1346 } 1346 }
1347 1347
1348 1348
1349 static bool ShouldOptimizeNewClosure(Isolate* isolate, 1349 static bool ShouldOptimizeNewClosure(Handle<SharedFunctionInfo> info) {
1350 Handle<SharedFunctionInfo> info) { 1350 return !info->is_toplevel() && info->allows_lazy_compilation();
1351 return !info->is_toplevel() && info->is_compiled() &&
1352 info->allows_lazy_compilation();
1353 } 1351 }
1354 1352
1355 1353
1356 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( 1354 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
1357 Handle<SharedFunctionInfo> info, 1355 Handle<SharedFunctionInfo> info,
1358 Handle<Context> context, 1356 Handle<Context> context,
1359 PretenureFlag pretenure) { 1357 PretenureFlag pretenure) {
1360 int map_index = 1358 int map_index =
1361 Context::FunctionMapIndex(info->language_mode(), info->kind()); 1359 Context::FunctionMapIndex(info->language_mode(), info->kind());
1362 Handle<Map> map(Map::cast(context->native_context()->get(map_index))); 1360 Handle<Map> map(Map::cast(context->native_context()->get(map_index)));
(...skipping 14 matching lines...) Expand all
1377 if (index > 0) { 1375 if (index > 0) {
1378 // Caching of optimized code enabled and optimized code found. 1376 // Caching of optimized code enabled and optimized code found.
1379 FixedArray* literals = info->GetLiteralsFromOptimizedCodeMap(index); 1377 FixedArray* literals = info->GetLiteralsFromOptimizedCodeMap(index);
1380 if (literals != NULL) result->set_literals(literals); 1378 if (literals != NULL) result->set_literals(literals);
1381 Code* code = info->GetCodeFromOptimizedCodeMap(index); 1379 Code* code = info->GetCodeFromOptimizedCodeMap(index);
1382 DCHECK(!code->marked_for_deoptimization()); 1380 DCHECK(!code->marked_for_deoptimization());
1383 result->ReplaceCode(code); 1381 result->ReplaceCode(code);
1384 return result; 1382 return result;
1385 } 1383 }
1386 1384
1387 if (FLAG_always_opt && ShouldOptimizeNewClosure(isolate(), info)) { 1385 if (FLAG_always_opt && ShouldOptimizeNewClosure(info)) {
1388 result->MarkForOptimization(); 1386 result->MarkForOptimization();
1389 } 1387 }
1390 return result; 1388 return result;
1391 } 1389 }
1392 1390
1393 1391
1394 Handle<ScopeInfo> Factory::NewScopeInfo(int length) { 1392 Handle<ScopeInfo> Factory::NewScopeInfo(int length) {
1395 Handle<FixedArray> array = NewFixedArray(length, TENURED); 1393 Handle<FixedArray> array = NewFixedArray(length, TENURED);
1396 array->set_map_no_write_barrier(*scope_info_map()); 1394 array->set_map_no_write_barrier(*scope_info_map());
1397 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array); 1395 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(array);
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
2316 return Handle<Object>::null(); 2314 return Handle<Object>::null();
2317 } 2315 }
2318 2316
2319 2317
2320 Handle<Object> Factory::ToBoolean(bool value) { 2318 Handle<Object> Factory::ToBoolean(bool value) {
2321 return value ? true_value() : false_value(); 2319 return value ? true_value() : false_value();
2322 } 2320 }
2323 2321
2324 2322
2325 } } // namespace v8::internal 2323 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698