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 5196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5207 __ mov(ip, Operand(Handle<Object>(cell))); | 5207 __ mov(ip, Operand(Handle<Object>(cell))); |
5208 __ ldr(ip, FieldMemOperand(ip, Cell::kValueOffset)); | 5208 __ ldr(ip, FieldMemOperand(ip, Cell::kValueOffset)); |
5209 __ cmp(reg, ip); | 5209 __ cmp(reg, ip); |
5210 } else { | 5210 } else { |
5211 __ cmp(reg, Operand(target)); | 5211 __ cmp(reg, Operand(target)); |
5212 } | 5212 } |
5213 DeoptimizeIf(ne, instr->environment()); | 5213 DeoptimizeIf(ne, instr->environment()); |
5214 } | 5214 } |
5215 | 5215 |
5216 | 5216 |
5217 void LCodeGen::DoCheckMapCommon(Register map_reg, | 5217 void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { |
5218 Handle<Map> map, | 5218 { |
5219 LEnvironment* env) { | 5219 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
5220 Label success; | 5220 __ push(object); |
5221 __ CompareMap(map_reg, map, &success); | 5221 CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); |
5222 DeoptimizeIf(ne, env); | 5222 __ StoreToSafepointRegisterSlot(scratch0(), r0); |
5223 __ bind(&success); | 5223 } |
| 5224 __ tst(scratch0(), Operand(kSmiTagMask)); |
| 5225 DeoptimizeIf(eq, instr->environment()); |
5224 } | 5226 } |
5225 | 5227 |
5226 | 5228 |
5227 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5229 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
| 5230 class DeferredCheckMaps: public LDeferredCode { |
| 5231 public: |
| 5232 DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
| 5233 : LDeferredCode(codegen), instr_(instr), object_(object) { |
| 5234 SetExit(check_maps()); |
| 5235 } |
| 5236 virtual void Generate() { |
| 5237 codegen()->DoDeferredInstanceMigration(instr_, object_); |
| 5238 } |
| 5239 Label* check_maps() { return &check_maps_; } |
| 5240 virtual LInstruction* instr() { return instr_; } |
| 5241 private: |
| 5242 LCheckMaps* instr_; |
| 5243 Label check_maps_; |
| 5244 Register object_; |
| 5245 }; |
| 5246 |
5228 if (instr->hydrogen()->CanOmitMapChecks()) return; | 5247 if (instr->hydrogen()->CanOmitMapChecks()) return; |
5229 Register map_reg = scratch0(); | 5248 Register map_reg = scratch0(); |
| 5249 |
5230 LOperand* input = instr->value(); | 5250 LOperand* input = instr->value(); |
5231 ASSERT(input->IsRegister()); | 5251 ASSERT(input->IsRegister()); |
5232 Register reg = ToRegister(input); | 5252 Register reg = ToRegister(input); |
5233 | 5253 |
5234 Label success; | |
5235 SmallMapList* map_set = instr->hydrogen()->map_set(); | 5254 SmallMapList* map_set = instr->hydrogen()->map_set(); |
5236 __ ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); | 5255 __ ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); |
| 5256 |
| 5257 DeferredCheckMaps* deferred = NULL; |
| 5258 if (instr->hydrogen()->has_migration_target()) { |
| 5259 deferred = new(zone()) DeferredCheckMaps(this, instr, reg); |
| 5260 __ bind(deferred->check_maps()); |
| 5261 } |
| 5262 |
| 5263 Label success; |
5237 for (int i = 0; i < map_set->length() - 1; i++) { | 5264 for (int i = 0; i < map_set->length() - 1; i++) { |
5238 Handle<Map> map = map_set->at(i); | 5265 Handle<Map> map = map_set->at(i); |
5239 __ CompareMap(map_reg, map, &success); | 5266 __ CompareMap(map_reg, map, &success); |
5240 __ b(eq, &success); | 5267 __ b(eq, &success); |
5241 } | 5268 } |
| 5269 |
5242 Handle<Map> map = map_set->last(); | 5270 Handle<Map> map = map_set->last(); |
5243 DoCheckMapCommon(map_reg, map, instr->environment()); | 5271 __ CompareMap(map_reg, map, &success); |
| 5272 if (instr->hydrogen()->has_migration_target()) { |
| 5273 __ b(ne, deferred->entry()); |
| 5274 } else { |
| 5275 DeoptimizeIf(ne, instr->environment()); |
| 5276 } |
| 5277 |
5244 __ bind(&success); | 5278 __ bind(&success); |
5245 } | 5279 } |
5246 | 5280 |
5247 | 5281 |
5248 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { | 5282 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { |
5249 DwVfpRegister value_reg = ToDoubleRegister(instr->unclamped()); | 5283 DwVfpRegister value_reg = ToDoubleRegister(instr->unclamped()); |
5250 Register result_reg = ToRegister(instr->result()); | 5284 Register result_reg = ToRegister(instr->result()); |
5251 __ ClampDoubleToUint8(result_reg, value_reg, double_scratch0()); | 5285 __ ClampDoubleToUint8(result_reg, value_reg, double_scratch0()); |
5252 } | 5286 } |
5253 | 5287 |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5805 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5839 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5806 __ ldr(result, FieldMemOperand(scratch, | 5840 __ ldr(result, FieldMemOperand(scratch, |
5807 FixedArray::kHeaderSize - kPointerSize)); | 5841 FixedArray::kHeaderSize - kPointerSize)); |
5808 __ bind(&done); | 5842 __ bind(&done); |
5809 } | 5843 } |
5810 | 5844 |
5811 | 5845 |
5812 #undef __ | 5846 #undef __ |
5813 | 5847 |
5814 } } // namespace v8::internal | 5848 } } // namespace v8::internal |
OLD | NEW |