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

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: 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') | src/hydrogen-gvn.h » ('J')
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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
6193 HValue* object, 6193 HValue* object,
6194 HValue* key, 6194 HValue* key,
6195 HValue* val, 6195 HValue* val,
6196 HValue* dependency, 6196 HValue* dependency,
6197 Handle<Map> map, 6197 Handle<Map> map,
6198 PropertyAccessType access_type, 6198 PropertyAccessType access_type,
6199 KeyedAccessStoreMode store_mode) { 6199 KeyedAccessStoreMode store_mode) {
6200 HCheckMaps* checked_object = Add<HCheckMaps>(object, map, top_info(), 6200 HCheckMaps* checked_object = Add<HCheckMaps>(object, map, top_info(),
6201 dependency); 6201 dependency);
6202 if (dependency) { 6202 if (dependency) {
6203 checked_object->ClearGVNFlag(kDependsOnElementsKind); 6203 checked_object->ClearDependsOnFlag(kElementsKind);
6204 } 6204 }
6205 6205
6206 if (access_type == STORE && map->prototype()->IsJSObject()) { 6206 if (access_type == STORE && map->prototype()->IsJSObject()) {
6207 // monomorphic stores need a prototype chain check because shape 6207 // monomorphic stores need a prototype chain check because shape
6208 // changes could allow callbacks on elements in the chain that 6208 // changes could allow callbacks on elements in the chain that
6209 // aren't compatible with monomorphic keyed stores. 6209 // aren't compatible with monomorphic keyed stores.
6210 Handle<JSObject> prototype(JSObject::cast(map->prototype())); 6210 Handle<JSObject> prototype(JSObject::cast(map->prototype()));
6211 Object* holder = map->prototype(); 6211 Object* holder = map->prototype();
6212 while (holder->GetPrototype(isolate())->IsJSObject()) { 6212 while (holder->GetPrototype(isolate())->IsJSObject()) {
6213 holder = holder->GetPrototype(isolate()); 6213 holder = holder->GetPrototype(isolate());
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
6694 6694
6695 if (constant->map()->CanOmitMapChecks()) { 6695 if (constant->map()->CanOmitMapChecks()) {
6696 constant->map()->AddDependentCompilationInfo( 6696 constant->map()->AddDependentCompilationInfo(
6697 DependentCode::kPrototypeCheckGroup, info); 6697 DependentCode::kPrototypeCheckGroup, info);
6698 return constant_value; 6698 return constant_value;
6699 } 6699 }
6700 6700
6701 AddInstruction(constant_value); 6701 AddInstruction(constant_value);
6702 HCheckMaps* check = 6702 HCheckMaps* check =
6703 Add<HCheckMaps>(constant_value, handle(constant->map()), info); 6703 Add<HCheckMaps>(constant_value, handle(constant->map()), info);
6704 check->ClearGVNFlag(kDependsOnElementsKind); 6704 check->ClearDependsOnFlag(kElementsKind);
6705 return check; 6705 return check;
6706 } 6706 }
6707 6707
6708 6708
6709 HInstruction* HGraphBuilder::BuildCheckPrototypeMaps(Handle<JSObject> prototype, 6709 HInstruction* HGraphBuilder::BuildCheckPrototypeMaps(Handle<JSObject> prototype,
6710 Handle<JSObject> holder) { 6710 Handle<JSObject> holder) {
6711 while (!prototype.is_identical_to(holder)) { 6711 while (!prototype.is_identical_to(holder)) {
6712 BuildConstantMapCheck(prototype, top_info()); 6712 BuildConstantMapCheck(prototype, top_info());
6713 prototype = handle(JSObject::cast(prototype->GetPrototype())); 6713 prototype = handle(JSObject::cast(prototype->GetPrototype()));
6714 } 6714 }
(...skipping 4493 matching lines...) Expand 10 before | Expand all | Expand 10 after
11208 if (ShouldProduceTraceOutput()) { 11208 if (ShouldProduceTraceOutput()) {
11209 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11209 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11210 } 11210 }
11211 11211
11212 #ifdef DEBUG 11212 #ifdef DEBUG
11213 graph_->Verify(false); // No full verify. 11213 graph_->Verify(false); // No full verify.
11214 #endif 11214 #endif
11215 } 11215 }
11216 11216
11217 } } // namespace v8::internal 11217 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-check-elimination.cc » ('j') | src/hydrogen-gvn.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698