OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 break; | 650 break; |
651 case STUB: | 651 case STUB: |
652 translation->BeginCompiledStubFrame(); | 652 translation->BeginCompiledStubFrame(); |
653 break; | 653 break; |
654 default: | 654 default: |
655 UNREACHABLE(); | 655 UNREACHABLE(); |
656 } | 656 } |
657 | 657 |
658 for (int i = 0; i < translation_size; ++i) { | 658 for (int i = 0; i < translation_size; ++i) { |
659 LOperand* value = environment->values()->at(i); | 659 LOperand* value = environment->values()->at(i); |
660 // spilled_registers_ and spilled_double_registers_ are either | |
661 // both NULL or both set. | |
662 if (environment->spilled_registers() != NULL && value != NULL) { | |
663 if (value->IsRegister() && | |
664 environment->spilled_registers()[value->index()] != NULL) { | |
665 translation->MarkDuplicate(); | |
666 AddToTranslation(translation, | |
667 environment->spilled_registers()[value->index()], | |
668 environment->HasTaggedValueAt(i), | |
669 environment->HasUint32ValueAt(i)); | |
670 } else if ( | |
671 value->IsDoubleRegister() && | |
672 environment->spilled_double_registers()[value->index()] != NULL) { | |
673 translation->MarkDuplicate(); | |
674 AddToTranslation( | |
675 translation, | |
676 environment->spilled_double_registers()[value->index()], | |
677 false, | |
678 false); | |
679 } | |
680 } | |
681 | 660 |
682 // TODO(mstarzinger): Introduce marker operands to indicate that this value | 661 // TODO(mstarzinger): Introduce marker operands to indicate that this value |
683 // is not present and must be reconstructed from the deoptimizer. Currently | 662 // is not present and must be reconstructed from the deoptimizer. Currently |
684 // this is only used for the arguments object. | 663 // this is only used for the arguments object. |
685 if (value == NULL) { | 664 if (value == NULL) { |
686 int arguments_count = environment->values()->length() - translation_size; | 665 int arguments_count = environment->values()->length() - translation_size; |
687 translation->BeginArgumentsObject(arguments_count); | 666 translation->BeginArgumentsObject(arguments_count); |
688 for (int i = 0; i < arguments_count; ++i) { | 667 for (int i = 0; i < arguments_count; ++i) { |
689 LOperand* value = environment->values()->at(translation_size + i); | 668 LOperand* value = environment->values()->at(translation_size + i); |
690 ASSERT(environment->spilled_registers() == NULL || | |
691 !value->IsRegister() || | |
692 environment->spilled_registers()[value->index()] == NULL); | |
693 ASSERT(environment->spilled_registers() == NULL || | |
694 !value->IsDoubleRegister() || | |
695 environment->spilled_double_registers()[value->index()] == NULL); | |
696 AddToTranslation(translation, | 669 AddToTranslation(translation, |
697 value, | 670 value, |
698 environment->HasTaggedValueAt(translation_size + i), | 671 environment->HasTaggedValueAt(translation_size + i), |
699 environment->HasUint32ValueAt(translation_size + i)); | 672 environment->HasUint32ValueAt(translation_size + i)); |
700 } | 673 } |
701 continue; | 674 continue; |
702 } | 675 } |
703 | 676 |
704 AddToTranslation(translation, | 677 AddToTranslation(translation, |
705 value, | 678 value, |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 1155 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
1183 break; | 1156 break; |
1184 } | 1157 } |
1185 default: | 1158 default: |
1186 UNREACHABLE(); | 1159 UNREACHABLE(); |
1187 } | 1160 } |
1188 } | 1161 } |
1189 | 1162 |
1190 | 1163 |
1191 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { | 1164 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { |
1192 // Nothing to do. | 1165 // Record the address of the first unknown OSR value as the place to enter. |
| 1166 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); |
1193 } | 1167 } |
1194 | 1168 |
1195 | 1169 |
1196 void LCodeGen::DoModI(LModI* instr) { | 1170 void LCodeGen::DoModI(LModI* instr) { |
1197 HMod* hmod = instr->hydrogen(); | 1171 HMod* hmod = instr->hydrogen(); |
1198 HValue* left = hmod->left(); | 1172 HValue* left = hmod->left(); |
1199 HValue* right = hmod->right(); | 1173 HValue* right = hmod->right(); |
1200 if (hmod->HasPowerOf2Divisor()) { | 1174 if (hmod->HasPowerOf2Divisor()) { |
1201 // TODO(svenpanne) We should really do the strength reduction on the | 1175 // TODO(svenpanne) We should really do the strength reduction on the |
1202 // Hydrogen level. | 1176 // Hydrogen level. |
(...skipping 5235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6438 // the deferred code. | 6412 // the deferred code. |
6439 } | 6413 } |
6440 } | 6414 } |
6441 | 6415 |
6442 | 6416 |
6443 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 6417 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
6444 // This is a pseudo-instruction that ensures that the environment here is | 6418 // This is a pseudo-instruction that ensures that the environment here is |
6445 // properly registered for deoptimization and records the assembler's PC | 6419 // properly registered for deoptimization and records the assembler's PC |
6446 // offset. | 6420 // offset. |
6447 LEnvironment* environment = instr->environment(); | 6421 LEnvironment* environment = instr->environment(); |
6448 environment->SetSpilledRegisters(instr->SpilledRegisterArray(), | |
6449 instr->SpilledDoubleRegisterArray()); | |
6450 | 6422 |
6451 // If the environment were already registered, we would have no way of | 6423 // If the environment were already registered, we would have no way of |
6452 // backpatching it with the spill slot operands. | 6424 // backpatching it with the spill slot operands. |
6453 ASSERT(!environment->HasBeenRegistered()); | 6425 ASSERT(!environment->HasBeenRegistered()); |
6454 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 6426 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
6455 ASSERT(osr_pc_offset_ == -1); | 6427 |
6456 osr_pc_offset_ = masm()->pc_offset(); | 6428 // Normally we record the first unknown OSR value as the entrypoint to the OSR |
| 6429 // code, but if there were none, record the entrypoint here. |
| 6430 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); |
6457 } | 6431 } |
6458 | 6432 |
6459 | 6433 |
6460 void LCodeGen::DoIn(LIn* instr) { | 6434 void LCodeGen::DoIn(LIn* instr) { |
6461 LOperand* obj = instr->object(); | 6435 LOperand* obj = instr->object(); |
6462 LOperand* key = instr->key(); | 6436 LOperand* key = instr->key(); |
6463 EmitPushTaggedOperand(key); | 6437 EmitPushTaggedOperand(key); |
6464 EmitPushTaggedOperand(obj); | 6438 EmitPushTaggedOperand(obj); |
6465 ASSERT(instr->HasPointerMap()); | 6439 ASSERT(instr->HasPointerMap()); |
6466 LPointerMap* pointers = instr->pointer_map(); | 6440 LPointerMap* pointers = instr->pointer_map(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6556 FixedArray::kHeaderSize - kPointerSize)); | 6530 FixedArray::kHeaderSize - kPointerSize)); |
6557 __ bind(&done); | 6531 __ bind(&done); |
6558 } | 6532 } |
6559 | 6533 |
6560 | 6534 |
6561 #undef __ | 6535 #undef __ |
6562 | 6536 |
6563 } } // namespace v8::internal | 6537 } } // namespace v8::internal |
6564 | 6538 |
6565 #endif // V8_TARGET_ARCH_IA32 | 6539 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |