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; | |
2469 if (IsExternalArrayElementsKind(elements_kind)) { | 2468 if (IsExternalArrayElementsKind(elements_kind)) { |
2470 HInstruction* buffer = | 2469 HInstruction* buffer = |
2471 Add<HLoadNamedField>(checked_object, nullptr, | 2470 Add<HLoadNamedField>(checked_object, nullptr, |
2472 HObjectAccess::ForJSArrayBufferViewBuffer()); | 2471 HObjectAccess::ForJSArrayBufferViewBuffer()); |
2473 HInstruction* buffer_length = Add<HLoadNamedField>( | 2472 HInstruction* buffer_length = Add<HLoadNamedField>( |
2474 buffer, nullptr, HObjectAccess::ForJSArrayBufferByteLength()); | 2473 buffer, nullptr, HObjectAccess::ForJSArrayBufferByteLength()); |
2475 neuter_checked_object = | 2474 Add<HBoundsCheck>(graph()->GetConstant0(), buffer_length); |
2476 Add<HBoundsCheck>(graph()->GetConstant0(), buffer_length); | |
2477 } | 2475 } |
2478 DCHECK(store_mode == STANDARD_STORE); | 2476 DCHECK(store_mode == STANDARD_STORE); |
2479 checked_key = Add<HBoundsCheck>(key, length); | 2477 checked_key = Add<HBoundsCheck>(key, length); |
2480 return AddElementAccess(backing_store, checked_key, val, | 2478 return AddElementAccess( |
2481 neuter_checked_object, elements_kind, | 2479 backing_store, checked_key, val, |
2482 access_type); | 2480 checked_object, elements_kind, access_type); |
2483 } | 2481 } |
2484 } | 2482 } |
2485 DCHECK(fast_smi_only_elements || | 2483 DCHECK(fast_smi_only_elements || |
2486 fast_elements || | 2484 fast_elements || |
2487 IsFastDoubleElementsKind(elements_kind)); | 2485 IsFastDoubleElementsKind(elements_kind)); |
2488 | 2486 |
2489 // In case val is stored into a fast smi array, assure that the value is a smi | 2487 // In case val is stored into a fast smi array, assure that the value is a smi |
2490 // before manipulating the backing store. Otherwise the actual store may | 2488 // before manipulating the backing store. Otherwise the actual store may |
2491 // deopt, leaving the backing store in an invalid state. | 2489 // deopt, leaving the backing store in an invalid state. |
2492 if (access_type == STORE && IsFastSmiElementsKind(elements_kind) && | 2490 if (access_type == STORE && IsFastSmiElementsKind(elements_kind) && |
(...skipping 3812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6305 HValue* value, BailoutId ast_id, BailoutId return_id, | 6303 HValue* value, BailoutId ast_id, BailoutId return_id, |
6306 bool can_inline_accessor) { | 6304 bool can_inline_accessor) { |
6307 HObjectAccess access = HObjectAccess::ForMap(); // bogus default | 6305 HObjectAccess access = HObjectAccess::ForMap(); // bogus default |
6308 if (info->GetJSObjectFieldAccess(&access)) { | 6306 if (info->GetJSObjectFieldAccess(&access)) { |
6309 DCHECK(info->IsLoad()); | 6307 DCHECK(info->IsLoad()); |
6310 return New<HLoadNamedField>(object, checked_object, access); | 6308 return New<HLoadNamedField>(object, checked_object, access); |
6311 } | 6309 } |
6312 | 6310 |
6313 if (info->GetJSArrayBufferViewFieldAccess(&access)) { | 6311 if (info->GetJSArrayBufferViewFieldAccess(&access)) { |
6314 DCHECK(info->IsLoad()); | 6312 DCHECK(info->IsLoad()); |
6315 HValue* neuter_checked_object = checked_object; | 6313 return BuildArrayBufferViewFieldAccessor( |
6316 if (IsExternalArrayElementsKind(info->map()->elements_kind())) { | 6314 object, checked_object, FieldIndex::ForInObjectOffset(access.offset())); |
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); | |
6325 } | 6315 } |
6326 | 6316 |
6327 if (info->name().is_identical_to(isolate()->factory()->prototype_string()) && | 6317 if (info->name().is_identical_to(isolate()->factory()->prototype_string()) && |
6328 info->map()->function_with_prototype()) { | 6318 info->map()->function_with_prototype()) { |
6329 DCHECK(!info->map()->has_non_instance_prototype()); | 6319 DCHECK(!info->map()->has_non_instance_prototype()); |
6330 return New<HLoadFunctionPrototype>(checked_object); | 6320 return New<HLoadFunctionPrototype>(checked_object); |
6331 } | 6321 } |
6332 | 6322 |
6333 HValue* checked_holder = checked_object; | 6323 HValue* checked_holder = checked_object; |
6334 if (info->has_holder()) { | 6324 if (info->has_holder()) { |
(...skipping 6756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13091 if (ShouldProduceTraceOutput()) { | 13081 if (ShouldProduceTraceOutput()) { |
13092 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13082 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13093 } | 13083 } |
13094 | 13084 |
13095 #ifdef DEBUG | 13085 #ifdef DEBUG |
13096 graph_->Verify(false); // No full verify. | 13086 graph_->Verify(false); // No full verify. |
13097 #endif | 13087 #endif |
13098 } | 13088 } |
13099 | 13089 |
13100 } } // namespace v8::internal | 13090 } } // namespace v8::internal |
OLD | NEW |