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 2929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2940 GetSaveFPRegsMode(), | 2940 GetSaveFPRegsMode(), |
2941 EMIT_REMEMBERED_SET, | 2941 EMIT_REMEMBERED_SET, |
2942 check_needed); | 2942 check_needed); |
2943 } | 2943 } |
2944 | 2944 |
2945 __ bind(&skip_assignment); | 2945 __ bind(&skip_assignment); |
2946 } | 2946 } |
2947 | 2947 |
2948 | 2948 |
2949 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2949 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
| 2950 int offset = instr->hydrogen()->offset(); |
2950 Register object = ToRegister(instr->object()); | 2951 Register object = ToRegister(instr->object()); |
2951 if (!FLAG_track_double_fields) { | 2952 if (FLAG_track_double_fields && |
2952 ASSERT(!instr->hydrogen()->representation().IsDouble()); | 2953 instr->hydrogen()->representation().IsDouble()) { |
2953 } | |
2954 Register temp = instr->hydrogen()->representation().IsDouble() | |
2955 ? ToRegister(instr->temp()) : ToRegister(instr->result()); | |
2956 if (instr->hydrogen()->is_in_object()) { | |
2957 __ mov(temp, FieldOperand(object, instr->hydrogen()->offset())); | |
2958 } else { | |
2959 __ mov(temp, FieldOperand(object, JSObject::kPropertiesOffset)); | |
2960 __ mov(temp, FieldOperand(temp, instr->hydrogen()->offset())); | |
2961 } | |
2962 | |
2963 if (instr->hydrogen()->representation().IsDouble()) { | |
2964 Label load_from_heap_number, done; | |
2965 if (CpuFeatures::IsSupported(SSE2)) { | 2954 if (CpuFeatures::IsSupported(SSE2)) { |
2966 CpuFeatureScope scope(masm(), SSE2); | 2955 CpuFeatureScope scope(masm(), SSE2); |
2967 XMMRegister result = ToDoubleRegister(instr->result()); | 2956 XMMRegister result = ToDoubleRegister(instr->result()); |
2968 __ JumpIfNotSmi(temp, &load_from_heap_number); | 2957 __ movdbl(result, FieldOperand(object, offset)); |
2969 __ SmiUntag(temp); | |
2970 __ cvtsi2sd(result, Operand(temp)); | |
2971 __ jmp(&done); | |
2972 __ bind(&load_from_heap_number); | |
2973 __ movdbl(result, FieldOperand(temp, HeapNumber::kValueOffset)); | |
2974 } else { | 2958 } else { |
2975 __ JumpIfNotSmi(temp, &load_from_heap_number); | 2959 PushX87DoubleOperand(FieldOperand(object, offset)); |
2976 __ SmiUntag(temp); | |
2977 __ push(temp); | |
2978 __ fild_s(Operand(esp, 0)); | |
2979 __ pop(temp); | |
2980 __ jmp(&done); | |
2981 __ bind(&load_from_heap_number); | |
2982 PushX87DoubleOperand(FieldOperand(temp, HeapNumber::kValueOffset)); | |
2983 CurrentInstructionReturnsX87Result(); | 2960 CurrentInstructionReturnsX87Result(); |
2984 } | 2961 } |
2985 __ bind(&done); | 2962 return; |
| 2963 } |
| 2964 |
| 2965 Register result = ToRegister(instr->result()); |
| 2966 if (instr->hydrogen()->is_in_object()) { |
| 2967 __ mov(result, FieldOperand(object, offset)); |
| 2968 } else { |
| 2969 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
| 2970 __ mov(result, FieldOperand(result, offset)); |
2986 } | 2971 } |
2987 } | 2972 } |
2988 | 2973 |
2989 | 2974 |
2990 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, | 2975 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, |
2991 Register object, | 2976 Register object, |
2992 Handle<Map> type, | 2977 Handle<Map> type, |
2993 Handle<String> name, | 2978 Handle<String> name, |
2994 LEnvironment* env) { | 2979 LEnvironment* env) { |
2995 LookupResult lookup(isolate()); | 2980 LookupResult lookup(isolate()); |
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4225 } | 4210 } |
4226 | 4211 |
4227 | 4212 |
4228 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 4213 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
4229 Representation representation = instr->representation(); | 4214 Representation representation = instr->representation(); |
4230 | 4215 |
4231 Register object = ToRegister(instr->object()); | 4216 Register object = ToRegister(instr->object()); |
4232 | 4217 |
4233 int offset = instr->offset(); | 4218 int offset = instr->offset(); |
4234 | 4219 |
| 4220 Handle<Map> transition = instr->transition(); |
| 4221 |
4235 if (FLAG_track_fields && representation.IsSmi()) { | 4222 if (FLAG_track_fields && representation.IsSmi()) { |
4236 if (instr->value()->IsConstantOperand()) { | 4223 if (instr->value()->IsConstantOperand()) { |
4237 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4224 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
4238 if (!IsInteger32(operand_value)) { | 4225 if (!IsInteger32(operand_value)) { |
4239 DeoptimizeIf(no_condition, instr->environment()); | 4226 DeoptimizeIf(no_condition, instr->environment()); |
4240 } | 4227 } |
4241 } else { | 4228 } else { |
4242 Register value = ToRegister(instr->value()); | 4229 Register value = ToRegister(instr->value()); |
4243 __ SmiTag(value); | 4230 __ SmiTag(value); |
4244 if (!instr->hydrogen()->value()->range()->IsInSmiRange()) { | 4231 if (!instr->hydrogen()->value()->range()->IsInSmiRange()) { |
4245 DeoptimizeIf(overflow, instr->environment()); | 4232 DeoptimizeIf(overflow, instr->environment()); |
4246 } | 4233 } |
4247 } | 4234 } |
4248 } else if (FLAG_track_double_fields && representation.IsDouble() && | 4235 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
4249 !instr->hydrogen()->value()->type().IsSmi() && | 4236 ASSERT(transition.is_null()); |
4250 !instr->hydrogen()->value()->type().IsHeapNumber()) { | 4237 ASSERT(instr->is_in_object()); |
4251 Register value = ToRegister(instr->value()); | 4238 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
4252 Label do_store; | 4239 if (CpuFeatures::IsSupported(SSE2)) { |
4253 __ JumpIfSmi(value, &do_store); | 4240 CpuFeatureScope scope(masm(), SSE2); |
4254 Handle<Map> map(isolate()->factory()->heap_number_map()); | 4241 XMMRegister value = ToDoubleRegister(instr->value()); |
4255 DoCheckMapCommon(value, map, REQUIRE_EXACT_MAP, instr); | 4242 __ movdbl(FieldOperand(object, offset), value); |
4256 __ bind(&do_store); | 4243 } else { |
| 4244 UNREACHABLE(); |
| 4245 } |
| 4246 return; |
4257 } | 4247 } |
4258 | 4248 |
4259 Handle<Map> transition = instr->transition(); | |
4260 if (!transition.is_null()) { | 4249 if (!transition.is_null()) { |
4261 if (transition->CanBeDeprecated()) { | 4250 if (transition->CanBeDeprecated()) { |
4262 transition_maps_.Add(transition, info()->zone()); | 4251 transition_maps_.Add(transition, info()->zone()); |
4263 } | 4252 } |
4264 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) { | 4253 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) { |
4265 __ mov(FieldOperand(object, HeapObject::kMapOffset), transition); | 4254 __ mov(FieldOperand(object, HeapObject::kMapOffset), transition); |
4266 } else { | 4255 } else { |
4267 Register temp = ToRegister(instr->temp()); | 4256 Register temp = ToRegister(instr->temp()); |
4268 Register temp_map = ToRegister(instr->temp_map()); | 4257 Register temp_map = ToRegister(instr->temp_map()); |
4269 __ mov(temp_map, transition); | 4258 __ mov(temp_map, transition); |
(...skipping 25 matching lines...) Expand all Loading... |
4295 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4284 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
4296 if (IsInteger32(operand_value)) { | 4285 if (IsInteger32(operand_value)) { |
4297 // In lithium register preparation, we made sure that the constant integer | 4286 // In lithium register preparation, we made sure that the constant integer |
4298 // operand fits into smi range. | 4287 // operand fits into smi range. |
4299 Smi* smi_value = Smi::FromInt(ToInteger32(operand_value)); | 4288 Smi* smi_value = Smi::FromInt(ToInteger32(operand_value)); |
4300 __ mov(FieldOperand(write_register, offset), Immediate(smi_value)); | 4289 __ mov(FieldOperand(write_register, offset), Immediate(smi_value)); |
4301 } else if (operand_value->IsRegister()) { | 4290 } else if (operand_value->IsRegister()) { |
4302 __ mov(FieldOperand(write_register, offset), ToRegister(operand_value)); | 4291 __ mov(FieldOperand(write_register, offset), ToRegister(operand_value)); |
4303 } else { | 4292 } else { |
4304 Handle<Object> handle_value = ToHandle(operand_value); | 4293 Handle<Object> handle_value = ToHandle(operand_value); |
| 4294 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
4305 __ mov(FieldOperand(write_register, offset), handle_value); | 4295 __ mov(FieldOperand(write_register, offset), handle_value); |
4306 } | 4296 } |
4307 } else { | 4297 } else { |
4308 __ mov(FieldOperand(write_register, offset), ToRegister(instr->value())); | 4298 __ mov(FieldOperand(write_register, offset), ToRegister(instr->value())); |
4309 } | 4299 } |
4310 | 4300 |
4311 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4301 if (instr->hydrogen()->NeedsWriteBarrier()) { |
4312 Register value = ToRegister(instr->value()); | 4302 Register value = ToRegister(instr->value()); |
4313 Register temp = instr->is_in_object() ? ToRegister(instr->temp()) : object; | 4303 Register temp = instr->is_in_object() ? ToRegister(instr->temp()) : object; |
4314 // Update the write barrier for the object for in-object properties. | 4304 // Update the write barrier for the object for in-object properties. |
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6142 int flags = instr->hydrogen()->fast_elements() | 6132 int flags = instr->hydrogen()->fast_elements() |
6143 ? ObjectLiteral::kFastElements | 6133 ? ObjectLiteral::kFastElements |
6144 : ObjectLiteral::kNoFlags; | 6134 : ObjectLiteral::kNoFlags; |
6145 flags |= instr->hydrogen()->has_function() | 6135 flags |= instr->hydrogen()->has_function() |
6146 ? ObjectLiteral::kHasFunction | 6136 ? ObjectLiteral::kHasFunction |
6147 : ObjectLiteral::kNoFlags; | 6137 : ObjectLiteral::kNoFlags; |
6148 | 6138 |
6149 // Set up the parameters to the stub/runtime call and pick the right | 6139 // Set up the parameters to the stub/runtime call and pick the right |
6150 // runtime function or stub to call. | 6140 // runtime function or stub to call. |
6151 int properties_count = instr->hydrogen()->constant_properties_length() / 2; | 6141 int properties_count = instr->hydrogen()->constant_properties_length() / 2; |
6152 if (instr->hydrogen()->depth() > 1) { | 6142 if ((FLAG_track_double_fields && instr->hydrogen()->may_store_doubles()) || |
| 6143 instr->hydrogen()->depth() > 1) { |
6153 __ PushHeapObject(literals); | 6144 __ PushHeapObject(literals); |
6154 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | 6145 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); |
6155 __ push(Immediate(constant_properties)); | 6146 __ push(Immediate(constant_properties)); |
6156 __ push(Immediate(Smi::FromInt(flags))); | 6147 __ push(Immediate(Smi::FromInt(flags))); |
6157 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); | 6148 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); |
6158 } else if (flags != ObjectLiteral::kFastElements || | 6149 } else if (flags != ObjectLiteral::kFastElements || |
6159 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | 6150 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
6160 __ PushHeapObject(literals); | 6151 __ PushHeapObject(literals); |
6161 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | 6152 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); |
6162 __ push(Immediate(constant_properties)); | 6153 __ push(Immediate(constant_properties)); |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6607 FixedArray::kHeaderSize - kPointerSize)); | 6598 FixedArray::kHeaderSize - kPointerSize)); |
6608 __ bind(&done); | 6599 __ bind(&done); |
6609 } | 6600 } |
6610 | 6601 |
6611 | 6602 |
6612 #undef __ | 6603 #undef __ |
6613 | 6604 |
6614 } } // namespace v8::internal | 6605 } } // namespace v8::internal |
6615 | 6606 |
6616 #endif // V8_TARGET_ARCH_IA32 | 6607 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |