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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 code->set_stack_slots(GetStackSlotCount()); | 84 code->set_stack_slots(GetStackSlotCount()); |
85 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 85 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
86 if (FLAG_weak_embedded_maps_in_optimized_code) { | 86 if (FLAG_weak_embedded_maps_in_optimized_code) { |
87 RegisterDependentCodeForEmbeddedMaps(code); | 87 RegisterDependentCodeForEmbeddedMaps(code); |
88 } | 88 } |
89 PopulateDeoptimizationData(code); | 89 PopulateDeoptimizationData(code); |
90 for (int i = 0 ; i < prototype_maps_.length(); i++) { | 90 for (int i = 0 ; i < prototype_maps_.length(); i++) { |
91 prototype_maps_.at(i)->AddDependentCode( | 91 prototype_maps_.at(i)->AddDependentCode( |
92 DependentCode::kPrototypeCheckGroup, code); | 92 DependentCode::kPrototypeCheckGroup, code); |
93 } | 93 } |
| 94 for (int i = 0 ; i < transition_maps_.length(); i++) { |
| 95 transition_maps_.at(i)->AddDependentCode( |
| 96 DependentCode::kTransitionGroup, code); |
| 97 } |
94 } | 98 } |
95 | 99 |
96 | 100 |
97 void LCodeGen::Abort(const char* reason) { | 101 void LCodeGen::Abort(const char* reason) { |
98 info()->set_bailout_reason(reason); | 102 info()->set_bailout_reason(reason); |
99 status_ = ABORTED; | 103 status_ = ABORTED; |
100 } | 104 } |
101 | 105 |
102 | 106 |
103 void LCodeGen::Comment(const char* format, ...) { | 107 void LCodeGen::Comment(const char* format, ...) { |
(...skipping 2961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3065 EMIT_REMEMBERED_SET, | 3069 EMIT_REMEMBERED_SET, |
3066 check_needed); | 3070 check_needed); |
3067 } | 3071 } |
3068 | 3072 |
3069 __ bind(&skip_assignment); | 3073 __ bind(&skip_assignment); |
3070 } | 3074 } |
3071 | 3075 |
3072 | 3076 |
3073 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 3077 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
3074 Register object = ToRegister(instr->object()); | 3078 Register object = ToRegister(instr->object()); |
3075 Register result = ToRegister(instr->result()); | 3079 if (!FLAG_track_double_fields) { |
| 3080 ASSERT(!instr->hydrogen()->representation().IsDouble()); |
| 3081 } |
| 3082 Register temp = instr->hydrogen()->representation().IsDouble() |
| 3083 ? ToRegister(instr->temp()) : ToRegister(instr->result()); |
3076 if (instr->hydrogen()->is_in_object()) { | 3084 if (instr->hydrogen()->is_in_object()) { |
3077 __ ldr(result, FieldMemOperand(object, instr->hydrogen()->offset())); | 3085 __ ldr(temp, FieldMemOperand(object, instr->hydrogen()->offset())); |
3078 } else { | 3086 } else { |
3079 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 3087 __ ldr(temp, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
3080 __ ldr(result, FieldMemOperand(result, instr->hydrogen()->offset())); | 3088 __ ldr(temp, FieldMemOperand(temp, instr->hydrogen()->offset())); |
| 3089 } |
| 3090 |
| 3091 if (instr->hydrogen()->representation().IsDouble()) { |
| 3092 Label load_from_heap_number, done; |
| 3093 DwVfpRegister result = ToDoubleRegister(instr->result()); |
| 3094 SwVfpRegister flt_scratch = double_scratch0().low(); |
| 3095 __ JumpIfNotSmi(temp, &load_from_heap_number); |
| 3096 __ SmiUntag(temp); |
| 3097 __ vmov(flt_scratch, temp); |
| 3098 __ vcvt_f64_s32(result, flt_scratch); |
| 3099 __ b(&done); |
| 3100 __ sub(ip, temp, Operand(kHeapObjectTag)); |
| 3101 __ vldr(result, ip, HeapNumber::kValueOffset); |
| 3102 __ bind(&done); |
3081 } | 3103 } |
3082 } | 3104 } |
3083 | 3105 |
3084 | 3106 |
3085 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, | 3107 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, |
3086 Register object, | 3108 Register object, |
3087 Handle<Map> type, | 3109 Handle<Map> type, |
3088 Handle<String> name, | 3110 Handle<String> name, |
3089 LEnvironment* env) { | 3111 LEnvironment* env) { |
3090 LookupResult lookup(isolate()); | 3112 LookupResult lookup(isolate()); |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4233 | 4255 |
4234 | 4256 |
4235 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 4257 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
4236 Register result = ToRegister(instr->result()); | 4258 Register result = ToRegister(instr->result()); |
4237 Register base = ToRegister(instr->base_object()); | 4259 Register base = ToRegister(instr->base_object()); |
4238 __ add(result, base, Operand(instr->offset())); | 4260 __ add(result, base, Operand(instr->offset())); |
4239 } | 4261 } |
4240 | 4262 |
4241 | 4263 |
4242 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 4264 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
| 4265 Representation representation = instr->representation(); |
| 4266 |
4243 Register object = ToRegister(instr->object()); | 4267 Register object = ToRegister(instr->object()); |
4244 Register value = ToRegister(instr->value()); | 4268 Register value = ToRegister(instr->value()); |
| 4269 ASSERT(!object.is(value)); |
4245 Register scratch = scratch0(); | 4270 Register scratch = scratch0(); |
4246 int offset = instr->offset(); | 4271 int offset = instr->offset(); |
4247 | 4272 |
4248 ASSERT(!object.is(value)); | 4273 if (FLAG_track_fields && representation.IsSmi()) { |
| 4274 __ SmiTag(value, value, SetCC); |
| 4275 if (!instr->hydrogen()->value()->range()->IsInSmiRange()) { |
| 4276 DeoptimizeIf(vs, instr->environment()); |
| 4277 } |
| 4278 } else if (FLAG_track_double_fields && representation.IsDouble() && |
| 4279 !instr->hydrogen()->value()->type().IsSmi() && |
| 4280 !instr->hydrogen()->value()->type().IsHeapNumber()) { |
| 4281 Label do_store; |
| 4282 __ JumpIfSmi(value, &do_store); |
| 4283 Handle<Map> map(isolate()->factory()->heap_number_map()); |
4249 | 4284 |
4250 if (!instr->transition().is_null()) { | 4285 __ ldr(scratch, FieldMemOperand(value, HeapObject::kMapOffset)); |
4251 __ mov(scratch, Operand(instr->transition())); | 4286 DoCheckMapCommon(scratch, map, REQUIRE_EXACT_MAP, instr->environment()); |
| 4287 __ bind(&do_store); |
| 4288 } |
| 4289 |
| 4290 Handle<Map> transition = instr->transition(); |
| 4291 if (!transition.is_null()) { |
| 4292 if (transition->CanBeDeprecated()) { |
| 4293 transition_maps_.Add(transition, info()->zone()); |
| 4294 } |
| 4295 __ mov(scratch, Operand(transition)); |
4252 __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 4296 __ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
4253 if (instr->hydrogen()->NeedsWriteBarrierForMap()) { | 4297 if (instr->hydrogen()->NeedsWriteBarrierForMap()) { |
4254 Register temp = ToRegister(instr->temp()); | 4298 Register temp = ToRegister(instr->temp()); |
4255 // Update the write barrier for the map field. | 4299 // Update the write barrier for the map field. |
4256 __ RecordWriteField(object, | 4300 __ RecordWriteField(object, |
4257 HeapObject::kMapOffset, | 4301 HeapObject::kMapOffset, |
4258 scratch, | 4302 scratch, |
4259 temp, | 4303 temp, |
4260 GetLinkRegisterState(), | 4304 GetLinkRegisterState(), |
4261 kSaveFPRegs, | 4305 kSaveFPRegs, |
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5997 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 6041 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
5998 __ ldr(result, FieldMemOperand(scratch, | 6042 __ ldr(result, FieldMemOperand(scratch, |
5999 FixedArray::kHeaderSize - kPointerSize)); | 6043 FixedArray::kHeaderSize - kPointerSize)); |
6000 __ bind(&done); | 6044 __ bind(&done); |
6001 } | 6045 } |
6002 | 6046 |
6003 | 6047 |
6004 #undef __ | 6048 #undef __ |
6005 | 6049 |
6006 } } // namespace v8::internal | 6050 } } // namespace v8::internal |
OLD | NEW |