OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 } | 1169 } |
1170 } | 1170 } |
1171 } | 1171 } |
1172 | 1172 |
1173 UNREACHABLE(); | 1173 UNREACHABLE(); |
1174 return NULL; | 1174 return NULL; |
1175 } | 1175 } |
1176 | 1176 |
1177 | 1177 |
1178 LInstruction* LChunkBuilder::DoCheckValue(HCheckValue* instr) { | 1178 LInstruction* LChunkBuilder::DoCheckValue(HCheckValue* instr) { |
1179 // We only need a temp register if the target is in new space, but we can't | 1179 LOperand* value = UseRegisterAtStart(instr->value()); |
1180 // dereference the handle to test that here. | 1180 return AssignEnvironment(new(zone()) LCheckValue(value)); |
1181 // TODO(all): Check these constraints. The temp register is not always used. | |
1182 LOperand* value = UseRegister(instr->value()); | |
1183 LOperand* temp = TempRegister(); | |
1184 return AssignEnvironment(new(zone()) LCheckValue(value, temp)); | |
1185 } | 1181 } |
1186 | 1182 |
1187 | 1183 |
1188 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { | 1184 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { |
1189 LOperand* value = UseRegisterAtStart(instr->value()); | 1185 LOperand* value = UseRegisterAtStart(instr->value()); |
1190 LOperand* temp = TempRegister(); | 1186 LOperand* temp = TempRegister(); |
1191 LInstruction* result = new(zone()) LCheckInstanceType(value, temp); | 1187 LInstruction* result = new(zone()) LCheckInstanceType(value, temp); |
1192 return AssignEnvironment(result); | 1188 return AssignEnvironment(result); |
1193 } | 1189 } |
1194 | 1190 |
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2285 LOperand* string = UseRegisterAndClobber(instr->string()); | 2281 LOperand* string = UseRegisterAndClobber(instr->string()); |
2286 LOperand* index = UseRegisterAndClobber(instr->index()); | 2282 LOperand* index = UseRegisterAndClobber(instr->index()); |
2287 LOperand* context = UseAny(instr->context()); | 2283 LOperand* context = UseAny(instr->context()); |
2288 LStringCharCodeAt* result = | 2284 LStringCharCodeAt* result = |
2289 new(zone()) LStringCharCodeAt(context, string, index); | 2285 new(zone()) LStringCharCodeAt(context, string, index); |
2290 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2286 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
2291 } | 2287 } |
2292 | 2288 |
2293 | 2289 |
2294 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { | 2290 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
2295 // TODO(all) use at start and remove assert in codegen | |
2296 LOperand* char_code = UseRegister(instr->value()); | 2291 LOperand* char_code = UseRegister(instr->value()); |
2297 LOperand* context = UseAny(instr->context()); | 2292 LOperand* context = UseAny(instr->context()); |
2298 LStringCharFromCode* result = | 2293 LStringCharFromCode* result = |
2299 new(zone()) LStringCharFromCode(context, char_code); | 2294 new(zone()) LStringCharFromCode(context, char_code); |
2300 return AssignPointerMap(DefineAsRegister(result)); | 2295 return AssignPointerMap(DefineAsRegister(result)); |
2301 } | 2296 } |
2302 | 2297 |
2303 | 2298 |
2304 LInstruction* LChunkBuilder::DoStringCompareAndBranch( | 2299 LInstruction* LChunkBuilder::DoStringCompareAndBranch( |
2305 HStringCompareAndBranch* instr) { | 2300 HStringCompareAndBranch* instr) { |
2306 ASSERT(instr->left()->representation().IsTagged()); | 2301 ASSERT(instr->left()->representation().IsTagged()); |
2307 ASSERT(instr->right()->representation().IsTagged()); | 2302 ASSERT(instr->right()->representation().IsTagged()); |
2308 LOperand* context = UseFixed(instr->context(), cp); | 2303 LOperand* context = UseFixed(instr->context(), cp); |
2309 LOperand* left = UseFixed(instr->left(), x1); | 2304 LOperand* left = UseFixed(instr->left(), x1); |
2310 LOperand* right = UseFixed(instr->right(), x0); | 2305 LOperand* right = UseFixed(instr->right(), x0); |
2311 LStringCompareAndBranch* result = | 2306 LStringCompareAndBranch* result = |
2312 new(zone()) LStringCompareAndBranch(context, left, right); | 2307 new(zone()) LStringCompareAndBranch(context, left, right); |
2313 return MarkAsCall(result, instr); | 2308 return MarkAsCall(result, instr); |
2314 } | 2309 } |
2315 | 2310 |
2316 | 2311 |
2317 LInstruction* LChunkBuilder::DoSub(HSub* instr) { | 2312 LInstruction* LChunkBuilder::DoSub(HSub* instr) { |
2318 if (instr->representation().IsSmiOrInteger32()) { | 2313 if (instr->representation().IsSmiOrInteger32()) { |
2319 ASSERT(instr->left()->representation().Equals(instr->representation())); | 2314 ASSERT(instr->left()->representation().Equals(instr->representation())); |
2320 ASSERT(instr->right()->representation().Equals(instr->representation())); | 2315 ASSERT(instr->right()->representation().Equals(instr->representation())); |
2321 LOperand *left; | 2316 LOperand *left; |
2322 if (instr->left()->IsConstant() && | 2317 if (instr->left()->IsConstant() && |
2323 (HConstant::cast(instr->left())->Integer32Value() == 0)) { | 2318 (HConstant::cast(instr->left())->Integer32Value() == 0)) { |
2324 left = UseConstant(instr->left()); | 2319 left = UseConstant(instr->left()); |
2325 } else { | 2320 } else { |
2326 left = UseRegisterAtStart(instr->left()); | 2321 left = UseRegisterAtStart(instr->left()); |
2327 } | 2322 } |
2328 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); | 2323 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); |
2329 LInstruction* result = instr->representation().IsSmi() ? | 2324 LInstruction* result = instr->representation().IsSmi() ? |
2330 DefineAsRegister(new(zone()) LSubS(left, right)) : | 2325 DefineAsRegister(new(zone()) LSubS(left, right)) : |
2331 DefineAsRegister(new(zone()) LSubI(left, right)); | 2326 DefineAsRegister(new(zone()) LSubI(left, right)); |
2332 if (instr->CheckFlag(HValue::kCanOverflow)) { | 2327 if (instr->CheckFlag(HValue::kCanOverflow)) { |
2333 result = AssignEnvironment(result); | 2328 result = AssignEnvironment(result); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2561 | 2556 |
2562 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2557 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
2563 LOperand* receiver = UseRegister(instr->receiver()); | 2558 LOperand* receiver = UseRegister(instr->receiver()); |
2564 LOperand* function = UseRegister(instr->function()); | 2559 LOperand* function = UseRegister(instr->function()); |
2565 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2560 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
2566 return AssignEnvironment(DefineAsRegister(result)); | 2561 return AssignEnvironment(DefineAsRegister(result)); |
2567 } | 2562 } |
2568 | 2563 |
2569 | 2564 |
2570 } } // namespace v8::internal | 2565 } } // namespace v8::internal |
OLD | NEW |