| 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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 void LCodeGen::LoadContextFromDeferred(LOperand* context) { | 875 void LCodeGen::LoadContextFromDeferred(LOperand* context) { |
| 876 if (context->IsRegister()) { | 876 if (context->IsRegister()) { |
| 877 if (!ToRegister(context).is(esi)) { | 877 if (!ToRegister(context).is(esi)) { |
| 878 __ mov(esi, ToRegister(context)); | 878 __ mov(esi, ToRegister(context)); |
| 879 } | 879 } |
| 880 } else if (context->IsStackSlot()) { | 880 } else if (context->IsStackSlot()) { |
| 881 __ mov(esi, ToOperand(context)); | 881 __ mov(esi, ToOperand(context)); |
| 882 } else if (context->IsConstantOperand()) { | 882 } else if (context->IsConstantOperand()) { |
| 883 HConstant* constant = | 883 HConstant* constant = |
| 884 chunk_->LookupConstant(LConstantOperand::cast(context)); | 884 chunk_->LookupConstant(LConstantOperand::cast(context)); |
| 885 __ LoadHeapObject(esi, Handle<Context>::cast(constant->handle())); | 885 __ LoadObject(esi, Handle<Object>::cast(constant->handle())); |
| 886 } else { | 886 } else { |
| 887 UNREACHABLE(); | 887 UNREACHABLE(); |
| 888 } | 888 } |
| 889 } | 889 } |
| 890 | 890 |
| 891 void LCodeGen::CallRuntimeFromDeferred(Runtime::FunctionId id, | 891 void LCodeGen::CallRuntimeFromDeferred(Runtime::FunctionId id, |
| 892 int argc, | 892 int argc, |
| 893 LInstruction* instr, | 893 LInstruction* instr, |
| 894 LOperand* context) { | 894 LOperand* context) { |
| 895 LoadContextFromDeferred(context); | 895 LoadContextFromDeferred(context); |
| (...skipping 4890 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 __ xor_(esi, esi); |
| 5801 DeoptimizeIf(not_equal, instr->environment()); | 5801 __ CallRuntimeSaveDoubles(Runtime::kMigrateInstance); |
| 5802 __ bind(&success); | 5802 RecordSafepointWithRegisters( |
| 5803 instr->pointer_map(), 1, Safepoint::kNoLazyDeopt); |
| 5804 |
| 5805 __ test(eax, Immediate(kSmiTagMask)); |
| 5806 } |
| 5807 DeoptimizeIf(zero, instr->environment()); |
| 5803 } | 5808 } |
| 5804 | 5809 |
| 5805 | 5810 |
| 5806 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5811 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
| 5812 class DeferredCheckMaps: public LDeferredCode { |
| 5813 public: |
| 5814 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
| 5815 : LDeferredCode(codegen), instr_(instr), object_(object) { |
| 5816 SetExit(check_maps()); |
| 5817 } |
| 5818 virtual void Generate() { |
| 5819 codegen()->DoDeferredInstanceMigration(instr_, object_); |
| 5820 } |
| 5821 Label* check_maps() { return &check_maps_; } |
| 5822 virtual LInstruction* instr() { return instr_; } |
| 5823 private: |
| 5824 LCheckMaps* instr_; |
| 5825 Label check_maps_; |
| 5826 Register object_; |
| 5827 }; |
| 5828 |
| 5807 if (instr->hydrogen()->CanOmitMapChecks()) return; | 5829 if (instr->hydrogen()->CanOmitMapChecks()) return; |
| 5830 |
| 5808 LOperand* input = instr->value(); | 5831 LOperand* input = instr->value(); |
| 5809 ASSERT(input->IsRegister()); | 5832 ASSERT(input->IsRegister()); |
| 5810 Register reg = ToRegister(input); | 5833 Register reg = ToRegister(input); |
| 5811 | 5834 |
| 5835 SmallMapList* map_set = instr->hydrogen()->map_set(); |
| 5836 |
| 5837 DeferredCheckMaps* deferred = NULL; |
| 5838 if (instr->hydrogen()->has_migration_target()) { |
| 5839 deferred = new(zone()) DeferredCheckMaps(this, instr, reg); |
| 5840 __ bind(deferred->check_maps()); |
| 5841 } |
| 5842 |
| 5812 Label success; | 5843 Label success; |
| 5813 SmallMapList* map_set = instr->hydrogen()->map_set(); | |
| 5814 for (int i = 0; i < map_set->length() - 1; i++) { | 5844 for (int i = 0; i < map_set->length() - 1; i++) { |
| 5815 Handle<Map> map = map_set->at(i); | 5845 Handle<Map> map = map_set->at(i); |
| 5816 __ CompareMap(reg, map, &success); | 5846 __ CompareMap(reg, map, &success); |
| 5817 __ j(equal, &success); | 5847 __ j(equal, &success); |
| 5818 } | 5848 } |
| 5849 |
| 5819 Handle<Map> map = map_set->last(); | 5850 Handle<Map> map = map_set->last(); |
| 5820 DoCheckMapCommon(reg, map, instr); | 5851 __ CompareMap(reg, map, &success); |
| 5852 if (instr->hydrogen()->has_migration_target()) { |
| 5853 __ j(not_equal, deferred->entry()); |
| 5854 } else { |
| 5855 DeoptimizeIf(not_equal, instr->environment()); |
| 5856 } |
| 5857 |
| 5821 __ bind(&success); | 5858 __ bind(&success); |
| 5822 } | 5859 } |
| 5823 | 5860 |
| 5824 | 5861 |
| 5825 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { | 5862 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { |
| 5826 CpuFeatureScope scope(masm(), SSE2); | 5863 CpuFeatureScope scope(masm(), SSE2); |
| 5827 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); | 5864 XMMRegister value_reg = ToDoubleRegister(instr->unclamped()); |
| 5828 Register result_reg = ToRegister(instr->result()); | 5865 Register result_reg = ToRegister(instr->result()); |
| 5829 __ ClampDoubleToUint8(value_reg, xmm0, result_reg); | 5866 __ ClampDoubleToUint8(value_reg, xmm0, result_reg); |
| 5830 } | 5867 } |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6495 FixedArray::kHeaderSize - kPointerSize)); | 6532 FixedArray::kHeaderSize - kPointerSize)); |
| 6496 __ bind(&done); | 6533 __ bind(&done); |
| 6497 } | 6534 } |
| 6498 | 6535 |
| 6499 | 6536 |
| 6500 #undef __ | 6537 #undef __ |
| 6501 | 6538 |
| 6502 } } // namespace v8::internal | 6539 } } // namespace v8::internal |
| 6503 | 6540 |
| 6504 #endif // V8_TARGET_ARCH_IA32 | 6541 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |