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

Side by Side Diff: src/hydrogen.h

Issue 153743005: Remove special ArrayLength handling already covered by JSObjectFieldAccessors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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 | « 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 // 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 2318 matching lines...) Expand 10 before | Expand all | Expand 10 after
2329 } 2329 }
2330 Type* type() const { return type_; } 2330 Type* type() const { return type_; }
2331 Handle<String> name() const { return name_; } 2331 Handle<String> name() const { return name_; }
2332 2332
2333 bool IsJSObjectFieldAccessor() { 2333 bool IsJSObjectFieldAccessor() {
2334 int offset; // unused 2334 int offset; // unused
2335 return Accessors::IsJSObjectFieldAccessor<Type>(type_, name_, &offset); 2335 return Accessors::IsJSObjectFieldAccessor<Type>(type_, name_, &offset);
2336 } 2336 }
2337 2337
2338 bool GetJSObjectFieldAccess(HObjectAccess* access) { 2338 bool GetJSObjectFieldAccess(HObjectAccess* access) {
2339 if (IsArrayLength()) {
2340 *access = HObjectAccess::ForArrayLength(map()->elements_kind());
2341 return true;
2342 }
2343 int offset; 2339 int offset;
2344 if (Accessors::IsJSObjectFieldAccessor<Type>(type_, name_, &offset)) { 2340 if (Accessors::IsJSObjectFieldAccessor<Type>(type_, name_, &offset)) {
2345 if (type_->Is(Type::String())) { 2341 if (type_->Is(Type::String())) {
2346 ASSERT(name_->Equals(isolate()->heap()->length_string())); 2342 ASSERT(name_->Equals(isolate()->heap()->length_string()));
2347 *access = HObjectAccess::ForStringLength(); 2343 *access = HObjectAccess::ForStringLength();
2344 } else if (type_->Is(Type::Array())) {
2345 ASSERT(name_->Equals(isolate()->heap()->length_string()));
2346 *access = HObjectAccess::ForArrayLength(map()->elements_kind());
2348 } else { 2347 } else {
2349 *access = HObjectAccess::ForMapAndOffset(map(), offset); 2348 *access = HObjectAccess::ForMapAndOffset(map(), offset);
2350 } 2349 }
2351 return true; 2350 return true;
2352 } 2351 }
2353 return false; 2352 return false;
2354 } 2353 }
2355 2354
2356 bool has_holder() { return !holder_.is_null(); } 2355 bool has_holder() { return !holder_.is_null(); }
2357 bool IsLoad() const { return access_type_ == LOAD; } 2356 bool IsLoad() const { return access_type_ == LOAD; }
2358 2357
2359 LookupResult* lookup() { return &lookup_; } 2358 LookupResult* lookup() { return &lookup_; }
2360 Handle<JSObject> holder() { return holder_; } 2359 Handle<JSObject> holder() { return holder_; }
2361 Handle<JSFunction> accessor() { return accessor_; } 2360 Handle<JSFunction> accessor() { return accessor_; }
2362 Handle<Object> constant() { return constant_; } 2361 Handle<Object> constant() { return constant_; }
2363 Handle<Object> transition() { return transition_; } 2362 Handle<Object> transition() { return transition_; }
2364 HObjectAccess access() { return access_; } 2363 HObjectAccess access() { return access_; }
2365 2364
2366 private: 2365 private:
2367 Type* ToType(Handle<Map> map) { return builder_->ToType(map); } 2366 Type* ToType(Handle<Map> map) { return builder_->ToType(map); }
2368 Isolate* isolate() { return lookup_.isolate(); } 2367 Isolate* isolate() { return lookup_.isolate(); }
2369 CompilationInfo* current_info() { return builder_->current_info(); } 2368 CompilationInfo* current_info() { return builder_->current_info(); }
2370 2369
2371 bool IsArrayLength() {
2372 return map()->instance_type() == JS_ARRAY_TYPE &&
2373 name_->Equals(isolate()->heap()->length_string());
2374 }
2375
2376 bool LoadResult(Handle<Map> map); 2370 bool LoadResult(Handle<Map> map);
2377 bool LookupDescriptor(); 2371 bool LookupDescriptor();
2378 bool LookupInPrototypes(); 2372 bool LookupInPrototypes();
2379 bool IsCompatible(PropertyAccessInfo* other); 2373 bool IsCompatible(PropertyAccessInfo* other);
2380 2374
2381 void GeneralizeRepresentation(Representation r) { 2375 void GeneralizeRepresentation(Representation r) {
2382 access_ = access_.WithRepresentation( 2376 access_ = access_.WithRepresentation(
2383 access_.representation().generalize(r)); 2377 access_.representation().generalize(r));
2384 } 2378 }
2385 2379
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2746 } 2740 }
2747 2741
2748 private: 2742 private:
2749 HGraphBuilder* builder_; 2743 HGraphBuilder* builder_;
2750 }; 2744 };
2751 2745
2752 2746
2753 } } // namespace v8::internal 2747 } } // namespace v8::internal
2754 2748
2755 #endif // V8_HYDROGEN_H_ 2749 #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