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 4987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4998 | 4998 |
4999 __ bind(&done); | 4999 __ bind(&done); |
5000 } | 5000 } |
5001 | 5001 |
5002 | 5002 |
5003 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { | 5003 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
5004 ASSERT(instr->temp()->Equals(instr->result())); | 5004 ASSERT(instr->temp()->Equals(instr->result())); |
5005 Register prototype_reg = ToRegister(instr->temp()); | 5005 Register prototype_reg = ToRegister(instr->temp()); |
5006 Register map_reg = ToRegister(instr->temp2()); | 5006 Register map_reg = ToRegister(instr->temp2()); |
5007 | 5007 |
5008 Handle<JSObject> holder = instr->holder(); | 5008 ZoneList<Handle<JSObject> >* prototypes = instr->prototypes(); |
5009 Handle<JSObject> current_prototype = instr->prototype(); | 5009 ZoneList<Handle<Map> >* maps = instr->maps(); |
5010 | 5010 |
5011 // Load prototype object. | 5011 ASSERT(prototypes->length() == maps->length()); |
5012 __ LoadHeapObject(prototype_reg, current_prototype); | |
5013 | 5012 |
5014 // Check prototype maps up to the holder. | 5013 for (int i = 0; i < prototypes->length(); i++) { |
5015 while (!current_prototype.is_identical_to(holder)) { | 5014 __ LoadHeapObject(prototype_reg, prototypes->at(i)); |
5016 __ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset)); | 5015 __ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset)); |
5017 DoCheckMapCommon(map_reg, | 5016 DoCheckMapCommon(map_reg, |
5018 Handle<Map>(current_prototype->map()), | 5017 maps->at(i), |
5019 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); | 5018 ALLOW_ELEMENT_TRANSITION_MAPS, |
5020 current_prototype = | 5019 instr->environment()); |
5021 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); | |
5022 // Load next prototype object. | |
5023 __ LoadHeapObject(prototype_reg, current_prototype); | |
5024 } | 5020 } |
5025 | |
5026 // Check the holder map. | |
5027 __ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset)); | |
5028 DoCheckMapCommon(map_reg, | |
5029 Handle<Map>(current_prototype->map()), | |
5030 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); | |
5031 } | 5021 } |
5032 | 5022 |
5033 | 5023 |
5034 void LCodeGen::DoAllocateObject(LAllocateObject* instr) { | 5024 void LCodeGen::DoAllocateObject(LAllocateObject* instr) { |
5035 class DeferredAllocateObject: public LDeferredCode { | 5025 class DeferredAllocateObject: public LDeferredCode { |
5036 public: | 5026 public: |
5037 DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr) | 5027 DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr) |
5038 : LDeferredCode(codegen), instr_(instr) { } | 5028 : LDeferredCode(codegen), instr_(instr) { } |
5039 virtual void Generate() { codegen()->DoDeferredAllocateObject(instr_); } | 5029 virtual void Generate() { codegen()->DoDeferredAllocateObject(instr_); } |
5040 virtual LInstruction* instr() { return instr_; } | 5030 virtual LInstruction* instr() { return instr_; } |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5833 __ Subu(scratch, result, scratch); | 5823 __ Subu(scratch, result, scratch); |
5834 __ lw(result, FieldMemOperand(scratch, | 5824 __ lw(result, FieldMemOperand(scratch, |
5835 FixedArray::kHeaderSize - kPointerSize)); | 5825 FixedArray::kHeaderSize - kPointerSize)); |
5836 __ bind(&done); | 5826 __ bind(&done); |
5837 } | 5827 } |
5838 | 5828 |
5839 | 5829 |
5840 #undef __ | 5830 #undef __ |
5841 | 5831 |
5842 } } // namespace v8::internal | 5832 } } // namespace v8::internal |
OLD | NEW |