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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 RegisterDependentCodeForEmbeddedMaps(code); | 106 RegisterDependentCodeForEmbeddedMaps(code); |
107 } | 107 } |
108 PopulateDeoptimizationData(code); | 108 PopulateDeoptimizationData(code); |
109 if (!info()->IsStub()) { | 109 if (!info()->IsStub()) { |
110 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code); | 110 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code); |
111 } | 111 } |
112 for (int i = 0 ; i < prototype_maps_.length(); i++) { | 112 for (int i = 0 ; i < prototype_maps_.length(); i++) { |
113 prototype_maps_.at(i)->AddDependentCode( | 113 prototype_maps_.at(i)->AddDependentCode( |
114 DependentCode::kPrototypeCheckGroup, code); | 114 DependentCode::kPrototypeCheckGroup, code); |
115 } | 115 } |
| 116 for (int i = 0 ; i < transition_maps_.length(); i++) { |
| 117 transition_maps_.at(i)->AddDependentCode( |
| 118 DependentCode::kFieldTransitionGroup, code); |
| 119 } |
116 } | 120 } |
117 | 121 |
118 | 122 |
119 void LCodeGen::Abort(const char* reason) { | 123 void LCodeGen::Abort(const char* reason) { |
120 info()->set_bailout_reason(reason); | 124 info()->set_bailout_reason(reason); |
121 status_ = ABORTED; | 125 status_ = ABORTED; |
122 } | 126 } |
123 | 127 |
124 | 128 |
125 void LCodeGen::Comment(const char* format, ...) { | 129 void LCodeGen::Comment(const char* format, ...) { |
(...skipping 2818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2944 EMIT_REMEMBERED_SET, | 2948 EMIT_REMEMBERED_SET, |
2945 check_needed); | 2949 check_needed); |
2946 } | 2950 } |
2947 | 2951 |
2948 __ bind(&skip_assignment); | 2952 __ bind(&skip_assignment); |
2949 } | 2953 } |
2950 | 2954 |
2951 | 2955 |
2952 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2956 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2953 Register object = ToRegister(instr->object()); | 2957 Register object = ToRegister(instr->object()); |
2954 Register result = ToRegister(instr->result()); | 2958 if (!FLAG_track_double_fields) { |
| 2959 ASSERT(!instr->hydrogen()->representation().IsDouble()); |
| 2960 } |
| 2961 Register temp = instr->hydrogen()->representation().IsDouble() |
| 2962 ? ToRegister(instr->temp()) : ToRegister(instr->result()); |
2955 if (instr->hydrogen()->is_in_object()) { | 2963 if (instr->hydrogen()->is_in_object()) { |
2956 __ mov(result, FieldOperand(object, instr->hydrogen()->offset())); | 2964 __ mov(temp, FieldOperand(object, instr->hydrogen()->offset())); |
2957 } else { | 2965 } else { |
2958 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); | 2966 __ mov(temp, FieldOperand(object, JSObject::kPropertiesOffset)); |
2959 __ mov(result, FieldOperand(result, instr->hydrogen()->offset())); | 2967 __ mov(temp, FieldOperand(temp, instr->hydrogen()->offset())); |
| 2968 } |
| 2969 |
| 2970 if (instr->hydrogen()->representation().IsDouble()) { |
| 2971 if (CpuFeatures::IsSupported(SSE2)) { |
| 2972 CpuFeatureScope scope(masm(), SSE2); |
| 2973 XMMRegister xmm = ToDoubleRegister(instr->result()); |
| 2974 Label load_from_heap_number, done; |
| 2975 __ JumpIfNotSmi(temp, &load_from_heap_number); |
| 2976 __ SmiUntag(temp); |
| 2977 __ cvtsi2sd(xmm, Operand(temp)); |
| 2978 __ jmp(&done); |
| 2979 __ bind(&load_from_heap_number); |
| 2980 __ movdbl(xmm, FieldOperand(temp, HeapNumber::kValueOffset)); |
| 2981 __ bind(&done); |
| 2982 } else { |
| 2983 // TODO(verwaest): Implement noSSE2 support. |
| 2984 UNREACHABLE(); |
| 2985 } |
2960 } | 2986 } |
2961 } | 2987 } |
2962 | 2988 |
2963 | 2989 |
2964 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, | 2990 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, |
2965 Register object, | 2991 Register object, |
2966 Handle<Map> type, | 2992 Handle<Map> type, |
2967 Handle<String> name, | 2993 Handle<String> name, |
2968 LEnvironment* env) { | 2994 LEnvironment* env) { |
2969 LookupResult lookup(isolate()); | 2995 LookupResult lookup(isolate()); |
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4209 | 4235 |
4210 | 4236 |
4211 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 4237 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
4212 Register result = ToRegister(instr->result()); | 4238 Register result = ToRegister(instr->result()); |
4213 Register base = ToRegister(instr->base_object()); | 4239 Register base = ToRegister(instr->base_object()); |
4214 __ lea(result, Operand(base, instr->offset())); | 4240 __ lea(result, Operand(base, instr->offset())); |
4215 } | 4241 } |
4216 | 4242 |
4217 | 4243 |
4218 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 4244 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
| 4245 StorageType storage = instr->storage_type(); |
| 4246 |
4219 Register object = ToRegister(instr->object()); | 4247 Register object = ToRegister(instr->object()); |
| 4248 |
4220 int offset = instr->offset(); | 4249 int offset = instr->offset(); |
4221 | 4250 |
4222 if (!instr->transition().is_null()) { | 4251 if (FLAG_track_fields && storage == SMI) { |
| 4252 if (instr->value()->IsConstantOperand()) { |
| 4253 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4254 if (!IsInteger32(operand_value)) { |
| 4255 DeoptimizeIf(no_condition, instr->environment()); |
| 4256 } |
| 4257 } else { |
| 4258 Register value = ToRegister(instr->value()); |
| 4259 __ SmiTag(value); |
| 4260 if (!instr->hydrogen()->value()->range()->IsInSmiRange()) { |
| 4261 DeoptimizeIf(overflow, instr->environment()); |
| 4262 } |
| 4263 } |
| 4264 } else if (FLAG_track_double_fields && storage == DOUBLE) { |
| 4265 if (instr->value()->IsConstantOperand()) { |
| 4266 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4267 if (operand_value->IsRegister()) { |
| 4268 DeoptimizeIf(no_condition, instr->environment()); |
| 4269 } else { |
| 4270 Handle<Object> operand(ToHandle(operand_value)); |
| 4271 if (!operand->IsHeapNumber() && !operand->IsSmi()) { |
| 4272 DeoptimizeIf(no_condition, instr->environment()); |
| 4273 } |
| 4274 } |
| 4275 } else if (!instr->hydrogen()->value()->type().IsSmi() && |
| 4276 !instr->hydrogen()->value()->type().IsHeapNumber()) { |
| 4277 Register value = ToRegister(instr->value()); |
| 4278 Label do_store; |
| 4279 __ JumpIfSmi(value, &do_store); |
| 4280 Handle<Map> map(isolate()->factory()->heap_number_map()); |
| 4281 DoCheckMapCommon(value, map, REQUIRE_EXACT_MAP, instr); |
| 4282 __ bind(&do_store); |
| 4283 } |
| 4284 } |
| 4285 |
| 4286 Handle<Map> transition = instr->transition(); |
| 4287 if (!transition.is_null()) { |
| 4288 if (transition->CanTransitionBeInvalidated()) { |
| 4289 transition_maps_.Add(transition, info()->zone()); |
| 4290 } |
4223 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) { | 4291 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) { |
4224 __ mov(FieldOperand(object, HeapObject::kMapOffset), instr->transition()); | 4292 __ mov(FieldOperand(object, HeapObject::kMapOffset), transition); |
4225 } else { | 4293 } else { |
4226 Register temp = ToRegister(instr->temp()); | 4294 Register temp = ToRegister(instr->temp()); |
4227 Register temp_map = ToRegister(instr->temp_map()); | 4295 Register temp_map = ToRegister(instr->temp_map()); |
4228 __ mov(temp_map, instr->transition()); | 4296 __ mov(temp_map, transition); |
4229 __ mov(FieldOperand(object, HeapObject::kMapOffset), temp_map); | 4297 __ mov(FieldOperand(object, HeapObject::kMapOffset), temp_map); |
4230 // Update the write barrier for the map field. | 4298 // Update the write barrier for the map field. |
4231 __ RecordWriteField(object, | 4299 __ RecordWriteField(object, |
4232 HeapObject::kMapOffset, | 4300 HeapObject::kMapOffset, |
4233 temp_map, | 4301 temp_map, |
4234 temp, | 4302 temp, |
4235 GetSaveFPRegsMode(), | 4303 GetSaveFPRegsMode(), |
4236 OMIT_REMEMBERED_SET, | 4304 OMIT_REMEMBERED_SET, |
4237 OMIT_SMI_CHECK); | 4305 OMIT_SMI_CHECK); |
4238 } | 4306 } |
(...skipping 2326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6565 FixedArray::kHeaderSize - kPointerSize)); | 6633 FixedArray::kHeaderSize - kPointerSize)); |
6566 __ bind(&done); | 6634 __ bind(&done); |
6567 } | 6635 } |
6568 | 6636 |
6569 | 6637 |
6570 #undef __ | 6638 #undef __ |
6571 | 6639 |
6572 } } // namespace v8::internal | 6640 } } // namespace v8::internal |
6573 | 6641 |
6574 #endif // V8_TARGET_ARCH_IA32 | 6642 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |