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

Side by Side Diff: src/hydrogen.cc

Issue 144423010: Improve inobject field tracking during GVN. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Created 6 years, 10 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 | « 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 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 !IsFixedTypedArrayElementsKind(elements_kind)) || 2167 !IsFixedTypedArrayElementsKind(elements_kind)) ||
2168 !is_js_array); 2168 !is_js_array);
2169 // No GVNFlag is necessary for ElementsKind if there is an explicit dependency 2169 // No GVNFlag is necessary for ElementsKind if there is an explicit dependency
2170 // on a HElementsTransition instruction. The flag can also be removed if the 2170 // on a HElementsTransition instruction. The flag can also be removed if the
2171 // map to check has FAST_HOLEY_ELEMENTS, since there can be no further 2171 // map to check has FAST_HOLEY_ELEMENTS, since there can be no further
2172 // ElementsKind transitions. Finally, the dependency can be removed for stores 2172 // ElementsKind transitions. Finally, the dependency can be removed for stores
2173 // for FAST_ELEMENTS, since a transition to HOLEY elements won't change the 2173 // for FAST_ELEMENTS, since a transition to HOLEY elements won't change the
2174 // generated store code. 2174 // generated store code.
2175 if ((elements_kind == FAST_HOLEY_ELEMENTS) || 2175 if ((elements_kind == FAST_HOLEY_ELEMENTS) ||
2176 (elements_kind == FAST_ELEMENTS && access_type == STORE)) { 2176 (elements_kind == FAST_ELEMENTS && access_type == STORE)) {
2177 checked_object->ClearGVNFlag(kDependsOnElementsKind); 2177 checked_object->ClearDependsOnFlag(kElementsKind);
2178 } 2178 }
2179 2179
2180 bool fast_smi_only_elements = IsFastSmiElementsKind(elements_kind); 2180 bool fast_smi_only_elements = IsFastSmiElementsKind(elements_kind);
2181 bool fast_elements = IsFastObjectElementsKind(elements_kind); 2181 bool fast_elements = IsFastObjectElementsKind(elements_kind);
2182 HValue* elements = AddLoadElements(checked_object); 2182 HValue* elements = AddLoadElements(checked_object);
2183 if (access_type == STORE && (fast_elements || fast_smi_only_elements) && 2183 if (access_type == STORE && (fast_elements || fast_smi_only_elements) &&
2184 store_mode != STORE_NO_TRANSITION_HANDLE_COW) { 2184 store_mode != STORE_NO_TRANSITION_HANDLE_COW) {
2185 HCheckMaps* check_cow_map = Add<HCheckMaps>( 2185 HCheckMaps* check_cow_map = Add<HCheckMaps>(
2186 elements, isolate()->factory()->fixed_array_map(), top_info()); 2186 elements, isolate()->factory()->fixed_array_map(), top_info());
2187 check_cow_map->ClearGVNFlag(kDependsOnElementsKind); 2187 check_cow_map->ClearDependsOnFlag(kElementsKind);
2188 } 2188 }
2189 HInstruction* length = NULL; 2189 HInstruction* length = NULL;
2190 if (is_js_array) { 2190 if (is_js_array) {
2191 length = Add<HLoadNamedField>( 2191 length = Add<HLoadNamedField>(
2192 checked_object, static_cast<HValue*>(NULL), 2192 checked_object, static_cast<HValue*>(NULL),
2193 HObjectAccess::ForArrayLength(elements_kind)); 2193 HObjectAccess::ForArrayLength(elements_kind));
2194 } else { 2194 } else {
2195 length = AddLoadFixedArrayLength(elements); 2195 length = AddLoadFixedArrayLength(elements);
2196 } 2196 }
2197 length->set_type(HType::Smi()); 2197 length->set_type(HType::Smi());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2251 checked_key = Add<HBoundsCheck>(key, length); 2251 checked_key = Add<HBoundsCheck>(key, length);
2252 2252
2253 if (access_type == STORE && (fast_elements || fast_smi_only_elements)) { 2253 if (access_type == STORE && (fast_elements || fast_smi_only_elements)) {
2254 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { 2254 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) {
2255 NoObservableSideEffectsScope no_effects(this); 2255 NoObservableSideEffectsScope no_effects(this);
2256 elements = BuildCopyElementsOnWrite(checked_object, elements, 2256 elements = BuildCopyElementsOnWrite(checked_object, elements,
2257 elements_kind, length); 2257 elements_kind, length);
2258 } else { 2258 } else {
2259 HCheckMaps* check_cow_map = Add<HCheckMaps>( 2259 HCheckMaps* check_cow_map = Add<HCheckMaps>(
2260 elements, isolate()->factory()->fixed_array_map(), top_info()); 2260 elements, isolate()->factory()->fixed_array_map(), top_info());
2261 check_cow_map->ClearGVNFlag(kDependsOnElementsKind); 2261 check_cow_map->ClearDependsOnFlag(kElementsKind);
2262 } 2262 }
2263 } 2263 }
2264 } 2264 }
2265 return AddElementAccess(elements, checked_key, val, checked_object, 2265 return AddElementAccess(elements, checked_key, val, checked_object,
2266 elements_kind, access_type, load_mode); 2266 elements_kind, access_type, load_mode);
2267 } 2267 }
2268 2268
2269 2269
2270 2270
2271 HValue* HGraphBuilder::BuildAllocateArrayFromLength( 2271 HValue* HGraphBuilder::BuildAllocateArrayFromLength(
(...skipping 3030 matching lines...) Expand 10 before | Expand all | Expand 10 after
5302 } else { 5302 } else {
5303 // This is a normal store. 5303 // This is a normal store.
5304 instr = New<HStoreNamedField>( 5304 instr = New<HStoreNamedField>(
5305 checked_object->ActualValue(), field_access, value, 5305 checked_object->ActualValue(), field_access, value,
5306 transition_to_field ? INITIALIZING_STORE : STORE_TO_INITIALIZED_ENTRY); 5306 transition_to_field ? INITIALIZING_STORE : STORE_TO_INITIALIZED_ENTRY);
5307 } 5307 }
5308 5308
5309 if (transition_to_field) { 5309 if (transition_to_field) {
5310 HConstant* transition_constant = Add<HConstant>(info->transition()); 5310 HConstant* transition_constant = Add<HConstant>(info->transition());
5311 instr->SetTransition(transition_constant, top_info()); 5311 instr->SetTransition(transition_constant, top_info());
5312 instr->SetGVNFlag(kChangesMaps); 5312 instr->SetChangesFlag(kMaps);
5313 } 5313 }
5314 return instr; 5314 return instr;
5315 } 5315 }
5316 5316
5317 5317
5318 bool HOptimizedGraphBuilder::PropertyAccessInfo::IsCompatible( 5318 bool HOptimizedGraphBuilder::PropertyAccessInfo::IsCompatible(
5319 PropertyAccessInfo* info) { 5319 PropertyAccessInfo* info) {
5320 if (!CanInlinePropertyAccess(type_)) return false; 5320 if (!CanInlinePropertyAccess(type_)) return false;
5321 5321
5322 // Currently only handle Type::Number as a polymorphic case. 5322 // Currently only handle Type::Number as a polymorphic case.
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
6201 HValue* object, 6201 HValue* object,
6202 HValue* key, 6202 HValue* key,
6203 HValue* val, 6203 HValue* val,
6204 HValue* dependency, 6204 HValue* dependency,
6205 Handle<Map> map, 6205 Handle<Map> map,
6206 PropertyAccessType access_type, 6206 PropertyAccessType access_type,
6207 KeyedAccessStoreMode store_mode) { 6207 KeyedAccessStoreMode store_mode) {
6208 HCheckMaps* checked_object = Add<HCheckMaps>(object, map, top_info(), 6208 HCheckMaps* checked_object = Add<HCheckMaps>(object, map, top_info(),
6209 dependency); 6209 dependency);
6210 if (dependency) { 6210 if (dependency) {
6211 checked_object->ClearGVNFlag(kDependsOnElementsKind); 6211 checked_object->ClearDependsOnFlag(kElementsKind);
6212 } 6212 }
6213 6213
6214 if (access_type == STORE && map->prototype()->IsJSObject()) { 6214 if (access_type == STORE && map->prototype()->IsJSObject()) {
6215 // monomorphic stores need a prototype chain check because shape 6215 // monomorphic stores need a prototype chain check because shape
6216 // changes could allow callbacks on elements in the chain that 6216 // changes could allow callbacks on elements in the chain that
6217 // aren't compatible with monomorphic keyed stores. 6217 // aren't compatible with monomorphic keyed stores.
6218 Handle<JSObject> prototype(JSObject::cast(map->prototype())); 6218 Handle<JSObject> prototype(JSObject::cast(map->prototype()));
6219 Object* holder = map->prototype(); 6219 Object* holder = map->prototype();
6220 while (holder->GetPrototype(isolate())->IsJSObject()) { 6220 while (holder->GetPrototype(isolate())->IsJSObject()) {
6221 holder = holder->GetPrototype(isolate()); 6221 holder = holder->GetPrototype(isolate());
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
6681 6681
6682 if (constant->map()->CanOmitMapChecks()) { 6682 if (constant->map()->CanOmitMapChecks()) {
6683 constant->map()->AddDependentCompilationInfo( 6683 constant->map()->AddDependentCompilationInfo(
6684 DependentCode::kPrototypeCheckGroup, info); 6684 DependentCode::kPrototypeCheckGroup, info);
6685 return constant_value; 6685 return constant_value;
6686 } 6686 }
6687 6687
6688 AddInstruction(constant_value); 6688 AddInstruction(constant_value);
6689 HCheckMaps* check = 6689 HCheckMaps* check =
6690 Add<HCheckMaps>(constant_value, handle(constant->map()), info); 6690 Add<HCheckMaps>(constant_value, handle(constant->map()), info);
6691 check->ClearGVNFlag(kDependsOnElementsKind); 6691 check->ClearDependsOnFlag(kElementsKind);
6692 return check; 6692 return check;
6693 } 6693 }
6694 6694
6695 6695
6696 HInstruction* HGraphBuilder::BuildCheckPrototypeMaps(Handle<JSObject> prototype, 6696 HInstruction* HGraphBuilder::BuildCheckPrototypeMaps(Handle<JSObject> prototype,
6697 Handle<JSObject> holder) { 6697 Handle<JSObject> holder) {
6698 while (!prototype.is_identical_to(holder)) { 6698 while (!prototype.is_identical_to(holder)) {
6699 BuildConstantMapCheck(prototype, top_info()); 6699 BuildConstantMapCheck(prototype, top_info());
6700 prototype = handle(JSObject::cast(prototype->GetPrototype())); 6700 prototype = handle(JSObject::cast(prototype->GetPrototype()));
6701 } 6701 }
(...skipping 4493 matching lines...) Expand 10 before | Expand all | Expand 10 after
11195 if (ShouldProduceTraceOutput()) { 11195 if (ShouldProduceTraceOutput()) {
11196 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11196 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11197 } 11197 }
11198 11198
11199 #ifdef DEBUG 11199 #ifdef DEBUG
11200 graph_->Verify(false); // No full verify. 11200 graph_->Verify(false); // No full verify.
11201 #endif 11201 #endif
11202 } 11202 }
11203 11203
11204 } } // namespace v8::internal 11204 } } // 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