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

Side by Side Diff: src/hydrogen.h

Issue 24360019: Speed up ArrayBuffer/typed array/DataView properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: After self-review Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/heap.h ('k') | src/hydrogen.cc » ('j') | src/ic.cc » ('J')
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 // 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 12 matching lines...) Expand all
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_HYDROGEN_H_ 28 #ifndef V8_HYDROGEN_H_
29 #define V8_HYDROGEN_H_ 29 #define V8_HYDROGEN_H_
30 30
31 #include "v8.h" 31 #include "v8.h"
32 32
33 #include "accessors.h"
33 #include "allocation.h" 34 #include "allocation.h"
34 #include "ast.h" 35 #include "ast.h"
35 #include "compiler.h" 36 #include "compiler.h"
36 #include "hydrogen-instructions.h" 37 #include "hydrogen-instructions.h"
37 #include "zone.h" 38 #include "zone.h"
38 #include "scopes.h" 39 #include "scopes.h"
39 40
40 namespace v8 { 41 namespace v8 {
41 namespace internal { 42 namespace internal {
42 43
(...skipping 1987 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 bool CanLoadMonomorphic(); 2031 bool CanLoadMonomorphic();
2031 2032
2032 // Checks whether all types behave uniform when loading name. If all maps 2033 // Checks whether all types behave uniform when loading name. If all maps
2033 // behave the same, a single monomorphic load instruction can be emitted, 2034 // behave the same, a single monomorphic load instruction can be emitted,
2034 // guarded by a single map-checks instruction that whether the receiver is 2035 // guarded by a single map-checks instruction that whether the receiver is
2035 // an instance of any of the types. 2036 // an instance of any of the types.
2036 // This method skips the first type in types, assuming that this 2037 // This method skips the first type in types, assuming that this
2037 // PropertyAccessInfo is built for types->first(). 2038 // PropertyAccessInfo is built for types->first().
2038 bool CanLoadAsMonomorphic(SmallMapList* types); 2039 bool CanLoadAsMonomorphic(SmallMapList* types);
2039 2040
2040 bool IsStringLength() { 2041 bool IsJSObjectFieldAccessor() {
2041 return map_->instance_type() < FIRST_NONSTRING_TYPE && 2042 int offset; // unused
2042 name_->Equals(isolate()->heap()->length_string()); 2043 return Accessors::IsJSObjectFieldAccessor(map_, name_, &offset);
2043 } 2044 }
2044 2045
2045 bool IsArrayLength() { 2046 bool GetJSObjectFieldAccess(HObjectAccess* access) {
2046 return map_->instance_type() == JS_ARRAY_TYPE && 2047 if (IsStringLength()) {
2047 name_->Equals(isolate()->heap()->length_string()); 2048 *access = HObjectAccess::ForStringLength();
2048 } 2049 return true;
2049 2050 } else if (IsArrayLength()) {
2050 bool IsTypedArrayLength() { 2051 *access = HObjectAccess::ForArrayLength(map_->elements_kind());
2051 return map_->instance_type() == JS_TYPED_ARRAY_TYPE && 2052 return true;
2052 name_->Equals(isolate()->heap()->length_string()); 2053 } else {
2054 int offset;
2055 if (Accessors::IsJSObjectFieldAccessor(map_, name_, &offset)) {
2056 *access = HObjectAccess::ForJSObjectOffset(offset);
2057 return true;
2058 }
2059 return false;
2060 }
2053 } 2061 }
2054 2062
2055 bool has_holder() { return !holder_.is_null(); } 2063 bool has_holder() { return !holder_.is_null(); }
2056 2064
2057 LookupResult* lookup() { return &lookup_; } 2065 LookupResult* lookup() { return &lookup_; }
2058 Handle<Map> map() { return map_; } 2066 Handle<Map> map() { return map_; }
2059 Handle<JSObject> holder() { return holder_; } 2067 Handle<JSObject> holder() { return holder_; }
2060 Handle<JSFunction> accessor() { return accessor_; } 2068 Handle<JSFunction> accessor() { return accessor_; }
2061 Handle<Object> constant() { return constant_; } 2069 Handle<Object> constant() { return constant_; }
2062 HObjectAccess access() { return access_; } 2070 HObjectAccess access() { return access_; }
2063 2071
2064 private: 2072 private:
2065 Isolate* isolate() { return lookup_.isolate(); } 2073 Isolate* isolate() { return lookup_.isolate(); }
2066 2074
2075 bool IsStringLength() {
2076 return map_->instance_type() < FIRST_NONSTRING_TYPE &&
2077 name_->Equals(isolate()->heap()->length_string());
2078 }
2079
2080 bool IsArrayLength() {
2081 return map_->instance_type() == JS_ARRAY_TYPE &&
2082 name_->Equals(isolate()->heap()->length_string());
2083 }
2084
2067 bool LoadResult(Handle<Map> map); 2085 bool LoadResult(Handle<Map> map);
2068 bool LookupDescriptor(); 2086 bool LookupDescriptor();
2069 bool LookupInPrototypes(); 2087 bool LookupInPrototypes();
2070 bool IsCompatibleForLoad(PropertyAccessInfo* other); 2088 bool IsCompatibleForLoad(PropertyAccessInfo* other);
2071 2089
2072 void GeneralizeRepresentation(Representation r) { 2090 void GeneralizeRepresentation(Representation r) {
2073 access_ = access_.WithRepresentation( 2091 access_ = access_.WithRepresentation(
2074 access_.representation().generalize(r)); 2092 access_.representation().generalize(r));
2075 } 2093 }
2076 2094
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 HValue* val, 2175 HValue* val,
2158 Expression* expr, 2176 Expression* expr,
2159 BailoutId ast_id, 2177 BailoutId ast_id,
2160 int position, 2178 int position,
2161 bool is_store, 2179 bool is_store,
2162 bool* has_side_effects); 2180 bool* has_side_effects);
2163 2181
2164 HInstruction* BuildLoadNamedGeneric(HValue* object, 2182 HInstruction* BuildLoadNamedGeneric(HValue* object,
2165 Handle<String> name, 2183 Handle<String> name,
2166 Property* expr); 2184 Property* expr);
2167 HInstruction* BuildCallGetter(HValue* object,
2168 Handle<Map> map,
2169 Handle<JSFunction> getter,
2170 Handle<JSObject> holder);
2171 2185
2172 HCheckMaps* AddCheckMap(HValue* object, Handle<Map> map); 2186 HCheckMaps* AddCheckMap(HValue* object, Handle<Map> map);
2173 2187
2174 void BuildLoad(Property* property, 2188 void BuildLoad(Property* property,
2175 int position, 2189 int position,
2176 BailoutId ast_id); 2190 BailoutId ast_id);
2177 void PushLoad(Property* property, 2191 void PushLoad(Property* property,
2178 HValue* object, 2192 HValue* object,
2179 HValue* key, 2193 HValue* key,
2180 int position); 2194 int position);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 } 2444 }
2431 2445
2432 private: 2446 private:
2433 HGraphBuilder* builder_; 2447 HGraphBuilder* builder_;
2434 }; 2448 };
2435 2449
2436 2450
2437 } } // namespace v8::internal 2451 } } // namespace v8::internal
2438 2452
2439 #endif // V8_HYDROGEN_H_ 2453 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/hydrogen.cc » ('j') | src/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698