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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 444883006: Initial shot at deoptimizing JSCallFunction in Turbofan. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove debug print Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/arm64/linkage-arm64.cc ('k') | src/compiler/code-generator.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/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/control-builders.h" 8 #include "src/compiler/control-builders.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 info()->context()->builtins()->javascript_builtin( 725 info()->context()->builtins()->javascript_builtin(
726 Builtins::FILTER_KEY))); 726 Builtins::FILTER_KEY)));
727 // Callee. 727 // Callee.
728 environment()->Push(jsgraph()->HeapConstant(function)); 728 environment()->Push(jsgraph()->HeapConstant(function));
729 // Receiver. 729 // Receiver.
730 environment()->Push(obj); 730 environment()->Push(obj);
731 // Args. 731 // Args.
732 environment()->Push(value); 732 environment()->Push(value);
733 // result is either the string key or Smi(0) indicating the property 733 // result is either the string key or Smi(0) indicating the property
734 // is gone. 734 // is gone.
735 // TODO(jarin) Insert lazy deoptimization support here - the call
736 // actually
737 // can deoptimize.
735 Node* res = ProcessArguments( 738 Node* res = ProcessArguments(
736 javascript()->Call(3, NO_CALL_FUNCTION_FLAGS), 3); 739 javascript()->Call(3, NO_CALL_FUNCTION_FLAGS,
740 CallDescriptor::kCannotDeoptimize),
741 3);
737 Node* property_missing = NewNode(javascript()->StrictEqual(), res, 742 Node* property_missing = NewNode(javascript()->StrictEqual(), res,
738 jsgraph()->ZeroConstant()); 743 jsgraph()->ZeroConstant());
739 { 744 {
740 IfBuilder is_property_missing(this); 745 IfBuilder is_property_missing(this);
741 is_property_missing.If(property_missing); 746 is_property_missing.If(property_missing);
742 is_property_missing.Then(); 747 is_property_missing.Then();
743 // Inc counter and continue. 748 // Inc counter and continue.
744 Node* index_inc = 749 Node* index_inc =
745 NewNode(javascript()->Add(), index, jsgraph()->OneConstant()); 750 NewNode(javascript()->Add(), index, jsgraph()->OneConstant());
746 environment()->Poke(0, index_inc); 751 environment()->Poke(0, index_inc);
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 Node* pair = NewNode(op, callee, source, receiver, strict, position); 1254 Node* pair = NewNode(op, callee, source, receiver, strict, position);
1250 Node* new_callee = NewNode(common()->Projection(0), pair); 1255 Node* new_callee = NewNode(common()->Projection(0), pair);
1251 Node* new_receiver = NewNode(common()->Projection(1), pair); 1256 Node* new_receiver = NewNode(common()->Projection(1), pair);
1252 1257
1253 // Patch callee and receiver on the environment. 1258 // Patch callee and receiver on the environment.
1254 environment()->Poke(arg_count + 1, new_callee); 1259 environment()->Poke(arg_count + 1, new_callee);
1255 environment()->Poke(arg_count + 0, new_receiver); 1260 environment()->Poke(arg_count + 0, new_receiver);
1256 } 1261 }
1257 1262
1258 // Create node to perform the function call. 1263 // Create node to perform the function call.
1259 Operator* call = javascript()->Call(args->length() + 2, flags); 1264 Operator* call = javascript()->Call(args->length() + 2, flags,
1265 CallDescriptor::kCanDeoptimize);
1260 Node* value = ProcessArguments(call, args->length() + 2); 1266 Node* value = ProcessArguments(call, args->length() + 2);
1261 ast_context()->ProduceValue(value); 1267 ast_context()->ProduceValue(value);
1268
1269 BuildLazyBailout(value, expr->id());
1262 } 1270 }
1263 1271
1264 1272
1265 void AstGraphBuilder::VisitCallNew(CallNew* expr) { 1273 void AstGraphBuilder::VisitCallNew(CallNew* expr) {
1266 VisitForValue(expr->expression()); 1274 VisitForValue(expr->expression());
1267 1275
1268 // Evaluate all arguments to the construct call. 1276 // Evaluate all arguments to the construct call.
1269 ZoneList<Expression*>* args = expr->arguments(); 1277 ZoneList<Expression*>* args = expr->arguments();
1270 VisitForValues(args); 1278 VisitForValues(args);
1271 1279
(...skipping 14 matching lines...) Expand all
1286 PrintableUnique<String> unique = MakeUnique(name); 1294 PrintableUnique<String> unique = MakeUnique(name);
1287 Node* callee_value = NewNode(javascript()->LoadNamed(unique), receiver_value); 1295 Node* callee_value = NewNode(javascript()->LoadNamed(unique), receiver_value);
1288 environment()->Push(callee_value); 1296 environment()->Push(callee_value);
1289 environment()->Push(receiver_value); 1297 environment()->Push(receiver_value);
1290 1298
1291 // Evaluate all arguments to the JS runtime call. 1299 // Evaluate all arguments to the JS runtime call.
1292 ZoneList<Expression*>* args = expr->arguments(); 1300 ZoneList<Expression*>* args = expr->arguments();
1293 VisitForValues(args); 1301 VisitForValues(args);
1294 1302
1295 // Create node to perform the JS runtime call. 1303 // Create node to perform the JS runtime call.
1296 Operator* call = javascript()->Call(args->length() + 2, flags); 1304 Operator* call = javascript()->Call(args->length() + 2, flags,
1305 CallDescriptor::kCanDeoptimize);
1297 Node* value = ProcessArguments(call, args->length() + 2); 1306 Node* value = ProcessArguments(call, args->length() + 2);
1298 ast_context()->ProduceValue(value); 1307 ast_context()->ProduceValue(value);
1308
1309 BuildLazyBailout(value, expr->id());
1299 } 1310 }
1300 1311
1301 1312
1302 void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) { 1313 void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
1303 const Runtime::Function* function = expr->function(); 1314 const Runtime::Function* function = expr->function();
1304 1315
1305 // Handle calls to runtime functions implemented in JavaScript separately as 1316 // Handle calls to runtime functions implemented in JavaScript separately as
1306 // the call follows JavaScript ABI and the callee is statically unknown. 1317 // the call follows JavaScript ABI and the callee is statically unknown.
1307 if (expr->is_jsruntime()) { 1318 if (expr->is_jsruntime()) {
1308 DCHECK(function == NULL && expr->name()->length() > 0); 1319 DCHECK(function == NULL && expr->name()->length() > 0);
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1977 1988
1978 // Continue with the original environment. 1989 // Continue with the original environment.
1979 set_environment(continuation_env); 1990 set_environment(continuation_env);
1980 1991
1981 NewNode(common()->Continuation()); 1992 NewNode(common()->Continuation());
1982 } 1993 }
1983 } 1994 }
1984 } 1995 }
1985 } 1996 }
1986 } // namespace v8::internal::compiler 1997 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/arm64/linkage-arm64.cc ('k') | src/compiler/code-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698