| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 | 82 |
| 83 void LCodeGen::FinishCode(Handle<Code> code) { | 83 void LCodeGen::FinishCode(Handle<Code> code) { |
| 84 ASSERT(is_done()); | 84 ASSERT(is_done()); |
| 85 code->set_stack_slots(GetStackSlotCount()); | 85 code->set_stack_slots(GetStackSlotCount()); |
| 86 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 86 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
| 87 if (FLAG_weak_embedded_maps_in_optimized_code) { | 87 if (FLAG_weak_embedded_maps_in_optimized_code) { |
| 88 RegisterDependentCodeForEmbeddedMaps(code); | 88 RegisterDependentCodeForEmbeddedMaps(code); |
| 89 } | 89 } |
| 90 PopulateDeoptimizationData(code); | 90 PopulateDeoptimizationData(code); |
| 91 for (int i = 0 ; i < prototype_maps_.length(); i++) { |
| 92 prototype_maps_.at(i)->AddDependentCode( |
| 93 DependentCode::kPrototypeCheckGroup, code); |
| 94 } |
| 91 } | 95 } |
| 92 | 96 |
| 93 | 97 |
| 94 void LChunkBuilder::Abort(const char* reason) { | 98 void LChunkBuilder::Abort(const char* reason) { |
| 95 info()->set_bailout_reason(reason); | 99 info()->set_bailout_reason(reason); |
| 96 status_ = ABORTED; | 100 status_ = ABORTED; |
| 97 } | 101 } |
| 98 | 102 |
| 99 | 103 |
| 100 void LCodeGen::Comment(const char* format, ...) { | 104 void LCodeGen::Comment(const char* format, ...) { |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 } | 866 } |
| 863 } | 867 } |
| 864 } | 868 } |
| 865 #ifdef VERIFY_HEAP | 869 #ifdef VERIFY_HEAP |
| 866 // This disables verification of weak embedded maps after full GC. | 870 // This disables verification of weak embedded maps after full GC. |
| 867 // AddDependentCode can cause a GC, which would observe the state where | 871 // AddDependentCode can cause a GC, which would observe the state where |
| 868 // this code is not yet in the depended code lists of the embedded maps. | 872 // this code is not yet in the depended code lists of the embedded maps. |
| 869 NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps; | 873 NoWeakEmbeddedMapsVerificationScope disable_verification_of_embedded_maps; |
| 870 #endif | 874 #endif |
| 871 for (int i = 0; i < maps.length(); i++) { | 875 for (int i = 0; i < maps.length(); i++) { |
| 872 maps.at(i)->AddDependentCode(code); | 876 maps.at(i)->AddDependentCode(DependentCode::kWeaklyEmbeddedGroup, code); |
| 873 } | 877 } |
| 874 } | 878 } |
| 875 | 879 |
| 876 | 880 |
| 877 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { | 881 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { |
| 878 int length = deoptimizations_.length(); | 882 int length = deoptimizations_.length(); |
| 879 if (length == 0) return; | 883 if (length == 0) return; |
| 880 Handle<DeoptimizationInputData> data = | 884 Handle<DeoptimizationInputData> data = |
| 881 factory()->NewDeoptimizationInputData(length, TENURED); | 885 factory()->NewDeoptimizationInputData(length, TENURED); |
| 882 | 886 |
| (...skipping 4264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5147 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { | 5151 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
| 5148 ASSERT(instr->temp()->Equals(instr->result())); | 5152 ASSERT(instr->temp()->Equals(instr->result())); |
| 5149 Register prototype_reg = ToRegister(instr->temp()); | 5153 Register prototype_reg = ToRegister(instr->temp()); |
| 5150 Register map_reg = ToRegister(instr->temp2()); | 5154 Register map_reg = ToRegister(instr->temp2()); |
| 5151 | 5155 |
| 5152 ZoneList<Handle<JSObject> >* prototypes = instr->prototypes(); | 5156 ZoneList<Handle<JSObject> >* prototypes = instr->prototypes(); |
| 5153 ZoneList<Handle<Map> >* maps = instr->maps(); | 5157 ZoneList<Handle<Map> >* maps = instr->maps(); |
| 5154 | 5158 |
| 5155 ASSERT(prototypes->length() == maps->length()); | 5159 ASSERT(prototypes->length() == maps->length()); |
| 5156 | 5160 |
| 5157 for (int i = 0; i < prototypes->length(); i++) { | 5161 if (instr->hydrogen()->CanOmitPrototypeChecks()) { |
| 5158 __ LoadHeapObject(prototype_reg, prototypes->at(i)); | 5162 for (int i = 0; i < maps->length(); i++) { |
| 5159 __ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset)); | 5163 prototype_maps_.Add(maps->at(i), info()->zone()); |
| 5160 DoCheckMapCommon(map_reg, | 5164 } |
| 5161 maps->at(i), | 5165 __ LoadHeapObject(prototype_reg, |
| 5162 ALLOW_ELEMENT_TRANSITION_MAPS, | 5166 prototypes->at(prototypes->length() - 1)); |
| 5163 instr->environment()); | 5167 } else { |
| 5168 for (int i = 0; i < prototypes->length(); i++) { |
| 5169 __ LoadHeapObject(prototype_reg, prototypes->at(i)); |
| 5170 __ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset)); |
| 5171 DoCheckMapCommon(map_reg, |
| 5172 maps->at(i), |
| 5173 ALLOW_ELEMENT_TRANSITION_MAPS, |
| 5174 instr->environment()); |
| 5175 } |
| 5164 } | 5176 } |
| 5165 } | 5177 } |
| 5166 | 5178 |
| 5167 | 5179 |
| 5168 void LCodeGen::DoAllocateObject(LAllocateObject* instr) { | 5180 void LCodeGen::DoAllocateObject(LAllocateObject* instr) { |
| 5169 class DeferredAllocateObject: public LDeferredCode { | 5181 class DeferredAllocateObject: public LDeferredCode { |
| 5170 public: | 5182 public: |
| 5171 DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr) | 5183 DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr) |
| 5172 : LDeferredCode(codegen), instr_(instr) { } | 5184 : LDeferredCode(codegen), instr_(instr) { } |
| 5173 virtual void Generate() { codegen()->DoDeferredAllocateObject(instr_); } | 5185 virtual void Generate() { codegen()->DoDeferredAllocateObject(instr_); } |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6024 __ Subu(scratch, result, scratch); | 6036 __ Subu(scratch, result, scratch); |
| 6025 __ lw(result, FieldMemOperand(scratch, | 6037 __ lw(result, FieldMemOperand(scratch, |
| 6026 FixedArray::kHeaderSize - kPointerSize)); | 6038 FixedArray::kHeaderSize - kPointerSize)); |
| 6027 __ bind(&done); | 6039 __ bind(&done); |
| 6028 } | 6040 } |
| 6029 | 6041 |
| 6030 | 6042 |
| 6031 #undef __ | 6043 #undef __ |
| 6032 | 6044 |
| 6033 } } // namespace v8::internal | 6045 } } // namespace v8::internal |
| OLD | NEW |