Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 14146005: Track representations of fields (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test for tracking fields Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::kTransitionGroup, 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
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 Label load_from_heap_number, done;
2972 if (CpuFeatures::IsSupported(SSE2)) {
2973 CpuFeatureScope scope(masm(), SSE2);
2974 XMMRegister result = ToDoubleRegister(instr->result());
2975 __ JumpIfNotSmi(temp, &load_from_heap_number);
2976 __ SmiUntag(temp);
2977 __ cvtsi2sd(result, Operand(temp));
2978 __ jmp(&done);
2979 __ bind(&load_from_heap_number);
2980 __ movdbl(result, FieldOperand(temp, HeapNumber::kValueOffset));
2981 } else {
2982 __ JumpIfNotSmi(temp, &load_from_heap_number);
2983 __ SmiUntag(temp);
2984 __ push(temp);
2985 __ fild_s(Operand(esp, 0));
2986 __ pop(temp);
2987 __ jmp(&done);
2988 __ bind(&load_from_heap_number);
2989 PushX87DoubleOperand(FieldOperand(temp, HeapNumber::kValueOffset));
2990 CurrentInstructionReturnsX87Result();
2991 }
2992 __ bind(&done);
2960 } 2993 }
2961 } 2994 }
2962 2995
2963 2996
2964 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result, 2997 void LCodeGen::EmitLoadFieldOrConstantFunction(Register result,
2965 Register object, 2998 Register object,
2966 Handle<Map> type, 2999 Handle<Map> type,
2967 Handle<String> name, 3000 Handle<String> name,
2968 LEnvironment* env) { 3001 LEnvironment* env) {
2969 LookupResult lookup(isolate()); 3002 LookupResult lookup(isolate());
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
4209 4242
4210 4243
4211 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { 4244 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) {
4212 Register result = ToRegister(instr->result()); 4245 Register result = ToRegister(instr->result());
4213 Register base = ToRegister(instr->base_object()); 4246 Register base = ToRegister(instr->base_object());
4214 __ lea(result, Operand(base, instr->offset())); 4247 __ lea(result, Operand(base, instr->offset()));
4215 } 4248 }
4216 4249
4217 4250
4218 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { 4251 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
4252 Representation representation = instr->representation();
4253
4219 Register object = ToRegister(instr->object()); 4254 Register object = ToRegister(instr->object());
4255
4220 int offset = instr->offset(); 4256 int offset = instr->offset();
4221 4257
4222 if (!instr->transition().is_null()) { 4258 if (FLAG_track_fields && representation.IsSmi()) {
4259 if (instr->value()->IsConstantOperand()) {
4260 LConstantOperand* operand_value = LConstantOperand::cast(instr->value());
4261 if (!IsInteger32(operand_value)) {
4262 DeoptimizeIf(no_condition, instr->environment());
4263 }
4264 } else {
4265 Register value = ToRegister(instr->value());
4266 __ SmiTag(value);
4267 if (!instr->hydrogen()->value()->range()->IsInSmiRange()) {
4268 DeoptimizeIf(overflow, instr->environment());
4269 }
4270 }
4271 } else if (FLAG_track_double_fields && representation.IsDouble() &&
4272 !instr->hydrogen()->value()->type().IsSmi() &&
4273 !instr->hydrogen()->value()->type().IsHeapNumber()) {
4274 Register value = ToRegister(instr->value());
4275 Label do_store;
4276 __ JumpIfSmi(value, &do_store);
4277 Handle<Map> map(isolate()->factory()->heap_number_map());
4278 DoCheckMapCommon(value, map, REQUIRE_EXACT_MAP, instr);
4279 __ bind(&do_store);
4280 }
4281
4282 Handle<Map> transition = instr->transition();
4283 if (!transition.is_null()) {
4284 if (transition->CanBeDeprecated()) {
4285 transition_maps_.Add(transition, info()->zone());
4286 }
4223 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) { 4287 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) {
4224 __ mov(FieldOperand(object, HeapObject::kMapOffset), instr->transition()); 4288 __ mov(FieldOperand(object, HeapObject::kMapOffset), transition);
4225 } else { 4289 } else {
4226 Register temp = ToRegister(instr->temp()); 4290 Register temp = ToRegister(instr->temp());
4227 Register temp_map = ToRegister(instr->temp_map()); 4291 Register temp_map = ToRegister(instr->temp_map());
4228 __ mov(temp_map, instr->transition()); 4292 __ mov(temp_map, transition);
4229 __ mov(FieldOperand(object, HeapObject::kMapOffset), temp_map); 4293 __ mov(FieldOperand(object, HeapObject::kMapOffset), temp_map);
4230 // Update the write barrier for the map field. 4294 // Update the write barrier for the map field.
4231 __ RecordWriteField(object, 4295 __ RecordWriteField(object,
4232 HeapObject::kMapOffset, 4296 HeapObject::kMapOffset,
4233 temp_map, 4297 temp_map,
4234 temp, 4298 temp,
4235 GetSaveFPRegsMode(), 4299 GetSaveFPRegsMode(),
4236 OMIT_REMEMBERED_SET, 4300 OMIT_REMEMBERED_SET,
4237 OMIT_SMI_CHECK); 4301 OMIT_SMI_CHECK);
4238 } 4302 }
(...skipping 2326 matching lines...) Expand 10 before | Expand all | Expand 10 after
6565 FixedArray::kHeaderSize - kPointerSize)); 6629 FixedArray::kHeaderSize - kPointerSize));
6566 __ bind(&done); 6630 __ bind(&done);
6567 } 6631 }
6568 6632
6569 6633
6570 #undef __ 6634 #undef __
6571 6635
6572 } } // namespace v8::internal 6636 } } // namespace v8::internal
6573 6637
6574 #endif // V8_TARGET_ARCH_IA32 6638 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698