OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 cache_ = create_heap_objects ? HEAP->empty_fixed_array() : NULL; | 48 cache_ = create_heap_objects ? HEAP->empty_fixed_array() : NULL; |
49 } | 49 } |
50 | 50 |
51 void Iterate(ObjectVisitor* v) { | 51 void Iterate(ObjectVisitor* v) { |
52 v->VisitPointer(BitCast<Object**, FixedArray**>(&cache_)); | 52 v->VisitPointer(BitCast<Object**, FixedArray**>(&cache_)); |
53 } | 53 } |
54 | 54 |
55 bool Lookup(Vector<const char> name, Handle<SharedFunctionInfo>* handle) { | 55 bool Lookup(Vector<const char> name, Handle<SharedFunctionInfo>* handle) { |
56 for (int i = 0; i < cache_->length(); i+=2) { | 56 for (int i = 0; i < cache_->length(); i+=2) { |
57 SeqOneByteString* str = SeqOneByteString::cast(cache_->get(i)); | 57 SeqOneByteString* str = SeqOneByteString::cast(cache_->get(i)); |
58 if (str->IsEqualTo(name)) { | 58 if (str->IsUtf8EqualTo(name)) { |
59 *handle = Handle<SharedFunctionInfo>( | 59 *handle = Handle<SharedFunctionInfo>( |
60 SharedFunctionInfo::cast(cache_->get(i + 1))); | 60 SharedFunctionInfo::cast(cache_->get(i + 1))); |
61 return true; | 61 return true; |
62 } | 62 } |
63 } | 63 } |
64 return false; | 64 return false; |
65 } | 65 } |
66 | 66 |
67 void Add(Vector<const char> name, Handle<SharedFunctionInfo> shared) { | 67 void Add(Vector<const char> name, Handle<SharedFunctionInfo> shared) { |
68 HandleScope scope; | 68 HandleScope scope; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return length_; | 180 return length_; |
181 } | 181 } |
182 private: | 182 private: |
183 const char* data_; | 183 const char* data_; |
184 size_t length_; | 184 size_t length_; |
185 }; | 185 }; |
186 | 186 |
187 }} // namespace v8::internal | 187 }} // namespace v8::internal |
188 | 188 |
189 #endif // V8_BOOTSTRAPPER_H_ | 189 #endif // V8_BOOTSTRAPPER_H_ |
OLD | NEW |