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/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
830 compare_if.Then(); | 830 compare_if.Then(); |
831 Visit(expr->then_expression()); | 831 Visit(expr->then_expression()); |
832 compare_if.Else(); | 832 compare_if.Else(); |
833 Visit(expr->else_expression()); | 833 Visit(expr->else_expression()); |
834 compare_if.End(); | 834 compare_if.End(); |
835 ast_context()->ReplaceValue(); | 835 ast_context()->ReplaceValue(); |
836 } | 836 } |
837 | 837 |
838 | 838 |
839 void AstGraphBuilder::VisitVariableProxy(VariableProxy* expr) { | 839 void AstGraphBuilder::VisitVariableProxy(VariableProxy* expr) { |
840 Node* value = BuildVariableLoad(expr->var(), expr->id()); | 840 VectorSlotPair pair = CreateVectorSlotPair(expr->VariableFeedbackSlot()); |
841 Node* value = BuildVariableLoad(expr->var(), expr->id(), pair); | |
841 ast_context()->ProduceValue(value); | 842 ast_context()->ProduceValue(value); |
842 } | 843 } |
843 | 844 |
844 | 845 |
845 void AstGraphBuilder::VisitLiteral(Literal* expr) { | 846 void AstGraphBuilder::VisitLiteral(Literal* expr) { |
846 Node* value = jsgraph()->Constant(expr->value()); | 847 Node* value = jsgraph()->Constant(expr->value()); |
847 ast_context()->ProduceValue(value); | 848 ast_context()->ProduceValue(value); |
848 } | 849 } |
849 | 850 |
850 | 851 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1084 break; | 1085 break; |
1085 } | 1086 } |
1086 } | 1087 } |
1087 | 1088 |
1088 // Evaluate the value and potentially handle compound assignments by loading | 1089 // Evaluate the value and potentially handle compound assignments by loading |
1089 // the left-hand side value and performing a binary operation. | 1090 // the left-hand side value and performing a binary operation. |
1090 if (expr->is_compound()) { | 1091 if (expr->is_compound()) { |
1091 Node* old_value = NULL; | 1092 Node* old_value = NULL; |
1092 switch (assign_type) { | 1093 switch (assign_type) { |
1093 case VARIABLE: { | 1094 case VARIABLE: { |
1094 Variable* variable = expr->target()->AsVariableProxy()->var(); | 1095 VariableProxy* proxy = expr->target()->AsVariableProxy(); |
1095 old_value = BuildVariableLoad(variable, expr->target()->id()); | 1096 VectorSlotPair pair = |
1097 CreateVectorSlotPair(proxy->VariableFeedbackSlot()); | |
1098 old_value = BuildVariableLoad(proxy->var(), expr->target()->id(), pair); | |
1096 break; | 1099 break; |
1097 } | 1100 } |
1098 case NAMED_PROPERTY: { | 1101 case NAMED_PROPERTY: { |
1099 Node* object = environment()->Top(); | 1102 Node* object = environment()->Top(); |
1100 Unique<Name> name = | 1103 Unique<Name> name = |
1101 MakeUnique(property->key()->AsLiteral()->AsPropertyName()); | 1104 MakeUnique(property->key()->AsLiteral()->AsPropertyName()); |
1102 old_value = NewNode(javascript()->LoadNamed(name), object); | 1105 int slot = property->PropertyFeedbackSlot(); |
Michael Starzinger
2014/10/10 09:09:58
nit: Instead of randomly pulling either "slot" or
mvstanton
2014/10/10 09:31:15
Good idea, done.
| |
1106 old_value = NewNode( | |
1107 javascript()->LoadNamed(name, CreateVectorSlotPair(slot)), object); | |
1103 PrepareFrameState(old_value, property->LoadId(), | 1108 PrepareFrameState(old_value, property->LoadId(), |
1104 OutputFrameStateCombine::Push()); | 1109 OutputFrameStateCombine::Push()); |
1105 break; | 1110 break; |
1106 } | 1111 } |
1107 case KEYED_PROPERTY: { | 1112 case KEYED_PROPERTY: { |
1108 Node* key = environment()->Top(); | 1113 Node* key = environment()->Top(); |
1109 Node* object = environment()->Peek(1); | 1114 Node* object = environment()->Peek(1); |
1110 old_value = NewNode(javascript()->LoadProperty(), object, key); | 1115 int slot = property->PropertyFeedbackSlot(); |
1116 old_value = | |
1117 NewNode(javascript()->LoadProperty(CreateVectorSlotPair(slot)), | |
1118 object, key); | |
1111 PrepareFrameState(old_value, property->LoadId(), | 1119 PrepareFrameState(old_value, property->LoadId(), |
1112 OutputFrameStateCombine::Push()); | 1120 OutputFrameStateCombine::Push()); |
1113 break; | 1121 break; |
1114 } | 1122 } |
1115 } | 1123 } |
1116 environment()->Push(old_value); | 1124 environment()->Push(old_value); |
1117 VisitForValue(expr->value()); | 1125 VisitForValue(expr->value()); |
1118 Node* right = environment()->Pop(); | 1126 Node* right = environment()->Pop(); |
1119 Node* left = environment()->Pop(); | 1127 Node* left = environment()->Pop(); |
1120 Node* value = BuildBinaryOp(left, right, expr->binary_op()); | 1128 Node* value = BuildBinaryOp(left, right, expr->binary_op()); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1172 Node* exception = environment()->Pop(); | 1180 Node* exception = environment()->Pop(); |
1173 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); | 1181 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1); |
1174 Node* value = NewNode(op, exception); | 1182 Node* value = NewNode(op, exception); |
1175 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 1183 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); |
1176 ast_context()->ProduceValue(value); | 1184 ast_context()->ProduceValue(value); |
1177 } | 1185 } |
1178 | 1186 |
1179 | 1187 |
1180 void AstGraphBuilder::VisitProperty(Property* expr) { | 1188 void AstGraphBuilder::VisitProperty(Property* expr) { |
1181 Node* value; | 1189 Node* value; |
1190 int slot = expr->PropertyFeedbackSlot(); | |
1182 if (expr->key()->IsPropertyName()) { | 1191 if (expr->key()->IsPropertyName()) { |
1183 VisitForValue(expr->obj()); | 1192 VisitForValue(expr->obj()); |
1184 Node* object = environment()->Pop(); | 1193 Node* object = environment()->Pop(); |
1185 Unique<Name> name = MakeUnique(expr->key()->AsLiteral()->AsPropertyName()); | 1194 Unique<Name> name = MakeUnique(expr->key()->AsLiteral()->AsPropertyName()); |
1186 value = NewNode(javascript()->LoadNamed(name), object); | 1195 value = NewNode(javascript()->LoadNamed(name, CreateVectorSlotPair(slot)), |
1196 object); | |
1187 } else { | 1197 } else { |
1188 VisitForValue(expr->obj()); | 1198 VisitForValue(expr->obj()); |
1189 VisitForValue(expr->key()); | 1199 VisitForValue(expr->key()); |
1190 Node* key = environment()->Pop(); | 1200 Node* key = environment()->Pop(); |
1191 Node* object = environment()->Pop(); | 1201 Node* object = environment()->Pop(); |
1192 value = NewNode(javascript()->LoadProperty(), object, key); | 1202 value = NewNode(javascript()->LoadProperty(CreateVectorSlotPair(slot)), |
1203 object, key); | |
1193 } | 1204 } |
1194 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 1205 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); |
1195 ast_context()->ProduceValue(value); | 1206 ast_context()->ProduceValue(value); |
1196 } | 1207 } |
1197 | 1208 |
1198 | 1209 |
1199 void AstGraphBuilder::VisitCall(Call* expr) { | 1210 void AstGraphBuilder::VisitCall(Call* expr) { |
1200 Expression* callee = expr->expression(); | 1211 Expression* callee = expr->expression(); |
1201 Call::CallType call_type = expr->GetCallType(isolate()); | 1212 Call::CallType call_type = expr->GetCallType(isolate()); |
1202 | 1213 |
1203 // Prepare the callee and the receiver to the function call. This depends on | 1214 // Prepare the callee and the receiver to the function call. This depends on |
1204 // the semantics of the underlying call type. | 1215 // the semantics of the underlying call type. |
1205 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS; | 1216 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS; |
1206 Node* receiver_value = NULL; | 1217 Node* receiver_value = NULL; |
1207 Node* callee_value = NULL; | 1218 Node* callee_value = NULL; |
1208 bool possibly_eval = false; | 1219 bool possibly_eval = false; |
1209 switch (call_type) { | 1220 switch (call_type) { |
1210 case Call::GLOBAL_CALL: { | 1221 case Call::GLOBAL_CALL: { |
1211 Variable* variable = callee->AsVariableProxy()->var(); | 1222 VariableProxy* proxy = callee->AsVariableProxy(); |
1212 callee_value = BuildVariableLoad(variable, expr->expression()->id()); | 1223 VectorSlotPair pair = CreateVectorSlotPair(proxy->VariableFeedbackSlot()); |
1224 callee_value = | |
1225 BuildVariableLoad(proxy->var(), expr->expression()->id(), pair); | |
1213 receiver_value = jsgraph()->UndefinedConstant(); | 1226 receiver_value = jsgraph()->UndefinedConstant(); |
1214 break; | 1227 break; |
1215 } | 1228 } |
1216 case Call::LOOKUP_SLOT_CALL: { | 1229 case Call::LOOKUP_SLOT_CALL: { |
1217 Variable* variable = callee->AsVariableProxy()->var(); | 1230 Variable* variable = callee->AsVariableProxy()->var(); |
1218 DCHECK(variable->location() == Variable::LOOKUP); | 1231 DCHECK(variable->location() == Variable::LOOKUP); |
1219 Node* name = jsgraph()->Constant(variable->name()); | 1232 Node* name = jsgraph()->Constant(variable->name()); |
1220 const Operator* op = | 1233 const Operator* op = |
1221 javascript()->CallRuntime(Runtime::kLoadLookupSlot, 2); | 1234 javascript()->CallRuntime(Runtime::kLoadLookupSlot, 2); |
1222 Node* pair = NewNode(op, current_context(), name); | 1235 Node* pair = NewNode(op, current_context(), name); |
1223 callee_value = NewNode(common()->Projection(0), pair); | 1236 callee_value = NewNode(common()->Projection(0), pair); |
1224 receiver_value = NewNode(common()->Projection(1), pair); | 1237 receiver_value = NewNode(common()->Projection(1), pair); |
1225 | 1238 |
1226 PrepareFrameState(pair, expr->EvalOrLookupId(), | 1239 PrepareFrameState(pair, expr->EvalOrLookupId(), |
1227 OutputFrameStateCombine::Push()); | 1240 OutputFrameStateCombine::Push()); |
1228 break; | 1241 break; |
1229 } | 1242 } |
1230 case Call::PROPERTY_CALL: { | 1243 case Call::PROPERTY_CALL: { |
1231 Property* property = callee->AsProperty(); | 1244 Property* property = callee->AsProperty(); |
1232 VisitForValue(property->obj()); | 1245 VisitForValue(property->obj()); |
1233 Node* object = environment()->Top(); | 1246 Node* object = environment()->Top(); |
1247 int slot = property->PropertyFeedbackSlot(); | |
1234 if (property->key()->IsPropertyName()) { | 1248 if (property->key()->IsPropertyName()) { |
1235 Unique<Name> name = | 1249 Unique<Name> name = |
1236 MakeUnique(property->key()->AsLiteral()->AsPropertyName()); | 1250 MakeUnique(property->key()->AsLiteral()->AsPropertyName()); |
1237 callee_value = NewNode(javascript()->LoadNamed(name), object); | 1251 callee_value = NewNode( |
1252 javascript()->LoadNamed(name, CreateVectorSlotPair(slot)), object); | |
1238 } else { | 1253 } else { |
1239 VisitForValue(property->key()); | 1254 VisitForValue(property->key()); |
1240 Node* key = environment()->Pop(); | 1255 Node* key = environment()->Pop(); |
1241 callee_value = NewNode(javascript()->LoadProperty(), object, key); | 1256 callee_value = |
1257 NewNode(javascript()->LoadProperty(CreateVectorSlotPair(slot)), | |
1258 object, key); | |
1242 } | 1259 } |
1243 PrepareFrameState(callee_value, property->LoadId(), | 1260 PrepareFrameState(callee_value, property->LoadId(), |
1244 OutputFrameStateCombine::Push()); | 1261 OutputFrameStateCombine::Push()); |
1245 receiver_value = environment()->Pop(); | 1262 receiver_value = environment()->Pop(); |
1246 // Note that a PROPERTY_CALL requires the receiver to be wrapped into an | 1263 // Note that a PROPERTY_CALL requires the receiver to be wrapped into an |
1247 // object for sloppy callees. This could also be modeled explicitly here, | 1264 // object for sloppy callees. This could also be modeled explicitly here, |
1248 // thereby obsoleting the need for a flag to the call operator. | 1265 // thereby obsoleting the need for a flag to the call operator. |
1249 flags = CALL_AS_METHOD; | 1266 flags = CALL_AS_METHOD; |
1250 break; | 1267 break; |
1251 } | 1268 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1319 | 1336 |
1320 | 1337 |
1321 void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) { | 1338 void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) { |
1322 Handle<String> name = expr->name(); | 1339 Handle<String> name = expr->name(); |
1323 | 1340 |
1324 // The callee and the receiver both have to be pushed onto the operand stack | 1341 // The callee and the receiver both have to be pushed onto the operand stack |
1325 // before arguments are being evaluated. | 1342 // before arguments are being evaluated. |
1326 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS; | 1343 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS; |
1327 Node* receiver_value = BuildLoadBuiltinsObject(); | 1344 Node* receiver_value = BuildLoadBuiltinsObject(); |
1328 Unique<String> unique = MakeUnique(name); | 1345 Unique<String> unique = MakeUnique(name); |
1329 Node* callee_value = NewNode(javascript()->LoadNamed(unique), receiver_value); | 1346 int slot = expr->CallRuntimeFeedbackSlot(); |
1347 Node* callee_value = | |
1348 NewNode(javascript()->LoadNamed(unique, CreateVectorSlotPair(slot)), | |
1349 receiver_value); | |
1330 // TODO(jarin): Find/create a bailout id to deoptimize to (crankshaft | 1350 // TODO(jarin): Find/create a bailout id to deoptimize to (crankshaft |
1331 // refuses to optimize functions with jsruntime calls). | 1351 // refuses to optimize functions with jsruntime calls). |
1332 PrepareFrameState(callee_value, BailoutId::None(), | 1352 PrepareFrameState(callee_value, BailoutId::None(), |
1333 OutputFrameStateCombine::Push()); | 1353 OutputFrameStateCombine::Push()); |
1334 environment()->Push(callee_value); | 1354 environment()->Push(callee_value); |
1335 environment()->Push(receiver_value); | 1355 environment()->Push(receiver_value); |
1336 | 1356 |
1337 // Evaluate all arguments to the JS runtime call. | 1357 // Evaluate all arguments to the JS runtime call. |
1338 ZoneList<Expression*>* args = expr->arguments(); | 1358 ZoneList<Expression*>* args = expr->arguments(); |
1339 VisitForValues(args); | 1359 VisitForValues(args); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1394 | 1414 |
1395 // Reserve space for result of postfix operation. | 1415 // Reserve space for result of postfix operation. |
1396 bool is_postfix = expr->is_postfix() && !ast_context()->IsEffect(); | 1416 bool is_postfix = expr->is_postfix() && !ast_context()->IsEffect(); |
1397 if (is_postfix) environment()->Push(jsgraph()->UndefinedConstant()); | 1417 if (is_postfix) environment()->Push(jsgraph()->UndefinedConstant()); |
1398 | 1418 |
1399 // Evaluate LHS expression and get old value. | 1419 // Evaluate LHS expression and get old value. |
1400 Node* old_value = NULL; | 1420 Node* old_value = NULL; |
1401 int stack_depth = -1; | 1421 int stack_depth = -1; |
1402 switch (assign_type) { | 1422 switch (assign_type) { |
1403 case VARIABLE: { | 1423 case VARIABLE: { |
1404 Variable* variable = expr->expression()->AsVariableProxy()->var(); | 1424 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
1405 old_value = BuildVariableLoad(variable, expr->expression()->id()); | 1425 VectorSlotPair pair = CreateVectorSlotPair(proxy->VariableFeedbackSlot()); |
1426 old_value = | |
1427 BuildVariableLoad(proxy->var(), expr->expression()->id(), pair); | |
1406 stack_depth = 0; | 1428 stack_depth = 0; |
1407 break; | 1429 break; |
1408 } | 1430 } |
1409 case NAMED_PROPERTY: { | 1431 case NAMED_PROPERTY: { |
1410 VisitForValue(property->obj()); | 1432 VisitForValue(property->obj()); |
1411 Node* object = environment()->Top(); | 1433 Node* object = environment()->Top(); |
1412 Unique<Name> name = | 1434 Unique<Name> name = |
1413 MakeUnique(property->key()->AsLiteral()->AsPropertyName()); | 1435 MakeUnique(property->key()->AsLiteral()->AsPropertyName()); |
1414 old_value = NewNode(javascript()->LoadNamed(name), object); | 1436 int slot = property->PropertyFeedbackSlot(); |
1437 old_value = NewNode( | |
1438 javascript()->LoadNamed(name, CreateVectorSlotPair(slot)), object); | |
1415 PrepareFrameState(old_value, property->LoadId(), | 1439 PrepareFrameState(old_value, property->LoadId(), |
1416 OutputFrameStateCombine::Push()); | 1440 OutputFrameStateCombine::Push()); |
1417 stack_depth = 1; | 1441 stack_depth = 1; |
1418 break; | 1442 break; |
1419 } | 1443 } |
1420 case KEYED_PROPERTY: { | 1444 case KEYED_PROPERTY: { |
1421 VisitForValue(property->obj()); | 1445 VisitForValue(property->obj()); |
1422 VisitForValue(property->key()); | 1446 VisitForValue(property->key()); |
1423 Node* key = environment()->Top(); | 1447 Node* key = environment()->Top(); |
1424 Node* object = environment()->Peek(1); | 1448 Node* object = environment()->Peek(1); |
1425 old_value = NewNode(javascript()->LoadProperty(), object, key); | 1449 int slot = property->PropertyFeedbackSlot(); |
1450 old_value = NewNode( | |
1451 javascript()->LoadProperty(CreateVectorSlotPair(slot)), object, key); | |
1426 PrepareFrameState(old_value, property->LoadId(), | 1452 PrepareFrameState(old_value, property->LoadId(), |
1427 OutputFrameStateCombine::Push()); | 1453 OutputFrameStateCombine::Push()); |
1428 stack_depth = 2; | 1454 stack_depth = 2; |
1429 break; | 1455 break; |
1430 } | 1456 } |
1431 } | 1457 } |
1432 | 1458 |
1433 // Convert old value into a number. | 1459 // Convert old value into a number. |
1434 old_value = NewNode(javascript()->ToNumber(), old_value); | 1460 old_value = NewNode(javascript()->ToNumber(), old_value); |
1435 | 1461 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1625 Node* value = jsgraph()->UndefinedConstant(); | 1651 Node* value = jsgraph()->UndefinedConstant(); |
1626 ast_context()->ProduceValue(value); | 1652 ast_context()->ProduceValue(value); |
1627 } | 1653 } |
1628 | 1654 |
1629 | 1655 |
1630 void AstGraphBuilder::VisitTypeof(UnaryOperation* expr) { | 1656 void AstGraphBuilder::VisitTypeof(UnaryOperation* expr) { |
1631 Node* operand; | 1657 Node* operand; |
1632 if (expr->expression()->IsVariableProxy()) { | 1658 if (expr->expression()->IsVariableProxy()) { |
1633 // Typeof does not throw a reference error on global variables, hence we | 1659 // Typeof does not throw a reference error on global variables, hence we |
1634 // perform a non-contextual load in case the operand is a variable proxy. | 1660 // perform a non-contextual load in case the operand is a variable proxy. |
1635 Variable* variable = expr->expression()->AsVariableProxy()->var(); | 1661 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
1636 operand = | 1662 VectorSlotPair pair = CreateVectorSlotPair(proxy->VariableFeedbackSlot()); |
1637 BuildVariableLoad(variable, expr->expression()->id(), NOT_CONTEXTUAL); | 1663 operand = BuildVariableLoad(proxy->var(), expr->expression()->id(), pair, |
1664 NOT_CONTEXTUAL); | |
1638 } else { | 1665 } else { |
1639 VisitForValue(expr->expression()); | 1666 VisitForValue(expr->expression()); |
1640 operand = environment()->Pop(); | 1667 operand = environment()->Pop(); |
1641 } | 1668 } |
1642 Node* value = NewNode(javascript()->TypeOf(), operand); | 1669 Node* value = NewNode(javascript()->TypeOf(), operand); |
1643 ast_context()->ProduceValue(value); | 1670 ast_context()->ProduceValue(value); |
1644 } | 1671 } |
1645 | 1672 |
1646 | 1673 |
1647 void AstGraphBuilder::VisitNot(UnaryOperation* expr) { | 1674 void AstGraphBuilder::VisitNot(UnaryOperation* expr) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1683 compare_if.End(); | 1710 compare_if.End(); |
1684 ast_context()->ReplaceValue(); | 1711 ast_context()->ReplaceValue(); |
1685 } | 1712 } |
1686 | 1713 |
1687 | 1714 |
1688 StrictMode AstGraphBuilder::strict_mode() const { | 1715 StrictMode AstGraphBuilder::strict_mode() const { |
1689 return info()->strict_mode(); | 1716 return info()->strict_mode(); |
1690 } | 1717 } |
1691 | 1718 |
1692 | 1719 |
1720 VectorSlotPair AstGraphBuilder::CreateVectorSlotPair(int slot) const { | |
1721 return VectorSlotPair(handle(info()->shared_info()->feedback_vector()), slot); | |
1722 } | |
1723 | |
1724 | |
1693 Node* AstGraphBuilder::ProcessArguments(const Operator* op, int arity) { | 1725 Node* AstGraphBuilder::ProcessArguments(const Operator* op, int arity) { |
1694 DCHECK(environment()->stack_height() >= arity); | 1726 DCHECK(environment()->stack_height() >= arity); |
1695 Node** all = info()->zone()->NewArray<Node*>(arity); | 1727 Node** all = info()->zone()->NewArray<Node*>(arity); |
1696 for (int i = arity - 1; i >= 0; --i) { | 1728 for (int i = arity - 1; i >= 0; --i) { |
1697 all[i] = environment()->Pop(); | 1729 all[i] = environment()->Pop(); |
1698 } | 1730 } |
1699 Node* value = NewNode(op, arity, all); | 1731 Node* value = NewNode(op, arity, all); |
1700 return value; | 1732 return value; |
1701 } | 1733 } |
1702 | 1734 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1772 environment()->Push(BuildThrowReferenceError(variable, bailout_id)); | 1804 environment()->Push(BuildThrowReferenceError(variable, bailout_id)); |
1773 hole_check.Else(); | 1805 hole_check.Else(); |
1774 environment()->Push(not_hole); | 1806 environment()->Push(not_hole); |
1775 hole_check.End(); | 1807 hole_check.End(); |
1776 return environment()->Pop(); | 1808 return environment()->Pop(); |
1777 } | 1809 } |
1778 | 1810 |
1779 | 1811 |
1780 Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, | 1812 Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, |
1781 BailoutId bailout_id, | 1813 BailoutId bailout_id, |
1814 const VectorSlotPair& feedback, | |
1782 ContextualMode contextual_mode) { | 1815 ContextualMode contextual_mode) { |
1783 Node* the_hole = jsgraph()->TheHoleConstant(); | 1816 Node* the_hole = jsgraph()->TheHoleConstant(); |
1784 VariableMode mode = variable->mode(); | 1817 VariableMode mode = variable->mode(); |
1785 switch (variable->location()) { | 1818 switch (variable->location()) { |
1786 case Variable::UNALLOCATED: { | 1819 case Variable::UNALLOCATED: { |
1787 // Global var, const, or let variable. | 1820 // Global var, const, or let variable. |
1788 Node* global = BuildLoadGlobalObject(); | 1821 Node* global = BuildLoadGlobalObject(); |
1789 Unique<Name> name = MakeUnique(variable->name()); | 1822 Unique<Name> name = MakeUnique(variable->name()); |
1790 const Operator* op = javascript()->LoadNamed(name, contextual_mode); | 1823 const Operator* op = |
1824 javascript()->LoadNamed(name, feedback, contextual_mode); | |
1791 Node* node = NewNode(op, global); | 1825 Node* node = NewNode(op, global); |
1792 PrepareFrameState(node, bailout_id, OutputFrameStateCombine::Push()); | 1826 PrepareFrameState(node, bailout_id, OutputFrameStateCombine::Push()); |
1793 return node; | 1827 return node; |
1794 } | 1828 } |
1795 case Variable::PARAMETER: | 1829 case Variable::PARAMETER: |
1796 case Variable::LOCAL: { | 1830 case Variable::LOCAL: { |
1797 // Local var, const, or let variable. | 1831 // Local var, const, or let variable. |
1798 Node* value = environment()->Lookup(variable); | 1832 Node* value = environment()->Lookup(variable); |
1799 if (mode == CONST_LEGACY) { | 1833 if (mode == CONST_LEGACY) { |
1800 // Perform check for uninitialized legacy const variables. | 1834 // Perform check for uninitialized legacy const variables. |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2082 DCHECK(NodeProperties::GetFrameStateInput(node)->opcode() == | 2116 DCHECK(NodeProperties::GetFrameStateInput(node)->opcode() == |
2083 IrOpcode::kDead); | 2117 IrOpcode::kDead); |
2084 NodeProperties::ReplaceFrameStateInput( | 2118 NodeProperties::ReplaceFrameStateInput( |
2085 node, environment()->Checkpoint(ast_id, combine)); | 2119 node, environment()->Checkpoint(ast_id, combine)); |
2086 } | 2120 } |
2087 } | 2121 } |
2088 | 2122 |
2089 } | 2123 } |
2090 } | 2124 } |
2091 } // namespace v8::internal::compiler | 2125 } // namespace v8::internal::compiler |
OLD | NEW |