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

Side by Side Diff: src/objects-inl.h

Issue 23453019: Allow uncacheable identifiers to go generic. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Adding test 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/objects.cc ('k') | test/mjsunit/regress/regress-store-uncacheable.js » ('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 2631 matching lines...) Expand 10 before | Expand all | Expand 10 after
2642 bool Name::Equals(Name* other) { 2642 bool Name::Equals(Name* other) {
2643 if (other == this) return true; 2643 if (other == this) return true;
2644 if ((this->IsInternalizedString() && other->IsInternalizedString()) || 2644 if ((this->IsInternalizedString() && other->IsInternalizedString()) ||
2645 this->IsSymbol() || other->IsSymbol()) { 2645 this->IsSymbol() || other->IsSymbol()) {
2646 return false; 2646 return false;
2647 } 2647 }
2648 return String::cast(this)->SlowEquals(String::cast(other)); 2648 return String::cast(this)->SlowEquals(String::cast(other));
2649 } 2649 }
2650 2650
2651 2651
2652 static bool IsIdentifier(UnicodeCache* cache, Name* name) {
Jakob Kummerow 2013/09/02 13:28:59 This seems a little large for -inl.h. Please move
2653 // Checks whether the buffer contains an identifier (no escape).
2654 if (!name->IsString()) return false;
2655 String* string = String::cast(name);
2656 if (string->length() == 0) return false;
2657 ConsStringIteratorOp op;
2658 StringCharacterStream stream(string, &op);
2659 if (!cache->IsIdentifierStart(stream.GetNext())) {
2660 return false;
2661 }
2662 while (stream.HasMore()) {
2663 if (!cache->IsIdentifierPart(stream.GetNext())) {
2664 return false;
2665 }
2666 }
2667 return true;
2668 }
2669
2670
2671 bool Name::IsCacheable(Isolate* isolate) {
2672 return IsSymbol() ||
2673 IsIdentifier(isolate->unicode_cache(), this) ||
2674 this == isolate->heap()->hidden_string();
2675 }
2676
2677
2652 ACCESSORS(Symbol, name, Object, kNameOffset) 2678 ACCESSORS(Symbol, name, Object, kNameOffset)
2653 2679
2654 2680
2655 bool String::Equals(String* other) { 2681 bool String::Equals(String* other) {
2656 if (other == this) return true; 2682 if (other == this) return true;
2657 if (this->IsInternalizedString() && other->IsInternalizedString()) { 2683 if (this->IsInternalizedString() && other->IsInternalizedString()) {
2658 return false; 2684 return false;
2659 } 2685 }
2660 return SlowEquals(other); 2686 return SlowEquals(other);
2661 } 2687 }
(...skipping 3623 matching lines...) Expand 10 before | Expand all | Expand 10 after
6285 #undef WRITE_UINT32_FIELD 6311 #undef WRITE_UINT32_FIELD
6286 #undef READ_SHORT_FIELD 6312 #undef READ_SHORT_FIELD
6287 #undef WRITE_SHORT_FIELD 6313 #undef WRITE_SHORT_FIELD
6288 #undef READ_BYTE_FIELD 6314 #undef READ_BYTE_FIELD
6289 #undef WRITE_BYTE_FIELD 6315 #undef WRITE_BYTE_FIELD
6290 6316
6291 6317
6292 } } // namespace v8::internal 6318 } } // namespace v8::internal
6293 6319
6294 #endif // V8_OBJECTS_INL_H_ 6320 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/regress/regress-store-uncacheable.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698