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

Side by Side Diff: src/full-codegen/full-codegen.cc

Issue 2504153002: [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: REBASE. Created 4 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
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/heap/object-stats.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/full-codegen/full-codegen.h" 5 #include "src/full-codegen/full-codegen.h"
6 6
7 #include "src/ast/ast-numbering.h" 7 #include "src/ast/ast-numbering.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/prettyprinter.h" 9 #include "src/ast/prettyprinter.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 NestedStatement* current = nesting_stack_; 1020 NestedStatement* current = nesting_stack_;
1021 int context_length = 0; 1021 int context_length = 0;
1022 while (current != NULL) { 1022 while (current != NULL) {
1023 if (HasStackOverflow()) return; 1023 if (HasStackOverflow()) return;
1024 current = current->Exit(&context_length); 1024 current = current->Exit(&context_length);
1025 } 1025 }
1026 EmitReturnSequence(); 1026 EmitReturnSequence();
1027 } 1027 }
1028 1028
1029 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, 1029 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info,
1030 FeedbackVectorSlot slot,
1030 bool pretenure) { 1031 bool pretenure) {
1032 // If slot is invalid, then it's a native function literal and we
1033 // can pass the empty array or empty literal array, something like that...
1034
1031 // If we're running with the --always-opt or the --prepare-always-opt 1035 // If we're running with the --always-opt or the --prepare-always-opt
1032 // flag, we need to use the runtime function so that the new function 1036 // flag, we need to use the runtime function so that the new function
1033 // we are creating here gets a chance to have its code optimized and 1037 // we are creating here gets a chance to have its code optimized and
1034 // doesn't just get a copy of the existing unoptimized code. 1038 // doesn't just get a copy of the existing unoptimized code.
1035 if (!FLAG_always_opt && !FLAG_prepare_always_opt && !pretenure && 1039 if (!FLAG_always_opt && !FLAG_prepare_always_opt && !pretenure &&
1036 scope()->is_function_scope()) { 1040 scope()->is_function_scope()) {
1037 FastNewClosureStub stub(isolate()); 1041 FastNewClosureStub stub(isolate());
1038 __ Move(stub.GetCallInterfaceDescriptor().GetRegisterParameter(0), info); 1042 __ Move(stub.GetCallInterfaceDescriptor().GetRegisterParameter(0), info);
1043 DCHECK(!slot.IsInvalid());
1044 __ EmitLoadTypeFeedbackVector(
1045 stub.GetCallInterfaceDescriptor().GetRegisterParameter(1));
1046 __ Move(stub.GetCallInterfaceDescriptor().GetRegisterParameter(2),
1047 SmiFromSlot(slot));
1039 __ CallStub(&stub); 1048 __ CallStub(&stub);
1040 } else { 1049 } else {
1041 __ Push(info); 1050 __ Push(info);
1051 __ EmitLoadTypeFeedbackVector(result_register());
1052 __ Push(result_register());
1053 __ Push(SmiFromSlot(slot));
1042 __ CallRuntime(pretenure ? Runtime::kNewClosure_Tenured 1054 __ CallRuntime(pretenure ? Runtime::kNewClosure_Tenured
1043 : Runtime::kNewClosure); 1055 : Runtime::kNewClosure);
1044 } 1056 }
1045 context()->Plug(result_register()); 1057 context()->Plug(result_register());
1046 } 1058 }
1047 1059
1048 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 1060 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
1049 SetExpressionPosition(prop); 1061 SetExpressionPosition(prop);
1050 Literal* key = prop->key()->AsLiteral(); 1062 Literal* key = prop->key()->AsLiteral();
1051 DCHECK(!key->value()->IsSmi()); 1063 DCHECK(!key->value()->IsSmi());
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 void FullCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) { 1305 void FullCodeGenerator::VisitFunctionLiteral(FunctionLiteral* expr) {
1294 Comment cmnt(masm_, "[ FunctionLiteral"); 1306 Comment cmnt(masm_, "[ FunctionLiteral");
1295 1307
1296 // Build the function boilerplate and instantiate it. 1308 // Build the function boilerplate and instantiate it.
1297 Handle<SharedFunctionInfo> function_info = 1309 Handle<SharedFunctionInfo> function_info =
1298 Compiler::GetSharedFunctionInfo(expr, script(), info_, compilation_mode_); 1310 Compiler::GetSharedFunctionInfo(expr, script(), info_, compilation_mode_);
1299 if (function_info.is_null()) { 1311 if (function_info.is_null()) {
1300 SetStackOverflow(); 1312 SetStackOverflow();
1301 return; 1313 return;
1302 } 1314 }
1303 EmitNewClosure(function_info, expr->pretenure()); 1315 EmitNewClosure(function_info, expr->LiteralFeedbackSlot(), expr->pretenure());
1304 } 1316 }
1305 1317
1306 1318
1307 void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) { 1319 void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) {
1308 // Unsupported 1320 // Unsupported
1309 UNREACHABLE(); 1321 UNREACHABLE();
1310 } 1322 }
1311 1323
1312 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { 1324 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
1313 Comment cmnt(masm_, "[ RegExpLiteral"); 1325 Comment cmnt(masm_, "[ RegExpLiteral");
(...skipping 12 matching lines...) Expand all
1326 LoadFromFrameField(StandardFrameConstants::kContextOffset, 1338 LoadFromFrameField(StandardFrameConstants::kContextOffset,
1327 context_register()); 1339 context_register());
1328 context()->Plug(result_register()); 1340 context()->Plug(result_register());
1329 } 1341 }
1330 1342
1331 void FullCodeGenerator::VisitNativeFunctionLiteral( 1343 void FullCodeGenerator::VisitNativeFunctionLiteral(
1332 NativeFunctionLiteral* expr) { 1344 NativeFunctionLiteral* expr) {
1333 Comment cmnt(masm_, "[ NativeFunctionLiteral"); 1345 Comment cmnt(masm_, "[ NativeFunctionLiteral");
1334 Handle<SharedFunctionInfo> shared = 1346 Handle<SharedFunctionInfo> shared =
1335 Compiler::GetSharedFunctionInfoForNative(expr->extension(), expr->name()); 1347 Compiler::GetSharedFunctionInfoForNative(expr->extension(), expr->name());
1336 EmitNewClosure(shared, false); 1348 EmitNewClosure(shared, expr->LiteralFeedbackSlot(), false);
1337 } 1349 }
1338 1350
1339 1351
1340 void FullCodeGenerator::VisitThrow(Throw* expr) { 1352 void FullCodeGenerator::VisitThrow(Throw* expr) {
1341 Comment cmnt(masm_, "[ Throw"); 1353 Comment cmnt(masm_, "[ Throw");
1342 VisitForStackValue(expr->exception()); 1354 VisitForStackValue(expr->exception());
1343 SetExpressionPosition(expr); 1355 SetExpressionPosition(expr);
1344 CallRuntimeWithOperands(Runtime::kThrow); 1356 CallRuntimeWithOperands(Runtime::kThrow);
1345 // Never returns here. 1357 // Never returns here.
1346 1358
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 return info_->has_simple_parameters(); 1624 return info_->has_simple_parameters();
1613 } 1625 }
1614 1626
1615 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); } 1627 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); }
1616 1628
1617 #undef __ 1629 #undef __
1618 1630
1619 1631
1620 } // namespace internal 1632 } // namespace internal
1621 } // namespace v8 1633 } // namespace v8
OLDNEW
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/heap/object-stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698