OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_BOOTSTRAPPER_H_ | 5 #ifndef V8_BOOTSTRAPPER_H_ |
6 #define V8_BOOTSTRAPPER_H_ | 6 #define V8_BOOTSTRAPPER_H_ |
7 | 7 |
8 #include "factory.h" | 8 #include "factory.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 void Add(Vector<const char> name, Handle<SharedFunctionInfo> shared) { | 42 void Add(Vector<const char> name, Handle<SharedFunctionInfo> shared) { |
43 Isolate* isolate = shared->GetIsolate(); | 43 Isolate* isolate = shared->GetIsolate(); |
44 Factory* factory = isolate->factory(); | 44 Factory* factory = isolate->factory(); |
45 HandleScope scope(isolate); | 45 HandleScope scope(isolate); |
46 int length = cache_->length(); | 46 int length = cache_->length(); |
47 Handle<FixedArray> new_array = factory->NewFixedArray(length + 2, TENURED); | 47 Handle<FixedArray> new_array = factory->NewFixedArray(length + 2, TENURED); |
48 cache_->CopyTo(0, *new_array, 0, cache_->length()); | 48 cache_->CopyTo(0, *new_array, 0, cache_->length()); |
49 cache_ = *new_array; | 49 cache_ = *new_array; |
50 Handle<String> str = factory->NewStringFromAscii(name, TENURED); | 50 Handle<String> str = |
| 51 factory->NewStringFromAscii(name, TENURED).ToHandleChecked(); |
51 ASSERT(!str.is_null()); | 52 ASSERT(!str.is_null()); |
52 cache_->set(length, *str); | 53 cache_->set(length, *str); |
53 cache_->set(length + 1, *shared); | 54 cache_->set(length + 1, *shared); |
54 Script::cast(shared->script())->set_type(Smi::FromInt(type_)); | 55 Script::cast(shared->script())->set_type(Smi::FromInt(type_)); |
55 } | 56 } |
56 | 57 |
57 private: | 58 private: |
58 Script::Type type_; | 59 Script::Type type_; |
59 FixedArray* cache_; | 60 FixedArray* cache_; |
60 DISALLOW_COPY_AND_ASSIGN(SourceCodeCache); | 61 DISALLOW_COPY_AND_ASSIGN(SourceCodeCache); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 virtual size_t length() const V8_OVERRIDE { return length_; } | 162 virtual size_t length() const V8_OVERRIDE { return length_; } |
162 | 163 |
163 private: | 164 private: |
164 const char* data_; | 165 const char* data_; |
165 size_t length_; | 166 size_t length_; |
166 }; | 167 }; |
167 | 168 |
168 }} // namespace v8::internal | 169 }} // namespace v8::internal |
169 | 170 |
170 #endif // V8_BOOTSTRAPPER_H_ | 171 #endif // V8_BOOTSTRAPPER_H_ |
OLD | NEW |