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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 | 508 |
509 // If instruction does not have side-effects lazy deoptimization | 509 // If instruction does not have side-effects lazy deoptimization |
510 // after the call will try to deoptimize to the point before the call. | 510 // after the call will try to deoptimize to the point before the call. |
511 // Thus we still need to attach environment to this call even if | 511 // Thus we still need to attach environment to this call even if |
512 // call sequence can not deoptimize eagerly. | 512 // call sequence can not deoptimize eagerly. |
513 bool needs_environment = | 513 bool needs_environment = |
514 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || | 514 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || |
515 !hinstr->HasObservableSideEffects(); | 515 !hinstr->HasObservableSideEffects(); |
516 if (needs_environment && !instr->HasEnvironment()) { | 516 if (needs_environment && !instr->HasEnvironment()) { |
517 instr = AssignEnvironment(instr); | 517 instr = AssignEnvironment(instr); |
| 518 // We can't really figure out if the environment is needed or not. |
| 519 instr->environment()->set_has_been_used(); |
518 } | 520 } |
519 | 521 |
520 return instr; | 522 return instr; |
521 } | 523 } |
522 | 524 |
523 | 525 |
524 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { | 526 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { |
525 ASSERT(!instr->HasPointerMap()); | 527 ASSERT(!instr->HasPointerMap()); |
526 instr->set_pointer_map(new(zone()) LPointerMap(zone())); | 528 instr->set_pointer_map(new(zone()) LPointerMap(zone())); |
527 return instr; | 529 return instr; |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 ASSERT(to.IsInteger32()); | 1102 ASSERT(to.IsInteger32()); |
1101 if (val->type().IsSmi() || val->representation().IsSmi()) { | 1103 if (val->type().IsSmi() || val->representation().IsSmi()) { |
1102 LOperand* value = UseRegisterAtStart(val); | 1104 LOperand* value = UseRegisterAtStart(val); |
1103 return DefineAsRegister(new(zone()) LSmiUntag(value, false)); | 1105 return DefineAsRegister(new(zone()) LSmiUntag(value, false)); |
1104 } else { | 1106 } else { |
1105 LOperand* value = UseRegister(val); | 1107 LOperand* value = UseRegister(val); |
1106 LOperand* temp1 = TempRegister(); | 1108 LOperand* temp1 = TempRegister(); |
1107 LOperand* temp2 = instr->CanTruncateToInt32() ? NULL : FixedTemp(d24); | 1109 LOperand* temp2 = instr->CanTruncateToInt32() ? NULL : FixedTemp(d24); |
1108 LInstruction* result = | 1110 LInstruction* result = |
1109 DefineAsRegister(new(zone()) LTaggedToI(value, temp1, temp2)); | 1111 DefineAsRegister(new(zone()) LTaggedToI(value, temp1, temp2)); |
1110 if (!val->representation().IsSmi()) { | 1112 if (!val->representation().IsSmi()) result = AssignEnvironment(result); |
1111 // Note: Only deopts in deferred code. | |
1112 result = AssignEnvironment(result); | |
1113 } | |
1114 return result; | 1113 return result; |
1115 } | 1114 } |
1116 } | 1115 } |
1117 } else if (from.IsDouble()) { | 1116 } else if (from.IsDouble()) { |
1118 if (to.IsTagged()) { | 1117 if (to.IsTagged()) { |
1119 info()->MarkAsDeferredCalling(); | 1118 info()->MarkAsDeferredCalling(); |
1120 LOperand* value = UseRegister(val); | 1119 LOperand* value = UseRegister(val); |
1121 LOperand* temp1 = TempRegister(); | 1120 LOperand* temp1 = TempRegister(); |
1122 LOperand* temp2 = TempRegister(); | 1121 LOperand* temp2 = TempRegister(); |
1123 LNumberTagD* result = new(zone()) LNumberTagD(value, temp1, temp2); | 1122 LNumberTagD* result = new(zone()) LNumberTagD(value, temp1, temp2); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) { | 1186 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) { |
1188 LOperand* value = NULL; | 1187 LOperand* value = NULL; |
1189 LOperand* temp = NULL; | 1188 LOperand* temp = NULL; |
1190 if (!instr->CanOmitMapChecks()) { | 1189 if (!instr->CanOmitMapChecks()) { |
1191 value = UseRegisterAtStart(instr->value()); | 1190 value = UseRegisterAtStart(instr->value()); |
1192 temp = TempRegister(); | 1191 temp = TempRegister(); |
1193 if (instr->has_migration_target()) info()->MarkAsDeferredCalling(); | 1192 if (instr->has_migration_target()) info()->MarkAsDeferredCalling(); |
1194 } | 1193 } |
1195 LInstruction* result = new(zone()) LCheckMaps(value, temp); | 1194 LInstruction* result = new(zone()) LCheckMaps(value, temp); |
1196 if (!instr->CanOmitMapChecks()) { | 1195 if (!instr->CanOmitMapChecks()) { |
1197 // Note: Only deopts in deferred code. | |
1198 result = AssignEnvironment(result); | 1196 result = AssignEnvironment(result); |
1199 if (instr->has_migration_target()) return AssignPointerMap(result); | 1197 if (instr->has_migration_target()) result = AssignPointerMap(result); |
1200 } | 1198 } |
1201 return result; | 1199 return result; |
1202 } | 1200 } |
1203 | 1201 |
1204 | 1202 |
1205 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) { | 1203 LInstruction* LChunkBuilder::DoCheckHeapObject(HCheckHeapObject* instr) { |
1206 LOperand* value = UseRegisterAtStart(instr->value()); | 1204 LOperand* value = UseRegisterAtStart(instr->value()); |
1207 return AssignEnvironment(new(zone()) LCheckNonSmi(value)); | 1205 return AssignEnvironment(new(zone()) LCheckNonSmi(value)); |
1208 } | 1206 } |
1209 | 1207 |
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2425 if (r.IsTagged()) { | 2423 if (r.IsTagged()) { |
2426 // The tagged case might need to allocate a HeapNumber for the result, | 2424 // The tagged case might need to allocate a HeapNumber for the result, |
2427 // so it is handled by a separate LInstruction. | 2425 // so it is handled by a separate LInstruction. |
2428 LOperand* context = UseFixed(instr->context(), cp); | 2426 LOperand* context = UseFixed(instr->context(), cp); |
2429 LOperand* input = UseRegister(instr->value()); | 2427 LOperand* input = UseRegister(instr->value()); |
2430 LOperand* temp1 = TempRegister(); | 2428 LOperand* temp1 = TempRegister(); |
2431 LOperand* temp2 = TempRegister(); | 2429 LOperand* temp2 = TempRegister(); |
2432 LOperand* temp3 = TempRegister(); | 2430 LOperand* temp3 = TempRegister(); |
2433 LInstruction* result = DefineAsRegister( | 2431 LInstruction* result = DefineAsRegister( |
2434 new(zone()) LMathAbsTagged(context, input, temp1, temp2, temp3)); | 2432 new(zone()) LMathAbsTagged(context, input, temp1, temp2, temp3)); |
2435 // Note: Only deopts in deferred code. | |
2436 return AssignEnvironment(AssignPointerMap(result)); | 2433 return AssignEnvironment(AssignPointerMap(result)); |
2437 } else { | 2434 } else { |
2438 LOperand* input = UseRegisterAtStart(instr->value()); | 2435 LOperand* input = UseRegisterAtStart(instr->value()); |
2439 LInstruction* result = DefineAsRegister(new(zone()) LMathAbs(input)); | 2436 LInstruction* result = DefineAsRegister(new(zone()) LMathAbs(input)); |
2440 if (!r.IsDouble()) result = AssignEnvironment(result); | 2437 if (!r.IsDouble()) result = AssignEnvironment(result); |
2441 return result; | 2438 return result; |
2442 } | 2439 } |
2443 } | 2440 } |
2444 case kMathExp: { | 2441 case kMathExp: { |
2445 ASSERT(instr->representation().IsDouble()); | 2442 ASSERT(instr->representation().IsDouble()); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 | 2561 |
2565 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2562 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
2566 LOperand* receiver = UseRegister(instr->receiver()); | 2563 LOperand* receiver = UseRegister(instr->receiver()); |
2567 LOperand* function = UseRegister(instr->function()); | 2564 LOperand* function = UseRegister(instr->function()); |
2568 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2565 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
2569 return AssignEnvironment(DefineAsRegister(result)); | 2566 return AssignEnvironment(DefineAsRegister(result)); |
2570 } | 2567 } |
2571 | 2568 |
2572 | 2569 |
2573 } } // namespace v8::internal | 2570 } } // namespace v8::internal |
OLD | NEW |