| Index: src/arm/lithium-codegen-arm.cc
|
| diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
|
| index 33aca06bc7bbe8e72eb1bbd17a417fa9442d70b9..6e1efebe2e050ca058353a844dfb853d0f7b2cfb 100644
|
| --- a/src/arm/lithium-codegen-arm.cc
|
| +++ b/src/arm/lithium-codegen-arm.cc
|
| @@ -5214,33 +5214,67 @@ void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
|
| }
|
|
|
|
|
| -void LCodeGen::DoCheckMapCommon(Register map_reg,
|
| - Handle<Map> map,
|
| - LEnvironment* env) {
|
| - Label success;
|
| - __ CompareMap(map_reg, map, &success);
|
| - DeoptimizeIf(ne, env);
|
| - __ bind(&success);
|
| +void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) {
|
| + {
|
| + PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters);
|
| + __ push(object);
|
| + CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr);
|
| + __ StoreToSafepointRegisterSlot(scratch0(), r0);
|
| + }
|
| + __ tst(scratch0(), Operand(kSmiTagMask));
|
| + DeoptimizeIf(eq, instr->environment());
|
| }
|
|
|
|
|
| void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
|
| + class DeferredCheckMaps: public LDeferredCode {
|
| + public:
|
| + DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object)
|
| + : LDeferredCode(codegen), instr_(instr), object_(object) {
|
| + SetExit(check_maps());
|
| + }
|
| + virtual void Generate() {
|
| + codegen()->DoDeferredInstanceMigration(instr_, object_);
|
| + }
|
| + Label* check_maps() { return &check_maps_; }
|
| + virtual LInstruction* instr() { return instr_; }
|
| + private:
|
| + LCheckMaps* instr_;
|
| + Label check_maps_;
|
| + Register object_;
|
| + };
|
| +
|
| if (instr->hydrogen()->CanOmitMapChecks()) return;
|
| Register map_reg = scratch0();
|
| +
|
| LOperand* input = instr->value();
|
| ASSERT(input->IsRegister());
|
| Register reg = ToRegister(input);
|
|
|
| - Label success;
|
| SmallMapList* map_set = instr->hydrogen()->map_set();
|
| __ ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
|
| +
|
| + DeferredCheckMaps* deferred = NULL;
|
| + if (instr->hydrogen()->has_migration_target()) {
|
| + deferred = new(zone()) DeferredCheckMaps(this, instr, reg);
|
| + __ bind(deferred->check_maps());
|
| + }
|
| +
|
| + Label success;
|
| for (int i = 0; i < map_set->length() - 1; i++) {
|
| Handle<Map> map = map_set->at(i);
|
| __ CompareMap(map_reg, map, &success);
|
| __ b(eq, &success);
|
| }
|
| +
|
| Handle<Map> map = map_set->last();
|
| - DoCheckMapCommon(map_reg, map, instr->environment());
|
| + __ CompareMap(map_reg, map, &success);
|
| + if (instr->hydrogen()->has_migration_target()) {
|
| + __ b(ne, deferred->entry());
|
| + } else {
|
| + DeoptimizeIf(ne, instr->environment());
|
| + }
|
| +
|
| __ bind(&success);
|
| }
|
|
|
|
|