| 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/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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 info()->context()->builtins()->javascript_builtin( | 715 info()->context()->builtins()->javascript_builtin( |
| 716 Builtins::FILTER_KEY))); | 716 Builtins::FILTER_KEY))); |
| 717 // Callee. | 717 // Callee. |
| 718 environment()->Push(jsgraph()->HeapConstant(function)); | 718 environment()->Push(jsgraph()->HeapConstant(function)); |
| 719 // Receiver. | 719 // Receiver. |
| 720 environment()->Push(obj); | 720 environment()->Push(obj); |
| 721 // Args. | 721 // Args. |
| 722 environment()->Push(value); | 722 environment()->Push(value); |
| 723 // result is either the string key or Smi(0) indicating the property | 723 // result is either the string key or Smi(0) indicating the property |
| 724 // is gone. | 724 // is gone. |
| 725 // TODO(jarin) Insert lazy deoptimization support here - the call | |
| 726 // actually | |
| 727 // can deoptimize. | |
| 728 Node* res = ProcessArguments( | 725 Node* res = ProcessArguments( |
| 729 javascript()->Call(3, NO_CALL_FUNCTION_FLAGS, | 726 javascript()->Call(3, NO_CALL_FUNCTION_FLAGS), 3); |
| 730 CallDescriptor::kCannotDeoptimize), | |
| 731 3); | |
| 732 Node* property_missing = NewNode(javascript()->StrictEqual(), res, | 727 Node* property_missing = NewNode(javascript()->StrictEqual(), res, |
| 733 jsgraph()->ZeroConstant()); | 728 jsgraph()->ZeroConstant()); |
| 734 { | 729 { |
| 735 IfBuilder is_property_missing(this); | 730 IfBuilder is_property_missing(this); |
| 736 is_property_missing.If(property_missing); | 731 is_property_missing.If(property_missing); |
| 737 is_property_missing.Then(); | 732 is_property_missing.Then(); |
| 738 // Inc counter and continue. | 733 // Inc counter and continue. |
| 739 Node* index_inc = | 734 Node* index_inc = |
| 740 NewNode(javascript()->Add(), index, jsgraph()->OneConstant()); | 735 NewNode(javascript()->Add(), index, jsgraph()->OneConstant()); |
| 741 environment()->Poke(0, index_inc); | 736 environment()->Poke(0, index_inc); |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 Node* pair = NewNode(op, callee, source, receiver, strict, position); | 1239 Node* pair = NewNode(op, callee, source, receiver, strict, position); |
| 1245 Node* new_callee = NewNode(common()->Projection(0), pair); | 1240 Node* new_callee = NewNode(common()->Projection(0), pair); |
| 1246 Node* new_receiver = NewNode(common()->Projection(1), pair); | 1241 Node* new_receiver = NewNode(common()->Projection(1), pair); |
| 1247 | 1242 |
| 1248 // Patch callee and receiver on the environment. | 1243 // Patch callee and receiver on the environment. |
| 1249 environment()->Poke(arg_count + 1, new_callee); | 1244 environment()->Poke(arg_count + 1, new_callee); |
| 1250 environment()->Poke(arg_count + 0, new_receiver); | 1245 environment()->Poke(arg_count + 0, new_receiver); |
| 1251 } | 1246 } |
| 1252 | 1247 |
| 1253 // Create node to perform the function call. | 1248 // Create node to perform the function call. |
| 1254 Operator* call = javascript()->Call(args->length() + 2, flags, | 1249 Operator* call = javascript()->Call(args->length() + 2, flags); |
| 1255 CallDescriptor::kCanDeoptimize); | |
| 1256 Node* value = ProcessArguments(call, args->length() + 2); | 1250 Node* value = ProcessArguments(call, args->length() + 2); |
| 1257 ast_context()->ProduceValue(value); | 1251 ast_context()->ProduceValue(value); |
| 1258 | |
| 1259 BuildLazyBailout(value, expr->id()); | |
| 1260 } | 1252 } |
| 1261 | 1253 |
| 1262 | 1254 |
| 1263 void AstGraphBuilder::VisitCallNew(CallNew* expr) { | 1255 void AstGraphBuilder::VisitCallNew(CallNew* expr) { |
| 1264 VisitForValue(expr->expression()); | 1256 VisitForValue(expr->expression()); |
| 1265 | 1257 |
| 1266 // Evaluate all arguments to the construct call. | 1258 // Evaluate all arguments to the construct call. |
| 1267 ZoneList<Expression*>* args = expr->arguments(); | 1259 ZoneList<Expression*>* args = expr->arguments(); |
| 1268 VisitForValues(args); | 1260 VisitForValues(args); |
| 1269 | 1261 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1284 PrintableUnique<String> unique = MakeUnique(name); | 1276 PrintableUnique<String> unique = MakeUnique(name); |
| 1285 Node* callee_value = NewNode(javascript()->LoadNamed(unique), receiver_value); | 1277 Node* callee_value = NewNode(javascript()->LoadNamed(unique), receiver_value); |
| 1286 environment()->Push(callee_value); | 1278 environment()->Push(callee_value); |
| 1287 environment()->Push(receiver_value); | 1279 environment()->Push(receiver_value); |
| 1288 | 1280 |
| 1289 // Evaluate all arguments to the JS runtime call. | 1281 // Evaluate all arguments to the JS runtime call. |
| 1290 ZoneList<Expression*>* args = expr->arguments(); | 1282 ZoneList<Expression*>* args = expr->arguments(); |
| 1291 VisitForValues(args); | 1283 VisitForValues(args); |
| 1292 | 1284 |
| 1293 // Create node to perform the JS runtime call. | 1285 // Create node to perform the JS runtime call. |
| 1294 Operator* call = javascript()->Call(args->length() + 2, flags, | 1286 Operator* call = javascript()->Call(args->length() + 2, flags); |
| 1295 CallDescriptor::kCanDeoptimize); | |
| 1296 Node* value = ProcessArguments(call, args->length() + 2); | 1287 Node* value = ProcessArguments(call, args->length() + 2); |
| 1297 ast_context()->ProduceValue(value); | 1288 ast_context()->ProduceValue(value); |
| 1298 | |
| 1299 BuildLazyBailout(value, expr->id()); | |
| 1300 } | 1289 } |
| 1301 | 1290 |
| 1302 | 1291 |
| 1303 void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) { | 1292 void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) { |
| 1304 const Runtime::Function* function = expr->function(); | 1293 const Runtime::Function* function = expr->function(); |
| 1305 | 1294 |
| 1306 // Handle calls to runtime functions implemented in JavaScript separately as | 1295 // Handle calls to runtime functions implemented in JavaScript separately as |
| 1307 // the call follows JavaScript ABI and the callee is statically unknown. | 1296 // the call follows JavaScript ABI and the callee is statically unknown. |
| 1308 if (expr->is_jsruntime()) { | 1297 if (expr->is_jsruntime()) { |
| 1309 DCHECK(function == NULL && expr->name()->length() > 0); | 1298 DCHECK(function == NULL && expr->name()->length() > 0); |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1977 | 1966 |
| 1978 // Continue with the original environment. | 1967 // Continue with the original environment. |
| 1979 set_environment(continuation_env); | 1968 set_environment(continuation_env); |
| 1980 | 1969 |
| 1981 NewNode(common()->Continuation()); | 1970 NewNode(common()->Continuation()); |
| 1982 } | 1971 } |
| 1983 } | 1972 } |
| 1984 } | 1973 } |
| 1985 } | 1974 } |
| 1986 } // namespace v8::internal::compiler | 1975 } // namespace v8::internal::compiler |
| OLD | NEW |