Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 21536003: Migrate instance of deprecated maps in HCheckMaps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Port to ARM Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 DeferredInstanceMigration: public LDeferredCode {
5231 public:
5232 DeferredInstanceMigration(LCodeGen* codegen,
5233 LCheckMaps* instr,
5234 Register object)
5235 : LDeferredCode(codegen), instr_(instr), object_(object) {
5236 SetExit(check_maps());
5237 }
5238 virtual void Generate() {
5239 codegen()->DoDeferredInstanceMigration(instr_, object_);
5240 }
5241 Label* check_maps() { return &check_maps_; }
5242 virtual LInstruction* instr() { return instr_; }
5243 private:
5244 LCheckMaps* instr_;
5245 Label check_maps_;
5246 Register object_;
5247 };
5248
5228 if (instr->hydrogen()->CanOmitMapChecks()) return; 5249 if (instr->hydrogen()->CanOmitMapChecks()) return;
5229 Register map_reg = scratch0(); 5250 Register map_reg = scratch0();
5251
5230 LOperand* input = instr->value(); 5252 LOperand* input = instr->value();
5231 ASSERT(input->IsRegister()); 5253 ASSERT(input->IsRegister());
5232 Register reg = ToRegister(input); 5254 Register reg = ToRegister(input);
5233 5255
5234 Label success;
5235 SmallMapList* map_set = instr->hydrogen()->map_set(); 5256 SmallMapList* map_set = instr->hydrogen()->map_set();
5236 __ ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); 5257 __ ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
5258
5259 DeferredInstanceMigration* deferred = NULL;
5260 if (instr->hydrogen()->has_migration_target()) {
5261 deferred = new(zone()) DeferredInstanceMigration(this, instr, reg);
5262 __ bind(deferred->check_maps());
5263 }
5264
5265 Label success;
5237 for (int i = 0; i < map_set->length() - 1; i++) { 5266 for (int i = 0; i < map_set->length() - 1; i++) {
5238 Handle<Map> map = map_set->at(i); 5267 Handle<Map> map = map_set->at(i);
5239 __ CompareMap(map_reg, map, &success); 5268 __ CompareMap(map_reg, map, &success);
5240 __ b(eq, &success); 5269 __ b(eq, &success);
5241 } 5270 }
5271
5242 Handle<Map> map = map_set->last(); 5272 Handle<Map> map = map_set->last();
5243 DoCheckMapCommon(map_reg, map, instr->environment()); 5273 __ CompareMap(map_reg, map, &success);
5274 if (instr->hydrogen()->has_migration_target()) {
5275 __ b(ne, deferred->entry());
5276 } else {
5277 DeoptimizeIf(ne, instr->environment());
5278 }
5279
5244 __ bind(&success); 5280 __ bind(&success);
5245 } 5281 }
5246 5282
5247 5283
5248 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { 5284 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) {
5249 DwVfpRegister value_reg = ToDoubleRegister(instr->unclamped()); 5285 DwVfpRegister value_reg = ToDoubleRegister(instr->unclamped());
5250 Register result_reg = ToRegister(instr->result()); 5286 Register result_reg = ToRegister(instr->result());
5251 __ ClampDoubleToUint8(result_reg, value_reg, double_scratch0()); 5287 __ ClampDoubleToUint8(result_reg, value_reg, double_scratch0());
5252 } 5288 }
5253 5289
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
5805 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5841 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5806 __ ldr(result, FieldMemOperand(scratch, 5842 __ ldr(result, FieldMemOperand(scratch,
5807 FixedArray::kHeaderSize - kPointerSize)); 5843 FixedArray::kHeaderSize - kPointerSize));
5808 __ bind(&done); 5844 __ bind(&done);
5809 } 5845 }
5810 5846
5811 5847
5812 #undef __ 5848 #undef __
5813 5849
5814 } } // namespace v8::internal 5850 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698