| 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 27 matching lines...) Expand all  Loading... | 
| 38 // A SourceCodeCache uses a FixedArray to store pairs of | 38 // A SourceCodeCache uses a FixedArray to store pairs of | 
| 39 // (AsciiString*, JSFunction*), mapping names of native code files | 39 // (AsciiString*, JSFunction*), mapping names of native code files | 
| 40 // (runtime.js, etc.) to precompiled functions. Instead of mapping | 40 // (runtime.js, etc.) to precompiled functions. Instead of mapping | 
| 41 // names to functions it might make sense to let the JS2C tool | 41 // names to functions it might make sense to let the JS2C tool | 
| 42 // generate an index for each native JS file. | 42 // generate an index for each native JS file. | 
| 43 class SourceCodeCache BASE_EMBEDDED { | 43 class SourceCodeCache BASE_EMBEDDED { | 
| 44  public: | 44  public: | 
| 45   explicit SourceCodeCache(Script::Type type): type_(type), cache_(NULL) { } | 45   explicit SourceCodeCache(Script::Type type): type_(type), cache_(NULL) { } | 
| 46 | 46 | 
| 47   void Initialize(bool create_heap_objects) { | 47   void Initialize(bool create_heap_objects) { | 
| 48     cache_ = create_heap_objects ? HEAP->empty_fixed_array() : NULL; | 48     cache_ = create_heap_objects ? | 
|  | 49         Isolate::Current()->heap()->empty_fixed_array() : NULL; | 
| 49   } | 50   } | 
| 50 | 51 | 
| 51   void Iterate(ObjectVisitor* v) { | 52   void Iterate(ObjectVisitor* v) { | 
| 52     v->VisitPointer(BitCast<Object**, FixedArray**>(&cache_)); | 53     v->VisitPointer(BitCast<Object**, FixedArray**>(&cache_)); | 
| 53   } | 54   } | 
| 54 | 55 | 
| 55   bool Lookup(Vector<const char> name, Handle<SharedFunctionInfo>* handle) { | 56   bool Lookup(Vector<const char> name, Handle<SharedFunctionInfo>* handle) { | 
| 56     for (int i = 0; i < cache_->length(); i+=2) { | 57     for (int i = 0; i < cache_->length(); i+=2) { | 
| 57       SeqOneByteString* str = SeqOneByteString::cast(cache_->get(i)); | 58       SeqOneByteString* str = SeqOneByteString::cast(cache_->get(i)); | 
| 58       if (str->IsUtf8EqualTo(name)) { | 59       if (str->IsUtf8EqualTo(name)) { | 
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 186     return length_; | 187     return length_; | 
| 187   } | 188   } | 
| 188  private: | 189  private: | 
| 189   const char* data_; | 190   const char* data_; | 
| 190   size_t length_; | 191   size_t length_; | 
| 191 }; | 192 }; | 
| 192 | 193 | 
| 193 }}  // namespace v8::internal | 194 }}  // namespace v8::internal | 
| 194 | 195 | 
| 195 #endif  // V8_BOOTSTRAPPER_H_ | 196 #endif  // V8_BOOTSTRAPPER_H_ | 
| OLD | NEW | 
|---|