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 5175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5186 __ lw(at, FieldMemOperand(at, Cell::kValueOffset)); | 5186 __ lw(at, FieldMemOperand(at, Cell::kValueOffset)); |
5187 DeoptimizeIf(ne, instr->environment(), reg, | 5187 DeoptimizeIf(ne, instr->environment(), reg, |
5188 Operand(at)); | 5188 Operand(at)); |
5189 } else { | 5189 } else { |
5190 DeoptimizeIf(ne, instr->environment(), reg, | 5190 DeoptimizeIf(ne, instr->environment(), reg, |
5191 Operand(target)); | 5191 Operand(target)); |
5192 } | 5192 } |
5193 } | 5193 } |
5194 | 5194 |
5195 | 5195 |
5196 void LCodeGen::DoCheckMapCommon(Register map_reg, | 5196 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { |
5197 Handle<Map> map, | 5197 { |
5198 LEnvironment* env) { | 5198 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
5199 Label success; | 5199 __ push(object); |
5200 __ CompareMapAndBranch(map_reg, map, &success, eq, &success); | 5200 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); |
5201 DeoptimizeIf(al, env); | 5201 __ StoreToSafepointRegisterSlot(v0, scratch0()); |
5202 __ bind(&success); | 5202 } |
| 5203 __ And(at, scratch0(), Operand(kSmiTagMask)); |
| 5204 DeoptimizeIf(eq, instr->environment(), at, Operand(zero_reg)); |
5203 } | 5205 } |
5204 | 5206 |
5205 | 5207 |
5206 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5208 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
| 5209 class DeferredCheckMaps: public LDeferredCode { |
| 5210 public: |
| 5211 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
| 5212 : LDeferredCode(codegen), instr_(instr), object_(object) { |
| 5213 SetExit(check_maps()); |
| 5214 } |
| 5215 virtual void Generate() { |
| 5216 codegen()->DoDeferredInstanceMigration(instr_, object_); |
| 5217 } |
| 5218 Label* check_maps() { return &check_maps_; } |
| 5219 virtual LInstruction* instr() { return instr_; } |
| 5220 private: |
| 5221 LCheckMaps* instr_; |
| 5222 Label check_maps_; |
| 5223 Register object_; |
| 5224 }; |
| 5225 |
5207 if (instr->hydrogen()->CanOmitMapChecks()) return; | 5226 if (instr->hydrogen()->CanOmitMapChecks()) return; |
5208 Register map_reg = scratch0(); | 5227 Register map_reg = scratch0(); |
5209 LOperand* input = instr->value(); | 5228 LOperand* input = instr->value(); |
5210 ASSERT(input->IsRegister()); | 5229 ASSERT(input->IsRegister()); |
5211 Register reg = ToRegister(input); | 5230 Register reg = ToRegister(input); |
5212 Label success; | |
5213 SmallMapList* map_set = instr->hydrogen()->map_set(); | 5231 SmallMapList* map_set = instr->hydrogen()->map_set(); |
5214 __ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); | 5232 __ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); |
| 5233 |
| 5234 DeferredCheckMaps* deferred = NULL; |
| 5235 if (instr->hydrogen()->has_migration_target()) { |
| 5236 deferred = new(zone()) DeferredCheckMaps(this, instr, reg); |
| 5237 __ bind(deferred->check_maps()); |
| 5238 } |
| 5239 |
| 5240 Label success; |
5215 for (int i = 0; i < map_set->length() - 1; i++) { | 5241 for (int i = 0; i < map_set->length() - 1; i++) { |
5216 Handle<Map> map = map_set->at(i); | 5242 Handle<Map> map = map_set->at(i); |
5217 __ CompareMapAndBranch(map_reg, map, &success, eq, &success); | 5243 __ CompareMapAndBranch(map_reg, map, &success, eq, &success); |
5218 } | 5244 } |
5219 Handle<Map> map = map_set->last(); | 5245 Handle<Map> map = map_set->last(); |
5220 DoCheckMapCommon(map_reg, map, instr->environment()); | 5246 __ CompareMapAndBranch(map_reg, map, &success, eq, &success); |
| 5247 if (instr->hydrogen()->has_migration_target()) { |
| 5248 __ Branch(deferred->entry()); |
| 5249 } else { |
| 5250 DeoptimizeIf(al, instr->environment()); |
| 5251 } |
| 5252 |
5221 __ bind(&success); | 5253 __ bind(&success); |
5222 } | 5254 } |
5223 | 5255 |
5224 | 5256 |
5225 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { | 5257 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { |
5226 DoubleRegister value_reg = ToDoubleRegister(instr->unclamped()); | 5258 DoubleRegister value_reg = ToDoubleRegister(instr->unclamped()); |
5227 Register result_reg = ToRegister(instr->result()); | 5259 Register result_reg = ToRegister(instr->result()); |
5228 DoubleRegister temp_reg = ToDoubleRegister(instr->temp()); | 5260 DoubleRegister temp_reg = ToDoubleRegister(instr->temp()); |
5229 __ ClampDoubleToUint8(result_reg, value_reg, temp_reg); | 5261 __ ClampDoubleToUint8(result_reg, value_reg, temp_reg); |
5230 } | 5262 } |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5823 __ Subu(scratch, result, scratch); | 5855 __ Subu(scratch, result, scratch); |
5824 __ lw(result, FieldMemOperand(scratch, | 5856 __ lw(result, FieldMemOperand(scratch, |
5825 FixedArray::kHeaderSize - kPointerSize)); | 5857 FixedArray::kHeaderSize - kPointerSize)); |
5826 __ bind(&done); | 5858 __ bind(&done); |
5827 } | 5859 } |
5828 | 5860 |
5829 | 5861 |
5830 #undef __ | 5862 #undef __ |
5831 | 5863 |
5832 } } // namespace v8::internal | 5864 } } // namespace v8::internal |
OLD | NEW |