OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 } | 774 } |
775 } | 775 } |
776 | 776 |
777 | 777 |
778 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, | 778 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, |
779 HBinaryOperation* instr) { | 779 HBinaryOperation* instr) { |
780 HValue* left = instr->left(); | 780 HValue* left = instr->left(); |
781 HValue* right = instr->right(); | 781 HValue* right = instr->right(); |
782 ASSERT(left->representation().IsTagged()); | 782 ASSERT(left->representation().IsTagged()); |
783 ASSERT(right->representation().IsTagged()); | 783 ASSERT(right->representation().IsTagged()); |
| 784 LOperand* context = UseFixed(instr->context(), rsi); |
784 LOperand* left_operand = UseFixed(left, rdx); | 785 LOperand* left_operand = UseFixed(left, rdx); |
785 LOperand* right_operand = UseFixed(right, rax); | 786 LOperand* right_operand = UseFixed(right, rax); |
786 LArithmeticT* result = | 787 LArithmeticT* result = |
787 new(zone()) LArithmeticT(op, left_operand, right_operand); | 788 new(zone()) LArithmeticT(op, context, left_operand, right_operand); |
788 return MarkAsCall(DefineFixed(result, rax), instr); | 789 return MarkAsCall(DefineFixed(result, rax), instr); |
789 } | 790 } |
790 | 791 |
791 | 792 |
792 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { | 793 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { |
793 ASSERT(is_building()); | 794 ASSERT(is_building()); |
794 current_block_ = block; | 795 current_block_ = block; |
795 next_block_ = next_block; | 796 next_block_ = next_block; |
796 if (block->IsStartBlock()) { | 797 if (block->IsStartBlock()) { |
797 block->UpdateEnvironment(graph_->start_environment()); | 798 block->UpdateEnvironment(graph_->start_environment()); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 | 1055 |
1055 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { | 1056 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { |
1056 info()->MarkAsRequiresFrame(); | 1057 info()->MarkAsRequiresFrame(); |
1057 return DefineAsRegister(new(zone()) LArgumentsElements); | 1058 return DefineAsRegister(new(zone()) LArgumentsElements); |
1058 } | 1059 } |
1059 | 1060 |
1060 | 1061 |
1061 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { | 1062 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { |
1062 LOperand* left = UseFixed(instr->left(), rax); | 1063 LOperand* left = UseFixed(instr->left(), rax); |
1063 LOperand* right = UseFixed(instr->right(), rdx); | 1064 LOperand* right = UseFixed(instr->right(), rdx); |
1064 LInstanceOf* result = new(zone()) LInstanceOf(left, right); | 1065 LOperand* context = UseFixed(instr->context(), rsi); |
| 1066 LInstanceOf* result = new(zone()) LInstanceOf(context, left, right); |
1065 return MarkAsCall(DefineFixed(result, rax), instr); | 1067 return MarkAsCall(DefineFixed(result, rax), instr); |
1066 } | 1068 } |
1067 | 1069 |
1068 | 1070 |
1069 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( | 1071 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( |
1070 HInstanceOfKnownGlobal* instr) { | 1072 HInstanceOfKnownGlobal* instr) { |
1071 LInstanceOfKnownGlobal* result = | 1073 LInstanceOfKnownGlobal* result = |
1072 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->left(), rax), | 1074 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->context(), rsi), |
| 1075 UseFixed(instr->left(), rax), |
1073 FixedTemp(rdi)); | 1076 FixedTemp(rdi)); |
1074 return MarkAsCall(DefineFixed(result, rax), instr); | 1077 return MarkAsCall(DefineFixed(result, rax), instr); |
1075 } | 1078 } |
1076 | 1079 |
1077 | 1080 |
1078 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 1081 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
1079 LOperand* receiver = UseRegister(instr->receiver()); | 1082 LOperand* receiver = UseRegister(instr->receiver()); |
1080 LOperand* function = UseRegisterAtStart(instr->function()); | 1083 LOperand* function = UseRegisterAtStart(instr->function()); |
1081 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 1084 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
1082 return AssignEnvironment(DefineSameAsFirst(result)); | 1085 return AssignEnvironment(DefineSameAsFirst(result)); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 | 1123 |
1121 | 1124 |
1122 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { | 1125 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { |
1123 return instr->HasNoUses() | 1126 return instr->HasNoUses() |
1124 ? NULL | 1127 ? NULL |
1125 : DefineAsRegister(new(zone()) LThisFunction); | 1128 : DefineAsRegister(new(zone()) LThisFunction); |
1126 } | 1129 } |
1127 | 1130 |
1128 | 1131 |
1129 LInstruction* LChunkBuilder::DoContext(HContext* instr) { | 1132 LInstruction* LChunkBuilder::DoContext(HContext* instr) { |
1130 // If there is a non-return use, the context must be allocated in a register. | 1133 if (instr->HasNoUses()) return NULL; |
1131 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { | 1134 |
1132 if (!it.value()->IsReturn()) { | 1135 if (info()->IsStub()) { |
1133 return DefineAsRegister(new(zone()) LContext); | 1136 return DefineFixed(new(zone()) LContext, rsi); |
1134 } | |
1135 } | 1137 } |
1136 | 1138 |
1137 return NULL; | 1139 return DefineAsRegister(new(zone()) LContext); |
1138 } | 1140 } |
1139 | 1141 |
1140 | 1142 |
1141 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { | 1143 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { |
1142 LOperand* context = UseRegisterAtStart(instr->value()); | 1144 LOperand* context = UseRegisterAtStart(instr->value()); |
1143 return DefineAsRegister(new(zone()) LOuterContext(context)); | 1145 return DefineAsRegister(new(zone()) LOuterContext(context)); |
1144 } | 1146 } |
1145 | 1147 |
1146 | 1148 |
1147 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { | 1149 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { |
1148 return MarkAsCall(new(zone()) LDeclareGlobals, instr); | 1150 LOperand* context = UseFixed(instr->context(), rsi); |
| 1151 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr); |
1149 } | 1152 } |
1150 | 1153 |
1151 | 1154 |
1152 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { | 1155 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { |
1153 return DefineAsRegister(new(zone()) LGlobalObject); | 1156 LOperand* context = UseRegisterAtStart(instr->value()); |
| 1157 return DefineAsRegister(new(zone()) LGlobalObject(context)); |
1154 } | 1158 } |
1155 | 1159 |
1156 | 1160 |
1157 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { | 1161 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { |
1158 LOperand* global_object = UseRegisterAtStart(instr->value()); | 1162 LOperand* global_object = UseRegisterAtStart(instr->value()); |
1159 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); | 1163 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); |
1160 } | 1164 } |
1161 | 1165 |
1162 | 1166 |
1163 LInstruction* LChunkBuilder::DoCallConstantFunction( | 1167 LInstruction* LChunkBuilder::DoCallConstantFunction( |
1164 HCallConstantFunction* instr) { | 1168 HCallConstantFunction* instr) { |
1165 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, rax), instr); | 1169 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, rax), instr); |
1166 } | 1170 } |
1167 | 1171 |
1168 | 1172 |
1169 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1173 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
| 1174 LOperand* context = UseFixed(instr->context(), rsi); |
1170 LOperand* function = UseFixed(instr->function(), rdi); | 1175 LOperand* function = UseFixed(instr->function(), rdi); |
1171 LInvokeFunction* result = new(zone()) LInvokeFunction(function); | 1176 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function); |
1172 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1177 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
1173 } | 1178 } |
1174 | 1179 |
1175 | 1180 |
1176 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1181 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
1177 switch (instr->op()) { | 1182 switch (instr->op()) { |
1178 case kMathFloor: return DoMathFloor(instr); | 1183 case kMathFloor: return DoMathFloor(instr); |
1179 case kMathRound: return DoMathRound(instr); | 1184 case kMathRound: return DoMathRound(instr); |
1180 case kMathAbs: return DoMathAbs(instr); | 1185 case kMathAbs: return DoMathAbs(instr); |
1181 case kMathLog: return DoMathLog(instr); | 1186 case kMathLog: return DoMathLog(instr); |
(...skipping 18 matching lines...) Expand all Loading... |
1200 | 1205 |
1201 | 1206 |
1202 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { | 1207 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { |
1203 LOperand* input = UseRegisterAtStart(instr->value()); | 1208 LOperand* input = UseRegisterAtStart(instr->value()); |
1204 LMathRound* result = new(zone()) LMathRound(input); | 1209 LMathRound* result = new(zone()) LMathRound(input); |
1205 return AssignEnvironment(DefineAsRegister(result)); | 1210 return AssignEnvironment(DefineAsRegister(result)); |
1206 } | 1211 } |
1207 | 1212 |
1208 | 1213 |
1209 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { | 1214 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { |
| 1215 LOperand* context = UseAny(instr->context()); |
1210 LOperand* input = UseRegisterAtStart(instr->value()); | 1216 LOperand* input = UseRegisterAtStart(instr->value()); |
1211 LMathAbs* result = new(zone()) LMathAbs(input); | 1217 LMathAbs* result = new(zone()) LMathAbs(context, input); |
1212 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1218 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
1213 } | 1219 } |
1214 | 1220 |
1215 | 1221 |
1216 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1222 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
1217 ASSERT(instr->representation().IsDouble()); | 1223 ASSERT(instr->representation().IsDouble()); |
1218 ASSERT(instr->value()->representation().IsDouble()); | 1224 ASSERT(instr->value()->representation().IsDouble()); |
1219 LOperand* input = UseRegisterAtStart(instr->value()); | 1225 LOperand* input = UseRegisterAtStart(instr->value()); |
1220 LMathLog* result = new(zone()) LMathLog(input); | 1226 LMathLog* result = new(zone()) LMathLog(input); |
1221 return DefineSameAsFirst(result); | 1227 return DefineSameAsFirst(result); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 | 1269 |
1264 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { | 1270 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { |
1265 LOperand* input = UseRegisterAtStart(instr->value()); | 1271 LOperand* input = UseRegisterAtStart(instr->value()); |
1266 LMathPowHalf* result = new(zone()) LMathPowHalf(input); | 1272 LMathPowHalf* result = new(zone()) LMathPowHalf(input); |
1267 return DefineSameAsFirst(result); | 1273 return DefineSameAsFirst(result); |
1268 } | 1274 } |
1269 | 1275 |
1270 | 1276 |
1271 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 1277 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
1272 ASSERT(instr->key()->representation().IsTagged()); | 1278 ASSERT(instr->key()->representation().IsTagged()); |
| 1279 LOperand* context = UseFixed(instr->context(), rsi); |
1273 LOperand* key = UseFixed(instr->key(), rcx); | 1280 LOperand* key = UseFixed(instr->key(), rcx); |
1274 LCallKeyed* result = new(zone()) LCallKeyed(key); | 1281 LCallKeyed* result = new(zone()) LCallKeyed(context, key); |
1275 return MarkAsCall(DefineFixed(result, rax), instr); | 1282 return MarkAsCall(DefineFixed(result, rax), instr); |
1276 } | 1283 } |
1277 | 1284 |
1278 | 1285 |
1279 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { | 1286 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { |
1280 return MarkAsCall(DefineFixed(new(zone()) LCallNamed, rax), instr); | 1287 LOperand* context = UseFixed(instr->context(), rsi); |
| 1288 LCallNamed* result = new(zone()) LCallNamed(context); |
| 1289 return MarkAsCall(DefineFixed(result, rax), instr); |
1281 } | 1290 } |
1282 | 1291 |
1283 | 1292 |
1284 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { | 1293 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { |
1285 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, rax), instr); | 1294 LOperand* context = UseFixed(instr->context(), rsi); |
| 1295 LCallGlobal* result = new(zone()) LCallGlobal(context); |
| 1296 return MarkAsCall(DefineFixed(result, rax), instr); |
1286 } | 1297 } |
1287 | 1298 |
1288 | 1299 |
1289 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { | 1300 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { |
1290 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, rax), instr); | 1301 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, rax), instr); |
1291 } | 1302 } |
1292 | 1303 |
1293 | 1304 |
1294 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { | 1305 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
| 1306 LOperand* context = UseFixed(instr->context(), rsi); |
1295 LOperand* constructor = UseFixed(instr->constructor(), rdi); | 1307 LOperand* constructor = UseFixed(instr->constructor(), rdi); |
1296 LCallNew* result = new(zone()) LCallNew(constructor); | 1308 LCallNew* result = new(zone()) LCallNew(context, constructor); |
1297 return MarkAsCall(DefineFixed(result, rax), instr); | 1309 return MarkAsCall(DefineFixed(result, rax), instr); |
1298 } | 1310 } |
1299 | 1311 |
1300 | 1312 |
1301 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { | 1313 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { |
| 1314 LOperand* context = UseFixed(instr->context(), rsi); |
1302 LOperand* constructor = UseFixed(instr->constructor(), rdi); | 1315 LOperand* constructor = UseFixed(instr->constructor(), rdi); |
1303 LCallNewArray* result = new(zone()) LCallNewArray(constructor); | 1316 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); |
1304 return MarkAsCall(DefineFixed(result, rax), instr); | 1317 return MarkAsCall(DefineFixed(result, rax), instr); |
1305 } | 1318 } |
1306 | 1319 |
1307 | 1320 |
1308 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { | 1321 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
| 1322 LOperand* context = UseFixed(instr->context(), rsi); |
1309 LOperand* function = UseFixed(instr->function(), rdi); | 1323 LOperand* function = UseFixed(instr->function(), rdi); |
1310 LCallFunction* result = new(zone()) LCallFunction(function); | 1324 LCallFunction* result = new(zone()) LCallFunction(context, function); |
1311 return MarkAsCall(DefineFixed(result, rax), instr); | 1325 return MarkAsCall(DefineFixed(result, rax), instr); |
1312 } | 1326 } |
1313 | 1327 |
1314 | 1328 |
1315 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { | 1329 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
1316 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime, rax), instr); | 1330 LOperand* context = UseFixed(instr->context(), rsi); |
| 1331 LCallRuntime* result = new(zone()) LCallRuntime(context); |
| 1332 return MarkAsCall(DefineFixed(result, rax), instr); |
1317 } | 1333 } |
1318 | 1334 |
1319 | 1335 |
1320 LInstruction* LChunkBuilder::DoRor(HRor* instr) { | 1336 LInstruction* LChunkBuilder::DoRor(HRor* instr) { |
1321 return DoShift(Token::ROR, instr); | 1337 return DoShift(Token::ROR, instr); |
1322 } | 1338 } |
1323 | 1339 |
1324 | 1340 |
1325 LInstruction* LChunkBuilder::DoShr(HShr* instr) { | 1341 LInstruction* LChunkBuilder::DoShr(HShr* instr) { |
1326 return DoShift(Token::SHR, instr); | 1342 return DoShift(Token::SHR, instr); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1595 LOperand* scratch3 = TempRegister(); | 1611 LOperand* scratch3 = TempRegister(); |
1596 LRandom* result = new(zone()) LRandom( | 1612 LRandom* result = new(zone()) LRandom( |
1597 global_object, scratch, scratch2, scratch3); | 1613 global_object, scratch, scratch2, scratch3); |
1598 return DefineFixedDouble(result, xmm1); | 1614 return DefineFixedDouble(result, xmm1); |
1599 } | 1615 } |
1600 | 1616 |
1601 | 1617 |
1602 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1618 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
1603 ASSERT(instr->left()->representation().IsTagged()); | 1619 ASSERT(instr->left()->representation().IsTagged()); |
1604 ASSERT(instr->right()->representation().IsTagged()); | 1620 ASSERT(instr->right()->representation().IsTagged()); |
| 1621 LOperand* context = UseFixed(instr->context(), rsi); |
1605 LOperand* left = UseFixed(instr->left(), rdx); | 1622 LOperand* left = UseFixed(instr->left(), rdx); |
1606 LOperand* right = UseFixed(instr->right(), rax); | 1623 LOperand* right = UseFixed(instr->right(), rax); |
1607 LCmpT* result = new(zone()) LCmpT(left, right); | 1624 LCmpT* result = new(zone()) LCmpT(context, left, right); |
1608 return MarkAsCall(DefineFixed(result, rax), instr); | 1625 return MarkAsCall(DefineFixed(result, rax), instr); |
1609 } | 1626 } |
1610 | 1627 |
1611 | 1628 |
1612 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( | 1629 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
1613 HCompareNumericAndBranch* instr) { | 1630 HCompareNumericAndBranch* instr) { |
1614 Representation r = instr->representation(); | 1631 Representation r = instr->representation(); |
1615 if (r.IsSmiOrInteger32()) { | 1632 if (r.IsSmiOrInteger32()) { |
1616 ASSERT(instr->left()->representation().Equals(r)); | 1633 ASSERT(instr->left()->representation().Equals(r)); |
1617 ASSERT(instr->right()->representation().Equals(r)); | 1634 ASSERT(instr->right()->representation().Equals(r)); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 LOperand* temp = TempRegister(); | 1697 LOperand* temp = TempRegister(); |
1681 return new(zone()) LIsUndetectableAndBranch(value, temp); | 1698 return new(zone()) LIsUndetectableAndBranch(value, temp); |
1682 } | 1699 } |
1683 | 1700 |
1684 | 1701 |
1685 LInstruction* LChunkBuilder::DoStringCompareAndBranch( | 1702 LInstruction* LChunkBuilder::DoStringCompareAndBranch( |
1686 HStringCompareAndBranch* instr) { | 1703 HStringCompareAndBranch* instr) { |
1687 | 1704 |
1688 ASSERT(instr->left()->representation().IsTagged()); | 1705 ASSERT(instr->left()->representation().IsTagged()); |
1689 ASSERT(instr->right()->representation().IsTagged()); | 1706 ASSERT(instr->right()->representation().IsTagged()); |
| 1707 LOperand* context = UseFixed(instr->context(), rsi); |
1690 LOperand* left = UseFixed(instr->left(), rdx); | 1708 LOperand* left = UseFixed(instr->left(), rdx); |
1691 LOperand* right = UseFixed(instr->right(), rax); | 1709 LOperand* right = UseFixed(instr->right(), rax); |
1692 LStringCompareAndBranch* result = | 1710 LStringCompareAndBranch* result = |
1693 new(zone()) LStringCompareAndBranch(left, right); | 1711 new(zone()) LStringCompareAndBranch(context, left, right); |
1694 | 1712 |
1695 return MarkAsCall(result, instr); | 1713 return MarkAsCall(result, instr); |
1696 } | 1714 } |
1697 | 1715 |
1698 | 1716 |
1699 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( | 1717 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( |
1700 HHasInstanceTypeAndBranch* instr) { | 1718 HHasInstanceTypeAndBranch* instr) { |
1701 ASSERT(instr->value()->representation().IsTagged()); | 1719 ASSERT(instr->value()->representation().IsTagged()); |
1702 LOperand* value = UseRegisterAtStart(instr->value()); | 1720 LOperand* value = UseRegisterAtStart(instr->value()); |
1703 return new(zone()) LHasInstanceTypeAndBranch(value); | 1721 return new(zone()) LHasInstanceTypeAndBranch(value); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 | 1800 |
1783 | 1801 |
1784 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { | 1802 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { |
1785 // The control instruction marking the end of a block that completed | 1803 // The control instruction marking the end of a block that completed |
1786 // abruptly (e.g., threw an exception). There is nothing specific to do. | 1804 // abruptly (e.g., threw an exception). There is nothing specific to do. |
1787 return NULL; | 1805 return NULL; |
1788 } | 1806 } |
1789 | 1807 |
1790 | 1808 |
1791 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { | 1809 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { |
| 1810 LOperand* context = UseFixed(instr->context(), rsi); |
1792 LOperand* value = UseFixed(instr->value(), rax); | 1811 LOperand* value = UseFixed(instr->value(), rax); |
1793 return MarkAsCall(new(zone()) LThrow(value), instr); | 1812 return MarkAsCall(new(zone()) LThrow(context, value), instr); |
1794 } | 1813 } |
1795 | 1814 |
1796 | 1815 |
1797 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { | 1816 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { |
1798 return NULL; | 1817 return NULL; |
1799 } | 1818 } |
1800 | 1819 |
1801 | 1820 |
1802 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { | 1821 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { |
1803 // All HForceRepresentation instructions should be eliminated in the | 1822 // All HForceRepresentation instructions should be eliminated in the |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 // Register allocator doesn't (yet) support allocation of double | 1978 // Register allocator doesn't (yet) support allocation of double |
1960 // temps. Reserve xmm1 explicitly. | 1979 // temps. Reserve xmm1 explicitly. |
1961 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, | 1980 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, |
1962 FixedTemp(xmm1)); | 1981 FixedTemp(xmm1)); |
1963 return AssignEnvironment(DefineSameAsFirst(result)); | 1982 return AssignEnvironment(DefineSameAsFirst(result)); |
1964 } | 1983 } |
1965 } | 1984 } |
1966 | 1985 |
1967 | 1986 |
1968 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { | 1987 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
| 1988 LOperand* context = info()->IsStub() ? UseFixed(instr->context(), rsi) : NULL; |
1969 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count()); | 1989 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count()); |
1970 return new(zone()) LReturn(UseFixed(instr->value(), rax), | 1990 return new(zone()) LReturn( |
1971 parameter_count); | 1991 UseFixed(instr->value(), rax), context, parameter_count); |
1972 } | 1992 } |
1973 | 1993 |
1974 | 1994 |
1975 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1995 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
1976 Representation r = instr->representation(); | 1996 Representation r = instr->representation(); |
1977 if (r.IsSmi()) { | 1997 if (r.IsSmi()) { |
1978 return DefineAsRegister(new(zone()) LConstantS); | 1998 return DefineAsRegister(new(zone()) LConstantS); |
1979 } else if (r.IsInteger32()) { | 1999 } else if (r.IsInteger32()) { |
1980 return DefineAsRegister(new(zone()) LConstantI); | 2000 return DefineAsRegister(new(zone()) LConstantI); |
1981 } else if (r.IsDouble()) { | 2001 } else if (r.IsDouble()) { |
(...skipping 12 matching lines...) Expand all Loading... |
1994 | 2014 |
1995 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { | 2015 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { |
1996 LLoadGlobalCell* result = new(zone()) LLoadGlobalCell; | 2016 LLoadGlobalCell* result = new(zone()) LLoadGlobalCell; |
1997 return instr->RequiresHoleCheck() | 2017 return instr->RequiresHoleCheck() |
1998 ? AssignEnvironment(DefineAsRegister(result)) | 2018 ? AssignEnvironment(DefineAsRegister(result)) |
1999 : DefineAsRegister(result); | 2019 : DefineAsRegister(result); |
2000 } | 2020 } |
2001 | 2021 |
2002 | 2022 |
2003 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { | 2023 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { |
| 2024 LOperand* context = UseFixed(instr->context(), rsi); |
2004 LOperand* global_object = UseFixed(instr->global_object(), rax); | 2025 LOperand* global_object = UseFixed(instr->global_object(), rax); |
2005 LLoadGlobalGeneric* result = new(zone()) LLoadGlobalGeneric(global_object); | 2026 LLoadGlobalGeneric* result = |
| 2027 new(zone()) LLoadGlobalGeneric(context, global_object); |
2006 return MarkAsCall(DefineFixed(result, rax), instr); | 2028 return MarkAsCall(DefineFixed(result, rax), instr); |
2007 } | 2029 } |
2008 | 2030 |
2009 | 2031 |
2010 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { | 2032 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { |
2011 LOperand* value = UseRegister(instr->value()); | 2033 LOperand* value = UseRegister(instr->value()); |
2012 // Use a temp to avoid reloading the cell value address in the case where | 2034 // Use a temp to avoid reloading the cell value address in the case where |
2013 // we perform a hole check. | 2035 // we perform a hole check. |
2014 return instr->RequiresHoleCheck() | 2036 return instr->RequiresHoleCheck() |
2015 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister())) | 2037 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister())) |
2016 : new(zone()) LStoreGlobalCell(value, NULL); | 2038 : new(zone()) LStoreGlobalCell(value, NULL); |
2017 } | 2039 } |
2018 | 2040 |
2019 | 2041 |
2020 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { | 2042 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { |
| 2043 LOperand* context = UseFixed(instr->context(), rsi); |
2021 LOperand* global_object = UseFixed(instr->global_object(), rdx); | 2044 LOperand* global_object = UseFixed(instr->global_object(), rdx); |
2022 LOperand* value = UseFixed(instr->value(), rax); | 2045 LOperand* value = UseFixed(instr->value(), rax); |
2023 LStoreGlobalGeneric* result = new(zone()) LStoreGlobalGeneric(global_object, | 2046 LStoreGlobalGeneric* result = |
2024 value); | 2047 new(zone()) LStoreGlobalGeneric(context, global_object, value); |
2025 return MarkAsCall(result, instr); | 2048 return MarkAsCall(result, instr); |
2026 } | 2049 } |
2027 | 2050 |
2028 | 2051 |
2029 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { | 2052 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { |
2030 LOperand* context = UseRegisterAtStart(instr->value()); | 2053 LOperand* context = UseRegisterAtStart(instr->value()); |
2031 LInstruction* result = | 2054 LInstruction* result = |
2032 DefineAsRegister(new(zone()) LLoadContextSlot(context)); | 2055 DefineAsRegister(new(zone()) LLoadContextSlot(context)); |
2033 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2056 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
2034 } | 2057 } |
2035 | 2058 |
2036 | 2059 |
2037 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { | 2060 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { |
2038 LOperand* context; | 2061 LOperand* context; |
2039 LOperand* value; | 2062 LOperand* value; |
2040 LOperand* temp; | 2063 LOperand* temp; |
| 2064 context = UseRegister(instr->context()); |
2041 if (instr->NeedsWriteBarrier()) { | 2065 if (instr->NeedsWriteBarrier()) { |
2042 context = UseTempRegister(instr->context()); | |
2043 value = UseTempRegister(instr->value()); | 2066 value = UseTempRegister(instr->value()); |
2044 temp = TempRegister(); | 2067 temp = TempRegister(); |
2045 } else { | 2068 } else { |
2046 context = UseRegister(instr->context()); | |
2047 value = UseRegister(instr->value()); | 2069 value = UseRegister(instr->value()); |
2048 temp = NULL; | 2070 temp = NULL; |
2049 } | 2071 } |
2050 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp); | 2072 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp); |
2051 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2073 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
2052 } | 2074 } |
2053 | 2075 |
2054 | 2076 |
2055 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { | 2077 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
2056 // Use the special mov rax, moffs64 encoding for external | 2078 // Use the special mov rax, moffs64 encoding for external |
2057 // memory accesses with 64-bit word-sized values. | 2079 // memory accesses with 64-bit word-sized values. |
2058 if (instr->access().IsExternalMemory() && | 2080 if (instr->access().IsExternalMemory() && |
2059 instr->access().offset() == 0 && | 2081 instr->access().offset() == 0 && |
2060 (instr->access().representation().IsSmi() || | 2082 (instr->access().representation().IsSmi() || |
2061 instr->access().representation().IsTagged() || | 2083 instr->access().representation().IsTagged() || |
2062 instr->access().representation().IsHeapObject() || | 2084 instr->access().representation().IsHeapObject() || |
2063 instr->access().representation().IsExternal())) { | 2085 instr->access().representation().IsExternal())) { |
2064 LOperand* obj = UseRegisterOrConstantAtStart(instr->object()); | 2086 LOperand* obj = UseRegisterOrConstantAtStart(instr->object()); |
2065 return DefineFixed(new(zone()) LLoadNamedField(obj), rax); | 2087 return DefineFixed(new(zone()) LLoadNamedField(obj), rax); |
2066 } | 2088 } |
2067 LOperand* obj = UseRegisterAtStart(instr->object()); | 2089 LOperand* obj = UseRegisterAtStart(instr->object()); |
2068 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); | 2090 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); |
2069 } | 2091 } |
2070 | 2092 |
2071 | 2093 |
2072 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { | 2094 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { |
| 2095 LOperand* context = UseFixed(instr->context(), rsi); |
2073 LOperand* object = UseFixed(instr->object(), rax); | 2096 LOperand* object = UseFixed(instr->object(), rax); |
2074 LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric(object); | 2097 LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric(context, object); |
2075 return MarkAsCall(DefineFixed(result, rax), instr); | 2098 return MarkAsCall(DefineFixed(result, rax), instr); |
2076 } | 2099 } |
2077 | 2100 |
2078 | 2101 |
2079 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( | 2102 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( |
2080 HLoadFunctionPrototype* instr) { | 2103 HLoadFunctionPrototype* instr) { |
2081 return AssignEnvironment(DefineAsRegister( | 2104 return AssignEnvironment(DefineAsRegister( |
2082 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); | 2105 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); |
2083 } | 2106 } |
2084 | 2107 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2119 DefineAsRegister(result); | 2142 DefineAsRegister(result); |
2120 bool can_deoptimize = instr->RequiresHoleCheck() || | 2143 bool can_deoptimize = instr->RequiresHoleCheck() || |
2121 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); | 2144 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); |
2122 // An unsigned int array load might overflow and cause a deopt, make sure it | 2145 // An unsigned int array load might overflow and cause a deopt, make sure it |
2123 // has an environment. | 2146 // has an environment. |
2124 return can_deoptimize ? AssignEnvironment(result) : result; | 2147 return can_deoptimize ? AssignEnvironment(result) : result; |
2125 } | 2148 } |
2126 | 2149 |
2127 | 2150 |
2128 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 2151 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 2152 LOperand* context = UseFixed(instr->context(), rsi); |
2129 LOperand* object = UseFixed(instr->object(), rdx); | 2153 LOperand* object = UseFixed(instr->object(), rdx); |
2130 LOperand* key = UseFixed(instr->key(), rax); | 2154 LOperand* key = UseFixed(instr->key(), rax); |
2131 | 2155 |
2132 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); | 2156 LLoadKeyedGeneric* result = |
| 2157 new(zone()) LLoadKeyedGeneric(context, object, key); |
2133 return MarkAsCall(DefineFixed(result, rax), instr); | 2158 return MarkAsCall(DefineFixed(result, rax), instr); |
2134 } | 2159 } |
2135 | 2160 |
2136 | 2161 |
2137 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2162 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
2138 ElementsKind elements_kind = instr->elements_kind(); | 2163 ElementsKind elements_kind = instr->elements_kind(); |
2139 | 2164 |
2140 if (!instr->is_external()) { | 2165 if (!instr->is_external()) { |
2141 ASSERT(instr->elements()->representation().IsTagged()); | 2166 ASSERT(instr->elements()->representation().IsTagged()); |
2142 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2167 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2176 elements_kind == EXTERNAL_FLOAT_ELEMENTS; | 2201 elements_kind == EXTERNAL_FLOAT_ELEMENTS; |
2177 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) | 2202 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) |
2178 : UseRegister(instr->value()); | 2203 : UseRegister(instr->value()); |
2179 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2204 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2180 LOperand* external_pointer = UseRegister(instr->elements()); | 2205 LOperand* external_pointer = UseRegister(instr->elements()); |
2181 return new(zone()) LStoreKeyed(external_pointer, key, val); | 2206 return new(zone()) LStoreKeyed(external_pointer, key, val); |
2182 } | 2207 } |
2183 | 2208 |
2184 | 2209 |
2185 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2210 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 2211 LOperand* context = UseFixed(instr->context(), rsi); |
2186 LOperand* object = UseFixed(instr->object(), rdx); | 2212 LOperand* object = UseFixed(instr->object(), rdx); |
2187 LOperand* key = UseFixed(instr->key(), rcx); | 2213 LOperand* key = UseFixed(instr->key(), rcx); |
2188 LOperand* value = UseFixed(instr->value(), rax); | 2214 LOperand* value = UseFixed(instr->value(), rax); |
2189 | 2215 |
2190 ASSERT(instr->object()->representation().IsTagged()); | 2216 ASSERT(instr->object()->representation().IsTagged()); |
2191 ASSERT(instr->key()->representation().IsTagged()); | 2217 ASSERT(instr->key()->representation().IsTagged()); |
2192 ASSERT(instr->value()->representation().IsTagged()); | 2218 ASSERT(instr->value()->representation().IsTagged()); |
2193 | 2219 |
2194 LStoreKeyedGeneric* result = | 2220 LStoreKeyedGeneric* result = |
2195 new(zone()) LStoreKeyedGeneric(object, key, value); | 2221 new(zone()) LStoreKeyedGeneric(context, object, key, value); |
2196 return MarkAsCall(result, instr); | 2222 return MarkAsCall(result, instr); |
2197 } | 2223 } |
2198 | 2224 |
2199 | 2225 |
2200 LInstruction* LChunkBuilder::DoTransitionElementsKind( | 2226 LInstruction* LChunkBuilder::DoTransitionElementsKind( |
2201 HTransitionElementsKind* instr) { | 2227 HTransitionElementsKind* instr) { |
2202 LOperand* object = UseRegister(instr->object()); | 2228 LOperand* object = UseRegister(instr->object()); |
2203 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { | 2229 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { |
2204 LOperand* object = UseRegister(instr->object()); | 2230 LOperand* object = UseRegister(instr->object()); |
2205 LOperand* new_map_reg = TempRegister(); | 2231 LOperand* new_map_reg = TempRegister(); |
2206 LOperand* temp_reg = TempRegister(); | 2232 LOperand* temp_reg = TempRegister(); |
2207 LTransitionElementsKind* result = | 2233 LTransitionElementsKind* result = new(zone()) LTransitionElementsKind( |
2208 new(zone()) LTransitionElementsKind(object, new_map_reg, temp_reg); | 2234 object, NULL, new_map_reg, temp_reg); |
2209 return result; | 2235 return result; |
2210 } else { | 2236 } else { |
| 2237 LOperand* context = UseAny(instr->context()); |
2211 LTransitionElementsKind* result = | 2238 LTransitionElementsKind* result = |
2212 new(zone()) LTransitionElementsKind(object, NULL, NULL); | 2239 new(zone()) LTransitionElementsKind(object, context, NULL, NULL); |
2213 return AssignPointerMap(result); | 2240 return AssignPointerMap(result); |
2214 } | 2241 } |
2215 } | 2242 } |
2216 | 2243 |
2217 | 2244 |
2218 LInstruction* LChunkBuilder::DoTrapAllocationMemento( | 2245 LInstruction* LChunkBuilder::DoTrapAllocationMemento( |
2219 HTrapAllocationMemento* instr) { | 2246 HTrapAllocationMemento* instr) { |
2220 LOperand* object = UseRegister(instr->object()); | 2247 LOperand* object = UseRegister(instr->object()); |
2221 LOperand* temp = TempRegister(); | 2248 LOperand* temp = TempRegister(); |
2222 LTrapAllocationMemento* result = | 2249 LTrapAllocationMemento* result = |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 instr->field_representation().IsHeapObject()) { | 2306 instr->field_representation().IsHeapObject()) { |
2280 if (!instr->value()->type().IsHeapObject()) { | 2307 if (!instr->value()->type().IsHeapObject()) { |
2281 return AssignEnvironment(result); | 2308 return AssignEnvironment(result); |
2282 } | 2309 } |
2283 } | 2310 } |
2284 return result; | 2311 return result; |
2285 } | 2312 } |
2286 | 2313 |
2287 | 2314 |
2288 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { | 2315 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { |
| 2316 LOperand* context = UseFixed(instr->context(), rsi); |
2289 LOperand* object = UseFixed(instr->object(), rdx); | 2317 LOperand* object = UseFixed(instr->object(), rdx); |
2290 LOperand* value = UseFixed(instr->value(), rax); | 2318 LOperand* value = UseFixed(instr->value(), rax); |
2291 | 2319 |
2292 LStoreNamedGeneric* result = new(zone()) LStoreNamedGeneric(object, value); | 2320 LStoreNamedGeneric* result = |
| 2321 new(zone()) LStoreNamedGeneric(context, object, value); |
2293 return MarkAsCall(result, instr); | 2322 return MarkAsCall(result, instr); |
2294 } | 2323 } |
2295 | 2324 |
2296 | 2325 |
2297 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { | 2326 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { |
| 2327 LOperand* context = UseFixed(instr->context(), rsi); |
2298 LOperand* left = UseOrConstantAtStart(instr->left()); | 2328 LOperand* left = UseOrConstantAtStart(instr->left()); |
2299 LOperand* right = UseOrConstantAtStart(instr->right()); | 2329 LOperand* right = UseOrConstantAtStart(instr->right()); |
2300 return MarkAsCall(DefineFixed(new(zone()) LStringAdd(left, right), rax), | 2330 return MarkAsCall( |
2301 instr); | 2331 DefineFixed(new(zone()) LStringAdd(context, left, right), rax), instr); |
2302 } | 2332 } |
2303 | 2333 |
2304 | 2334 |
2305 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 2335 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
2306 LOperand* string = UseTempRegister(instr->string()); | 2336 LOperand* string = UseTempRegister(instr->string()); |
2307 LOperand* index = UseTempRegister(instr->index()); | 2337 LOperand* index = UseTempRegister(instr->index()); |
2308 LStringCharCodeAt* result = new(zone()) LStringCharCodeAt(string, index); | 2338 LOperand* context = UseAny(instr->context()); |
| 2339 LStringCharCodeAt* result = |
| 2340 new(zone()) LStringCharCodeAt(context, string, index); |
2309 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2341 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
2310 } | 2342 } |
2311 | 2343 |
2312 | 2344 |
2313 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { | 2345 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
2314 LOperand* char_code = UseRegister(instr->value()); | 2346 LOperand* char_code = UseRegister(instr->value()); |
2315 LStringCharFromCode* result = new(zone()) LStringCharFromCode(char_code); | 2347 LOperand* context = UseAny(instr->context()); |
| 2348 LStringCharFromCode* result = |
| 2349 new(zone()) LStringCharFromCode(context, char_code); |
2316 return AssignPointerMap(DefineAsRegister(result)); | 2350 return AssignPointerMap(DefineAsRegister(result)); |
2317 } | 2351 } |
2318 | 2352 |
2319 | 2353 |
2320 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { | 2354 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { |
2321 info()->MarkAsDeferredCalling(); | 2355 info()->MarkAsDeferredCalling(); |
| 2356 LOperand* context = UseAny(instr->context()); |
2322 LOperand* size = instr->size()->IsConstant() | 2357 LOperand* size = instr->size()->IsConstant() |
2323 ? UseConstant(instr->size()) | 2358 ? UseConstant(instr->size()) |
2324 : UseTempRegister(instr->size()); | 2359 : UseTempRegister(instr->size()); |
2325 LOperand* temp = TempRegister(); | 2360 LOperand* temp = TempRegister(); |
2326 LAllocate* result = new(zone()) LAllocate(size, temp); | 2361 LAllocate* result = new(zone()) LAllocate(context, size, temp); |
2327 return AssignPointerMap(DefineAsRegister(result)); | 2362 return AssignPointerMap(DefineAsRegister(result)); |
2328 } | 2363 } |
2329 | 2364 |
2330 | 2365 |
2331 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { | 2366 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { |
2332 return MarkAsCall(DefineFixed(new(zone()) LRegExpLiteral, rax), instr); | 2367 LOperand* context = UseFixed(instr->context(), rsi); |
| 2368 LRegExpLiteral* result = new(zone()) LRegExpLiteral(context); |
| 2369 return MarkAsCall(DefineFixed(result, rax), instr); |
2333 } | 2370 } |
2334 | 2371 |
2335 | 2372 |
2336 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { | 2373 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { |
2337 return MarkAsCall(DefineFixed(new(zone()) LFunctionLiteral, rax), instr); | 2374 LOperand* context = UseFixed(instr->context(), rsi); |
| 2375 LFunctionLiteral* result = new(zone()) LFunctionLiteral(context); |
| 2376 return MarkAsCall(DefineFixed(result, rax), instr); |
2338 } | 2377 } |
2339 | 2378 |
2340 | 2379 |
2341 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { | 2380 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { |
2342 ASSERT(argument_count_ == 0); | 2381 ASSERT(argument_count_ == 0); |
2343 allocator_->MarkAsOsrEntry(); | 2382 allocator_->MarkAsOsrEntry(); |
2344 current_block_->last_environment()->set_ast_id(instr->ast_id()); | 2383 current_block_->last_environment()->set_ast_id(instr->ast_id()); |
2345 return AssignEnvironment(new(zone()) LOsrEntry); | 2384 return AssignEnvironment(new(zone()) LOsrEntry); |
2346 } | 2385 } |
2347 | 2386 |
(...skipping 26 matching lines...) Expand all Loading... |
2374 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 2413 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { |
2375 Abort(kTooManySpillSlotsNeededForOSR); | 2414 Abort(kTooManySpillSlotsNeededForOSR); |
2376 spill_index = 0; | 2415 spill_index = 0; |
2377 } | 2416 } |
2378 } | 2417 } |
2379 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2418 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
2380 } | 2419 } |
2381 | 2420 |
2382 | 2421 |
2383 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { | 2422 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
2384 return MarkAsCall(DefineFixed(new(zone()) LCallStub, rax), instr); | 2423 LOperand* context = UseFixed(instr->context(), rsi); |
| 2424 LCallStub* result = new(zone()) LCallStub(context); |
| 2425 return MarkAsCall(DefineFixed(result, rax), instr); |
2385 } | 2426 } |
2386 | 2427 |
2387 | 2428 |
2388 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { | 2429 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { |
2389 // There are no real uses of the arguments object. | 2430 // There are no real uses of the arguments object. |
2390 // arguments.length and element access are supported directly on | 2431 // arguments.length and element access are supported directly on |
2391 // stack arguments, and any real arguments object use causes a bailout. | 2432 // stack arguments, and any real arguments object use causes a bailout. |
2392 // So this value is never used. | 2433 // So this value is never used. |
2393 return NULL; | 2434 return NULL; |
2394 } | 2435 } |
(...skipping 24 matching lines...) Expand all Loading... |
2419 | 2460 |
2420 | 2461 |
2421 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { | 2462 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { |
2422 LOperand* object = UseFixed(instr->value(), rax); | 2463 LOperand* object = UseFixed(instr->value(), rax); |
2423 LToFastProperties* result = new(zone()) LToFastProperties(object); | 2464 LToFastProperties* result = new(zone()) LToFastProperties(object); |
2424 return MarkAsCall(DefineFixed(result, rax), instr); | 2465 return MarkAsCall(DefineFixed(result, rax), instr); |
2425 } | 2466 } |
2426 | 2467 |
2427 | 2468 |
2428 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { | 2469 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
2429 LTypeof* result = new(zone()) LTypeof(UseAtStart(instr->value())); | 2470 LOperand* context = UseFixed(instr->context(), rsi); |
| 2471 LOperand* value = UseAtStart(instr->value()); |
| 2472 LTypeof* result = new(zone()) LTypeof(context, value); |
2430 return MarkAsCall(DefineFixed(result, rax), instr); | 2473 return MarkAsCall(DefineFixed(result, rax), instr); |
2431 } | 2474 } |
2432 | 2475 |
2433 | 2476 |
2434 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { | 2477 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { |
2435 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); | 2478 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); |
2436 } | 2479 } |
2437 | 2480 |
2438 | 2481 |
2439 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2482 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
(...skipping 19 matching lines...) Expand all Loading... |
2459 return result; | 2502 return result; |
2460 } | 2503 } |
2461 | 2504 |
2462 return NULL; | 2505 return NULL; |
2463 } | 2506 } |
2464 | 2507 |
2465 | 2508 |
2466 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 2509 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
2467 info()->MarkAsDeferredCalling(); | 2510 info()->MarkAsDeferredCalling(); |
2468 if (instr->is_function_entry()) { | 2511 if (instr->is_function_entry()) { |
2469 return MarkAsCall(new(zone()) LStackCheck, instr); | 2512 LOperand* context = UseFixed(instr->context(), rsi); |
| 2513 return MarkAsCall(new(zone()) LStackCheck(context), instr); |
2470 } else { | 2514 } else { |
2471 ASSERT(instr->is_backwards_branch()); | 2515 ASSERT(instr->is_backwards_branch()); |
2472 return AssignEnvironment(AssignPointerMap(new(zone()) LStackCheck)); | 2516 LOperand* context = UseAny(instr->context()); |
| 2517 return AssignEnvironment( |
| 2518 AssignPointerMap(new(zone()) LStackCheck(context))); |
2473 } | 2519 } |
2474 } | 2520 } |
2475 | 2521 |
2476 | 2522 |
2477 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2523 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
2478 HEnvironment* outer = current_block_->last_environment(); | 2524 HEnvironment* outer = current_block_->last_environment(); |
2479 HConstant* undefined = graph()->GetConstantUndefined(); | 2525 HConstant* undefined = graph()->GetConstantUndefined(); |
2480 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2526 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
2481 instr->arguments_count(), | 2527 instr->arguments_count(), |
2482 instr->function(), | 2528 instr->function(), |
(...skipping 24 matching lines...) Expand all Loading... |
2507 | 2553 |
2508 HEnvironment* outer = current_block_->last_environment()-> | 2554 HEnvironment* outer = current_block_->last_environment()-> |
2509 DiscardInlined(false); | 2555 DiscardInlined(false); |
2510 current_block_->UpdateEnvironment(outer); | 2556 current_block_->UpdateEnvironment(outer); |
2511 | 2557 |
2512 return pop; | 2558 return pop; |
2513 } | 2559 } |
2514 | 2560 |
2515 | 2561 |
2516 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) { | 2562 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) { |
| 2563 LOperand* context = UseFixed(instr->context(), rsi); |
2517 LOperand* object = UseFixed(instr->enumerable(), rax); | 2564 LOperand* object = UseFixed(instr->enumerable(), rax); |
2518 LForInPrepareMap* result = new(zone()) LForInPrepareMap(object); | 2565 LForInPrepareMap* result = new(zone()) LForInPrepareMap(context, object); |
2519 return MarkAsCall(DefineFixed(result, rax), instr, CAN_DEOPTIMIZE_EAGERLY); | 2566 return MarkAsCall(DefineFixed(result, rax), instr, CAN_DEOPTIMIZE_EAGERLY); |
2520 } | 2567 } |
2521 | 2568 |
2522 | 2569 |
2523 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) { | 2570 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) { |
2524 LOperand* map = UseRegister(instr->map()); | 2571 LOperand* map = UseRegister(instr->map()); |
2525 return AssignEnvironment(DefineAsRegister( | 2572 return AssignEnvironment(DefineAsRegister( |
2526 new(zone()) LForInCacheArray(map))); | 2573 new(zone()) LForInCacheArray(map))); |
2527 } | 2574 } |
2528 | 2575 |
2529 | 2576 |
2530 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) { | 2577 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) { |
2531 LOperand* value = UseRegisterAtStart(instr->value()); | 2578 LOperand* value = UseRegisterAtStart(instr->value()); |
2532 LOperand* map = UseRegisterAtStart(instr->map()); | 2579 LOperand* map = UseRegisterAtStart(instr->map()); |
2533 return AssignEnvironment(new(zone()) LCheckMapValue(value, map)); | 2580 return AssignEnvironment(new(zone()) LCheckMapValue(value, map)); |
2534 } | 2581 } |
2535 | 2582 |
2536 | 2583 |
2537 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2584 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2538 LOperand* object = UseRegister(instr->object()); | 2585 LOperand* object = UseRegister(instr->object()); |
2539 LOperand* index = UseTempRegister(instr->index()); | 2586 LOperand* index = UseTempRegister(instr->index()); |
2540 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2587 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2541 } | 2588 } |
2542 | 2589 |
2543 | 2590 |
2544 } } // namespace v8::internal | 2591 } } // namespace v8::internal |
2545 | 2592 |
2546 #endif // V8_TARGET_ARCH_X64 | 2593 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |