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 5775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5786 Handle<Cell> cell = isolate()->factory()->NewCell(target); | 5786 Handle<Cell> cell = isolate()->factory()->NewCell(target); |
5787 __ cmp(reg, Operand::ForCell(cell)); | 5787 __ cmp(reg, Operand::ForCell(cell)); |
5788 } else { | 5788 } else { |
5789 Operand operand = ToOperand(instr->value()); | 5789 Operand operand = ToOperand(instr->value()); |
5790 __ cmp(operand, target); | 5790 __ cmp(operand, target); |
5791 } | 5791 } |
5792 DeoptimizeIf(not_equal, instr->environment()); | 5792 DeoptimizeIf(not_equal, instr->environment()); |
5793 } | 5793 } |
5794 | 5794 |
5795 | 5795 |
5796 void LCodeGen::DoCheckMapCommon(Register reg, | 5796 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { |
5797 Handle<Map> map, | 5797 { |
5798 LInstruction* instr) { | 5798 PushSafepointRegistersScope scope(this); |
5799 Label success; | 5799 __ push(object); |
5800 __ CompareMap(reg, map, &success); | 5800 CallRuntimeFromDeferred( |
5801 DeoptimizeIf(not_equal, instr->environment()); | 5801 Runtime::kMigrateInstance, 1, instr, instr->context()); |
5802 __ bind(&success); | 5802 __ test(eax, Immediate(kSmiTagMask)); |
| 5803 } |
| 5804 DeoptimizeIf(zero, instr->environment()); |
5803 } | 5805 } |
5804 | 5806 |
5805 | 5807 |
5806 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5808 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
| 5809 class DeferredInstanceMigration: public LDeferredCode { |
| 5810 public: |
| 5811 DeferredInstanceMigration(LCodeGen* codegen, |
| 5812 LCheckMaps* instr, |
| 5813 Register object) |
| 5814 : LDeferredCode(codegen), instr_(instr), object_(object) { |
| 5815 SetExit(check_maps()); |
| 5816 } |
| 5817 virtual void Generate() { |
| 5818 codegen()->DoDeferredInstanceMigration(instr_, object_); |
| 5819 } |
| 5820 Label* check_maps() { return &check_maps_; } |
| 5821 virtual LInstruction* instr() { return instr_; } |
| 5822 private: |
| 5823 LCheckMaps* instr_; |
| 5824 Label check_maps_; |
| 5825 Register object_; |
| 5826 }; |
| 5827 |
5807 if (instr->hydrogen()->CanOmitMapChecks()) return; | 5828 if (instr->hydrogen()->CanOmitMapChecks()) return; |
| 5829 |
5808 LOperand* input = instr->value(); | 5830 LOperand* input = instr->value(); |
5809 ASSERT(input->IsRegister()); | 5831 ASSERT(input->IsRegister()); |
5810 Register reg = ToRegister(input); | 5832 Register reg = ToRegister(input); |
5811 | 5833 |
| 5834 SmallMapList* map_set = instr->hydrogen()->map_set(); |
| 5835 |
| 5836 DeferredInstanceMigration* deferred = NULL; |
| 5837 if (instr->hydrogen()->has_migration_target()) { |
| 5838 deferred = new(zone()) DeferredInstanceMigration(this, instr, reg); |
| 5839 __ bind(deferred->check_maps()); |
| 5840 } |
| 5841 |
5812 Label success; | 5842 Label success; |
5813 SmallMapList* map_set = instr->hydrogen()->map_set(); | |
5814 for (int i = 0; i < map_set->length() - 1; i++) { | 5843 for (int i = 0; i < map_set->length() - 1; i++) { |
5815 Handle<Map> map = map_set->at(i); | 5844 Handle<Map> map = map_set->at(i); |
5816 __ CompareMap(reg, map, &success); | 5845 __ CompareMap(reg, map, &success); |
5817 __ j(equal, &success); | 5846 __ j(equal, &success); |
5818 } | 5847 } |
| 5848 |
5819 Handle<Map> map = map_set->last(); | 5849 Handle<Map> map = map_set->last(); |
5820 DoCheckMapCommon(reg, map, instr); | 5850 __ CompareMap(reg, map, &success); |
| 5851 if (instr->hydrogen()->has_migration_target()) { |
| 5852 __ j(not_equal, deferred->entry()); |
| 5853 } else { |
| 5854 DeoptimizeIf(not_equal, instr->environment()); |
| 5855 } |
| 5856 |
5821 __ bind(&success); | 5857 __ bind(&success); |
5822 } | 5858 } |
5823 | 5859 |
5824 | 5860 |
5825 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { | 5861 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { |
5826 CpuFeatureScope scope(masm(), SSE2); | 5862 CpuFeatureScope scope(masm(), SSE2); |
5827 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); | 5863 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); |
5828 Register result_reg = ToRegister(instr->result()); | 5864 Register result_reg = ToRegister(instr->result()); |
5829 __ ClampDoubleToUint8(value_reg, xmm0, result_reg); | 5865 __ ClampDoubleToUint8(value_reg, xmm0, result_reg); |
5830 } | 5866 } |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6495 FixedArray::kHeaderSize - kPointerSize)); | 6531 FixedArray::kHeaderSize - kPointerSize)); |
6496 __ bind(&done); | 6532 __ bind(&done); |
6497 } | 6533 } |
6498 | 6534 |
6499 | 6535 |
6500 #undef __ | 6536 #undef __ |
6501 | 6537 |
6502 } } // namespace v8::internal | 6538 } } // namespace v8::internal |
6503 | 6539 |
6504 #endif // V8_TARGET_ARCH_IA32 | 6540 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |