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