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 2740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2751 DeoptimizeIf(al, instr->environment()); | 2751 DeoptimizeIf(al, instr->environment()); |
2752 return; | 2752 return; |
2753 } | 2753 } |
2754 Handle<String> name = instr->hydrogen()->name(); | 2754 Handle<String> name = instr->hydrogen()->name(); |
2755 Label done; | 2755 Label done; |
2756 __ lw(object_map, FieldMemOperand(object, HeapObject::kMapOffset)); | 2756 __ lw(object_map, FieldMemOperand(object, HeapObject::kMapOffset)); |
2757 for (int i = 0; i < map_count; ++i) { | 2757 for (int i = 0; i < map_count; ++i) { |
2758 bool last = (i == map_count - 1); | 2758 bool last = (i == map_count - 1); |
2759 Handle<Map> map = instr->hydrogen()->types()->at(i); | 2759 Handle<Map> map = instr->hydrogen()->types()->at(i); |
2760 Label check_passed; | 2760 Label check_passed; |
2761 __ CompareMapAndBranch( | 2761 __ CompareMapAndBranch(object_map, map, &check_passed, eq, &check_passed); |
2762 object_map, map, &check_passed, | |
2763 eq, &check_passed, ALLOW_ELEMENT_TRANSITION_MAPS); | |
2764 if (last && !need_generic) { | 2762 if (last && !need_generic) { |
2765 DeoptimizeIf(al, instr->environment()); | 2763 DeoptimizeIf(al, instr->environment()); |
2766 __ bind(&check_passed); | 2764 __ bind(&check_passed); |
2767 EmitLoadFieldOrConstantFunction( | 2765 EmitLoadFieldOrConstantFunction( |
2768 result, object, map, name, instr->environment()); | 2766 result, object, map, name, instr->environment()); |
2769 } else { | 2767 } else { |
2770 Label next; | 2768 Label next; |
2771 __ Branch(&next); | 2769 __ Branch(&next); |
2772 __ bind(&check_passed); | 2770 __ bind(&check_passed); |
2773 EmitLoadFieldOrConstantFunction( | 2771 EmitLoadFieldOrConstantFunction( |
(...skipping 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4937 Operand(at)); | 4935 Operand(at)); |
4938 } else { | 4936 } else { |
4939 DeoptimizeIf(ne, instr->environment(), reg, | 4937 DeoptimizeIf(ne, instr->environment(), reg, |
4940 Operand(target)); | 4938 Operand(target)); |
4941 } | 4939 } |
4942 } | 4940 } |
4943 | 4941 |
4944 | 4942 |
4945 void LCodeGen::DoCheckMapCommon(Register map_reg, | 4943 void LCodeGen::DoCheckMapCommon(Register map_reg, |
4946 Handle<Map> map, | 4944 Handle<Map> map, |
4947 CompareMapMode mode, | |
4948 LEnvironment* env) { | 4945 LEnvironment* env) { |
4949 Label success; | 4946 Label success; |
4950 __ CompareMapAndBranch(map_reg, map, &success, eq, &success, mode); | 4947 __ CompareMapAndBranch(map_reg, map, &success, eq, &success); |
4951 DeoptimizeIf(al, env); | 4948 DeoptimizeIf(al, env); |
4952 __ bind(&success); | 4949 __ bind(&success); |
4953 } | 4950 } |
4954 | 4951 |
4955 | 4952 |
4956 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { | 4953 void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
4957 Register map_reg = scratch0(); | 4954 Register map_reg = scratch0(); |
4958 LOperand* input = instr->value(); | 4955 LOperand* input = instr->value(); |
4959 ASSERT(input->IsRegister()); | 4956 ASSERT(input->IsRegister()); |
4960 Register reg = ToRegister(input); | 4957 Register reg = ToRegister(input); |
4961 Label success; | 4958 Label success; |
4962 SmallMapList* map_set = instr->hydrogen()->map_set(); | 4959 SmallMapList* map_set = instr->hydrogen()->map_set(); |
4963 __ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); | 4960 __ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); |
4964 for (int i = 0; i < map_set->length() - 1; i++) { | 4961 for (int i = 0; i < map_set->length() - 1; i++) { |
4965 Handle<Map> map = map_set->at(i); | 4962 Handle<Map> map = map_set->at(i); |
4966 __ CompareMapAndBranch( | 4963 __ CompareMapAndBranch(map_reg, map, &success, eq, &success); |
4967 map_reg, map, &success, eq, &success, REQUIRE_EXACT_MAP); | |
4968 } | 4964 } |
4969 Handle<Map> map = map_set->last(); | 4965 Handle<Map> map = map_set->last(); |
4970 DoCheckMapCommon(map_reg, map, REQUIRE_EXACT_MAP, instr->environment()); | 4966 DoCheckMapCommon(map_reg, map, instr->environment()); |
4971 __ bind(&success); | 4967 __ bind(&success); |
4972 } | 4968 } |
4973 | 4969 |
4974 | 4970 |
4975 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { | 4971 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { |
4976 DoubleRegister value_reg = ToDoubleRegister(instr->unclamped()); | 4972 DoubleRegister value_reg = ToDoubleRegister(instr->unclamped()); |
4977 Register result_reg = ToRegister(instr->result()); | 4973 Register result_reg = ToRegister(instr->result()); |
4978 DoubleRegister temp_reg = ToDoubleRegister(instr->temp()); | 4974 DoubleRegister temp_reg = ToDoubleRegister(instr->temp()); |
4979 __ ClampDoubleToUint8(result_reg, value_reg, temp_reg); | 4975 __ ClampDoubleToUint8(result_reg, value_reg, temp_reg); |
4980 } | 4976 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5032 ASSERT(prototypes->length() == maps->length()); | 5028 ASSERT(prototypes->length() == maps->length()); |
5033 | 5029 |
5034 if (instr->hydrogen()->CanOmitPrototypeChecks()) { | 5030 if (instr->hydrogen()->CanOmitPrototypeChecks()) { |
5035 for (int i = 0; i < maps->length(); i++) { | 5031 for (int i = 0; i < maps->length(); i++) { |
5036 prototype_maps_.Add(maps->at(i), info()->zone()); | 5032 prototype_maps_.Add(maps->at(i), info()->zone()); |
5037 } | 5033 } |
5038 } else { | 5034 } else { |
5039 for (int i = 0; i < prototypes->length(); i++) { | 5035 for (int i = 0; i < prototypes->length(); i++) { |
5040 __ LoadHeapObject(prototype_reg, prototypes->at(i)); | 5036 __ LoadHeapObject(prototype_reg, prototypes->at(i)); |
5041 __ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset)); | 5037 __ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset)); |
5042 DoCheckMapCommon(map_reg, | 5038 DoCheckMapCommon(map_reg, maps->at(i), instr->environment()); |
5043 maps->at(i), | |
5044 ALLOW_ELEMENT_TRANSITION_MAPS, | |
5045 instr->environment()); | |
5046 } | 5039 } |
5047 } | 5040 } |
5048 } | 5041 } |
5049 | 5042 |
5050 | 5043 |
5051 void LCodeGen::DoAllocateObject(LAllocateObject* instr) { | 5044 void LCodeGen::DoAllocateObject(LAllocateObject* instr) { |
5052 class DeferredAllocateObject: public LDeferredCode { | 5045 class DeferredAllocateObject: public LDeferredCode { |
5053 public: | 5046 public: |
5054 DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr) | 5047 DeferredAllocateObject(LCodeGen* codegen, LAllocateObject* instr) |
5055 : LDeferredCode(codegen), instr_(instr) { } | 5048 : LDeferredCode(codegen), instr_(instr) { } |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5673 __ Subu(scratch, result, scratch); | 5666 __ Subu(scratch, result, scratch); |
5674 __ lw(result, FieldMemOperand(scratch, | 5667 __ lw(result, FieldMemOperand(scratch, |
5675 FixedArray::kHeaderSize - kPointerSize)); | 5668 FixedArray::kHeaderSize - kPointerSize)); |
5676 __ bind(&done); | 5669 __ bind(&done); |
5677 } | 5670 } |
5678 | 5671 |
5679 | 5672 |
5680 #undef __ | 5673 #undef __ |
5681 | 5674 |
5682 } } // namespace v8::internal | 5675 } } // namespace v8::internal |
OLD | NEW |