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

Side by Side Diff: src/objects.cc

Issue 12468: Merge code review fixes. (Closed)
Patch Set: Created 12 years 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 3487 matching lines...) Expand 10 before | Expand all | Expand 10 after
3498 3498
3499 UNREACHABLE(); 3499 UNREACHABLE();
3500 return 0; 3500 return 0;
3501 } 3501 }
3502 3502
3503 3503
3504 FlatStringReader* FlatStringReader::top_ = NULL; 3504 FlatStringReader* FlatStringReader::top_ = NULL;
3505 3505
3506 3506
3507 FlatStringReader::FlatStringReader(Handle<String> str) 3507 FlatStringReader::FlatStringReader(Handle<String> str)
3508 : str_(str.location()), 3508 : str_(str.location()),
3509 length_(str->length()), 3509 length_(str->length()),
3510 prev_(top_) { 3510 prev_(top_) {
3511 top_ = this; 3511 top_ = this;
3512 RefreshState(); 3512 RefreshState();
3513 } 3513 }
3514 3514
3515 3515
3516 FlatStringReader::FlatStringReader(Vector<const char> input) 3516 FlatStringReader::FlatStringReader(Vector<const char> input)
3517 : str_(NULL), 3517 : str_(NULL),
3518 is_ascii_(true), 3518 is_ascii_(true),
3519 length_(input.length()), 3519 length_(input.length()),
3520 start_(input.start()), 3520 start_(input.start()),
3521 prev_(top_) { 3521 prev_(top_) {
3522 top_ = this; 3522 top_ = this;
3523 } 3523 }
3524 3524
3525 3525
3526 FlatStringReader::~FlatStringReader() { 3526 FlatStringReader::~FlatStringReader() {
3527 ASSERT_EQ(top_, this); 3527 ASSERT_EQ(top_, this);
3528 top_ = prev_; 3528 top_ = prev_;
3529 } 3529 }
3530 3530
3531 3531
(...skipping 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after
5789 5789
5790 bool IsStringKey() { return true; } 5790 bool IsStringKey() { return true; }
5791 5791
5792 String* string_; 5792 String* string_;
5793 }; 5793 };
5794 5794
5795 // RegExpKey carries the source and flags of a regular expression as key. 5795 // RegExpKey carries the source and flags of a regular expression as key.
5796 class RegExpKey : public HashTableKey { 5796 class RegExpKey : public HashTableKey {
5797 public: 5797 public:
5798 RegExpKey(String* string, JSRegExp::Flags flags) 5798 RegExpKey(String* string, JSRegExp::Flags flags)
5799 : string_(string), 5799 : string_(string),
5800 flags_(Smi::FromInt(flags.value())) { } 5800 flags_(Smi::FromInt(flags.value())) { }
5801 5801
5802 bool IsMatch(Object* obj) { 5802 bool IsMatch(Object* obj) {
5803 FixedArray* val = FixedArray::cast(obj); 5803 FixedArray* val = FixedArray::cast(obj);
5804 return string_->Equals(String::cast(val->get(JSRegExp::kSourceIndex))) 5804 return string_->Equals(String::cast(val->get(JSRegExp::kSourceIndex)))
5805 && (flags_ == val->get(JSRegExp::kFlagsIndex)); 5805 && (flags_ == val->get(JSRegExp::kFlagsIndex));
5806 } 5806 }
5807 5807
5808 uint32_t Hash() { return RegExpHash(string_, flags_); } 5808 uint32_t Hash() { return RegExpHash(string_, flags_); }
5809 5809
5810 HashFunction GetHashFunction() { return RegExpObjectHash; } 5810 HashFunction GetHashFunction() { return RegExpObjectHash; }
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
6181 6181
6182 private: 6182 private:
6183 FixedArray* symbols_; 6183 FixedArray* symbols_;
6184 }; 6184 };
6185 6185
6186 6186
6187 // MapNameKeys are used as keys in lookup caches. 6187 // MapNameKeys are used as keys in lookup caches.
6188 class MapNameKey : public HashTableKey { 6188 class MapNameKey : public HashTableKey {
6189 public: 6189 public:
6190 MapNameKey(Map* map, String* name) 6190 MapNameKey(Map* map, String* name)
6191 : map_(map), name_(name) { } 6191 : map_(map), name_(name) { }
6192 6192
6193 bool IsMatch(Object* other) { 6193 bool IsMatch(Object* other) {
6194 if (!other->IsFixedArray()) return false; 6194 if (!other->IsFixedArray()) return false;
6195 FixedArray* pair = FixedArray::cast(other); 6195 FixedArray* pair = FixedArray::cast(other);
6196 Map* map = Map::cast(pair->get(0)); 6196 Map* map = Map::cast(pair->get(0));
6197 if (map != map_) return false; 6197 if (map != map_) return false;
6198 String* name = String::cast(pair->get(1)); 6198 String* name = String::cast(pair->get(1));
6199 return name->Equals(name_); 6199 return name->Equals(name_);
6200 } 6200 }
6201 6201
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
6954 // No break point. 6954 // No break point.
6955 if (break_point_objects()->IsUndefined()) return 0; 6955 if (break_point_objects()->IsUndefined()) return 0;
6956 // Single beak point. 6956 // Single beak point.
6957 if (!break_point_objects()->IsFixedArray()) return 1; 6957 if (!break_point_objects()->IsFixedArray()) return 1;
6958 // Multiple break points. 6958 // Multiple break points.
6959 return FixedArray::cast(break_point_objects())->length(); 6959 return FixedArray::cast(break_point_objects())->length();
6960 } 6960 }
6961 6961
6962 6962
6963 } } // namespace v8::internal 6963 } } // namespace v8::internal
OLDNEW
« src/jsregexp.cc ('K') | « src/jsregexp-inl.h ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698