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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 void Add(Vector<const char> name, Handle<SharedFunctionInfo> shared) { | 67 void Add(Vector<const char> name, Handle<SharedFunctionInfo> shared) { |
68 Isolate* isolate = shared->GetIsolate(); | 68 Isolate* isolate = shared->GetIsolate(); |
69 Factory* factory = isolate->factory(); | 69 Factory* factory = isolate->factory(); |
70 HandleScope scope(isolate); | 70 HandleScope scope(isolate); |
71 int length = cache_->length(); | 71 int length = cache_->length(); |
72 Handle<FixedArray> new_array = factory->NewFixedArray(length + 2, TENURED); | 72 Handle<FixedArray> new_array = factory->NewFixedArray(length + 2, TENURED); |
73 cache_->CopyTo(0, *new_array, 0, cache_->length()); | 73 cache_->CopyTo(0, *new_array, 0, cache_->length()); |
74 cache_ = *new_array; | 74 cache_ = *new_array; |
75 Handle<String> str = factory->NewStringFromAscii(name, TENURED); | 75 Handle<String> str = factory->NewStringFromAscii(name, TENURED); |
| 76 ASSERT(!str.is_null()); |
76 cache_->set(length, *str); | 77 cache_->set(length, *str); |
77 cache_->set(length + 1, *shared); | 78 cache_->set(length + 1, *shared); |
78 Script::cast(shared->script())->set_type(Smi::FromInt(type_)); | 79 Script::cast(shared->script())->set_type(Smi::FromInt(type_)); |
79 } | 80 } |
80 | 81 |
81 private: | 82 private: |
82 Script::Type type_; | 83 Script::Type type_; |
83 FixedArray* cache_; | 84 FixedArray* cache_; |
84 DISALLOW_COPY_AND_ASSIGN(SourceCodeCache); | 85 DISALLOW_COPY_AND_ASSIGN(SourceCodeCache); |
85 }; | 86 }; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 return length_; | 191 return length_; |
191 } | 192 } |
192 private: | 193 private: |
193 const char* data_; | 194 const char* data_; |
194 size_t length_; | 195 size_t length_; |
195 }; | 196 }; |
196 | 197 |
197 }} // namespace v8::internal | 198 }} // namespace v8::internal |
198 | 199 |
199 #endif // V8_BOOTSTRAPPER_H_ | 200 #endif // V8_BOOTSTRAPPER_H_ |
OLD | NEW |