OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_CRANKSHAFT_HYDROGEN_H_ | 5 #ifndef V8_CRANKSHAFT_HYDROGEN_H_ |
6 #define V8_CRANKSHAFT_HYDROGEN_H_ | 6 #define V8_CRANKSHAFT_HYDROGEN_H_ |
7 | 7 |
8 #include "src/accessors.h" | 8 #include "src/accessors.h" |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 #include "src/ast/ast-type-bounds.h" | 10 #include "src/ast/ast-type-bounds.h" |
(...skipping 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2449 PropertyAccessInfo(HOptimizedGraphBuilder* builder, | 2449 PropertyAccessInfo(HOptimizedGraphBuilder* builder, |
2450 PropertyAccessType access_type, Handle<Map> map, | 2450 PropertyAccessType access_type, Handle<Map> map, |
2451 Handle<Name> name) | 2451 Handle<Name> name) |
2452 : builder_(builder), | 2452 : builder_(builder), |
2453 access_type_(access_type), | 2453 access_type_(access_type), |
2454 map_(map), | 2454 map_(map), |
2455 name_(isolate()->factory()->InternalizeName(name)), | 2455 name_(isolate()->factory()->InternalizeName(name)), |
2456 field_type_(HType::Tagged()), | 2456 field_type_(HType::Tagged()), |
2457 access_(HObjectAccess::ForMap()), | 2457 access_(HObjectAccess::ForMap()), |
2458 lookup_type_(NOT_FOUND), | 2458 lookup_type_(NOT_FOUND), |
2459 details_(PropertyDetails::Empty()) {} | 2459 details_(PropertyDetails::Empty()), |
| 2460 store_mode_(STORE_TO_INITIALIZED_ENTRY) {} |
| 2461 |
| 2462 // Ensure the full store is performed. |
| 2463 void MarkAsInitializingStore() { |
| 2464 DCHECK_EQ(STORE, access_type_); |
| 2465 store_mode_ = INITIALIZING_STORE; |
| 2466 } |
| 2467 |
| 2468 StoreFieldOrKeyedMode StoreMode() { |
| 2469 DCHECK_EQ(STORE, access_type_); |
| 2470 return store_mode_; |
| 2471 } |
2460 | 2472 |
2461 // Checkes whether this PropertyAccessInfo can be handled as a monomorphic | 2473 // Checkes whether this PropertyAccessInfo can be handled as a monomorphic |
2462 // load named. It additionally fills in the fields necessary to generate the | 2474 // load named. It additionally fills in the fields necessary to generate the |
2463 // lookup code. | 2475 // lookup code. |
2464 bool CanAccessMonomorphic(); | 2476 bool CanAccessMonomorphic(); |
2465 | 2477 |
2466 // Checks whether all types behave uniform when loading name. If all maps | 2478 // Checks whether all types behave uniform when loading name. If all maps |
2467 // behave the same, a single monomorphic load instruction can be emitted, | 2479 // behave the same, a single monomorphic load instruction can be emitted, |
2468 // guarded by a single map-checks instruction that whether the receiver is | 2480 // guarded by a single map-checks instruction that whether the receiver is |
2469 // an instance of any of the types. | 2481 // an instance of any of the types. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2565 number_ = number; | 2577 number_ = number; |
2566 } | 2578 } |
2567 void LookupTransition(Map* map, Name* name, PropertyAttributes attributes) { | 2579 void LookupTransition(Map* map, Name* name, PropertyAttributes attributes) { |
2568 Map* target = | 2580 Map* target = |
2569 TransitionArray::SearchTransition(map, kData, name, attributes); | 2581 TransitionArray::SearchTransition(map, kData, name, attributes); |
2570 if (target == NULL) return NotFound(); | 2582 if (target == NULL) return NotFound(); |
2571 lookup_type_ = TRANSITION_TYPE; | 2583 lookup_type_ = TRANSITION_TYPE; |
2572 transition_ = handle(target); | 2584 transition_ = handle(target); |
2573 number_ = transition_->LastAdded(); | 2585 number_ = transition_->LastAdded(); |
2574 details_ = transition_->instance_descriptors()->GetDetails(number_); | 2586 details_ = transition_->instance_descriptors()->GetDetails(number_); |
| 2587 MarkAsInitializingStore(); |
2575 } | 2588 } |
2576 void NotFound() { | 2589 void NotFound() { |
2577 lookup_type_ = NOT_FOUND; | 2590 lookup_type_ = NOT_FOUND; |
2578 details_ = PropertyDetails::Empty(); | 2591 details_ = PropertyDetails::Empty(); |
2579 } | 2592 } |
2580 Representation representation() const { | 2593 Representation representation() const { |
2581 DCHECK(IsFound()); | 2594 DCHECK(IsFound()); |
2582 return details_.representation(); | 2595 return details_.representation(); |
2583 } | 2596 } |
2584 bool IsTransitionToData() const { | 2597 bool IsTransitionToData() const { |
(...skipping 26 matching lines...) Expand all Loading... |
2611 Handle<JSObject> api_holder_; | 2624 Handle<JSObject> api_holder_; |
2612 Handle<Object> constant_; | 2625 Handle<Object> constant_; |
2613 SmallMapList field_maps_; | 2626 SmallMapList field_maps_; |
2614 HType field_type_; | 2627 HType field_type_; |
2615 HObjectAccess access_; | 2628 HObjectAccess access_; |
2616 | 2629 |
2617 enum { NOT_FOUND, DESCRIPTOR_TYPE, TRANSITION_TYPE } lookup_type_; | 2630 enum { NOT_FOUND, DESCRIPTOR_TYPE, TRANSITION_TYPE } lookup_type_; |
2618 Handle<Map> transition_; | 2631 Handle<Map> transition_; |
2619 int number_; | 2632 int number_; |
2620 PropertyDetails details_; | 2633 PropertyDetails details_; |
| 2634 StoreFieldOrKeyedMode store_mode_; |
2621 }; | 2635 }; |
2622 | 2636 |
2623 HValue* BuildMonomorphicAccess(PropertyAccessInfo* info, HValue* object, | 2637 HValue* BuildMonomorphicAccess(PropertyAccessInfo* info, HValue* object, |
2624 HValue* checked_object, HValue* value, | 2638 HValue* checked_object, HValue* value, |
2625 BailoutId ast_id, BailoutId return_id, | 2639 BailoutId ast_id, BailoutId return_id, |
2626 bool can_inline_accessor = true); | 2640 bool can_inline_accessor = true); |
2627 | 2641 |
2628 HValue* BuildNamedAccess(PropertyAccessType access, BailoutId ast_id, | 2642 HValue* BuildNamedAccess(PropertyAccessType access, BailoutId ast_id, |
2629 BailoutId reutrn_id, Expression* expr, | 2643 BailoutId reutrn_id, Expression* expr, |
2630 FeedbackVectorSlot slot, HValue* object, | 2644 FeedbackVectorSlot slot, HValue* object, |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2982 } | 2996 } |
2983 | 2997 |
2984 private: | 2998 private: |
2985 HOptimizedGraphBuilder* builder_; | 2999 HOptimizedGraphBuilder* builder_; |
2986 }; | 3000 }; |
2987 | 3001 |
2988 } // namespace internal | 3002 } // namespace internal |
2989 } // namespace v8 | 3003 } // namespace v8 |
2990 | 3004 |
2991 #endif // V8_CRANKSHAFT_HYDROGEN_H_ | 3005 #endif // V8_CRANKSHAFT_HYDROGEN_H_ |
OLD | NEW |