OLD | NEW |
---|---|
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 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1158 AddInstruction(new(zone) HLoadElements(object, mapcheck)); | 1158 AddInstruction(new(zone) HLoadElements(object, mapcheck)); |
1159 if (is_store && (fast_elements || fast_smi_only_elements) && | 1159 if (is_store && (fast_elements || fast_smi_only_elements) && |
1160 store_mode != STORE_NO_TRANSITION_HANDLE_COW) { | 1160 store_mode != STORE_NO_TRANSITION_HANDLE_COW) { |
1161 HCheckMaps* check_cow_map = new(zone) HCheckMaps( | 1161 HCheckMaps* check_cow_map = new(zone) HCheckMaps( |
1162 elements, isolate()->factory()->fixed_array_map(), zone); | 1162 elements, isolate()->factory()->fixed_array_map(), zone); |
1163 check_cow_map->ClearGVNFlag(kDependsOnElementsKind); | 1163 check_cow_map->ClearGVNFlag(kDependsOnElementsKind); |
1164 AddInstruction(check_cow_map); | 1164 AddInstruction(check_cow_map); |
1165 } | 1165 } |
1166 HInstruction* length = NULL; | 1166 HInstruction* length = NULL; |
1167 if (is_js_array) { | 1167 if (is_js_array) { |
1168 length = AddInstruction(new(zone) HJSArrayLength(object, mapcheck, | 1168 length = AddInstruction( |
1169 HType::Smi())); | 1169 HLoadNamedField::NewArrayLength(zone, object, mapcheck)); |
danno
2013/04/02 11:10:43
I think you are losing the fact that the type of t
| |
1170 } else { | 1170 } else { |
1171 length = AddInstruction(new(zone) HFixedArrayBaseLength(elements)); | 1171 length = AddInstruction(new(zone) HFixedArrayBaseLength(elements)); |
1172 } | 1172 } |
1173 HValue* checked_key = NULL; | 1173 HValue* checked_key = NULL; |
1174 if (IsExternalArrayElementsKind(elements_kind)) { | 1174 if (IsExternalArrayElementsKind(elements_kind)) { |
1175 if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { | 1175 if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { |
1176 HLoadExternalArrayPointer* external_elements = | 1176 HLoadExternalArrayPointer* external_elements = |
1177 new(zone) HLoadExternalArrayPointer(elements); | 1177 new(zone) HLoadExternalArrayPointer(elements); |
1178 AddInstruction(external_elements); | 1178 AddInstruction(external_elements); |
1179 IfBuilder length_checker(this); | 1179 IfBuilder length_checker(this); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1230 } | 1230 } |
1231 } | 1231 } |
1232 return AddInstruction( | 1232 return AddInstruction( |
1233 BuildFastElementAccess(elements, checked_key, val, mapcheck, | 1233 BuildFastElementAccess(elements, checked_key, val, mapcheck, |
1234 elements_kind, is_store, store_mode)); | 1234 elements_kind, is_store, store_mode)); |
1235 } | 1235 } |
1236 | 1236 |
1237 | 1237 |
1238 HInstruction* HGraphBuilder::BuildFastArrayLengthLoad(HValue* object, | 1238 HInstruction* HGraphBuilder::BuildFastArrayLengthLoad(HValue* object, |
1239 HValue* typecheck) { | 1239 HValue* typecheck) { |
1240 Zone* zone = this->zone(); | 1240 return HLoadNamedField::NewArrayLength(zone(), object, typecheck); |
1241 return new (zone) HJSArrayLength(object, typecheck, HType::Smi()); | |
1242 } | 1241 } |
1243 | 1242 |
1244 | 1243 |
1245 HValue* HGraphBuilder::BuildAllocateElements(HValue* context, | 1244 HValue* HGraphBuilder::BuildAllocateElements(HValue* context, |
1246 ElementsKind kind, | 1245 ElementsKind kind, |
1247 HValue* capacity) { | 1246 HValue* capacity) { |
1248 BailoutId ast_id = current_block()->last_environment()->previous_ast_id(); | 1247 BailoutId ast_id = current_block()->last_environment()->previous_ast_id(); |
1249 Zone* zone = this->zone(); | 1248 Zone* zone = this->zone(); |
1250 | 1249 |
1251 int elements_size = IsFastDoubleElementsKind(kind) | 1250 int elements_size = IsFastDoubleElementsKind(kind) |
(...skipping 6118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7370 HBasicBlock* if_jsarray = graph()->CreateBasicBlock(); | 7369 HBasicBlock* if_jsarray = graph()->CreateBasicBlock(); |
7371 HBasicBlock* if_fastobject = graph()->CreateBasicBlock(); | 7370 HBasicBlock* if_fastobject = graph()->CreateBasicBlock(); |
7372 HHasInstanceTypeAndBranch* typecheck = | 7371 HHasInstanceTypeAndBranch* typecheck = |
7373 new(zone()) HHasInstanceTypeAndBranch(object, JS_ARRAY_TYPE); | 7372 new(zone()) HHasInstanceTypeAndBranch(object, JS_ARRAY_TYPE); |
7374 typecheck->SetSuccessorAt(0, if_jsarray); | 7373 typecheck->SetSuccessorAt(0, if_jsarray); |
7375 typecheck->SetSuccessorAt(1, if_fastobject); | 7374 typecheck->SetSuccessorAt(1, if_fastobject); |
7376 current_block()->Finish(typecheck); | 7375 current_block()->Finish(typecheck); |
7377 | 7376 |
7378 set_current_block(if_jsarray); | 7377 set_current_block(if_jsarray); |
7379 HInstruction* length; | 7378 HInstruction* length; |
7380 length = AddInstruction(new(zone()) HJSArrayLength(object, typecheck, | 7379 length = AddInstruction( |
7381 HType::Smi())); | 7380 HLoadNamedField::NewArrayLength(zone(), object, typecheck)); |
7382 checked_key = AddBoundsCheck(key, length, ALLOW_SMI_KEY); | 7381 checked_key = AddBoundsCheck(key, length, ALLOW_SMI_KEY); |
7383 access = AddInstruction(BuildFastElementAccess( | 7382 access = AddInstruction(BuildFastElementAccess( |
7384 elements, checked_key, val, elements_kind_branch, | 7383 elements, checked_key, val, elements_kind_branch, |
7385 elements_kind, is_store, STANDARD_STORE)); | 7384 elements_kind, is_store, STANDARD_STORE)); |
7386 if (!is_store) { | 7385 if (!is_store) { |
7387 Push(access); | 7386 Push(access); |
7388 } | 7387 } |
7389 | 7388 |
7390 *has_side_effects |= access->HasObservableSideEffects(); | 7389 *has_side_effects |= access->HasObservableSideEffects(); |
7391 if (position != -1) { | 7390 if (position != -1) { |
(...skipping 3887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11279 } | 11278 } |
11280 } | 11279 } |
11281 | 11280 |
11282 #ifdef DEBUG | 11281 #ifdef DEBUG |
11283 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11282 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
11284 if (allocator_ != NULL) allocator_->Verify(); | 11283 if (allocator_ != NULL) allocator_->Verify(); |
11285 #endif | 11284 #endif |
11286 } | 11285 } |
11287 | 11286 |
11288 } } // namespace v8::internal | 11287 } } // namespace v8::internal |
OLD | NEW |