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

Side by Side Diff: src/hydrogen.cc

Issue 112913002: Split up HLoadNamedField and HStoreNamedField. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 | « no previous file | src/hydrogen-check-elimination.cc » ('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 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 5218 matching lines...) Expand 10 before | Expand all | Expand 10 after
5229 ASSERT(proto->IsJSObject()); 5229 ASSERT(proto->IsJSObject());
5230 BuildCheckPrototypeMaps( 5230 BuildCheckPrototypeMaps(
5231 Handle<JSObject>(JSObject::cast(map->prototype())), 5231 Handle<JSObject>(JSObject::cast(map->prototype())),
5232 Handle<JSObject>(JSObject::cast(proto))); 5232 Handle<JSObject>(JSObject::cast(proto)));
5233 } 5233 }
5234 5234
5235 HObjectAccess field_access = HObjectAccess::ForField(map, lookup, name); 5235 HObjectAccess field_access = HObjectAccess::ForField(map, lookup, name);
5236 bool transition_to_field = lookup->IsTransitionToField(*map); 5236 bool transition_to_field = lookup->IsTransitionToField(*map);
5237 5237
5238 HStoreNamedField *instr; 5238 HStoreNamedField *instr;
5239 HValue* store_target = checked_object->ActualValue();
5240 if (!field_access.IsInobject()) {
5241 store_target = Add<HLoadNamedField>(
5242 store_target, HObjectAccess::ForBackingStore());
5243 }
5239 if (FLAG_track_double_fields && field_access.representation().IsDouble()) { 5244 if (FLAG_track_double_fields && field_access.representation().IsDouble()) {
5240 HObjectAccess heap_number_access = 5245 HObjectAccess heap_number_access =
5241 field_access.WithRepresentation(Representation::Tagged()); 5246 field_access.WithRepresentation(Representation::Tagged());
5242 if (transition_to_field) { 5247 if (transition_to_field) {
5243 // The store requires a mutable HeapNumber to be allocated. 5248 // The store requires a mutable HeapNumber to be allocated.
5244 NoObservableSideEffectsScope no_side_effects(this); 5249 NoObservableSideEffectsScope no_side_effects(this);
5245 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); 5250 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize);
5246 HInstruction* heap_number = Add<HAllocate>(heap_number_size, 5251 HInstruction* heap_number = Add<HAllocate>(heap_number_size,
5247 HType::HeapNumber(), isolate()->heap()->GetPretenureMode(), 5252 HType::HeapNumber(), isolate()->heap()->GetPretenureMode(),
5248 HEAP_NUMBER_TYPE); 5253 HEAP_NUMBER_TYPE);
5249 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map()); 5254 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map());
5250 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), 5255 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(),
5251 value); 5256 value);
5252 instr = New<HStoreNamedField>(checked_object->ActualValue(), 5257 instr = New<HStoreNamedField>(
5253 heap_number_access, 5258 store_target, heap_number_access, heap_number);
5254 heap_number);
5255 } else { 5259 } else {
5256 // Already holds a HeapNumber; load the box and write its value field. 5260 // Already holds a HeapNumber; load the box and write its value field.
5257 HInstruction* heap_number = Add<HLoadNamedField>(checked_object, 5261 HInstruction* heap_number = Add<HLoadNamedField>(
5258 heap_number_access); 5262 store_target, heap_number_access);
5259 heap_number->set_type(HType::HeapNumber()); 5263 heap_number->set_type(HType::HeapNumber());
5260 instr = New<HStoreNamedField>(heap_number, 5264 instr = New<HStoreNamedField>(
5261 HObjectAccess::ForHeapNumberValue(), 5265 heap_number, HObjectAccess::ForHeapNumberValue(), value);
5262 value);
5263 } 5266 }
5264 } else { 5267 } else {
5265 // This is a normal store. 5268 // This is a normal store.
5266 instr = New<HStoreNamedField>(checked_object->ActualValue(), 5269 instr = New<HStoreNamedField>(store_target, field_access, value);
5267 field_access,
5268 value);
5269 } 5270 }
5270 5271
5271 if (transition_to_field) { 5272 if (transition_to_field) {
5272 Handle<Map> transition(lookup->GetTransitionMapFromMap(*map)); 5273 Handle<Map> transition(lookup->GetTransitionMapFromMap(*map));
5273 HConstant* transition_constant = Add<HConstant>(transition); 5274 HConstant* transition_constant = Add<HConstant>(transition);
5274 instr->SetTransition(transition_constant, top_info()); 5275 Add<HStoreNamedField>(
5275 // TODO(fschneider): Record the new map type of the object in the IR to 5276 checked_object, HObjectAccess::ForMap(), transition_constant);
5276 // enable elimination of redundant checks after the transition store. 5277 instr->SetTransition(transition, top_info());
5277 instr->SetGVNFlag(kChangesMaps);
5278 } 5278 }
5279 return instr; 5279 return instr;
5280 } 5280 }
5281 5281
5282 5282
5283 HInstruction* HOptimizedGraphBuilder::BuildStoreNamedGeneric( 5283 HInstruction* HOptimizedGraphBuilder::BuildStoreNamedGeneric(
5284 HValue* object, 5284 HValue* object,
5285 Handle<String> name, 5285 Handle<String> name,
5286 HValue* value) { 5286 HValue* value) {
5287 return New<HStoreNamedGeneric>( 5287 return New<HStoreNamedGeneric>(
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
6118 // control flow at this point. This is not the case if the throw is inside 6118 // control flow at this point. This is not the case if the throw is inside
6119 // an inlined function which may be replaced. 6119 // an inlined function which may be replaced.
6120 if (call_context() == NULL) { 6120 if (call_context() == NULL) {
6121 FinishExitCurrentBlock(New<HAbnormalExit>()); 6121 FinishExitCurrentBlock(New<HAbnormalExit>());
6122 } 6122 }
6123 } 6123 }
6124 6124
6125 6125
6126 HLoadNamedField* HGraphBuilder::BuildLoadNamedField(HValue* object, 6126 HLoadNamedField* HGraphBuilder::BuildLoadNamedField(HValue* object,
6127 HObjectAccess access) { 6127 HObjectAccess access) {
6128 if (!access.IsInobject()) {
6129 object = Add<HLoadNamedField>(object, HObjectAccess::ForBackingStore());
6130 }
6128 if (FLAG_track_double_fields && access.representation().IsDouble()) { 6131 if (FLAG_track_double_fields && access.representation().IsDouble()) {
6129 // load the heap number 6132 // load the heap number
6130 HLoadNamedField* heap_number = Add<HLoadNamedField>( 6133 HLoadNamedField* heap_number = Add<HLoadNamedField>(
6131 object, access.WithRepresentation(Representation::Tagged())); 6134 object, access.WithRepresentation(Representation::Tagged()));
6132 heap_number->set_type(HType::HeapNumber()); 6135 heap_number->set_type(HType::HeapNumber());
6133 // load the double value from it 6136 // load the double value from it
6134 return New<HLoadNamedField>( 6137 return New<HLoadNamedField>(
6135 heap_number, HObjectAccess::ForHeapNumberValue()); 6138 heap_number, HObjectAccess::ForHeapNumberValue());
6136 } 6139 }
6137 return New<HLoadNamedField>(object, access); 6140 return New<HLoadNamedField>(object, access);
(...skipping 4675 matching lines...) Expand 10 before | Expand all | Expand 10 after
10813 if (ShouldProduceTraceOutput()) { 10816 if (ShouldProduceTraceOutput()) {
10814 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10817 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10815 } 10818 }
10816 10819
10817 #ifdef DEBUG 10820 #ifdef DEBUG
10818 graph_->Verify(false); // No full verify. 10821 graph_->Verify(false); // No full verify.
10819 #endif 10822 #endif
10820 } 10823 }
10821 10824
10822 } } // namespace v8::internal 10825 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-check-elimination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698