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 5177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5188 Handle<Map> map, | 5188 Handle<Map> map, |
5189 LEnvironment* env) { | 5189 LEnvironment* env) { |
5190 Label success; | 5190 Label success; |
5191 __ CompareMapAndBranch(map_reg, map, &success, eq, &success); | 5191 __ CompareMapAndBranch(map_reg, map, &success, eq, &success); |
5192 DeoptimizeIf(al, env); | 5192 DeoptimizeIf(al, env); |
5193 __ bind(&success); | 5193 __ bind(&success); |
5194 } | 5194 } |
5195 | 5195 |
5196 | 5196 |
5197 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 5197 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
| 5198 if (instr->hydrogen()->CanOmitMapChecks()) return; |
5198 Register map_reg = scratch0(); | 5199 Register map_reg = scratch0(); |
5199 LOperand* input = instr->value(); | 5200 LOperand* input = instr->value(); |
5200 ASSERT(input->IsRegister()); | 5201 ASSERT(input->IsRegister()); |
5201 Register reg = ToRegister(input); | 5202 Register reg = ToRegister(input); |
5202 Label success; | 5203 Label success; |
5203 SmallMapList* map_set = instr->hydrogen()->map_set(); | 5204 SmallMapList* map_set = instr->hydrogen()->map_set(); |
5204 __ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); | 5205 __ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); |
5205 for (int i = 0; i < map_set->length() - 1; i++) { | 5206 for (int i = 0; i < map_set->length() - 1; i++) { |
5206 Handle<Map> map = map_set->at(i); | 5207 Handle<Map> map = map_set->at(i); |
5207 __ CompareMapAndBranch(map_reg, map, &success, eq, &success); | 5208 __ CompareMapAndBranch(map_reg, map, &success, eq, &success); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5256 __ jmp(&done); | 5257 __ jmp(&done); |
5257 | 5258 |
5258 __ bind(&is_smi); | 5259 __ bind(&is_smi); |
5259 __ ClampUint8(result_reg, scratch); | 5260 __ ClampUint8(result_reg, scratch); |
5260 | 5261 |
5261 __ bind(&done); | 5262 __ bind(&done); |
5262 } | 5263 } |
5263 | 5264 |
5264 | 5265 |
5265 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { | 5266 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
| 5267 if (instr->hydrogen()->CanOmitPrototypeChecks()) return; |
| 5268 |
5266 Register prototype_reg = ToRegister(instr->temp()); | 5269 Register prototype_reg = ToRegister(instr->temp()); |
5267 Register map_reg = ToRegister(instr->temp2()); | 5270 Register map_reg = ToRegister(instr->temp2()); |
5268 | 5271 |
5269 ZoneList<Handle<JSObject> >* prototypes = instr->prototypes(); | 5272 ZoneList<Handle<JSObject> >* prototypes = instr->prototypes(); |
5270 ZoneList<Handle<Map> >* maps = instr->maps(); | 5273 ZoneList<Handle<Map> >* maps = instr->maps(); |
5271 | 5274 |
5272 ASSERT(prototypes->length() == maps->length()); | 5275 ASSERT(prototypes->length() == maps->length()); |
5273 | 5276 |
5274 if (!instr->hydrogen()->CanOmitPrototypeChecks()) { | 5277 for (int i = 0; i < prototypes->length(); i++) { |
5275 for (int i = 0; i < prototypes->length(); i++) { | 5278 __ LoadHeapObject(prototype_reg, prototypes->at(i)); |
5276 __ LoadHeapObject(prototype_reg, prototypes->at(i)); | 5279 __ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset)); |
5277 __ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset)); | 5280 DoCheckMapCommon(map_reg, maps->at(i), instr->environment()); |
5278 DoCheckMapCommon(map_reg, maps->at(i), instr->environment()); | |
5279 } | |
5280 } | 5281 } |
5281 } | 5282 } |
5282 | 5283 |
5283 | 5284 |
5284 void LCodeGen::DoAllocate(LAllocate* instr) { | 5285 void LCodeGen::DoAllocate(LAllocate* instr) { |
5285 class DeferredAllocate: public LDeferredCode { | 5286 class DeferredAllocate: public LDeferredCode { |
5286 public: | 5287 public: |
5287 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) | 5288 DeferredAllocate(LCodeGen* codegen, LAllocate* instr) |
5288 : LDeferredCode(codegen), instr_(instr) { } | 5289 : LDeferredCode(codegen), instr_(instr) { } |
5289 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } | 5290 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5824 __ Subu(scratch, result, scratch); | 5825 __ Subu(scratch, result, scratch); |
5825 __ lw(result, FieldMemOperand(scratch, | 5826 __ lw(result, FieldMemOperand(scratch, |
5826 FixedArray::kHeaderSize - kPointerSize)); | 5827 FixedArray::kHeaderSize - kPointerSize)); |
5827 __ bind(&done); | 5828 __ bind(&done); |
5828 } | 5829 } |
5829 | 5830 |
5830 | 5831 |
5831 #undef __ | 5832 #undef __ |
5832 | 5833 |
5833 } } // namespace v8::internal | 5834 } } // namespace v8::internal |
OLD | NEW |