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

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

Issue 19954005: Eliminate map checks of constant values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Naming Created 7 years, 5 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
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5212 matching lines...) Expand 10 before | Expand all | Expand 10 after
5223 Handle<Map> map, 5223 Handle<Map> map,
5224 LEnvironment* env) { 5224 LEnvironment* env) {
5225 Label success; 5225 Label success;
5226 __ CompareMap(map_reg, map, &success); 5226 __ CompareMap(map_reg, map, &success);
5227 DeoptimizeIf(ne, env); 5227 DeoptimizeIf(ne, env);
5228 __ bind(&success); 5228 __ bind(&success);
5229 } 5229 }
5230 5230
5231 5231
5232 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { 5232 void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
5233 if (instr->hydrogen()->CanOmitMapChecks()) return;
5233 Register map_reg = scratch0(); 5234 Register map_reg = scratch0();
5234 LOperand* input = instr->value(); 5235 LOperand* input = instr->value();
5235 ASSERT(input->IsRegister()); 5236 ASSERT(input->IsRegister());
5236 Register reg = ToRegister(input); 5237 Register reg = ToRegister(input);
5237 5238
5238 Label success; 5239 Label success;
5239 SmallMapList* map_set = instr->hydrogen()->map_set(); 5240 SmallMapList* map_set = instr->hydrogen()->map_set();
5240 __ ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); 5241 __ ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
5241 for (int i = 0; i < map_set->length() - 1; i++) { 5242 for (int i = 0; i < map_set->length() - 1; i++) {
5242 Handle<Map> map = map_set->at(i); 5243 Handle<Map> map = map_set->at(i);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
5295 5296
5296 // smi 5297 // smi
5297 __ bind(&is_smi); 5298 __ bind(&is_smi);
5298 __ ClampUint8(result_reg, result_reg); 5299 __ ClampUint8(result_reg, result_reg);
5299 5300
5300 __ bind(&done); 5301 __ bind(&done);
5301 } 5302 }
5302 5303
5303 5304
5304 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { 5305 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
5306 if (instr->hydrogen()->CanOmitPrototypeChecks()) return;
5307
5305 Register prototype_reg = ToRegister(instr->temp()); 5308 Register prototype_reg = ToRegister(instr->temp());
5306 Register map_reg = ToRegister(instr->temp2()); 5309 Register map_reg = ToRegister(instr->temp2());
5307 5310
5308 ZoneList<Handle<JSObject> >* prototypes = instr->prototypes(); 5311 ZoneList<Handle<JSObject> >* prototypes = instr->prototypes();
5309 ZoneList<Handle<Map> >* maps = instr->maps(); 5312 ZoneList<Handle<Map> >* maps = instr->maps();
5310 5313
5311 ASSERT(prototypes->length() == maps->length()); 5314 ASSERT(prototypes->length() == maps->length());
5312 5315
5313 if (!instr->hydrogen()->CanOmitPrototypeChecks()) { 5316 for (int i = 0; i < prototypes->length(); i++) {
5314 for (int i = 0; i < prototypes->length(); i++) { 5317 __ LoadHeapObject(prototype_reg, prototypes->at(i));
5315 __ LoadHeapObject(prototype_reg, prototypes->at(i)); 5318 __ ldr(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset));
5316 __ ldr(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset)); 5319 DoCheckMapCommon(map_reg, maps->at(i), instr->environment());
5317 DoCheckMapCommon(map_reg, maps->at(i), instr->environment());
5318 }
5319 } 5320 }
5320 } 5321 }
5321 5322
5322 5323
5323 void LCodeGen::DoAllocate(LAllocate* instr) { 5324 void LCodeGen::DoAllocate(LAllocate* instr) {
5324 class DeferredAllocate: public LDeferredCode { 5325 class DeferredAllocate: public LDeferredCode {
5325 public: 5326 public:
5326 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) 5327 DeferredAllocate(LCodeGen* codegen, LAllocate* instr)
5327 : LDeferredCode(codegen), instr_(instr) { } 5328 : LDeferredCode(codegen), instr_(instr) { }
5328 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } 5329 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); }
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
5821 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5822 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5822 __ ldr(result, FieldMemOperand(scratch, 5823 __ ldr(result, FieldMemOperand(scratch,
5823 FixedArray::kHeaderSize - kPointerSize)); 5824 FixedArray::kHeaderSize - kPointerSize));
5824 __ bind(&done); 5825 __ bind(&done);
5825 } 5826 }
5826 5827
5827 5828
5828 #undef __ 5829 #undef __
5829 5830
5830 } } // namespace v8::internal 5831 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698