OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 2447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2458 HValue* bounds_check = negative_checker.If<HCompareNumericAndBranch>( | 2458 HValue* bounds_check = negative_checker.If<HCompareNumericAndBranch>( |
2459 key, graph()->GetConstant0(), Token::GTE); | 2459 key, graph()->GetConstant0(), Token::GTE); |
2460 negative_checker.Then(); | 2460 negative_checker.Then(); |
2461 HInstruction* result = AddElementAccess( | 2461 HInstruction* result = AddElementAccess( |
2462 backing_store, key, val, bounds_check, elements_kind, access_type); | 2462 backing_store, key, val, bounds_check, elements_kind, access_type); |
2463 negative_checker.ElseDeopt(Deoptimizer::kNegativeKeyEncountered); | 2463 negative_checker.ElseDeopt(Deoptimizer::kNegativeKeyEncountered); |
2464 negative_checker.End(); | 2464 negative_checker.End(); |
2465 length_checker.End(); | 2465 length_checker.End(); |
2466 return result; | 2466 return result; |
2467 } else { | 2467 } else { |
| 2468 HValue* neuter_checked_object = checked_object; |
2468 if (IsExternalArrayElementsKind(elements_kind)) { | 2469 if (IsExternalArrayElementsKind(elements_kind)) { |
2469 HInstruction* buffer = | 2470 HInstruction* buffer = |
2470 Add<HLoadNamedField>(checked_object, nullptr, | 2471 Add<HLoadNamedField>(checked_object, nullptr, |
2471 HObjectAccess::ForJSArrayBufferViewBuffer()); | 2472 HObjectAccess::ForJSArrayBufferViewBuffer()); |
2472 HInstruction* buffer_length = Add<HLoadNamedField>( | 2473 HInstruction* buffer_length = Add<HLoadNamedField>( |
2473 buffer, nullptr, HObjectAccess::ForJSArrayBufferByteLength()); | 2474 buffer, nullptr, HObjectAccess::ForJSArrayBufferByteLength()); |
2474 Add<HBoundsCheck>(graph()->GetConstant0(), buffer_length); | 2475 neuter_checked_object = |
| 2476 Add<HBoundsCheck>(graph()->GetConstant0(), buffer_length); |
2475 } | 2477 } |
2476 DCHECK(store_mode == STANDARD_STORE); | 2478 DCHECK(store_mode == STANDARD_STORE); |
2477 checked_key = Add<HBoundsCheck>(key, length); | 2479 checked_key = Add<HBoundsCheck>(key, length); |
2478 return AddElementAccess( | 2480 return AddElementAccess(backing_store, checked_key, val, |
2479 backing_store, checked_key, val, | 2481 neuter_checked_object, elements_kind, |
2480 checked_object, elements_kind, access_type); | 2482 access_type); |
2481 } | 2483 } |
2482 } | 2484 } |
2483 DCHECK(fast_smi_only_elements || | 2485 DCHECK(fast_smi_only_elements || |
2484 fast_elements || | 2486 fast_elements || |
2485 IsFastDoubleElementsKind(elements_kind)); | 2487 IsFastDoubleElementsKind(elements_kind)); |
2486 | 2488 |
2487 // In case val is stored into a fast smi array, assure that the value is a smi | 2489 // In case val is stored into a fast smi array, assure that the value is a smi |
2488 // before manipulating the backing store. Otherwise the actual store may | 2490 // before manipulating the backing store. Otherwise the actual store may |
2489 // deopt, leaving the backing store in an invalid state. | 2491 // deopt, leaving the backing store in an invalid state. |
2490 if (access_type == STORE && IsFastSmiElementsKind(elements_kind) && | 2492 if (access_type == STORE && IsFastSmiElementsKind(elements_kind) && |
(...skipping 3812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6303 HValue* value, BailoutId ast_id, BailoutId return_id, | 6305 HValue* value, BailoutId ast_id, BailoutId return_id, |
6304 bool can_inline_accessor) { | 6306 bool can_inline_accessor) { |
6305 HObjectAccess access = HObjectAccess::ForMap(); // bogus default | 6307 HObjectAccess access = HObjectAccess::ForMap(); // bogus default |
6306 if (info->GetJSObjectFieldAccess(&access)) { | 6308 if (info->GetJSObjectFieldAccess(&access)) { |
6307 DCHECK(info->IsLoad()); | 6309 DCHECK(info->IsLoad()); |
6308 return New<HLoadNamedField>(object, checked_object, access); | 6310 return New<HLoadNamedField>(object, checked_object, access); |
6309 } | 6311 } |
6310 | 6312 |
6311 if (info->GetJSArrayBufferViewFieldAccess(&access)) { | 6313 if (info->GetJSArrayBufferViewFieldAccess(&access)) { |
6312 DCHECK(info->IsLoad()); | 6314 DCHECK(info->IsLoad()); |
6313 return BuildArrayBufferViewFieldAccessor( | 6315 HValue* neuter_checked_object = checked_object; |
6314 object, checked_object, FieldIndex::ForInObjectOffset(access.offset())); | 6316 if (IsExternalArrayElementsKind(info->map()->elements_kind())) { |
| 6317 HInstruction* buffer = Add<HLoadNamedField>( |
| 6318 checked_object, nullptr, HObjectAccess::ForJSArrayBufferViewBuffer()); |
| 6319 HInstruction* buffer_length = Add<HLoadNamedField>( |
| 6320 buffer, nullptr, HObjectAccess::ForJSArrayBufferByteLength()); |
| 6321 neuter_checked_object = |
| 6322 Add<HBoundsCheck>(graph()->GetConstant0(), buffer_length); |
| 6323 } |
| 6324 return New<HLoadNamedField>(object, neuter_checked_object, access); |
6315 } | 6325 } |
6316 | 6326 |
6317 if (info->name().is_identical_to(isolate()->factory()->prototype_string()) && | 6327 if (info->name().is_identical_to(isolate()->factory()->prototype_string()) && |
6318 info->map()->function_with_prototype()) { | 6328 info->map()->function_with_prototype()) { |
6319 DCHECK(!info->map()->has_non_instance_prototype()); | 6329 DCHECK(!info->map()->has_non_instance_prototype()); |
6320 return New<HLoadFunctionPrototype>(checked_object); | 6330 return New<HLoadFunctionPrototype>(checked_object); |
6321 } | 6331 } |
6322 | 6332 |
6323 HValue* checked_holder = checked_object; | 6333 HValue* checked_holder = checked_object; |
6324 if (info->has_holder()) { | 6334 if (info->has_holder()) { |
(...skipping 6756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13081 if (ShouldProduceTraceOutput()) { | 13091 if (ShouldProduceTraceOutput()) { |
13082 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13092 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13083 } | 13093 } |
13084 | 13094 |
13085 #ifdef DEBUG | 13095 #ifdef DEBUG |
13086 graph_->Verify(false); // No full verify. | 13096 graph_->Verify(false); // No full verify. |
13087 #endif | 13097 #endif |
13088 } | 13098 } |
13089 | 13099 |
13090 } } // namespace v8::internal | 13100 } } // namespace v8::internal |
OLD | NEW |