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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // generate an index for each native JS file. | 49 // generate an index for each native JS file. |
50 class SourceCodeCache BASE_EMBEDDED { | 50 class SourceCodeCache BASE_EMBEDDED { |
51 public: | 51 public: |
52 explicit SourceCodeCache(Script::Type type): type_(type), cache_(NULL) { } | 52 explicit SourceCodeCache(Script::Type type): type_(type), cache_(NULL) { } |
53 | 53 |
54 void Initialize(bool create_heap_objects) { | 54 void Initialize(bool create_heap_objects) { |
55 cache_ = create_heap_objects ? Heap::empty_fixed_array() : NULL; | 55 cache_ = create_heap_objects ? Heap::empty_fixed_array() : NULL; |
56 } | 56 } |
57 | 57 |
58 void Iterate(ObjectVisitor* v) { | 58 void Iterate(ObjectVisitor* v) { |
59 v->VisitPointer(BitCast<Object**, FixedArray**>(&cache_)); | 59 v->VisitPointer(BitCast<Object**>(&cache_)); |
60 } | 60 } |
61 | 61 |
62 | 62 |
63 bool Lookup(Vector<const char> name, Handle<SharedFunctionInfo>* handle) { | 63 bool Lookup(Vector<const char> name, Handle<SharedFunctionInfo>* handle) { |
64 for (int i = 0; i < cache_->length(); i+=2) { | 64 for (int i = 0; i < cache_->length(); i+=2) { |
65 SeqAsciiString* str = SeqAsciiString::cast(cache_->get(i)); | 65 SeqAsciiString* str = SeqAsciiString::cast(cache_->get(i)); |
66 if (str->IsEqualTo(name)) { | 66 if (str->IsEqualTo(name)) { |
67 *handle = Handle<SharedFunctionInfo>( | 67 *handle = Handle<SharedFunctionInfo>( |
68 SharedFunctionInfo::cast(cache_->get(i + 1))); | 68 SharedFunctionInfo::cast(cache_->get(i + 1))); |
69 return true; | 69 return true; |
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1813 } | 1813 } |
1814 | 1814 |
1815 | 1815 |
1816 // Restore statics that are thread local. | 1816 // Restore statics that are thread local. |
1817 char* BootstrapperActive::RestoreState(char* from) { | 1817 char* BootstrapperActive::RestoreState(char* from) { |
1818 nesting_ = *reinterpret_cast<int*>(from); | 1818 nesting_ = *reinterpret_cast<int*>(from); |
1819 return from + sizeof(nesting_); | 1819 return from + sizeof(nesting_); |
1820 } | 1820 } |
1821 | 1821 |
1822 } } // namespace v8::internal | 1822 } } // namespace v8::internal |
OLD | NEW |