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

Side by Side Diff: src/hydrogen.h

Issue 1345313005: [crankshaft] Generalize PropertyAccessInfo to Name (so it can deal with symbols). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_HYDROGEN_H_ 5 #ifndef V8_HYDROGEN_H_
6 #define V8_HYDROGEN_H_ 6 #define V8_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.h" 10 #include "src/ast.h"
(...skipping 2525 matching lines...) Expand 10 before | Expand all | Expand 10 after
2536 void BuildInlinedCallArray(Expression* expression, int argument_count, 2536 void BuildInlinedCallArray(Expression* expression, int argument_count,
2537 Handle<AllocationSite> site); 2537 Handle<AllocationSite> site);
2538 2538
2539 void BuildInitializeInobjectProperties(HValue* receiver, 2539 void BuildInitializeInobjectProperties(HValue* receiver,
2540 Handle<Map> initial_map); 2540 Handle<Map> initial_map);
2541 2541
2542 class PropertyAccessInfo { 2542 class PropertyAccessInfo {
2543 public: 2543 public:
2544 PropertyAccessInfo(HOptimizedGraphBuilder* builder, 2544 PropertyAccessInfo(HOptimizedGraphBuilder* builder,
2545 PropertyAccessType access_type, Handle<Map> map, 2545 PropertyAccessType access_type, Handle<Map> map,
2546 Handle<String> name) 2546 Handle<Name> name)
2547 : builder_(builder), 2547 : builder_(builder),
2548 access_type_(access_type), 2548 access_type_(access_type),
2549 map_(map), 2549 map_(map),
2550 name_(name), 2550 name_(name),
2551 field_type_(HType::Tagged()), 2551 field_type_(HType::Tagged()),
2552 access_(HObjectAccess::ForMap()), 2552 access_(HObjectAccess::ForMap()),
2553 lookup_type_(NOT_FOUND), 2553 lookup_type_(NOT_FOUND),
2554 details_(NONE, DATA, Representation::None()) {} 2554 details_(NONE, DATA, Representation::None()) {}
2555 2555
2556 // Checkes whether this PropertyAccessInfo can be handled as a monomorphic 2556 // Checkes whether this PropertyAccessInfo can be handled as a monomorphic
2557 // load named. It additionally fills in the fields necessary to generate the 2557 // load named. It additionally fills in the fields necessary to generate the
2558 // lookup code. 2558 // lookup code.
2559 bool CanAccessMonomorphic(); 2559 bool CanAccessMonomorphic();
2560 2560
2561 // Checks whether all types behave uniform when loading name. If all maps 2561 // Checks whether all types behave uniform when loading name. If all maps
2562 // behave the same, a single monomorphic load instruction can be emitted, 2562 // behave the same, a single monomorphic load instruction can be emitted,
2563 // guarded by a single map-checks instruction that whether the receiver is 2563 // guarded by a single map-checks instruction that whether the receiver is
2564 // an instance of any of the types. 2564 // an instance of any of the types.
2565 // This method skips the first type in types, assuming that this 2565 // This method skips the first type in types, assuming that this
2566 // PropertyAccessInfo is built for types->first(). 2566 // PropertyAccessInfo is built for types->first().
2567 bool CanAccessAsMonomorphic(SmallMapList* types); 2567 bool CanAccessAsMonomorphic(SmallMapList* types);
2568 2568
2569 bool NeedsWrappingFor(Handle<JSFunction> target) const; 2569 bool NeedsWrappingFor(Handle<JSFunction> target) const;
2570 2570
2571 Handle<Map> map(); 2571 Handle<Map> map();
2572 Handle<String> name() const { return name_; } 2572 Handle<Name> name() const { return name_; }
2573 2573
2574 bool IsJSObjectFieldAccessor() { 2574 bool IsJSObjectFieldAccessor() {
2575 int offset; // unused 2575 int offset; // unused
2576 return Accessors::IsJSObjectFieldAccessor(map_, name_, &offset); 2576 return Accessors::IsJSObjectFieldAccessor(map_, name_, &offset);
2577 } 2577 }
2578 2578
2579 bool GetJSObjectFieldAccess(HObjectAccess* access) { 2579 bool GetJSObjectFieldAccess(HObjectAccess* access) {
2580 int offset; 2580 int offset;
2581 if (Accessors::IsJSObjectFieldAccessor(map_, name_, &offset)) { 2581 if (Accessors::IsJSObjectFieldAccessor(map_, name_, &offset)) {
2582 if (IsStringType()) { 2582 if (IsStringType()) {
2583 DCHECK(String::Equals(isolate()->factory()->length_string(), name_)); 2583 DCHECK(Name::Equals(isolate()->factory()->length_string(), name_));
2584 *access = HObjectAccess::ForStringLength(); 2584 *access = HObjectAccess::ForStringLength();
2585 } else if (IsArrayType()) { 2585 } else if (IsArrayType()) {
2586 DCHECK(String::Equals(isolate()->factory()->length_string(), name_)); 2586 DCHECK(Name::Equals(isolate()->factory()->length_string(), name_));
2587 *access = HObjectAccess::ForArrayLength(map_->elements_kind()); 2587 *access = HObjectAccess::ForArrayLength(map_->elements_kind());
2588 } else { 2588 } else {
2589 *access = HObjectAccess::ForMapAndOffset(map_, offset); 2589 *access = HObjectAccess::ForMapAndOffset(map_, offset);
2590 } 2590 }
2591 return true; 2591 return true;
2592 } 2592 }
2593 return false; 2593 return false;
2594 } 2594 }
2595 2595
2596 bool IsJSArrayBufferViewFieldAccessor() { 2596 bool IsJSArrayBufferViewFieldAccessor() {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2709 bool IsCompatible(PropertyAccessInfo* other); 2709 bool IsCompatible(PropertyAccessInfo* other);
2710 2710
2711 void GeneralizeRepresentation(Representation r) { 2711 void GeneralizeRepresentation(Representation r) {
2712 access_ = access_.WithRepresentation( 2712 access_ = access_.WithRepresentation(
2713 access_.representation().generalize(r)); 2713 access_.representation().generalize(r));
2714 } 2714 }
2715 2715
2716 HOptimizedGraphBuilder* builder_; 2716 HOptimizedGraphBuilder* builder_;
2717 PropertyAccessType access_type_; 2717 PropertyAccessType access_type_;
2718 Handle<Map> map_; 2718 Handle<Map> map_;
2719 Handle<String> name_; 2719 Handle<Name> name_;
2720 Handle<JSObject> holder_; 2720 Handle<JSObject> holder_;
2721 Handle<JSFunction> accessor_; 2721 Handle<JSFunction> accessor_;
2722 Handle<JSObject> api_holder_; 2722 Handle<JSObject> api_holder_;
2723 Handle<Object> constant_; 2723 Handle<Object> constant_;
2724 SmallMapList field_maps_; 2724 SmallMapList field_maps_;
2725 HType field_type_; 2725 HType field_type_;
2726 HObjectAccess access_; 2726 HObjectAccess access_;
2727 2727
2728 enum { NOT_FOUND, DESCRIPTOR_TYPE, TRANSITION_TYPE } lookup_type_; 2728 enum { NOT_FOUND, DESCRIPTOR_TYPE, TRANSITION_TYPE } lookup_type_;
2729 Handle<Map> transition_; 2729 Handle<Map> transition_;
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
3067 } 3067 }
3068 3068
3069 private: 3069 private:
3070 HGraphBuilder* builder_; 3070 HGraphBuilder* builder_;
3071 }; 3071 };
3072 3072
3073 3073
3074 } } // namespace v8::internal 3074 } } // namespace v8::internal
3075 3075
3076 #endif // V8_HYDROGEN_H_ 3076 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698