| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 ASSERT(instr->right()->representation().IsInteger32()); | 812 ASSERT(instr->right()->representation().IsInteger32()); |
| 813 | 813 |
| 814 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 814 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); |
| 815 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); | 815 LOperand* right = UseOrConstantAtStart(instr->MostConstantOperand()); |
| 816 return DefineSameAsFirst(new LBitI(op, left, right)); | 816 return DefineSameAsFirst(new LBitI(op, left, right)); |
| 817 } else { | 817 } else { |
| 818 ASSERT(instr->representation().IsTagged()); | 818 ASSERT(instr->representation().IsTagged()); |
| 819 ASSERT(instr->left()->representation().IsTagged()); | 819 ASSERT(instr->left()->representation().IsTagged()); |
| 820 ASSERT(instr->right()->representation().IsTagged()); | 820 ASSERT(instr->right()->representation().IsTagged()); |
| 821 | 821 |
| 822 LOperand* context = UseFixed(instr->context(), rsi); |
| 822 LOperand* left = UseFixed(instr->left(), rdx); | 823 LOperand* left = UseFixed(instr->left(), rdx); |
| 823 LOperand* right = UseFixed(instr->right(), rax); | 824 LOperand* right = UseFixed(instr->right(), rax); |
| 824 LArithmeticT* result = new LArithmeticT(op, left, right); | 825 LArithmeticT* result = new LArithmeticT(op, context, left, right); |
| 825 return MarkAsCall(DefineFixed(result, rax), instr); | 826 return MarkAsCall(DefineFixed(result, rax), instr); |
| 826 } | 827 } |
| 827 } | 828 } |
| 828 | 829 |
| 829 | 830 |
| 830 LInstruction* LChunkBuilder::DoShift(Token::Value op, | 831 LInstruction* LChunkBuilder::DoShift(Token::Value op, |
| 831 HBitwiseBinaryOperation* instr) { | 832 HBitwiseBinaryOperation* instr) { |
| 832 if (instr->representation().IsTagged()) { | 833 if (instr->representation().IsTagged()) { |
| 833 ASSERT(instr->left()->representation().IsTagged()); | 834 ASSERT(instr->left()->representation().IsTagged()); |
| 834 ASSERT(instr->right()->representation().IsTagged()); | 835 ASSERT(instr->right()->representation().IsTagged()); |
| 835 | 836 |
| 837 LOperand* context = UseFixed(instr->context(), rsi); |
| 836 LOperand* left = UseFixed(instr->left(), rdx); | 838 LOperand* left = UseFixed(instr->left(), rdx); |
| 837 LOperand* right = UseFixed(instr->right(), rax); | 839 LOperand* right = UseFixed(instr->right(), rax); |
| 838 LArithmeticT* result = new LArithmeticT(op, left, right); | 840 LArithmeticT* result = new LArithmeticT(op, context, left, right); |
| 839 return MarkAsCall(DefineFixed(result, rax), instr); | 841 return MarkAsCall(DefineFixed(result, rax), instr); |
| 840 } | 842 } |
| 841 | 843 |
| 842 ASSERT(instr->representation().IsInteger32()); | 844 ASSERT(instr->representation().IsInteger32()); |
| 843 ASSERT(instr->left()->representation().IsInteger32()); | 845 ASSERT(instr->left()->representation().IsInteger32()); |
| 844 ASSERT(instr->right()->representation().IsInteger32()); | 846 ASSERT(instr->right()->representation().IsInteger32()); |
| 845 LOperand* left = UseRegisterAtStart(instr->left()); | 847 LOperand* left = UseRegisterAtStart(instr->left()); |
| 846 | 848 |
| 847 HValue* right_value = instr->right(); | 849 HValue* right_value = instr->right(); |
| 848 LOperand* right = NULL; | 850 LOperand* right = NULL; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 HArithmeticBinaryOperation* instr) { | 893 HArithmeticBinaryOperation* instr) { |
| 892 ASSERT(op == Token::ADD || | 894 ASSERT(op == Token::ADD || |
| 893 op == Token::DIV || | 895 op == Token::DIV || |
| 894 op == Token::MOD || | 896 op == Token::MOD || |
| 895 op == Token::MUL || | 897 op == Token::MUL || |
| 896 op == Token::SUB); | 898 op == Token::SUB); |
| 897 HValue* left = instr->left(); | 899 HValue* left = instr->left(); |
| 898 HValue* right = instr->right(); | 900 HValue* right = instr->right(); |
| 899 ASSERT(left->representation().IsTagged()); | 901 ASSERT(left->representation().IsTagged()); |
| 900 ASSERT(right->representation().IsTagged()); | 902 ASSERT(right->representation().IsTagged()); |
| 903 LOperand* context = UseFixed(instr->context(), rsi); |
| 901 LOperand* left_operand = UseFixed(left, rdx); | 904 LOperand* left_operand = UseFixed(left, rdx); |
| 902 LOperand* right_operand = UseFixed(right, rax); | 905 LOperand* right_operand = UseFixed(right, rax); |
| 903 LArithmeticT* result = new LArithmeticT(op, left_operand, right_operand); | 906 LArithmeticT* result = |
| 907 new LArithmeticT(op, context, left_operand, right_operand); |
| 904 return MarkAsCall(DefineFixed(result, rax), instr); | 908 return MarkAsCall(DefineFixed(result, rax), instr); |
| 905 } | 909 } |
| 906 | 910 |
| 907 | 911 |
| 908 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { | 912 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { |
| 909 ASSERT(is_building()); | 913 ASSERT(is_building()); |
| 910 current_block_ = block; | 914 current_block_ = block; |
| 911 next_block_ = next_block; | 915 next_block_ = next_block; |
| 912 if (block->IsStartBlock()) { | 916 if (block->IsStartBlock()) { |
| 913 block->UpdateEnvironment(graph_->start_environment()); | 917 block->UpdateEnvironment(graph_->start_environment()); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 | 1057 |
| 1054 | 1058 |
| 1055 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { | 1059 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { |
| 1056 return DefineAsRegister(new LArgumentsElements); | 1060 return DefineAsRegister(new LArgumentsElements); |
| 1057 } | 1061 } |
| 1058 | 1062 |
| 1059 | 1063 |
| 1060 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { | 1064 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { |
| 1061 LOperand* left = UseFixed(instr->left(), rax); | 1065 LOperand* left = UseFixed(instr->left(), rax); |
| 1062 LOperand* right = UseFixed(instr->right(), rdx); | 1066 LOperand* right = UseFixed(instr->right(), rdx); |
| 1063 LInstanceOf* result = new LInstanceOf(left, right); | 1067 LOperand* context = UseFixed(instr->context(), rsi); |
| 1068 LInstanceOf* result = new LInstanceOf(context, left, right); |
| 1064 return MarkAsCall(DefineFixed(result, rax), instr); | 1069 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1065 } | 1070 } |
| 1066 | 1071 |
| 1067 | 1072 |
| 1068 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( | 1073 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal( |
| 1069 HInstanceOfKnownGlobal* instr) { | 1074 HInstanceOfKnownGlobal* instr) { |
| 1075 LOperand* left = UseFixed(instr->left(), rax); |
| 1076 LOperand* temp = FixedTemp(rdi); |
| 1077 LOperand* context = UseFixed(instr->context(), rsi); |
| 1070 LInstanceOfKnownGlobal* result = | 1078 LInstanceOfKnownGlobal* result = |
| 1071 new LInstanceOfKnownGlobal(UseFixed(instr->left(), rax), | 1079 new LInstanceOfKnownGlobal(context, left, temp); |
| 1072 FixedTemp(rdi)); | |
| 1073 return MarkAsCall(DefineFixed(result, rax), instr); | 1080 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1074 } | 1081 } |
| 1075 | 1082 |
| 1076 | 1083 |
| 1077 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { | 1084 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { |
| 1078 LOperand* function = UseFixed(instr->function(), rdi); | 1085 LOperand* function = UseFixed(instr->function(), rdi); |
| 1079 LOperand* receiver = UseFixed(instr->receiver(), rax); | 1086 LOperand* receiver = UseFixed(instr->receiver(), rax); |
| 1080 LOperand* length = UseFixed(instr->length(), rbx); | 1087 LOperand* length = UseFixed(instr->length(), rbx); |
| 1081 LOperand* elements = UseFixed(instr->elements(), rcx); | 1088 LOperand* elements = UseFixed(instr->elements(), rcx); |
| 1082 LApplyArguments* result = new LApplyArguments(function, | 1089 LApplyArguments* result = new LApplyArguments(function, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1104 } | 1111 } |
| 1105 | 1112 |
| 1106 | 1113 |
| 1107 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { | 1114 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { |
| 1108 LOperand* context = UseRegisterAtStart(instr->value()); | 1115 LOperand* context = UseRegisterAtStart(instr->value()); |
| 1109 return DefineAsRegister(new LOuterContext(context)); | 1116 return DefineAsRegister(new LOuterContext(context)); |
| 1110 } | 1117 } |
| 1111 | 1118 |
| 1112 | 1119 |
| 1113 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { | 1120 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { |
| 1114 return DefineAsRegister(new LGlobalObject); | 1121 LOperand* context = UseRegisterAtStart(instr->value()); |
| 1122 return DefineAsRegister(new LGlobalObject(context)); |
| 1115 } | 1123 } |
| 1116 | 1124 |
| 1117 | 1125 |
| 1118 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { | 1126 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { |
| 1119 LOperand* global_object = UseRegisterAtStart(instr->value()); | 1127 LOperand* global_object = UseRegisterAtStart(instr->value()); |
| 1120 return DefineAsRegister(new LGlobalReceiver(global_object)); | 1128 return DefineAsRegister(new LGlobalReceiver(global_object)); |
| 1121 } | 1129 } |
| 1122 | 1130 |
| 1123 | 1131 |
| 1124 LInstruction* LChunkBuilder::DoCallConstantFunction( | 1132 LInstruction* LChunkBuilder::DoCallConstantFunction( |
| 1125 HCallConstantFunction* instr) { | 1133 HCallConstantFunction* instr) { |
| 1126 argument_count_ -= instr->argument_count(); | 1134 argument_count_ -= instr->argument_count(); |
| 1127 return MarkAsCall(DefineFixed(new LCallConstantFunction, rax), instr); | 1135 return MarkAsCall(DefineFixed(new LCallConstantFunction, rax), instr); |
| 1128 } | 1136 } |
| 1129 | 1137 |
| 1130 | 1138 |
| 1131 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { | 1139 LInstruction* LChunkBuilder::DoInvokeFunction(HInvokeFunction* instr) { |
| 1140 LOperand* context = UseFixed(instr->context(), rsi); |
| 1132 LOperand* function = UseFixed(instr->function(), rdi); | 1141 LOperand* function = UseFixed(instr->function(), rdi); |
| 1133 argument_count_ -= instr->argument_count(); | 1142 argument_count_ -= instr->argument_count(); |
| 1134 LInvokeFunction* result = new LInvokeFunction(function); | 1143 LInvokeFunction* result = new LInvokeFunction(context, function); |
| 1135 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1144 return MarkAsCall(DefineFixed(result, rax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1136 } | 1145 } |
| 1137 | 1146 |
| 1138 | 1147 |
| 1139 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1148 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1140 BuiltinFunctionId op = instr->op(); | 1149 BuiltinFunctionId op = instr->op(); |
| 1141 if (op == kMathLog || op == kMathSin || op == kMathCos) { | 1150 if (op == kMathLog) { |
| 1151 ASSERT(instr->representation().IsDouble()); |
| 1152 ASSERT(instr->value()->representation().IsDouble()); |
| 1153 LOperand* context = UseAny(instr->context()); // Not actually used. |
| 1154 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1155 LUnaryMathOperation* result = new LUnaryMathOperation(context, input); |
| 1156 return DefineSameAsFirst(result); |
| 1157 } else if (op == kMathSin || op == kMathCos) { |
| 1158 LOperand* context = UseFixed(instr->context(), rsi); |
| 1142 LOperand* input = UseFixedDouble(instr->value(), xmm1); | 1159 LOperand* input = UseFixedDouble(instr->value(), xmm1); |
| 1143 LUnaryMathOperation* result = new LUnaryMathOperation(input); | 1160 LUnaryMathOperation* result = new LUnaryMathOperation(context, input); |
| 1144 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | 1161 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); |
| 1145 } else { | 1162 } else { |
| 1146 LOperand* input = UseRegisterAtStart(instr->value()); | 1163 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1147 LUnaryMathOperation* result = new LUnaryMathOperation(input); | 1164 LOperand* context = UseAny(instr->context()); // Deferred use by MathAbs. |
| 1165 LUnaryMathOperation* result = new LUnaryMathOperation(context, input); |
| 1148 switch (op) { | 1166 switch (op) { |
| 1149 case kMathAbs: | 1167 case kMathAbs: |
| 1150 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1168 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
| 1151 case kMathFloor: | 1169 case kMathFloor: |
| 1152 return AssignEnvironment(DefineAsRegister(result)); | 1170 return AssignEnvironment(DefineAsRegister(result)); |
| 1153 case kMathRound: | 1171 case kMathRound: |
| 1154 return AssignEnvironment(DefineAsRegister(result)); | 1172 return AssignEnvironment(DefineAsRegister(result)); |
| 1155 case kMathSqrt: | 1173 case kMathSqrt: |
| 1156 return DefineSameAsFirst(result); | 1174 return DefineSameAsFirst(result); |
| 1157 case kMathPowHalf: | 1175 case kMathPowHalf: |
| 1158 return DefineSameAsFirst(result); | 1176 return DefineSameAsFirst(result); |
| 1159 default: | 1177 default: |
| 1160 UNREACHABLE(); | 1178 UNREACHABLE(); |
| 1161 return NULL; | 1179 return NULL; |
| 1162 } | 1180 } |
| 1163 } | 1181 } |
| 1164 } | 1182 } |
| 1165 | 1183 |
| 1166 | 1184 |
| 1167 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { | 1185 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { |
| 1168 ASSERT(instr->key()->representation().IsTagged()); | 1186 ASSERT(instr->key()->representation().IsTagged()); |
| 1169 LOperand* key = UseFixed(instr->key(), rcx); | 1187 LOperand* key = UseFixed(instr->key(), rcx); |
| 1188 LOperand* context = UseFixed(instr->context(), rsi); |
| 1170 argument_count_ -= instr->argument_count(); | 1189 argument_count_ -= instr->argument_count(); |
| 1171 LCallKeyed* result = new LCallKeyed(key); | 1190 LCallKeyed* result = new LCallKeyed(context, key); |
| 1172 return MarkAsCall(DefineFixed(result, rax), instr); | 1191 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1173 } | 1192 } |
| 1174 | 1193 |
| 1175 | 1194 |
| 1176 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { | 1195 LInstruction* LChunkBuilder::DoCallNamed(HCallNamed* instr) { |
| 1196 LOperand* context = UseFixed(instr->context(), rsi); |
| 1177 argument_count_ -= instr->argument_count(); | 1197 argument_count_ -= instr->argument_count(); |
| 1178 return MarkAsCall(DefineFixed(new LCallNamed, rax), instr); | 1198 LCallNamed* result = new LCallNamed(context); |
| 1199 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1179 } | 1200 } |
| 1180 | 1201 |
| 1181 | 1202 |
| 1182 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { | 1203 LInstruction* LChunkBuilder::DoCallGlobal(HCallGlobal* instr) { |
| 1204 LOperand* context = UseFixed(instr->context(), rsi); |
| 1183 argument_count_ -= instr->argument_count(); | 1205 argument_count_ -= instr->argument_count(); |
| 1184 return MarkAsCall(DefineFixed(new LCallGlobal, rax), instr); | 1206 LCallGlobal* result = new LCallGlobal(context); |
| 1207 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1185 } | 1208 } |
| 1186 | 1209 |
| 1187 | 1210 |
| 1188 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { | 1211 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { |
| 1189 argument_count_ -= instr->argument_count(); | 1212 argument_count_ -= instr->argument_count(); |
| 1190 return MarkAsCall(DefineFixed(new LCallKnownGlobal, rax), instr); | 1213 return MarkAsCall(DefineFixed(new LCallKnownGlobal, rax), instr); |
| 1191 } | 1214 } |
| 1192 | 1215 |
| 1193 | 1216 |
| 1194 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { | 1217 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { |
| 1218 LOperand* context = UseFixed(instr->context(), rsi); |
| 1195 LOperand* constructor = UseFixed(instr->constructor(), rdi); | 1219 LOperand* constructor = UseFixed(instr->constructor(), rdi); |
| 1196 argument_count_ -= instr->argument_count(); | 1220 argument_count_ -= instr->argument_count(); |
| 1197 LCallNew* result = new LCallNew(constructor); | 1221 LCallNew* result = new LCallNew(context, constructor); |
| 1198 return MarkAsCall(DefineFixed(result, rax), instr); | 1222 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1199 } | 1223 } |
| 1200 | 1224 |
| 1201 | 1225 |
| 1202 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { | 1226 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
| 1227 LOperand* context = UseFixed(instr->context(), rsi); |
| 1203 argument_count_ -= instr->argument_count(); | 1228 argument_count_ -= instr->argument_count(); |
| 1204 LCallFunction* result = new LCallFunction(); | 1229 LCallFunction* result = new LCallFunction(context); |
| 1205 return MarkAsCall(DefineFixed(result, rax), instr); | 1230 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1206 } | 1231 } |
| 1207 | 1232 |
| 1208 | 1233 |
| 1209 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { | 1234 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
| 1235 LOperand* context = UseFixed(instr->context(), rsi); |
| 1210 argument_count_ -= instr->argument_count(); | 1236 argument_count_ -= instr->argument_count(); |
| 1211 return MarkAsCall(DefineFixed(new LCallRuntime, rax), instr); | 1237 LCallRuntime* result = new LCallRuntime(context); |
| 1238 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1212 } | 1239 } |
| 1213 | 1240 |
| 1214 | 1241 |
| 1215 LInstruction* LChunkBuilder::DoShr(HShr* instr) { | 1242 LInstruction* LChunkBuilder::DoShr(HShr* instr) { |
| 1216 return DoShift(Token::SHR, instr); | 1243 return DoShift(Token::SHR, instr); |
| 1217 } | 1244 } |
| 1218 | 1245 |
| 1219 | 1246 |
| 1220 LInstruction* LChunkBuilder::DoSar(HSar* instr) { | 1247 LInstruction* LChunkBuilder::DoSar(HSar* instr) { |
| 1221 return DoShift(Token::SAR, instr); | 1248 return DoShift(Token::SAR, instr); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 return MarkAsCall(DefineFixedDouble(result, xmm1), instr, | 1414 return MarkAsCall(DefineFixedDouble(result, xmm1), instr, |
| 1388 CAN_DEOPTIMIZE_EAGERLY); | 1415 CAN_DEOPTIMIZE_EAGERLY); |
| 1389 } | 1416 } |
| 1390 | 1417 |
| 1391 | 1418 |
| 1392 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1419 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
| 1393 Token::Value op = instr->token(); | 1420 Token::Value op = instr->token(); |
| 1394 ASSERT(instr->left()->representation().IsTagged()); | 1421 ASSERT(instr->left()->representation().IsTagged()); |
| 1395 ASSERT(instr->right()->representation().IsTagged()); | 1422 ASSERT(instr->right()->representation().IsTagged()); |
| 1396 bool reversed = (op == Token::GT || op == Token::LTE); | 1423 bool reversed = (op == Token::GT || op == Token::LTE); |
| 1424 LOperand* context = UseFixed(instr->context(), rsi); |
| 1397 LOperand* left = UseFixed(instr->left(), reversed ? rax : rdx); | 1425 LOperand* left = UseFixed(instr->left(), reversed ? rax : rdx); |
| 1398 LOperand* right = UseFixed(instr->right(), reversed ? rdx : rax); | 1426 LOperand* right = UseFixed(instr->right(), reversed ? rdx : rax); |
| 1399 LCmpT* result = new LCmpT(left, right); | 1427 LCmpT* result = new LCmpT(context, left, right); |
| 1400 return MarkAsCall(DefineFixed(result, rax), instr); | 1428 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1401 } | 1429 } |
| 1402 | 1430 |
| 1403 | 1431 |
| 1404 LInstruction* LChunkBuilder::DoCompareIDAndBranch( | 1432 LInstruction* LChunkBuilder::DoCompareIDAndBranch( |
| 1405 HCompareIDAndBranch* instr) { | 1433 HCompareIDAndBranch* instr) { |
| 1406 Representation r = instr->GetInputRepresentation(); | 1434 Representation r = instr->GetInputRepresentation(); |
| 1407 if (r.IsInteger32()) { | 1435 if (r.IsInteger32()) { |
| 1408 ASSERT(instr->left()->representation().IsInteger32()); | 1436 ASSERT(instr->left()->representation().IsInteger32()); |
| 1409 ASSERT(instr->right()->representation().IsInteger32()); | 1437 ASSERT(instr->right()->representation().IsInteger32()); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 | 1554 |
| 1527 | 1555 |
| 1528 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { | 1556 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) { |
| 1529 // The control instruction marking the end of a block that completed | 1557 // The control instruction marking the end of a block that completed |
| 1530 // abruptly (e.g., threw an exception). There is nothing specific to do. | 1558 // abruptly (e.g., threw an exception). There is nothing specific to do. |
| 1531 return NULL; | 1559 return NULL; |
| 1532 } | 1560 } |
| 1533 | 1561 |
| 1534 | 1562 |
| 1535 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { | 1563 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { |
| 1564 LOperand* context = UseFixed(instr->context(), rsi); |
| 1536 LOperand* value = UseFixed(instr->value(), rax); | 1565 LOperand* value = UseFixed(instr->value(), rax); |
| 1537 return MarkAsCall(new LThrow(value), instr); | 1566 return MarkAsCall(new LThrow(context, value), instr); |
| 1538 } | 1567 } |
| 1539 | 1568 |
| 1540 | 1569 |
| 1541 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { | 1570 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { |
| 1542 return NULL; | 1571 return NULL; |
| 1543 } | 1572 } |
| 1544 | 1573 |
| 1545 | 1574 |
| 1546 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { | 1575 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { |
| 1547 // All HForceRepresentation instructions should be eliminated in the | 1576 // All HForceRepresentation instructions should be eliminated in the |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 | 1744 |
| 1716 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { | 1745 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { |
| 1717 LLoadGlobalCell* result = new LLoadGlobalCell; | 1746 LLoadGlobalCell* result = new LLoadGlobalCell; |
| 1718 return instr->check_hole_value() | 1747 return instr->check_hole_value() |
| 1719 ? AssignEnvironment(DefineAsRegister(result)) | 1748 ? AssignEnvironment(DefineAsRegister(result)) |
| 1720 : DefineAsRegister(result); | 1749 : DefineAsRegister(result); |
| 1721 } | 1750 } |
| 1722 | 1751 |
| 1723 | 1752 |
| 1724 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { | 1753 LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { |
| 1754 LOperand* context = UseFixed(instr->context(), rsi); |
| 1725 LOperand* global_object = UseFixed(instr->global_object(), rax); | 1755 LOperand* global_object = UseFixed(instr->global_object(), rax); |
| 1726 LLoadGlobalGeneric* result = new LLoadGlobalGeneric(global_object); | 1756 LLoadGlobalGeneric* result = new LLoadGlobalGeneric(context, global_object); |
| 1727 return MarkAsCall(DefineFixed(result, rax), instr); | 1757 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1728 } | 1758 } |
| 1729 | 1759 |
| 1730 | 1760 |
| 1731 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { | 1761 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { |
| 1732 LStoreGlobalCell* result = | 1762 LStoreGlobalCell* result = |
| 1733 new LStoreGlobalCell(UseRegister(instr->value()), TempRegister()); | 1763 new LStoreGlobalCell(UseRegister(instr->value()), TempRegister()); |
| 1734 return instr->check_hole_value() ? AssignEnvironment(result) : result; | 1764 return instr->check_hole_value() ? AssignEnvironment(result) : result; |
| 1735 } | 1765 } |
| 1736 | 1766 |
| 1737 | 1767 |
| 1738 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { | 1768 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { |
| 1769 LOperand* context = UseFixed(instr->context(), rsi); |
| 1739 LOperand* global_object = UseFixed(instr->global_object(), rdx); | 1770 LOperand* global_object = UseFixed(instr->global_object(), rdx); |
| 1740 LOperand* value = UseFixed(instr->value(), rax); | 1771 LOperand* value = UseFixed(instr->value(), rax); |
| 1741 LStoreGlobalGeneric* result = new LStoreGlobalGeneric(global_object, value); | 1772 LStoreGlobalGeneric* result = |
| 1773 new LStoreGlobalGeneric(context, global_object, value); |
| 1742 return MarkAsCall(result, instr); | 1774 return MarkAsCall(result, instr); |
| 1743 } | 1775 } |
| 1744 | 1776 |
| 1745 | 1777 |
| 1746 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { | 1778 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { |
| 1747 LOperand* context = UseRegisterAtStart(instr->value()); | 1779 LOperand* context = UseRegisterAtStart(instr->value()); |
| 1748 return DefineAsRegister(new LLoadContextSlot(context)); | 1780 return DefineAsRegister(new LLoadContextSlot(context)); |
| 1749 } | 1781 } |
| 1750 | 1782 |
| 1751 | 1783 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1769 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { | 1801 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
| 1770 ASSERT(instr->representation().IsTagged()); | 1802 ASSERT(instr->representation().IsTagged()); |
| 1771 LOperand* obj = UseRegisterAtStart(instr->object()); | 1803 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 1772 return DefineAsRegister(new LLoadNamedField(obj)); | 1804 return DefineAsRegister(new LLoadNamedField(obj)); |
| 1773 } | 1805 } |
| 1774 | 1806 |
| 1775 | 1807 |
| 1776 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( | 1808 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( |
| 1777 HLoadNamedFieldPolymorphic* instr) { | 1809 HLoadNamedFieldPolymorphic* instr) { |
| 1778 ASSERT(instr->representation().IsTagged()); | 1810 ASSERT(instr->representation().IsTagged()); |
| 1811 LOperand* context = UseFixed(instr->context(), rsi); |
| 1779 if (instr->need_generic()) { | 1812 if (instr->need_generic()) { |
| 1780 LOperand* obj = UseFixed(instr->object(), rax); | 1813 LOperand* obj = UseFixed(instr->object(), rax); |
| 1781 LLoadNamedFieldPolymorphic* result = new LLoadNamedFieldPolymorphic(obj); | 1814 LLoadNamedFieldPolymorphic* result = |
| 1815 new LLoadNamedFieldPolymorphic(context, obj); |
| 1782 return MarkAsCall(DefineFixed(result, rax), instr); | 1816 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1783 } else { | 1817 } else { |
| 1784 LOperand* obj = UseRegisterAtStart(instr->object()); | 1818 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 1785 LLoadNamedFieldPolymorphic* result = new LLoadNamedFieldPolymorphic(obj); | 1819 LLoadNamedFieldPolymorphic* result = |
| 1820 new LLoadNamedFieldPolymorphic(context, obj); |
| 1786 return AssignEnvironment(DefineAsRegister(result)); | 1821 return AssignEnvironment(DefineAsRegister(result)); |
| 1787 } | 1822 } |
| 1788 } | 1823 } |
| 1789 | 1824 |
| 1790 | 1825 |
| 1791 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { | 1826 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { |
| 1827 LOperand* context = UseFixed(instr->context(), rsi); |
| 1792 LOperand* object = UseFixed(instr->object(), rax); | 1828 LOperand* object = UseFixed(instr->object(), rax); |
| 1793 LLoadNamedGeneric* result = new LLoadNamedGeneric(object); | 1829 LLoadNamedGeneric* result = new LLoadNamedGeneric(context, object); |
| 1794 return MarkAsCall(DefineFixed(result, rax), instr); | 1830 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1795 } | 1831 } |
| 1796 | 1832 |
| 1797 | 1833 |
| 1798 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( | 1834 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( |
| 1799 HLoadFunctionPrototype* instr) { | 1835 HLoadFunctionPrototype* instr) { |
| 1800 return AssignEnvironment(DefineAsRegister( | 1836 return AssignEnvironment(DefineAsRegister( |
| 1801 new LLoadFunctionPrototype(UseRegister(instr->function())))); | 1837 new LLoadFunctionPrototype(UseRegister(instr->function())))); |
| 1802 } | 1838 } |
| 1803 | 1839 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1856 new LLoadKeyedSpecializedArrayElement(external_pointer, key); | 1892 new LLoadKeyedSpecializedArrayElement(external_pointer, key); |
| 1857 LInstruction* load_instr = DefineAsRegister(result); | 1893 LInstruction* load_instr = DefineAsRegister(result); |
| 1858 // An unsigned int array load might overflow and cause a deopt, make sure it | 1894 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 1859 // has an environment. | 1895 // has an environment. |
| 1860 return (elements_kind == JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS) ? | 1896 return (elements_kind == JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS) ? |
| 1861 AssignEnvironment(load_instr) : load_instr; | 1897 AssignEnvironment(load_instr) : load_instr; |
| 1862 } | 1898 } |
| 1863 | 1899 |
| 1864 | 1900 |
| 1865 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1901 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 1902 LOperand* context = UseFixed(instr->context(), rsi); |
| 1866 LOperand* object = UseFixed(instr->object(), rdx); | 1903 LOperand* object = UseFixed(instr->object(), rdx); |
| 1867 LOperand* key = UseFixed(instr->key(), rax); | 1904 LOperand* key = UseFixed(instr->key(), rax); |
| 1868 | 1905 |
| 1869 LLoadKeyedGeneric* result = new LLoadKeyedGeneric(object, key); | 1906 LLoadKeyedGeneric* result = new LLoadKeyedGeneric(context, object, key); |
| 1870 return MarkAsCall(DefineFixed(result, rax), instr); | 1907 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1871 } | 1908 } |
| 1872 | 1909 |
| 1873 | 1910 |
| 1874 LInstruction* LChunkBuilder::DoStoreKeyedFastElement( | 1911 LInstruction* LChunkBuilder::DoStoreKeyedFastElement( |
| 1875 HStoreKeyedFastElement* instr) { | 1912 HStoreKeyedFastElement* instr) { |
| 1876 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 1913 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 1877 ASSERT(instr->value()->representation().IsTagged()); | 1914 ASSERT(instr->value()->representation().IsTagged()); |
| 1878 ASSERT(instr->object()->representation().IsTagged()); | 1915 ASSERT(instr->object()->representation().IsTagged()); |
| 1879 ASSERT(instr->key()->representation().IsInteger32()); | 1916 ASSERT(instr->key()->representation().IsInteger32()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 : UseRegister(instr->value()); | 1964 : UseRegister(instr->value()); |
| 1928 LOperand* key = UseRegisterOrConstant(instr->key()); | 1965 LOperand* key = UseRegisterOrConstant(instr->key()); |
| 1929 | 1966 |
| 1930 return new LStoreKeyedSpecializedArrayElement(external_pointer, | 1967 return new LStoreKeyedSpecializedArrayElement(external_pointer, |
| 1931 key, | 1968 key, |
| 1932 val); | 1969 val); |
| 1933 } | 1970 } |
| 1934 | 1971 |
| 1935 | 1972 |
| 1936 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 1973 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 1974 LOperand* context = UseFixed(instr->context(), rsi); |
| 1937 LOperand* object = UseFixed(instr->object(), rdx); | 1975 LOperand* object = UseFixed(instr->object(), rdx); |
| 1938 LOperand* key = UseFixed(instr->key(), rcx); | 1976 LOperand* key = UseFixed(instr->key(), rcx); |
| 1939 LOperand* value = UseFixed(instr->value(), rax); | 1977 LOperand* value = UseFixed(instr->value(), rax); |
| 1940 | 1978 |
| 1941 ASSERT(instr->object()->representation().IsTagged()); | 1979 ASSERT(instr->object()->representation().IsTagged()); |
| 1942 ASSERT(instr->key()->representation().IsTagged()); | 1980 ASSERT(instr->key()->representation().IsTagged()); |
| 1943 ASSERT(instr->value()->representation().IsTagged()); | 1981 ASSERT(instr->value()->representation().IsTagged()); |
| 1944 | 1982 |
| 1945 LStoreKeyedGeneric* result = new LStoreKeyedGeneric(object, key, value); | 1983 LStoreKeyedGeneric* result = |
| 1984 new LStoreKeyedGeneric(context, object, key, value); |
| 1946 return MarkAsCall(result, instr); | 1985 return MarkAsCall(result, instr); |
| 1947 } | 1986 } |
| 1948 | 1987 |
| 1949 | 1988 |
| 1950 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { | 1989 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
| 1951 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 1990 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 1952 | 1991 |
| 1953 LOperand* obj = needs_write_barrier | 1992 LOperand* obj = needs_write_barrier |
| 1954 ? UseTempRegister(instr->object()) | 1993 ? UseTempRegister(instr->object()) |
| 1955 : UseRegisterAtStart(instr->object()); | 1994 : UseRegisterAtStart(instr->object()); |
| 1956 | 1995 |
| 1957 LOperand* val = needs_write_barrier | 1996 LOperand* val = needs_write_barrier |
| 1958 ? UseTempRegister(instr->value()) | 1997 ? UseTempRegister(instr->value()) |
| 1959 : UseRegister(instr->value()); | 1998 : UseRegister(instr->value()); |
| 1960 | 1999 |
| 1961 // We only need a scratch register if we have a write barrier or we | 2000 // We only need a scratch register if we have a write barrier or we |
| 1962 // have a store into the properties array (not in-object-property). | 2001 // have a store into the properties array (not in-object-property). |
| 1963 LOperand* temp = (!instr->is_in_object() || needs_write_barrier) | 2002 LOperand* temp = (!instr->is_in_object() || needs_write_barrier) |
| 1964 ? TempRegister() : NULL; | 2003 ? TempRegister() : NULL; |
| 1965 | 2004 |
| 1966 return new LStoreNamedField(obj, val, temp); | 2005 return new LStoreNamedField(obj, val, temp); |
| 1967 } | 2006 } |
| 1968 | 2007 |
| 1969 | 2008 |
| 1970 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { | 2009 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { |
| 2010 LOperand* context = UseFixed(instr->context(), rsi); |
| 1971 LOperand* object = UseFixed(instr->object(), rdx); | 2011 LOperand* object = UseFixed(instr->object(), rdx); |
| 1972 LOperand* value = UseFixed(instr->value(), rax); | 2012 LOperand* value = UseFixed(instr->value(), rax); |
| 1973 | 2013 |
| 1974 LStoreNamedGeneric* result = new LStoreNamedGeneric(object, value); | 2014 LStoreNamedGeneric* result = new LStoreNamedGeneric(context, object, value); |
| 1975 return MarkAsCall(result, instr); | 2015 return MarkAsCall(result, instr); |
| 1976 } | 2016 } |
| 1977 | 2017 |
| 1978 | 2018 |
| 1979 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { | 2019 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { |
| 2020 LOperand* context = UseFixed(instr->context(), rsi); |
| 1980 LOperand* left = UseOrConstantAtStart(instr->left()); | 2021 LOperand* left = UseOrConstantAtStart(instr->left()); |
| 1981 LOperand* right = UseOrConstantAtStart(instr->right()); | 2022 LOperand* right = UseOrConstantAtStart(instr->right()); |
| 1982 return MarkAsCall(DefineFixed(new LStringAdd(left, right), rax), instr); | 2023 LStringAdd* result = new LStringAdd(context, left, right); |
| 2024 return MarkAsCall(DefineFixed(result, rax), instr); |
| 1983 } | 2025 } |
| 1984 | 2026 |
| 1985 | 2027 |
| 1986 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 2028 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
| 1987 LOperand* string = UseTempRegister(instr->string()); | 2029 LOperand* string = UseTempRegister(instr->string()); |
| 1988 LOperand* index = UseTempRegister(instr->index()); | 2030 LOperand* index = UseTempRegister(instr->index()); |
| 1989 LStringCharCodeAt* result = new LStringCharCodeAt(string, index); | 2031 LOperand* context = UseAny(instr->context()); |
| 2032 LStringCharCodeAt* result = new LStringCharCodeAt(context, string, index); |
| 1990 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2033 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 1991 } | 2034 } |
| 1992 | 2035 |
| 1993 | 2036 |
| 1994 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { | 2037 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
| 1995 LOperand* char_code = UseRegister(instr->value()); | 2038 LOperand* char_code = UseRegister(instr->value()); |
| 1996 LStringCharFromCode* result = new LStringCharFromCode(char_code); | 2039 LOperand* context = UseAny(instr->context()); |
| 2040 LStringCharFromCode* result = new LStringCharFromCode(context, char_code); |
| 1997 return AssignPointerMap(DefineAsRegister(result)); | 2041 return AssignPointerMap(DefineAsRegister(result)); |
| 1998 } | 2042 } |
| 1999 | 2043 |
| 2000 | 2044 |
| 2001 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { | 2045 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { |
| 2002 LOperand* string = UseRegisterAtStart(instr->value()); | 2046 LOperand* string = UseRegisterAtStart(instr->value()); |
| 2003 return DefineAsRegister(new LStringLength(string)); | 2047 return DefineAsRegister(new LStringLength(string)); |
| 2004 } | 2048 } |
| 2005 | 2049 |
| 2006 | 2050 |
| 2007 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { | 2051 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { |
| 2008 return MarkAsCall(DefineFixed(new LArrayLiteral, rax), instr); | 2052 LOperand* context = UseFixed(instr->context(), rsi); |
| 2053 return MarkAsCall(DefineFixed(new LArrayLiteral(context), rax), instr); |
| 2009 } | 2054 } |
| 2010 | 2055 |
| 2011 | 2056 |
| 2012 LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) { | 2057 LInstruction* LChunkBuilder::DoObjectLiteral(HObjectLiteral* instr) { |
| 2013 return MarkAsCall(DefineFixed(new LObjectLiteral, rax), instr); | 2058 LOperand* context = UseFixed(instr->context(), rsi); |
| 2059 return MarkAsCall(DefineFixed(new LObjectLiteral(context), rax), instr); |
| 2014 } | 2060 } |
| 2015 | 2061 |
| 2016 | 2062 |
| 2017 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { | 2063 LInstruction* LChunkBuilder::DoRegExpLiteral(HRegExpLiteral* instr) { |
| 2018 return MarkAsCall(DefineFixed(new LRegExpLiteral, rax), instr); | 2064 LOperand* context = UseFixed(instr->context(), rsi); |
| 2065 return MarkAsCall(DefineFixed(new LRegExpLiteral(context), rax), instr); |
| 2019 } | 2066 } |
| 2020 | 2067 |
| 2021 | 2068 |
| 2022 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { | 2069 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { |
| 2023 return MarkAsCall(DefineFixed(new LFunctionLiteral, rax), instr); | 2070 LOperand* context = UseFixed(instr->context(), rsi); |
| 2071 return MarkAsCall(DefineFixed(new LFunctionLiteral(context), rax), instr); |
| 2024 } | 2072 } |
| 2025 | 2073 |
| 2026 | 2074 |
| 2027 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { | 2075 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { |
| 2028 LDeleteProperty* result = | 2076 LOperand* context = UseFixed(instr->context(), rsi); |
| 2029 new LDeleteProperty(UseAtStart(instr->object()), | 2077 LOperand* object = UseAtStart(instr->object()); |
| 2030 UseOrConstantAtStart(instr->key())); | 2078 LOperand* key = UseOrConstantAtStart(instr->key()); |
| 2079 LDeleteProperty* result = new LDeleteProperty(context, object, key); |
| 2031 return MarkAsCall(DefineFixed(result, rax), instr); | 2080 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2032 } | 2081 } |
| 2033 | 2082 |
| 2034 | 2083 |
| 2035 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { | 2084 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { |
| 2036 allocator_->MarkAsOsrEntry(); | 2085 allocator_->MarkAsOsrEntry(); |
| 2037 current_block_->last_environment()->set_ast_id(instr->ast_id()); | 2086 current_block_->last_environment()->set_ast_id(instr->ast_id()); |
| 2038 return AssignEnvironment(new LOsrEntry); | 2087 return AssignEnvironment(new LOsrEntry); |
| 2039 } | 2088 } |
| 2040 | 2089 |
| 2041 | 2090 |
| 2042 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { | 2091 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { |
| 2043 int spill_index = chunk()->GetParameterStackSlot(instr->index()); | 2092 int spill_index = chunk()->GetParameterStackSlot(instr->index()); |
| 2044 return DefineAsSpilled(new LParameter, spill_index); | 2093 return DefineAsSpilled(new LParameter, spill_index); |
| 2045 } | 2094 } |
| 2046 | 2095 |
| 2047 | 2096 |
| 2048 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { | 2097 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
| 2049 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. | 2098 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. |
| 2050 if (spill_index > LUnallocated::kMaxFixedIndex) { | 2099 if (spill_index > LUnallocated::kMaxFixedIndex) { |
| 2051 Abort("Too many spill slots needed for OSR"); | 2100 Abort("Too many spill slots needed for OSR"); |
| 2052 spill_index = 0; | 2101 spill_index = 0; |
| 2053 } | 2102 } |
| 2054 return DefineAsSpilled(new LUnknownOSRValue, spill_index); | 2103 return DefineAsSpilled(new LUnknownOSRValue, spill_index); |
| 2055 } | 2104 } |
| 2056 | 2105 |
| 2057 | 2106 |
| 2058 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { | 2107 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
| 2108 LOperand* context = UseFixed(instr->context(), rsi); |
| 2059 argument_count_ -= instr->argument_count(); | 2109 argument_count_ -= instr->argument_count(); |
| 2060 return MarkAsCall(DefineFixed(new LCallStub, rax), instr); | 2110 return MarkAsCall(DefineFixed(new LCallStub(context), rax), instr); |
| 2061 } | 2111 } |
| 2062 | 2112 |
| 2063 | 2113 |
| 2064 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { | 2114 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { |
| 2065 // There are no real uses of the arguments object. | 2115 // There are no real uses of the arguments object. |
| 2066 // arguments.length and element access are supported directly on | 2116 // arguments.length and element access are supported directly on |
| 2067 // stack arguments, and any real arguments object use causes a bailout. | 2117 // stack arguments, and any real arguments object use causes a bailout. |
| 2068 // So this value is never used. | 2118 // So this value is never used. |
| 2069 return NULL; | 2119 return NULL; |
| 2070 } | 2120 } |
| 2071 | 2121 |
| 2072 | 2122 |
| 2073 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { | 2123 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { |
| 2074 LOperand* arguments = UseRegister(instr->arguments()); | 2124 LOperand* arguments = UseRegister(instr->arguments()); |
| 2075 LOperand* length = UseTempRegister(instr->length()); | 2125 LOperand* length = UseTempRegister(instr->length()); |
| 2076 LOperand* index = Use(instr->index()); | 2126 LOperand* index = Use(instr->index()); |
| 2077 LAccessArgumentsAt* result = new LAccessArgumentsAt(arguments, length, index); | 2127 LAccessArgumentsAt* result = new LAccessArgumentsAt(arguments, length, index); |
| 2078 return AssignEnvironment(DefineAsRegister(result)); | 2128 return AssignEnvironment(DefineAsRegister(result)); |
| 2079 } | 2129 } |
| 2080 | 2130 |
| 2081 | 2131 |
| 2082 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { | 2132 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { |
| 2083 LOperand* object = UseFixed(instr->value(), rax); | 2133 LOperand* object = UseFixed(instr->value(), rax); |
| 2084 LToFastProperties* result = new LToFastProperties(object); | 2134 LToFastProperties* result = new LToFastProperties(object); |
| 2085 return MarkAsCall(DefineFixed(result, rax), instr); | 2135 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2086 } | 2136 } |
| 2087 | 2137 |
| 2088 | 2138 |
| 2089 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { | 2139 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
| 2090 LTypeof* result = new LTypeof(UseAtStart(instr->value())); | 2140 LOperand* context = UseFixed(instr->context(), rsi); |
| 2141 LOperand* value = UseAtStart(instr->value()); |
| 2142 LTypeof* result = new LTypeof(context, value); |
| 2091 return MarkAsCall(DefineFixed(result, rax), instr); | 2143 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2092 } | 2144 } |
| 2093 | 2145 |
| 2094 | 2146 |
| 2095 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { | 2147 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { |
| 2096 return new LTypeofIsAndBranch(UseTempRegister(instr->value())); | 2148 return new LTypeofIsAndBranch(UseTempRegister(instr->value())); |
| 2097 } | 2149 } |
| 2098 | 2150 |
| 2099 | 2151 |
| 2100 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2152 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2129 ClearInstructionPendingDeoptimizationEnvironment(); | 2181 ClearInstructionPendingDeoptimizationEnvironment(); |
| 2130 return result; | 2182 return result; |
| 2131 } | 2183 } |
| 2132 | 2184 |
| 2133 return NULL; | 2185 return NULL; |
| 2134 } | 2186 } |
| 2135 | 2187 |
| 2136 | 2188 |
| 2137 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 2189 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
| 2138 if (instr->is_function_entry()) { | 2190 if (instr->is_function_entry()) { |
| 2139 return MarkAsCall(new LStackCheck, instr); | 2191 LOperand* context = UseFixed(instr->context(), rsi); |
| 2192 return MarkAsCall(new LStackCheck(context), instr); |
| 2140 } else { | 2193 } else { |
| 2141 ASSERT(instr->is_backwards_branch()); | 2194 ASSERT(instr->is_backwards_branch()); |
| 2142 return AssignEnvironment(AssignPointerMap(new LStackCheck)); | 2195 LOperand* context = UseAny(instr->context()); |
| 2196 return AssignEnvironment(AssignPointerMap(new LStackCheck(context))); |
| 2143 } | 2197 } |
| 2144 } | 2198 } |
| 2145 | 2199 |
| 2146 | 2200 |
| 2147 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { | 2201 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { |
| 2148 HEnvironment* outer = current_block_->last_environment(); | 2202 HEnvironment* outer = current_block_->last_environment(); |
| 2149 HConstant* undefined = graph()->GetConstantUndefined(); | 2203 HConstant* undefined = graph()->GetConstantUndefined(); |
| 2150 HEnvironment* inner = outer->CopyForInlining(instr->closure(), | 2204 HEnvironment* inner = outer->CopyForInlining(instr->closure(), |
| 2151 instr->function(), | 2205 instr->function(), |
| 2152 undefined, | 2206 undefined, |
| 2153 instr->call_kind()); | 2207 instr->call_kind()); |
| 2154 current_block_->UpdateEnvironment(inner); | 2208 current_block_->UpdateEnvironment(inner); |
| 2155 chunk_->AddInlinedClosure(instr->closure()); | 2209 chunk_->AddInlinedClosure(instr->closure()); |
| 2156 return NULL; | 2210 return NULL; |
| 2157 } | 2211 } |
| 2158 | 2212 |
| 2159 | 2213 |
| 2160 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2214 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2161 HEnvironment* outer = current_block_->last_environment()->outer(); | 2215 HEnvironment* outer = current_block_->last_environment()->outer(); |
| 2162 current_block_->UpdateEnvironment(outer); | 2216 current_block_->UpdateEnvironment(outer); |
| 2163 return NULL; | 2217 return NULL; |
| 2164 } | 2218 } |
| 2165 | 2219 |
| 2166 | 2220 |
| 2167 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2221 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
| 2222 LOperand* context = UseFixed(instr->context(), rsi); |
| 2168 LOperand* key = UseOrConstantAtStart(instr->key()); | 2223 LOperand* key = UseOrConstantAtStart(instr->key()); |
| 2169 LOperand* object = UseOrConstantAtStart(instr->object()); | 2224 LOperand* object = UseOrConstantAtStart(instr->object()); |
| 2170 LIn* result = new LIn(key, object); | 2225 LIn* result = new LIn(context, key, object); |
| 2171 return MarkAsCall(DefineFixed(result, rax), instr); | 2226 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2172 } | 2227 } |
| 2173 | 2228 |
| 2174 | 2229 |
| 2175 } } // namespace v8::internal | 2230 } } // namespace v8::internal |
| 2176 | 2231 |
| 2177 #endif // V8_TARGET_ARCH_X64 | 2232 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |