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 10 matching lines...) Expand all Loading... |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_FACTORY_H_ | 28 #ifndef V8_FACTORY_H_ |
29 #define V8_FACTORY_H_ | 29 #define V8_FACTORY_H_ |
30 | 30 |
| 31 #include "globals.h" |
31 #include "heap.h" | 32 #include "heap.h" |
32 #include "zone-inl.h" | 33 #include "zone-inl.h" |
33 | 34 |
34 namespace v8 { | 35 namespace v8 { |
35 namespace internal { | 36 namespace internal { |
36 | 37 |
37 | 38 |
38 // Interface for handle based allocation. | 39 // Interface for handle based allocation. |
39 | 40 |
40 class Factory : public AllStatic { | 41 class Factory : public AllStatic { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 293 |
293 static Handle<JSFunction> InstallMembers(Handle<JSFunction> function); | 294 static Handle<JSFunction> InstallMembers(Handle<JSFunction> function); |
294 | 295 |
295 // Installs interceptors on the instance. 'desc' is a function template, | 296 // Installs interceptors on the instance. 'desc' is a function template, |
296 // and instance is an object instance created by the function of this | 297 // and instance is an object instance created by the function of this |
297 // function template. | 298 // function template. |
298 static void ConfigureInstance(Handle<FunctionTemplateInfo> desc, | 299 static void ConfigureInstance(Handle<FunctionTemplateInfo> desc, |
299 Handle<JSObject> instance, | 300 Handle<JSObject> instance, |
300 bool* pending_exception); | 301 bool* pending_exception); |
301 | 302 |
302 #define ROOT_ACCESSOR(type, name) \ | 303 #define ROOT_ACCESSOR(type, name, camel_name) \ |
303 static Handle<type> name() { return Handle<type>(&Heap::name##_); } | 304 static inline Handle<type> name() { \ |
| 305 return Handle<type>(bit_cast<type**, Object**>( \ |
| 306 &Heap::roots_[Heap::k##camel_name##RootIndex])); \ |
| 307 } |
304 ROOT_LIST(ROOT_ACCESSOR) | 308 ROOT_LIST(ROOT_ACCESSOR) |
305 #undef ROOT_ACCESSOR_ACCESSOR | 309 #undef ROOT_ACCESSOR_ACCESSOR |
306 | 310 |
307 #define SYMBOL_ACCESSOR(name, str) \ | 311 #define SYMBOL_ACCESSOR(name, str) \ |
308 static Handle<String> name() { return Handle<String>(&Heap::name##_); } | 312 static inline Handle<String> name() { \ |
| 313 return Handle<String>(bit_cast<String**, Object**>( \ |
| 314 &Heap::roots_[Heap::k##name##RootIndex])); \ |
| 315 } |
309 SYMBOL_LIST(SYMBOL_ACCESSOR) | 316 SYMBOL_LIST(SYMBOL_ACCESSOR) |
310 #undef SYMBOL_ACCESSOR | 317 #undef SYMBOL_ACCESSOR |
311 | 318 |
312 static Handle<String> hidden_symbol() { | 319 static Handle<String> hidden_symbol() { |
313 return Handle<String>(&Heap::hidden_symbol_); | 320 return Handle<String>(&Heap::hidden_symbol_); |
314 } | 321 } |
315 | 322 |
316 static Handle<SharedFunctionInfo> NewSharedFunctionInfo(Handle<String> name); | 323 static Handle<SharedFunctionInfo> NewSharedFunctionInfo(Handle<String> name); |
317 | 324 |
318 static Handle<NumberDictionary> DictionaryAtNumberPut( | 325 static Handle<NumberDictionary> DictionaryAtNumberPut( |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 // Update the map cache in the global context with (keys, map) | 370 // Update the map cache in the global context with (keys, map) |
364 static Handle<MapCache> AddToMapCache(Handle<Context> context, | 371 static Handle<MapCache> AddToMapCache(Handle<Context> context, |
365 Handle<FixedArray> keys, | 372 Handle<FixedArray> keys, |
366 Handle<Map> map); | 373 Handle<Map> map); |
367 }; | 374 }; |
368 | 375 |
369 | 376 |
370 } } // namespace v8::internal | 377 } } // namespace v8::internal |
371 | 378 |
372 #endif // V8_FACTORY_H_ | 379 #endif // V8_FACTORY_H_ |
OLD | NEW |