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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 if (str->IsUtf8EqualTo(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(shared->GetIsolate()); | 68 Isolate* isolate = shared->GetIsolate(); |
| 69 Factory* factory = isolate->factory(); |
| 70 HandleScope scope(isolate); |
69 int length = cache_->length(); | 71 int length = cache_->length(); |
70 Handle<FixedArray> new_array = | 72 Handle<FixedArray> new_array = factory->NewFixedArray(length + 2, TENURED); |
71 FACTORY->NewFixedArray(length + 2, TENURED); | |
72 cache_->CopyTo(0, *new_array, 0, cache_->length()); | 73 cache_->CopyTo(0, *new_array, 0, cache_->length()); |
73 cache_ = *new_array; | 74 cache_ = *new_array; |
74 Handle<String> str = FACTORY->NewStringFromAscii(name, TENURED); | 75 Handle<String> str = factory->NewStringFromAscii(name, TENURED); |
75 cache_->set(length, *str); | 76 cache_->set(length, *str); |
76 cache_->set(length + 1, *shared); | 77 cache_->set(length + 1, *shared); |
77 Script::cast(shared->script())->set_type(Smi::FromInt(type_)); | 78 Script::cast(shared->script())->set_type(Smi::FromInt(type_)); |
78 } | 79 } |
79 | 80 |
80 private: | 81 private: |
81 Script::Type type_; | 82 Script::Type type_; |
82 FixedArray* cache_; | 83 FixedArray* cache_; |
83 DISALLOW_COPY_AND_ASSIGN(SourceCodeCache); | 84 DISALLOW_COPY_AND_ASSIGN(SourceCodeCache); |
84 }; | 85 }; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 return length_; | 186 return length_; |
186 } | 187 } |
187 private: | 188 private: |
188 const char* data_; | 189 const char* data_; |
189 size_t length_; | 190 size_t length_; |
190 }; | 191 }; |
191 | 192 |
192 }} // namespace v8::internal | 193 }} // namespace v8::internal |
193 | 194 |
194 #endif // V8_BOOTSTRAPPER_H_ | 195 #endif // V8_BOOTSTRAPPER_H_ |
OLD | NEW |