OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 5212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5223 } | 5223 } |
5224 ASSERT(proto->GetPrototype(isolate())->IsNull()); | 5224 ASSERT(proto->GetPrototype(isolate())->IsNull()); |
5225 } | 5225 } |
5226 ASSERT(proto->IsJSObject()); | 5226 ASSERT(proto->IsJSObject()); |
5227 BuildCheckPrototypeMaps( | 5227 BuildCheckPrototypeMaps( |
5228 Handle<JSObject>(JSObject::cast(map->prototype())), | 5228 Handle<JSObject>(JSObject::cast(map->prototype())), |
5229 Handle<JSObject>(JSObject::cast(proto))); | 5229 Handle<JSObject>(JSObject::cast(proto))); |
5230 } | 5230 } |
5231 | 5231 |
5232 HObjectAccess field_access = HObjectAccess::ForField(map, lookup, name); | 5232 HObjectAccess field_access = HObjectAccess::ForField(map, lookup, name); |
5233 bool transition_to_field = lookup->IsTransitionToField(*map); | 5233 bool transition_to_field = lookup->IsTransitionToField(); |
5234 | 5234 |
5235 HStoreNamedField *instr; | 5235 HStoreNamedField *instr; |
5236 if (FLAG_track_double_fields && field_access.representation().IsDouble()) { | 5236 if (FLAG_track_double_fields && field_access.representation().IsDouble()) { |
5237 HObjectAccess heap_number_access = | 5237 HObjectAccess heap_number_access = |
5238 field_access.WithRepresentation(Representation::Tagged()); | 5238 field_access.WithRepresentation(Representation::Tagged()); |
5239 if (transition_to_field) { | 5239 if (transition_to_field) { |
5240 // The store requires a mutable HeapNumber to be allocated. | 5240 // The store requires a mutable HeapNumber to be allocated. |
5241 NoObservableSideEffectsScope no_side_effects(this); | 5241 NoObservableSideEffectsScope no_side_effects(this); |
5242 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); | 5242 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); |
5243 HInstruction* heap_number = Add<HAllocate>(heap_number_size, | 5243 HInstruction* heap_number = Add<HAllocate>(heap_number_size, |
(...skipping 15 matching lines...) Expand all Loading... |
5259 value); | 5259 value); |
5260 } | 5260 } |
5261 } else { | 5261 } else { |
5262 // This is a normal store. | 5262 // This is a normal store. |
5263 instr = New<HStoreNamedField>(checked_object->ActualValue(), | 5263 instr = New<HStoreNamedField>(checked_object->ActualValue(), |
5264 field_access, | 5264 field_access, |
5265 value); | 5265 value); |
5266 } | 5266 } |
5267 | 5267 |
5268 if (transition_to_field) { | 5268 if (transition_to_field) { |
5269 Handle<Map> transition(lookup->GetTransitionMapFromMap(*map)); | 5269 Handle<Map> transition(lookup->GetTransitionTarget()); |
5270 HConstant* transition_constant = Add<HConstant>(transition); | 5270 HConstant* transition_constant = Add<HConstant>(transition); |
5271 instr->SetTransition(transition_constant, top_info()); | 5271 instr->SetTransition(transition_constant, top_info()); |
5272 // TODO(fschneider): Record the new map type of the object in the IR to | 5272 // TODO(fschneider): Record the new map type of the object in the IR to |
5273 // enable elimination of redundant checks after the transition store. | 5273 // enable elimination of redundant checks after the transition store. |
5274 instr->SetGVNFlag(kChangesMaps); | 5274 instr->SetGVNFlag(kChangesMaps); |
5275 } | 5275 } |
5276 return instr; | 5276 return instr; |
5277 } | 5277 } |
5278 | 5278 |
5279 | 5279 |
(...skipping 19 matching lines...) Expand all Loading... |
5299 lookup->NotFound(); | 5299 lookup->NotFound(); |
5300 return false; | 5300 return false; |
5301 } | 5301 } |
5302 // If we directly find a field, the access can be inlined. | 5302 // If we directly find a field, the access can be inlined. |
5303 type->LookupDescriptor(NULL, *name, lookup); | 5303 type->LookupDescriptor(NULL, *name, lookup); |
5304 if (lookup->IsField()) return true; | 5304 if (lookup->IsField()) return true; |
5305 | 5305 |
5306 if (!lookup_transition) return false; | 5306 if (!lookup_transition) return false; |
5307 | 5307 |
5308 type->LookupTransition(NULL, *name, lookup); | 5308 type->LookupTransition(NULL, *name, lookup); |
5309 return lookup->IsTransitionToField(*type) && | 5309 return lookup->IsTransitionToField() && |
5310 (type->unused_property_fields() > 0); | 5310 (type->unused_property_fields() > 0); |
5311 } | 5311 } |
5312 | 5312 |
5313 | 5313 |
5314 HInstruction* HOptimizedGraphBuilder::BuildStoreNamedMonomorphic( | 5314 HInstruction* HOptimizedGraphBuilder::BuildStoreNamedMonomorphic( |
5315 HValue* object, | 5315 HValue* object, |
5316 Handle<String> name, | 5316 Handle<String> name, |
5317 HValue* value, | 5317 HValue* value, |
5318 Handle<Map> map) { | 5318 Handle<Map> map) { |
5319 // Handle a store to a known field. | 5319 // Handle a store to a known field. |
(...skipping 5491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10811 if (ShouldProduceTraceOutput()) { | 10811 if (ShouldProduceTraceOutput()) { |
10812 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10812 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
10813 } | 10813 } |
10814 | 10814 |
10815 #ifdef DEBUG | 10815 #ifdef DEBUG |
10816 graph_->Verify(false); // No full verify. | 10816 graph_->Verify(false); // No full verify. |
10817 #endif | 10817 #endif |
10818 } | 10818 } |
10819 | 10819 |
10820 } } // namespace v8::internal | 10820 } } // namespace v8::internal |
OLD | NEW |