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 4068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4079 __ lw(at, FieldMemOperand(at, JSGlobalPropertyCell::kValueOffset)); | 4079 __ lw(at, FieldMemOperand(at, JSGlobalPropertyCell::kValueOffset)); |
4080 DeoptimizeIf(ne, instr->environment(), reg, | 4080 DeoptimizeIf(ne, instr->environment(), reg, |
4081 Operand(at)); | 4081 Operand(at)); |
4082 } else { | 4082 } else { |
4083 DeoptimizeIf(ne, instr->environment(), reg, | 4083 DeoptimizeIf(ne, instr->environment(), reg, |
4084 Operand(target)); | 4084 Operand(target)); |
4085 } | 4085 } |
4086 } | 4086 } |
4087 | 4087 |
4088 | 4088 |
| 4089 void LCodeGen::DoCheckMapCommon(Register reg, |
| 4090 Register scratch, |
| 4091 Handle<Map> map, |
| 4092 CompareMapMode mode, |
| 4093 LEnvironment* env) { |
| 4094 Label success; |
| 4095 __ CompareMapAndBranch(reg, scratch, map, &success, eq, &success, mode); |
| 4096 DeoptimizeIf(al, env); |
| 4097 __ bind(&success); |
| 4098 } |
| 4099 |
| 4100 |
4089 void LCodeGen::DoCheckMap(LCheckMap* instr) { | 4101 void LCodeGen::DoCheckMap(LCheckMap* instr) { |
4090 Register scratch = scratch0(); | 4102 Register scratch = scratch0(); |
4091 LOperand* input = instr->InputAt(0); | 4103 LOperand* input = instr->InputAt(0); |
4092 ASSERT(input->IsRegister()); | 4104 ASSERT(input->IsRegister()); |
4093 Register reg = ToRegister(input); | 4105 Register reg = ToRegister(input); |
4094 __ lw(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); | 4106 Handle<Map> map = instr->hydrogen()->map(); |
4095 DeoptimizeIf(ne, | 4107 DoCheckMapCommon(reg, scratch, map, instr->hydrogen()->mode(), |
4096 instr->environment(), | 4108 instr->environment()); |
4097 scratch, | |
4098 Operand(instr->hydrogen()->map())); | |
4099 } | 4109 } |
4100 | 4110 |
4101 | 4111 |
4102 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { | 4112 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { |
4103 DoubleRegister value_reg = ToDoubleRegister(instr->unclamped()); | 4113 DoubleRegister value_reg = ToDoubleRegister(instr->unclamped()); |
4104 Register result_reg = ToRegister(instr->result()); | 4114 Register result_reg = ToRegister(instr->result()); |
4105 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); | 4115 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); |
4106 __ ClampDoubleToUint8(result_reg, value_reg, temp_reg); | 4116 __ ClampDoubleToUint8(result_reg, value_reg, temp_reg); |
4107 } | 4117 } |
4108 | 4118 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4156 Register temp2 = ToRegister(instr->TempAt(1)); | 4166 Register temp2 = ToRegister(instr->TempAt(1)); |
4157 | 4167 |
4158 Handle<JSObject> holder = instr->holder(); | 4168 Handle<JSObject> holder = instr->holder(); |
4159 Handle<JSObject> current_prototype = instr->prototype(); | 4169 Handle<JSObject> current_prototype = instr->prototype(); |
4160 | 4170 |
4161 // Load prototype object. | 4171 // Load prototype object. |
4162 __ LoadHeapObject(temp1, current_prototype); | 4172 __ LoadHeapObject(temp1, current_prototype); |
4163 | 4173 |
4164 // Check prototype maps up to the holder. | 4174 // Check prototype maps up to the holder. |
4165 while (!current_prototype.is_identical_to(holder)) { | 4175 while (!current_prototype.is_identical_to(holder)) { |
4166 __ lw(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset)); | 4176 DoCheckMapCommon(temp1, temp2, |
4167 DeoptimizeIf(ne, | 4177 Handle<Map>(current_prototype->map()), |
4168 instr->environment(), | 4178 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); |
4169 temp2, | |
4170 Operand(Handle<Map>(current_prototype->map()))); | |
4171 current_prototype = | 4179 current_prototype = |
4172 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); | 4180 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); |
4173 // Load next prototype object. | 4181 // Load next prototype object. |
4174 __ LoadHeapObject(temp1, current_prototype); | 4182 __ LoadHeapObject(temp1, current_prototype); |
4175 } | 4183 } |
4176 | 4184 |
4177 // Check the holder map. | 4185 // Check the holder map. |
4178 __ lw(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset)); | 4186 DoCheckMapCommon(temp1, temp2, |
4179 DeoptimizeIf(ne, | 4187 Handle<Map>(current_prototype->map()), |
4180 instr->environment(), | 4188 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); |
4181 temp2, | |
4182 Operand(Handle<Map>(current_prototype->map()))); | |
4183 } | 4189 } |
4184 | 4190 |
4185 | 4191 |
4186 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 4192 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
4187 Heap* heap = isolate()->heap(); | 4193 Heap* heap = isolate()->heap(); |
4188 ElementsKind boilerplate_elements_kind = | 4194 ElementsKind boilerplate_elements_kind = |
4189 instr->hydrogen()->boilerplate_elements_kind(); | 4195 instr->hydrogen()->boilerplate_elements_kind(); |
4190 | 4196 |
4191 // Deopt if the array literal boilerplate ElementsKind is of a type different | 4197 // Deopt if the array literal boilerplate ElementsKind is of a type different |
4192 // than the expected one. The check isn't necessary if the boilerplate has | 4198 // than the expected one. The check isn't necessary if the boilerplate has |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4706 ASSERT(!environment->HasBeenRegistered()); | 4712 ASSERT(!environment->HasBeenRegistered()); |
4707 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4713 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
4708 ASSERT(osr_pc_offset_ == -1); | 4714 ASSERT(osr_pc_offset_ == -1); |
4709 osr_pc_offset_ = masm()->pc_offset(); | 4715 osr_pc_offset_ = masm()->pc_offset(); |
4710 } | 4716 } |
4711 | 4717 |
4712 | 4718 |
4713 #undef __ | 4719 #undef __ |
4714 | 4720 |
4715 } } // namespace v8::internal | 4721 } } // namespace v8::internal |
OLD | NEW |