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

Side by Side Diff: src/x64/lithium-x64.cc

Issue 132373011: A64: Synchronize with r17635. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/lithium-x64.h ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 current_block_ = NULL; 856 current_block_ = NULL;
856 } 857 }
857 858
858 859
859 void LChunkBuilder::VisitInstruction(HInstruction* current) { 860 void LChunkBuilder::VisitInstruction(HInstruction* current) {
860 HInstruction* old_current = current_instruction_; 861 HInstruction* old_current = current_instruction_;
861 current_instruction_ = current; 862 current_instruction_ = current;
862 863
863 LInstruction* instr = NULL; 864 LInstruction* instr = NULL;
864 if (current->CanReplaceWithDummyUses()) { 865 if (current->CanReplaceWithDummyUses()) {
865 HValue* first_operand = current->OperandCount() == 0 866 if (current->OperandCount() == 0) {
866 ? graph()->GetConstant1() 867 instr = DefineAsRegister(new(zone()) LDummy());
867 : current->OperandAt(0); 868 } else {
868 instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand))); 869 instr = DefineAsRegister(new(zone())
870 LDummyUse(UseAny(current->OperandAt(0))));
871 }
869 for (int i = 1; i < current->OperandCount(); ++i) { 872 for (int i = 1; i < current->OperandCount(); ++i) {
870 LInstruction* dummy = 873 LInstruction* dummy =
871 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); 874 new(zone()) LDummyUse(UseAny(current->OperandAt(i)));
872 dummy->set_hydrogen_value(current); 875 dummy->set_hydrogen_value(current);
873 chunk_->AddInstruction(dummy, current_block_); 876 chunk_->AddInstruction(dummy, current_block_);
874 } 877 }
875 } else { 878 } else {
876 instr = current->CompileToLithium(this); 879 instr = current->CompileToLithium(this);
877 } 880 }
878 881
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 1057
1055 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { 1058 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) {
1056 info()->MarkAsRequiresFrame(); 1059 info()->MarkAsRequiresFrame();
1057 return DefineAsRegister(new(zone()) LArgumentsElements); 1060 return DefineAsRegister(new(zone()) LArgumentsElements);
1058 } 1061 }
1059 1062
1060 1063
1061 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { 1064 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1062 LOperand* left = UseFixed(instr->left(), rax); 1065 LOperand* left = UseFixed(instr->left(), rax);
1063 LOperand* right = UseFixed(instr->right(), rdx); 1066 LOperand* right = UseFixed(instr->right(), rdx);
1064 LInstanceOf* result = new(zone()) LInstanceOf(left, right); 1067 LOperand* context = UseFixed(instr->context(), rsi);
1068 LInstanceOf* result = new(zone()) LInstanceOf(context, left, right);
1065 return MarkAsCall(DefineFixed(result, rax), instr); 1069 return MarkAsCall(DefineFixed(result, rax), instr);
1066 } 1070 }
1067 1071
1068 1072
1069 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( 1073 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal(
1070 HInstanceOfKnownGlobal* instr) { 1074 HInstanceOfKnownGlobal* instr) {
1071 LInstanceOfKnownGlobal* result = 1075 LInstanceOfKnownGlobal* result =
1072 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->left(), rax), 1076 new(zone()) LInstanceOfKnownGlobal(UseFixed(instr->context(), rsi),
1077 UseFixed(instr->left(), rax),
1073 FixedTemp(rdi)); 1078 FixedTemp(rdi));
1074 return MarkAsCall(DefineFixed(result, rax), instr); 1079 return MarkAsCall(DefineFixed(result, rax), instr);
1075 } 1080 }
1076 1081
1077 1082
1078 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { 1083 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1079 LOperand* receiver = UseRegister(instr->receiver()); 1084 LOperand* receiver = UseRegister(instr->receiver());
1080 LOperand* function = UseRegisterAtStart(instr->function()); 1085 LOperand* function = UseRegisterAtStart(instr->function());
1081 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); 1086 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function);
1082 return AssignEnvironment(DefineSameAsFirst(result)); 1087 return AssignEnvironment(DefineSameAsFirst(result));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 1125
1121 1126
1122 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { 1127 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1123 return instr->HasNoUses() 1128 return instr->HasNoUses()
1124 ? NULL 1129 ? NULL
1125 : DefineAsRegister(new(zone()) LThisFunction); 1130 : DefineAsRegister(new(zone()) LThisFunction);
1126 } 1131 }
1127 1132
1128 1133
1129 LInstruction* LChunkBuilder::DoContext(HContext* instr) { 1134 LInstruction* LChunkBuilder::DoContext(HContext* instr) {
1130 // If there is a non-return use, the context must be allocated in a register. 1135 if (instr->HasNoUses()) return NULL;
1131 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { 1136
1132 if (!it.value()->IsReturn()) { 1137 if (info()->IsStub()) {
1133 return DefineAsRegister(new(zone()) LContext); 1138 return DefineFixed(new(zone()) LContext, rsi);
1134 }
1135 } 1139 }
1136 1140
1137 return NULL; 1141 return DefineAsRegister(new(zone()) LContext);
1138 } 1142 }
1139 1143
1140 1144
1141 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { 1145 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) {
1142 LOperand* context = UseRegisterAtStart(instr->value()); 1146 LOperand* context = UseRegisterAtStart(instr->value());
1143 return DefineAsRegister(new(zone()) LOuterContext(context)); 1147 return DefineAsRegister(new(zone()) LOuterContext(context));
1144 } 1148 }
1145 1149
1146 1150
1147 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) { 1151 LInstruction* LChunkBuilder::DoDeclareGlobals(HDeclareGlobals* instr) {
1148 return MarkAsCall(new(zone()) LDeclareGlobals, instr); 1152 LOperand* context = UseFixed(instr->context(), rsi);
1153 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr);
1149 } 1154 }
1150 1155
1151 1156
1152 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { 1157 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1153 return DefineAsRegister(new(zone()) LGlobalObject); 1158 LOperand* context = UseRegisterAtStart(instr->value());
1159 return DefineAsRegister(new(zone()) LGlobalObject(context));
1154 } 1160 }
1155 1161
1156 1162
1157 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { 1163 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1158 LOperand* global_object = UseRegisterAtStart(instr->value()); 1164 LOperand* global_object = UseRegisterAtStart(instr->value());
1159 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object)); 1165 return DefineAsRegister(new(zone()) LGlobalReceiver(global_object));
1160 } 1166 }
1161 1167
1162 1168
1163 LInstruction* LChunkBuilder::DoCallConstantFunction( 1169 LInstruction* LChunkBuilder::DoCallConstantFunction(
1164 HCallConstantFunction* instr) { 1170 HCallConstantFunction* instr) {
1165 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, rax), instr); 1171 return MarkAsCall(DefineFixed(new(zone()) LCallConstantFunction, rax), instr);
1166 } 1172 }
1167 1173
1168 1174
1169 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { 1175 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) {
1176 LOperand* context = UseFixed(instr->context(), rsi);
1170 LOperand* function = UseFixed(instr->function(), rdi); 1177 LOperand* function = UseFixed(instr->function(), rdi);
1171 LInvokeFunction* result = new(zone()) LInvokeFunction(function); 1178 LInvokeFunction* result = new(zone()) LInvokeFunction(context, function);
1172 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); 1179 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1173 } 1180 }
1174 1181
1175 1182
1176 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1183 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1177 switch (instr->op()) { 1184 switch (instr->op()) {
1178 case kMathFloor: return DoMathFloor(instr); 1185 case kMathFloor: return DoMathFloor(instr);
1179 case kMathRound: return DoMathRound(instr); 1186 case kMathRound: return DoMathRound(instr);
1180 case kMathAbs: return DoMathAbs(instr); 1187 case kMathAbs: return DoMathAbs(instr);
1181 case kMathLog: return DoMathLog(instr); 1188 case kMathLog: return DoMathLog(instr);
(...skipping 18 matching lines...) Expand all
1200 1207
1201 1208
1202 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) { 1209 LInstruction* LChunkBuilder::DoMathRound(HUnaryMathOperation* instr) {
1203 LOperand* input = UseRegisterAtStart(instr->value()); 1210 LOperand* input = UseRegisterAtStart(instr->value());
1204 LMathRound* result = new(zone()) LMathRound(input); 1211 LMathRound* result = new(zone()) LMathRound(input);
1205 return AssignEnvironment(DefineAsRegister(result)); 1212 return AssignEnvironment(DefineAsRegister(result));
1206 } 1213 }
1207 1214
1208 1215
1209 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { 1216 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) {
1217 LOperand* context = UseAny(instr->context());
1210 LOperand* input = UseRegisterAtStart(instr->value()); 1218 LOperand* input = UseRegisterAtStart(instr->value());
1211 LMathAbs* result = new(zone()) LMathAbs(input); 1219 LMathAbs* result = new(zone()) LMathAbs(context, input);
1212 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1220 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1213 } 1221 }
1214 1222
1215 1223
1216 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { 1224 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1217 ASSERT(instr->representation().IsDouble()); 1225 ASSERT(instr->representation().IsDouble());
1218 ASSERT(instr->value()->representation().IsDouble()); 1226 ASSERT(instr->value()->representation().IsDouble());
1219 LOperand* input = UseRegisterAtStart(instr->value()); 1227 LOperand* input = UseRegisterAtStart(instr->value());
1220 LMathLog* result = new(zone()) LMathLog(input); 1228 LMathLog* result = new(zone()) LMathLog(input);
1221 return DefineSameAsFirst(result); 1229 return DefineSameAsFirst(result);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 1271
1264 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { 1272 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1265 LOperand* input = UseRegisterAtStart(instr->value()); 1273 LOperand* input = UseRegisterAtStart(instr->value());
1266 LMathPowHalf* result = new(zone()) LMathPowHalf(input); 1274 LMathPowHalf* result = new(zone()) LMathPowHalf(input);
1267 return DefineSameAsFirst(result); 1275 return DefineSameAsFirst(result);
1268 } 1276 }
1269 1277
1270 1278
1271 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { 1279 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1272 ASSERT(instr->key()->representation().IsTagged()); 1280 ASSERT(instr->key()->representation().IsTagged());
1281 LOperand* context = UseFixed(instr->context(), rsi);
1273 LOperand* key = UseFixed(instr->key(), rcx); 1282 LOperand* key = UseFixed(instr->key(), rcx);
1274 LCallKeyed* result = new(zone()) LCallKeyed(key); 1283 LCallKeyed* result = new(zone()) LCallKeyed(context, key);
1275 return MarkAsCall(DefineFixed(result, rax), instr); 1284 return MarkAsCall(DefineFixed(result, rax), instr);
1276 } 1285 }
1277 1286
1278 1287
1279 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { 1288 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) {
1280 return MarkAsCall(DefineFixed(new(zone()) LCallNamed, rax), instr); 1289 LOperand* context = UseFixed(instr->context(), rsi);
1290 LCallNamed* result = new(zone()) LCallNamed(context);
1291 return MarkAsCall(DefineFixed(result, rax), instr);
1281 } 1292 }
1282 1293
1283 1294
1284 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { 1295 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) {
1285 return MarkAsCall(DefineFixed(new(zone()) LCallGlobal, rax), instr); 1296 LOperand* context = UseFixed(instr->context(), rsi);
1297 LCallGlobal* result = new(zone()) LCallGlobal(context);
1298 return MarkAsCall(DefineFixed(result, rax), instr);
1286 } 1299 }
1287 1300
1288 1301
1289 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { 1302 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1290 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, rax), instr); 1303 return MarkAsCall(DefineFixed(new(zone()) LCallKnownGlobal, rax), instr);
1291 } 1304 }
1292 1305
1293 1306
1294 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { 1307 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1308 LOperand* context = UseFixed(instr->context(), rsi);
1295 LOperand* constructor = UseFixed(instr->constructor(), rdi); 1309 LOperand* constructor = UseFixed(instr->constructor(), rdi);
1296 LCallNew* result = new(zone()) LCallNew(constructor); 1310 LCallNew* result = new(zone()) LCallNew(context, constructor);
1297 return MarkAsCall(DefineFixed(result, rax), instr); 1311 return MarkAsCall(DefineFixed(result, rax), instr);
1298 } 1312 }
1299 1313
1300 1314
1301 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) { 1315 LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
1316 LOperand* context = UseFixed(instr->context(), rsi);
1302 LOperand* constructor = UseFixed(instr->constructor(), rdi); 1317 LOperand* constructor = UseFixed(instr->constructor(), rdi);
1303 LCallNewArray* result = new(zone()) LCallNewArray(constructor); 1318 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor);
1304 return MarkAsCall(DefineFixed(result, rax), instr); 1319 return MarkAsCall(DefineFixed(result, rax), instr);
1305 } 1320 }
1306 1321
1307 1322
1308 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { 1323 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1324 LOperand* context = UseFixed(instr->context(), rsi);
1309 LOperand* function = UseFixed(instr->function(), rdi); 1325 LOperand* function = UseFixed(instr->function(), rdi);
1310 LCallFunction* result = new(zone()) LCallFunction(function); 1326 LCallFunction* result = new(zone()) LCallFunction(context, function);
1311 return MarkAsCall(DefineFixed(result, rax), instr); 1327 return MarkAsCall(DefineFixed(result, rax), instr);
1312 } 1328 }
1313 1329
1314 1330
1315 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { 1331 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
1316 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime, rax), instr); 1332 LOperand* context = UseFixed(instr->context(), rsi);
1333 LCallRuntime* result = new(zone()) LCallRuntime(context);
1334 return MarkAsCall(DefineFixed(result, rax), instr);
1317 } 1335 }
1318 1336
1319 1337
1320 LInstruction* LChunkBuilder::DoRor(HRor* instr) { 1338 LInstruction* LChunkBuilder::DoRor(HRor* instr) {
1321 return DoShift(Token::ROR, instr); 1339 return DoShift(Token::ROR, instr);
1322 } 1340 }
1323 1341
1324 1342
1325 LInstruction* LChunkBuilder::DoShr(HShr* instr) { 1343 LInstruction* LChunkBuilder::DoShr(HShr* instr) {
1326 return DoShift(Token::SHR, instr); 1344 return DoShift(Token::SHR, instr);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 LOperand* scratch3 = TempRegister(); 1613 LOperand* scratch3 = TempRegister();
1596 LRandom* result = new(zone()) LRandom( 1614 LRandom* result = new(zone()) LRandom(
1597 global_object, scratch, scratch2, scratch3); 1615 global_object, scratch, scratch2, scratch3);
1598 return DefineFixedDouble(result, xmm1); 1616 return DefineFixedDouble(result, xmm1);
1599 } 1617 }
1600 1618
1601 1619
1602 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { 1620 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1603 ASSERT(instr->left()->representation().IsTagged()); 1621 ASSERT(instr->left()->representation().IsTagged());
1604 ASSERT(instr->right()->representation().IsTagged()); 1622 ASSERT(instr->right()->representation().IsTagged());
1623 LOperand* context = UseFixed(instr->context(), rsi);
1605 LOperand* left = UseFixed(instr->left(), rdx); 1624 LOperand* left = UseFixed(instr->left(), rdx);
1606 LOperand* right = UseFixed(instr->right(), rax); 1625 LOperand* right = UseFixed(instr->right(), rax);
1607 LCmpT* result = new(zone()) LCmpT(left, right); 1626 LCmpT* result = new(zone()) LCmpT(context, left, right);
1608 return MarkAsCall(DefineFixed(result, rax), instr); 1627 return MarkAsCall(DefineFixed(result, rax), instr);
1609 } 1628 }
1610 1629
1611 1630
1612 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( 1631 LInstruction* LChunkBuilder::DoCompareNumericAndBranch(
1613 HCompareNumericAndBranch* instr) { 1632 HCompareNumericAndBranch* instr) {
1614 Representation r = instr->representation(); 1633 Representation r = instr->representation();
1615 if (r.IsSmiOrInteger32()) { 1634 if (r.IsSmiOrInteger32()) {
1616 ASSERT(instr->left()->representation().Equals(r)); 1635 ASSERT(instr->left()->representation().Equals(r));
1617 ASSERT(instr->right()->representation().Equals(r)); 1636 ASSERT(instr->right()->representation().Equals(r));
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1680 LOperand* temp = TempRegister(); 1699 LOperand* temp = TempRegister();
1681 return new(zone()) LIsUndetectableAndBranch(value, temp); 1700 return new(zone()) LIsUndetectableAndBranch(value, temp);
1682 } 1701 }
1683 1702
1684 1703
1685 LInstruction* LChunkBuilder::DoStringCompareAndBranch( 1704 LInstruction* LChunkBuilder::DoStringCompareAndBranch(
1686 HStringCompareAndBranch* instr) { 1705 HStringCompareAndBranch* instr) {
1687 1706
1688 ASSERT(instr->left()->representation().IsTagged()); 1707 ASSERT(instr->left()->representation().IsTagged());
1689 ASSERT(instr->right()->representation().IsTagged()); 1708 ASSERT(instr->right()->representation().IsTagged());
1709 LOperand* context = UseFixed(instr->context(), rsi);
1690 LOperand* left = UseFixed(instr->left(), rdx); 1710 LOperand* left = UseFixed(instr->left(), rdx);
1691 LOperand* right = UseFixed(instr->right(), rax); 1711 LOperand* right = UseFixed(instr->right(), rax);
1692 LStringCompareAndBranch* result = 1712 LStringCompareAndBranch* result =
1693 new(zone()) LStringCompareAndBranch(left, right); 1713 new(zone()) LStringCompareAndBranch(context, left, right);
1694 1714
1695 return MarkAsCall(result, instr); 1715 return MarkAsCall(result, instr);
1696 } 1716 }
1697 1717
1698 1718
1699 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( 1719 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch(
1700 HHasInstanceTypeAndBranch* instr) { 1720 HHasInstanceTypeAndBranch* instr) {
1701 ASSERT(instr->value()->representation().IsTagged()); 1721 ASSERT(instr->value()->representation().IsTagged());
1702 LOperand* value = UseRegisterAtStart(instr->value()); 1722 LOperand* value = UseRegisterAtStart(instr->value());
1703 return new(zone()) LHasInstanceTypeAndBranch(value); 1723 return new(zone()) LHasInstanceTypeAndBranch(value);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 } 1769 }
1750 1770
1751 1771
1752 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) { 1772 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) {
1753 LOperand* object = UseFixed(instr->value(), rax); 1773 LOperand* object = UseFixed(instr->value(), rax);
1754 LDateField* result = new(zone()) LDateField(object, instr->index()); 1774 LDateField* result = new(zone()) LDateField(object, instr->index());
1755 return MarkAsCall(DefineFixed(result, rax), instr, CAN_DEOPTIMIZE_EAGERLY); 1775 return MarkAsCall(DefineFixed(result, rax), instr, CAN_DEOPTIMIZE_EAGERLY);
1756 } 1776 }
1757 1777
1758 1778
1779 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) {
1780 LOperand* string = UseRegisterAtStart(instr->string());
1781 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1782 return DefineAsRegister(new(zone()) LSeqStringGetChar(string, index));
1783 }
1784
1785
1759 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { 1786 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) {
1760 LOperand* string = UseRegisterAtStart(instr->string()); 1787 LOperand* string = UseRegisterAtStart(instr->string());
1761 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); 1788 LOperand* index = UseRegisterOrConstantAtStart(instr->index());
1762 LOperand* value = UseRegisterOrConstantAtStart(instr->value()); 1789 LOperand* value = UseRegisterOrConstantAtStart(instr->value());
1763 return new(zone()) LSeqStringSetChar(string, index, value); 1790 return new(zone()) LSeqStringSetChar(string, index, value);
1764 } 1791 }
1765 1792
1766 1793
1767 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { 1794 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1768 LOperand* value = UseRegisterOrConstantAtStart(instr->index()); 1795 LOperand* value = UseRegisterOrConstantAtStart(instr->index());
(...skipping 10 matching lines...) Expand all
1779 1806
1780 1807
1781 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { 1808 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1782 // The control instruction marking the end of a block that completed 1809 // The control instruction marking the end of a block that completed
1783 // abruptly (e.g., threw an exception). There is nothing specific to do. 1810 // abruptly (e.g., threw an exception). There is nothing specific to do.
1784 return NULL; 1811 return NULL;
1785 } 1812 }
1786 1813
1787 1814
1788 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { 1815 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1816 LOperand* context = UseFixed(instr->context(), rsi);
1789 LOperand* value = UseFixed(instr->value(), rax); 1817 LOperand* value = UseFixed(instr->value(), rax);
1790 return MarkAsCall(new(zone()) LThrow(value), instr); 1818 return MarkAsCall(new(zone()) LThrow(context, value), instr);
1791 } 1819 }
1792 1820
1793 1821
1794 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { 1822 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) {
1795 return NULL; 1823 return NULL;
1796 } 1824 }
1797 1825
1798 1826
1799 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { 1827 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) {
1800 // All HForceRepresentation instructions should be eliminated in the 1828 // All HForceRepresentation instructions should be eliminated in the
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 // Register allocator doesn't (yet) support allocation of double 1992 // Register allocator doesn't (yet) support allocation of double
1965 // temps. Reserve xmm1 explicitly. 1993 // temps. Reserve xmm1 explicitly.
1966 LClampTToUint8* result = new(zone()) LClampTToUint8(reg, 1994 LClampTToUint8* result = new(zone()) LClampTToUint8(reg,
1967 FixedTemp(xmm1)); 1995 FixedTemp(xmm1));
1968 return AssignEnvironment(DefineSameAsFirst(result)); 1996 return AssignEnvironment(DefineSameAsFirst(result));
1969 } 1997 }
1970 } 1998 }
1971 1999
1972 2000
1973 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { 2001 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
2002 LOperand* context = info()->IsStub() ? UseFixed(instr->context(), rsi) : NULL;
1974 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count()); 2003 LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
1975 return new(zone()) LReturn(UseFixed(instr->value(), rax), 2004 return new(zone()) LReturn(
1976 parameter_count); 2005 UseFixed(instr->value(), rax), context, parameter_count);
1977 } 2006 }
1978 2007
1979 2008
1980 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { 2009 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1981 Representation r = instr->representation(); 2010 Representation r = instr->representation();
1982 if (r.IsSmi()) { 2011 if (r.IsSmi()) {
1983 return DefineAsRegister(new(zone()) LConstantS); 2012 return DefineAsRegister(new(zone()) LConstantS);
1984 } else if (r.IsInteger32()) { 2013 } else if (r.IsInteger32()) {
1985 return DefineAsRegister(new(zone()) LConstantI); 2014 return DefineAsRegister(new(zone()) LConstantI);
1986 } else if (r.IsDouble()) { 2015 } else if (r.IsDouble()) {
(...skipping 12 matching lines...) Expand all
1999 2028
2000 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { 2029 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
2001 LLoadGlobalCell* result = new(zone()) LLoadGlobalCell; 2030 LLoadGlobalCell* result = new(zone()) LLoadGlobalCell;
2002 return instr->RequiresHoleCheck() 2031 return instr->RequiresHoleCheck()
2003 ? AssignEnvironment(DefineAsRegister(result)) 2032 ? AssignEnvironment(DefineAsRegister(result))
2004 : DefineAsRegister(result); 2033 : DefineAsRegister(result);
2005 } 2034 }
2006 2035
2007 2036
2008 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { 2037 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {
2038 LOperand* context = UseFixed(instr->context(), rsi);
2009 LOperand* global_object = UseFixed(instr->global_object(), rax); 2039 LOperand* global_object = UseFixed(instr->global_object(), rax);
2010 LLoadGlobalGeneric* result = new(zone()) LLoadGlobalGeneric(global_object); 2040 LLoadGlobalGeneric* result =
2041 new(zone()) LLoadGlobalGeneric(context, global_object);
2011 return MarkAsCall(DefineFixed(result, rax), instr); 2042 return MarkAsCall(DefineFixed(result, rax), instr);
2012 } 2043 }
2013 2044
2014 2045
2015 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { 2046 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
2016 LOperand* value = UseRegister(instr->value()); 2047 LOperand* value = UseRegister(instr->value());
2017 // Use a temp to avoid reloading the cell value address in the case where 2048 // Use a temp to avoid reloading the cell value address in the case where
2018 // we perform a hole check. 2049 // we perform a hole check.
2019 return instr->RequiresHoleCheck() 2050 return instr->RequiresHoleCheck()
2020 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister())) 2051 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister()))
2021 : new(zone()) LStoreGlobalCell(value, NULL); 2052 : new(zone()) LStoreGlobalCell(value, NULL);
2022 } 2053 }
2023 2054
2024 2055
2025 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { 2056 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) {
2057 LOperand* context = UseFixed(instr->context(), rsi);
2026 LOperand* global_object = UseFixed(instr->global_object(), rdx); 2058 LOperand* global_object = UseFixed(instr->global_object(), rdx);
2027 LOperand* value = UseFixed(instr->value(), rax); 2059 LOperand* value = UseFixed(instr->value(), rax);
2028 LStoreGlobalGeneric* result = new(zone()) LStoreGlobalGeneric(global_object, 2060 LStoreGlobalGeneric* result =
2029 value); 2061 new(zone()) LStoreGlobalGeneric(context, global_object, value);
2030 return MarkAsCall(result, instr); 2062 return MarkAsCall(result, instr);
2031 } 2063 }
2032 2064
2033 2065
2034 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { 2066 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
2035 LOperand* context = UseRegisterAtStart(instr->value()); 2067 LOperand* context = UseRegisterAtStart(instr->value());
2036 LInstruction* result = 2068 LInstruction* result =
2037 DefineAsRegister(new(zone()) LLoadContextSlot(context)); 2069 DefineAsRegister(new(zone()) LLoadContextSlot(context));
2038 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; 2070 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2039 } 2071 }
2040 2072
2041 2073
2042 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { 2074 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
2043 LOperand* context; 2075 LOperand* context;
2044 LOperand* value; 2076 LOperand* value;
2045 LOperand* temp; 2077 LOperand* temp;
2078 context = UseRegister(instr->context());
2046 if (instr->NeedsWriteBarrier()) { 2079 if (instr->NeedsWriteBarrier()) {
2047 context = UseTempRegister(instr->context());
2048 value = UseTempRegister(instr->value()); 2080 value = UseTempRegister(instr->value());
2049 temp = TempRegister(); 2081 temp = TempRegister();
2050 } else { 2082 } else {
2051 context = UseRegister(instr->context());
2052 value = UseRegister(instr->value()); 2083 value = UseRegister(instr->value());
2053 temp = NULL; 2084 temp = NULL;
2054 } 2085 }
2055 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp); 2086 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp);
2056 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; 2087 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2057 } 2088 }
2058 2089
2059 2090
2060 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { 2091 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2061 // Use the special mov rax, moffs64 encoding for external 2092 // Use the special mov rax, moffs64 encoding for external
2062 // memory accesses with 64-bit word-sized values. 2093 // memory accesses with 64-bit word-sized values.
2063 if (instr->access().IsExternalMemory() && 2094 if (instr->access().IsExternalMemory() &&
2064 instr->access().offset() == 0 && 2095 instr->access().offset() == 0 &&
2065 (instr->access().representation().IsSmi() || 2096 (instr->access().representation().IsSmi() ||
2066 instr->access().representation().IsTagged() || 2097 instr->access().representation().IsTagged() ||
2067 instr->access().representation().IsHeapObject() || 2098 instr->access().representation().IsHeapObject() ||
2068 instr->access().representation().IsExternal())) { 2099 instr->access().representation().IsExternal())) {
2069 LOperand* obj = UseRegisterOrConstantAtStart(instr->object()); 2100 LOperand* obj = UseRegisterOrConstantAtStart(instr->object());
2070 return DefineFixed(new(zone()) LLoadNamedField(obj), rax); 2101 return DefineFixed(new(zone()) LLoadNamedField(obj), rax);
2071 } 2102 }
2072 LOperand* obj = UseRegisterAtStart(instr->object()); 2103 LOperand* obj = UseRegisterAtStart(instr->object());
2073 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); 2104 return DefineAsRegister(new(zone()) LLoadNamedField(obj));
2074 } 2105 }
2075 2106
2076 2107
2077 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { 2108 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
2109 LOperand* context = UseFixed(instr->context(), rsi);
2078 LOperand* object = UseFixed(instr->object(), rax); 2110 LOperand* object = UseFixed(instr->object(), rax);
2079 LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric(object); 2111 LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric(context, object);
2080 return MarkAsCall(DefineFixed(result, rax), instr); 2112 return MarkAsCall(DefineFixed(result, rax), instr);
2081 } 2113 }
2082 2114
2083 2115
2084 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( 2116 LInstruction* LChunkBuilder::DoLoadFunctionPrototype(
2085 HLoadFunctionPrototype* instr) { 2117 HLoadFunctionPrototype* instr) {
2086 return AssignEnvironment(DefineAsRegister( 2118 return AssignEnvironment(DefineAsRegister(
2087 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); 2119 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
2088 } 2120 }
2089 2121
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 DefineAsRegister(result); 2156 DefineAsRegister(result);
2125 bool can_deoptimize = instr->RequiresHoleCheck() || 2157 bool can_deoptimize = instr->RequiresHoleCheck() ||
2126 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); 2158 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS);
2127 // An unsigned int array load might overflow and cause a deopt, make sure it 2159 // An unsigned int array load might overflow and cause a deopt, make sure it
2128 // has an environment. 2160 // has an environment.
2129 return can_deoptimize ? AssignEnvironment(result) : result; 2161 return can_deoptimize ? AssignEnvironment(result) : result;
2130 } 2162 }
2131 2163
2132 2164
2133 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { 2165 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
2166 LOperand* context = UseFixed(instr->context(), rsi);
2134 LOperand* object = UseFixed(instr->object(), rdx); 2167 LOperand* object = UseFixed(instr->object(), rdx);
2135 LOperand* key = UseFixed(instr->key(), rax); 2168 LOperand* key = UseFixed(instr->key(), rax);
2136 2169
2137 LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(object, key); 2170 LLoadKeyedGeneric* result =
2171 new(zone()) LLoadKeyedGeneric(context, object, key);
2138 return MarkAsCall(DefineFixed(result, rax), instr); 2172 return MarkAsCall(DefineFixed(result, rax), instr);
2139 } 2173 }
2140 2174
2141 2175
2142 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { 2176 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2143 ElementsKind elements_kind = instr->elements_kind(); 2177 ElementsKind elements_kind = instr->elements_kind();
2144 2178
2145 if (!instr->is_external()) { 2179 if (!instr->is_external()) {
2146 ASSERT(instr->elements()->representation().IsTagged()); 2180 ASSERT(instr->elements()->representation().IsTagged());
2147 bool needs_write_barrier = instr->NeedsWriteBarrier(); 2181 bool needs_write_barrier = instr->NeedsWriteBarrier();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2181 elements_kind == EXTERNAL_FLOAT_ELEMENTS; 2215 elements_kind == EXTERNAL_FLOAT_ELEMENTS;
2182 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) 2216 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value())
2183 : UseRegister(instr->value()); 2217 : UseRegister(instr->value());
2184 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 2218 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2185 LOperand* external_pointer = UseRegister(instr->elements()); 2219 LOperand* external_pointer = UseRegister(instr->elements());
2186 return new(zone()) LStoreKeyed(external_pointer, key, val); 2220 return new(zone()) LStoreKeyed(external_pointer, key, val);
2187 } 2221 }
2188 2222
2189 2223
2190 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { 2224 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2225 LOperand* context = UseFixed(instr->context(), rsi);
2191 LOperand* object = UseFixed(instr->object(), rdx); 2226 LOperand* object = UseFixed(instr->object(), rdx);
2192 LOperand* key = UseFixed(instr->key(), rcx); 2227 LOperand* key = UseFixed(instr->key(), rcx);
2193 LOperand* value = UseFixed(instr->value(), rax); 2228 LOperand* value = UseFixed(instr->value(), rax);
2194 2229
2195 ASSERT(instr->object()->representation().IsTagged()); 2230 ASSERT(instr->object()->representation().IsTagged());
2196 ASSERT(instr->key()->representation().IsTagged()); 2231 ASSERT(instr->key()->representation().IsTagged());
2197 ASSERT(instr->value()->representation().IsTagged()); 2232 ASSERT(instr->value()->representation().IsTagged());
2198 2233
2199 LStoreKeyedGeneric* result = 2234 LStoreKeyedGeneric* result =
2200 new(zone()) LStoreKeyedGeneric(object, key, value); 2235 new(zone()) LStoreKeyedGeneric(context, object, key, value);
2201 return MarkAsCall(result, instr); 2236 return MarkAsCall(result, instr);
2202 } 2237 }
2203 2238
2204 2239
2205 LInstruction* LChunkBuilder::DoTransitionElementsKind( 2240 LInstruction* LChunkBuilder::DoTransitionElementsKind(
2206 HTransitionElementsKind* instr) { 2241 HTransitionElementsKind* instr) {
2207 LOperand* object = UseRegister(instr->object()); 2242 LOperand* object = UseRegister(instr->object());
2208 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { 2243 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) {
2209 LOperand* object = UseRegister(instr->object()); 2244 LOperand* object = UseRegister(instr->object());
2210 LOperand* new_map_reg = TempRegister(); 2245 LOperand* new_map_reg = TempRegister();
2211 LOperand* temp_reg = TempRegister(); 2246 LOperand* temp_reg = TempRegister();
2212 LTransitionElementsKind* result = 2247 LTransitionElementsKind* result = new(zone()) LTransitionElementsKind(
2213 new(zone()) LTransitionElementsKind(object, new_map_reg, temp_reg); 2248 object, NULL, new_map_reg, temp_reg);
2214 return result; 2249 return result;
2215 } else { 2250 } else {
2251 LOperand* context = UseAny(instr->context());
2216 LTransitionElementsKind* result = 2252 LTransitionElementsKind* result =
2217 new(zone()) LTransitionElementsKind(object, NULL, NULL); 2253 new(zone()) LTransitionElementsKind(object, context, NULL, NULL);
2218 return AssignPointerMap(result); 2254 return AssignPointerMap(result);
2219 } 2255 }
2220 } 2256 }
2221 2257
2222 2258
2223 LInstruction* LChunkBuilder::DoTrapAllocationMemento( 2259 LInstruction* LChunkBuilder::DoTrapAllocationMemento(
2224 HTrapAllocationMemento* instr) { 2260 HTrapAllocationMemento* instr) {
2225 LOperand* object = UseRegister(instr->object()); 2261 LOperand* object = UseRegister(instr->object());
2226 LOperand* temp = TempRegister(); 2262 LOperand* temp = TempRegister();
2227 LTrapAllocationMemento* result = 2263 LTrapAllocationMemento* result =
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 instr->field_representation().IsHeapObject()) { 2320 instr->field_representation().IsHeapObject()) {
2285 if (!instr->value()->type().IsHeapObject()) { 2321 if (!instr->value()->type().IsHeapObject()) {
2286 return AssignEnvironment(result); 2322 return AssignEnvironment(result);
2287 } 2323 }
2288 } 2324 }
2289 return result; 2325 return result;
2290 } 2326 }
2291 2327
2292 2328
2293 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { 2329 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2330 LOperand* context = UseFixed(instr->context(), rsi);
2294 LOperand* object = UseFixed(instr->object(), rdx); 2331 LOperand* object = UseFixed(instr->object(), rdx);
2295 LOperand* value = UseFixed(instr->value(), rax); 2332 LOperand* value = UseFixed(instr->value(), rax);
2296 2333
2297 LStoreNamedGeneric* result = new(zone()) LStoreNamedGeneric(object, value); 2334 LStoreNamedGeneric* result =
2335 new(zone()) LStoreNamedGeneric(context, object, value);
2298 return MarkAsCall(result, instr); 2336 return MarkAsCall(result, instr);
2299 } 2337 }
2300 2338
2301 2339
2302 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { 2340 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) {
2303 LOperand* left = UseOrConstantAtStart(instr->left()); 2341 LOperand* context = UseFixed(instr->context(), rsi);
2304 LOperand* right = UseOrConstantAtStart(instr->right()); 2342 LOperand* left = FLAG_new_string_add
2305 return MarkAsCall(DefineFixed(new(zone()) LStringAdd(left, right), rax), 2343 ? UseFixed(instr->left(), rdx)
2306 instr); 2344 : UseOrConstantAtStart(instr->left());
2345 LOperand* right = FLAG_new_string_add
2346 ? UseFixed(instr->right(), rax)
2347 : UseOrConstantAtStart(instr->right());
2348 return MarkAsCall(
2349 DefineFixed(new(zone()) LStringAdd(context, left, right), rax), instr);
2307 } 2350 }
2308 2351
2309 2352
2310 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { 2353 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2311 LOperand* string = UseTempRegister(instr->string()); 2354 LOperand* string = UseTempRegister(instr->string());
2312 LOperand* index = UseTempRegister(instr->index()); 2355 LOperand* index = UseTempRegister(instr->index());
2313 LStringCharCodeAt* result = new(zone()) LStringCharCodeAt(string, index); 2356 LOperand* context = UseAny(instr->context());
2357 LStringCharCodeAt* result =
2358 new(zone()) LStringCharCodeAt(context, string, index);
2314 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 2359 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
2315 } 2360 }
2316 2361
2317 2362
2318 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { 2363 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2319 LOperand* char_code = UseRegister(instr->value()); 2364 LOperand* char_code = UseRegister(instr->value());
2320 LStringCharFromCode* result = new(zone()) LStringCharFromCode(char_code); 2365 LOperand* context = UseAny(instr->context());
2366 LStringCharFromCode* result =
2367 new(zone()) LStringCharFromCode(context, char_code);
2321 return AssignPointerMap(DefineAsRegister(result)); 2368 return AssignPointerMap(DefineAsRegister(result));
2322 } 2369 }
2323 2370
2324 2371
2325 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { 2372 LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
2326 info()->MarkAsDeferredCalling(); 2373 info()->MarkAsDeferredCalling();
2374 LOperand* context = UseAny(instr->context());
2327 LOperand* size = instr->size()->IsConstant() 2375 LOperand* size = instr->size()->IsConstant()
2328 ? UseConstant(instr->size()) 2376 ? UseConstant(instr->size())
2329 : UseTempRegister(instr->size()); 2377 : UseTempRegister(instr->size());
2330 LOperand* temp = TempRegister(); 2378 LOperand* temp = TempRegister();
2331 LAllocate* result = new(zone()) LAllocate(size, temp); 2379 LAllocate* result = new(zone()) LAllocate(context, size, temp);
2332 return AssignPointerMap(DefineAsRegister(result)); 2380 return AssignPointerMap(DefineAsRegister(result));
2333 } 2381 }
2334 2382
2335 2383
2336 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { 2384 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) {
2337 return MarkAsCall(DefineFixed(new(zone()) LRegExpLiteral, rax), instr); 2385 LOperand* context = UseFixed(instr->context(), rsi);
2386 LRegExpLiteral* result = new(zone()) LRegExpLiteral(context);
2387 return MarkAsCall(DefineFixed(result, rax), instr);
2338 } 2388 }
2339 2389
2340 2390
2341 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { 2391 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) {
2342 return MarkAsCall(DefineFixed(new(zone()) LFunctionLiteral, rax), instr); 2392 LOperand* context = UseFixed(instr->context(), rsi);
2393 LFunctionLiteral* result = new(zone()) LFunctionLiteral(context);
2394 return MarkAsCall(DefineFixed(result, rax), instr);
2343 } 2395 }
2344 2396
2345 2397
2346 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { 2398 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) {
2347 ASSERT(argument_count_ == 0); 2399 ASSERT(argument_count_ == 0);
2348 allocator_->MarkAsOsrEntry(); 2400 allocator_->MarkAsOsrEntry();
2349 current_block_->last_environment()->set_ast_id(instr->ast_id()); 2401 current_block_->last_environment()->set_ast_id(instr->ast_id());
2350 return AssignEnvironment(new(zone()) LOsrEntry); 2402 return AssignEnvironment(new(zone()) LOsrEntry);
2351 } 2403 }
2352 2404
(...skipping 26 matching lines...) Expand all
2379 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { 2431 if (spill_index > LUnallocated::kMaxFixedSlotIndex) {
2380 Abort(kTooManySpillSlotsNeededForOSR); 2432 Abort(kTooManySpillSlotsNeededForOSR);
2381 spill_index = 0; 2433 spill_index = 0;
2382 } 2434 }
2383 } 2435 }
2384 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); 2436 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index);
2385 } 2437 }
2386 2438
2387 2439
2388 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { 2440 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) {
2389 return MarkAsCall(DefineFixed(new(zone()) LCallStub, rax), instr); 2441 LOperand* context = UseFixed(instr->context(), rsi);
2442 LCallStub* result = new(zone()) LCallStub(context);
2443 return MarkAsCall(DefineFixed(result, rax), instr);
2390 } 2444 }
2391 2445
2392 2446
2393 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { 2447 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) {
2394 // There are no real uses of the arguments object. 2448 // There are no real uses of the arguments object.
2395 // arguments.length and element access are supported directly on 2449 // arguments.length and element access are supported directly on
2396 // stack arguments, and any real arguments object use causes a bailout. 2450 // stack arguments, and any real arguments object use causes a bailout.
2397 // So this value is never used. 2451 // So this value is never used.
2398 return NULL; 2452 return NULL;
2399 } 2453 }
(...skipping 24 matching lines...) Expand all
2424 2478
2425 2479
2426 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { 2480 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2427 LOperand* object = UseFixed(instr->value(), rax); 2481 LOperand* object = UseFixed(instr->value(), rax);
2428 LToFastProperties* result = new(zone()) LToFastProperties(object); 2482 LToFastProperties* result = new(zone()) LToFastProperties(object);
2429 return MarkAsCall(DefineFixed(result, rax), instr); 2483 return MarkAsCall(DefineFixed(result, rax), instr);
2430 } 2484 }
2431 2485
2432 2486
2433 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { 2487 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
2434 LTypeof* result = new(zone()) LTypeof(UseAtStart(instr->value())); 2488 LOperand* context = UseFixed(instr->context(), rsi);
2489 LOperand* value = UseAtStart(instr->value());
2490 LTypeof* result = new(zone()) LTypeof(context, value);
2435 return MarkAsCall(DefineFixed(result, rax), instr); 2491 return MarkAsCall(DefineFixed(result, rax), instr);
2436 } 2492 }
2437 2493
2438 2494
2439 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { 2495 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2440 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); 2496 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value()));
2441 } 2497 }
2442 2498
2443 2499
2444 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( 2500 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch(
(...skipping 19 matching lines...) Expand all
2464 return result; 2520 return result;
2465 } 2521 }
2466 2522
2467 return NULL; 2523 return NULL;
2468 } 2524 }
2469 2525
2470 2526
2471 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { 2527 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2472 info()->MarkAsDeferredCalling(); 2528 info()->MarkAsDeferredCalling();
2473 if (instr->is_function_entry()) { 2529 if (instr->is_function_entry()) {
2474 return MarkAsCall(new(zone()) LStackCheck, instr); 2530 LOperand* context = UseFixed(instr->context(), rsi);
2531 return MarkAsCall(new(zone()) LStackCheck(context), instr);
2475 } else { 2532 } else {
2476 ASSERT(instr->is_backwards_branch()); 2533 ASSERT(instr->is_backwards_branch());
2477 return AssignEnvironment(AssignPointerMap(new(zone()) LStackCheck)); 2534 LOperand* context = UseAny(instr->context());
2535 return AssignEnvironment(
2536 AssignPointerMap(new(zone()) LStackCheck(context)));
2478 } 2537 }
2479 } 2538 }
2480 2539
2481 2540
2482 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { 2541 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2483 HEnvironment* outer = current_block_->last_environment(); 2542 HEnvironment* outer = current_block_->last_environment();
2484 HConstant* undefined = graph()->GetConstantUndefined(); 2543 HConstant* undefined = graph()->GetConstantUndefined();
2485 HEnvironment* inner = outer->CopyForInlining(instr->closure(), 2544 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2486 instr->arguments_count(), 2545 instr->arguments_count(),
2487 instr->function(), 2546 instr->function(),
(...skipping 24 matching lines...) Expand all
2512 2571
2513 HEnvironment* outer = current_block_->last_environment()-> 2572 HEnvironment* outer = current_block_->last_environment()->
2514 DiscardInlined(false); 2573 DiscardInlined(false);
2515 current_block_->UpdateEnvironment(outer); 2574 current_block_->UpdateEnvironment(outer);
2516 2575
2517 return pop; 2576 return pop;
2518 } 2577 }
2519 2578
2520 2579
2521 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) { 2580 LInstruction* LChunkBuilder::DoForInPrepareMap(HForInPrepareMap* instr) {
2581 LOperand* context = UseFixed(instr->context(), rsi);
2522 LOperand* object = UseFixed(instr->enumerable(), rax); 2582 LOperand* object = UseFixed(instr->enumerable(), rax);
2523 LForInPrepareMap* result = new(zone()) LForInPrepareMap(object); 2583 LForInPrepareMap* result = new(zone()) LForInPrepareMap(context, object);
2524 return MarkAsCall(DefineFixed(result, rax), instr, CAN_DEOPTIMIZE_EAGERLY); 2584 return MarkAsCall(DefineFixed(result, rax), instr, CAN_DEOPTIMIZE_EAGERLY);
2525 } 2585 }
2526 2586
2527 2587
2528 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) { 2588 LInstruction* LChunkBuilder::DoForInCacheArray(HForInCacheArray* instr) {
2529 LOperand* map = UseRegister(instr->map()); 2589 LOperand* map = UseRegister(instr->map());
2530 return AssignEnvironment(DefineAsRegister( 2590 return AssignEnvironment(DefineAsRegister(
2531 new(zone()) LForInCacheArray(map))); 2591 new(zone()) LForInCacheArray(map)));
2532 } 2592 }
2533 2593
2534 2594
2535 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) { 2595 LInstruction* LChunkBuilder::DoCheckMapValue(HCheckMapValue* instr) {
2536 LOperand* value = UseRegisterAtStart(instr->value()); 2596 LOperand* value = UseRegisterAtStart(instr->value());
2537 LOperand* map = UseRegisterAtStart(instr->map()); 2597 LOperand* map = UseRegisterAtStart(instr->map());
2538 return AssignEnvironment(new(zone()) LCheckMapValue(value, map)); 2598 return AssignEnvironment(new(zone()) LCheckMapValue(value, map));
2539 } 2599 }
2540 2600
2541 2601
2542 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2602 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2543 LOperand* object = UseRegister(instr->object()); 2603 LOperand* object = UseRegister(instr->object());
2544 LOperand* index = UseTempRegister(instr->index()); 2604 LOperand* index = UseTempRegister(instr->index());
2545 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2605 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2546 } 2606 }
2547 2607
2548 2608
2549 } } // namespace v8::internal 2609 } } // namespace v8::internal
2550 2610
2551 #endif // V8_TARGET_ARCH_X64 2611 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.h ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698