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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 case ARGUMENTS_ADAPTOR: | 504 case ARGUMENTS_ADAPTOR: |
505 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 505 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
506 break; | 506 break; |
507 case STUB: | 507 case STUB: |
508 translation->BeginCompiledStubFrame(); | 508 translation->BeginCompiledStubFrame(); |
509 break; | 509 break; |
510 } | 510 } |
511 | 511 |
512 for (int i = 0; i < translation_size; ++i) { | 512 for (int i = 0; i < translation_size; ++i) { |
513 LOperand* value = environment->values()->at(i); | 513 LOperand* value = environment->values()->at(i); |
514 // spilled_registers_ and spilled_double_registers_ are either | |
515 // both NULL or both set. | |
516 if (environment->spilled_registers() != NULL && value != NULL) { | |
517 if (value->IsRegister() && | |
518 environment->spilled_registers()[value->index()] != NULL) { | |
519 translation->MarkDuplicate(); | |
520 AddToTranslation(translation, | |
521 environment->spilled_registers()[value->index()], | |
522 environment->HasTaggedValueAt(i), | |
523 environment->HasUint32ValueAt(i)); | |
524 } else if ( | |
525 value->IsDoubleRegister() && | |
526 environment->spilled_double_registers()[value->index()] != NULL) { | |
527 translation->MarkDuplicate(); | |
528 AddToTranslation( | |
529 translation, | |
530 environment->spilled_double_registers()[value->index()], | |
531 false, | |
532 false); | |
533 } | |
534 } | |
535 | 514 |
536 // TODO(mstarzinger): Introduce marker operands to indicate that this value | 515 // TODO(mstarzinger): Introduce marker operands to indicate that this value |
537 // is not present and must be reconstructed from the deoptimizer. Currently | 516 // is not present and must be reconstructed from the deoptimizer. Currently |
538 // this is only used for the arguments object. | 517 // this is only used for the arguments object. |
539 if (value == NULL) { | 518 if (value == NULL) { |
540 int arguments_count = environment->values()->length() - translation_size; | 519 int arguments_count = environment->values()->length() - translation_size; |
541 translation->BeginArgumentsObject(arguments_count); | 520 translation->BeginArgumentsObject(arguments_count); |
542 for (int i = 0; i < arguments_count; ++i) { | 521 for (int i = 0; i < arguments_count; ++i) { |
543 LOperand* value = environment->values()->at(translation_size + i); | 522 LOperand* value = environment->values()->at(translation_size + i); |
544 ASSERT(environment->spilled_registers() == NULL || | |
545 !value->IsRegister() || | |
546 environment->spilled_registers()[value->index()] == NULL); | |
547 ASSERT(environment->spilled_registers() == NULL || | |
548 !value->IsDoubleRegister() || | |
549 environment->spilled_double_registers()[value->index()] == NULL); | |
550 AddToTranslation(translation, | 523 AddToTranslation(translation, |
551 value, | 524 value, |
552 environment->HasTaggedValueAt(translation_size + i), | 525 environment->HasTaggedValueAt(translation_size + i), |
553 environment->HasUint32ValueAt(translation_size + i)); | 526 environment->HasUint32ValueAt(translation_size + i)); |
554 } | 527 } |
555 continue; | 528 continue; |
556 } | 529 } |
557 | 530 |
558 AddToTranslation(translation, | 531 AddToTranslation(translation, |
559 value, | 532 value, |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 966 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
994 break; | 967 break; |
995 } | 968 } |
996 default: | 969 default: |
997 UNREACHABLE(); | 970 UNREACHABLE(); |
998 } | 971 } |
999 } | 972 } |
1000 | 973 |
1001 | 974 |
1002 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { | 975 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { |
1003 // Nothing to do. | 976 // Record the address of the first unknown OSR value as the place to enter. |
| 977 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); |
1004 } | 978 } |
1005 | 979 |
1006 | 980 |
1007 void LCodeGen::DoModI(LModI* instr) { | 981 void LCodeGen::DoModI(LModI* instr) { |
1008 HMod* hmod = instr->hydrogen(); | 982 HMod* hmod = instr->hydrogen(); |
1009 HValue* left = hmod->left(); | 983 HValue* left = hmod->left(); |
1010 HValue* right = hmod->right(); | 984 HValue* right = hmod->right(); |
1011 if (hmod->HasPowerOf2Divisor()) { | 985 if (hmod->HasPowerOf2Divisor()) { |
1012 // TODO(svenpanne) We should really do the strength reduction on the | 986 // TODO(svenpanne) We should really do the strength reduction on the |
1013 // Hydrogen level. | 987 // Hydrogen level. |
(...skipping 4538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5552 // the deferred code. | 5526 // the deferred code. |
5553 } | 5527 } |
5554 } | 5528 } |
5555 | 5529 |
5556 | 5530 |
5557 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 5531 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
5558 // This is a pseudo-instruction that ensures that the environment here is | 5532 // This is a pseudo-instruction that ensures that the environment here is |
5559 // properly registered for deoptimization and records the assembler's PC | 5533 // properly registered for deoptimization and records the assembler's PC |
5560 // offset. | 5534 // offset. |
5561 LEnvironment* environment = instr->environment(); | 5535 LEnvironment* environment = instr->environment(); |
5562 environment->SetSpilledRegisters(instr->SpilledRegisterArray(), | |
5563 instr->SpilledDoubleRegisterArray()); | |
5564 | 5536 |
5565 // If the environment were already registered, we would have no way of | 5537 // If the environment were already registered, we would have no way of |
5566 // backpatching it with the spill slot operands. | 5538 // backpatching it with the spill slot operands. |
5567 ASSERT(!environment->HasBeenRegistered()); | 5539 ASSERT(!environment->HasBeenRegistered()); |
5568 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 5540 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
5569 ASSERT(osr_pc_offset_ == -1); | 5541 |
5570 osr_pc_offset_ = masm()->pc_offset(); | 5542 // Normally we record the first unknown OSR value as the entrypoint to the OSR |
| 5543 // code, but if there were none, record the entrypoint here. |
| 5544 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); |
5571 } | 5545 } |
5572 | 5546 |
5573 | 5547 |
5574 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { | 5548 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { |
5575 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); | 5549 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
5576 DeoptimizeIf(equal, instr->environment()); | 5550 DeoptimizeIf(equal, instr->environment()); |
5577 | 5551 |
5578 Register null_value = rdi; | 5552 Register null_value = rdi; |
5579 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 5553 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
5580 __ cmpq(rax, null_value); | 5554 __ cmpq(rax, null_value); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5658 FixedArray::kHeaderSize - kPointerSize)); | 5632 FixedArray::kHeaderSize - kPointerSize)); |
5659 __ bind(&done); | 5633 __ bind(&done); |
5660 } | 5634 } |
5661 | 5635 |
5662 | 5636 |
5663 #undef __ | 5637 #undef __ |
5664 | 5638 |
5665 } } // namespace v8::internal | 5639 } } // namespace v8::internal |
5666 | 5640 |
5667 #endif // V8_TARGET_ARCH_X64 | 5641 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |