OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2119 } | 2119 } |
2120 | 2120 |
2121 | 2121 |
2122 void Genesis::InstallJSFunctionResultCaches() { | 2122 void Genesis::InstallJSFunctionResultCaches() { |
2123 const int kNumberOfCaches = 0 + | 2123 const int kNumberOfCaches = 0 + |
2124 #define F(size, func) + 1 | 2124 #define F(size, func) + 1 |
2125 JSFUNCTION_RESULT_CACHE_LIST(F) | 2125 JSFUNCTION_RESULT_CACHE_LIST(F) |
2126 #undef F | 2126 #undef F |
2127 ; | 2127 ; |
2128 | 2128 |
2129 Handle<FixedArray> caches = FACTORY->NewFixedArray(kNumberOfCaches, TENURED); | 2129 Handle<FixedArray> caches = |
| 2130 factory()->NewFixedArray(kNumberOfCaches, TENURED); |
2130 | 2131 |
2131 int index = 0; | 2132 int index = 0; |
2132 | 2133 |
2133 #define F(size, func) do { \ | 2134 #define F(size, func) do { \ |
2134 FixedArray* cache = CreateCache((size), Handle<JSFunction>(func)); \ | 2135 FixedArray* cache = CreateCache((size), Handle<JSFunction>(func)); \ |
2135 caches->set(index++, cache); \ | 2136 caches->set(index++, cache); \ |
2136 } while (false) | 2137 } while (false) |
2137 | 2138 |
2138 JSFUNCTION_RESULT_CACHE_LIST(F); | 2139 JSFUNCTION_RESULT_CACHE_LIST(F); |
2139 | 2140 |
2140 #undef F | 2141 #undef F |
2141 | 2142 |
2142 native_context()->set_jsfunction_result_caches(*caches); | 2143 native_context()->set_jsfunction_result_caches(*caches); |
2143 } | 2144 } |
2144 | 2145 |
2145 | 2146 |
2146 void Genesis::InitializeNormalizedMapCaches() { | 2147 void Genesis::InitializeNormalizedMapCaches() { |
2147 Handle<FixedArray> array( | 2148 Handle<FixedArray> array( |
2148 FACTORY->NewFixedArray(NormalizedMapCache::kEntries, TENURED)); | 2149 factory()->NewFixedArray(NormalizedMapCache::kEntries, TENURED)); |
2149 native_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array)); | 2150 native_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array)); |
2150 } | 2151 } |
2151 | 2152 |
2152 | 2153 |
2153 bool Bootstrapper::InstallExtensions(Handle<Context> native_context, | 2154 bool Bootstrapper::InstallExtensions(Handle<Context> native_context, |
2154 v8::ExtensionConfiguration* extensions) { | 2155 v8::ExtensionConfiguration* extensions) { |
2155 BootstrapperActive active(this); | 2156 BootstrapperActive active(this); |
2156 SaveContext saved_context(isolate_); | 2157 SaveContext saved_context(isolate_); |
2157 isolate_->set_context(*native_context); | 2158 isolate_->set_context(*native_context); |
2158 if (!Genesis::InstallExtensions(native_context, extensions)) return false; | 2159 if (!Genesis::InstallExtensions(native_context, extensions)) return false; |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 } | 2499 } |
2499 } | 2500 } |
2500 } | 2501 } |
2501 | 2502 |
2502 | 2503 |
2503 void Genesis::TransferIndexedProperties(Handle<JSObject> from, | 2504 void Genesis::TransferIndexedProperties(Handle<JSObject> from, |
2504 Handle<JSObject> to) { | 2505 Handle<JSObject> to) { |
2505 // Cloning the elements array is sufficient. | 2506 // Cloning the elements array is sufficient. |
2506 Handle<FixedArray> from_elements = | 2507 Handle<FixedArray> from_elements = |
2507 Handle<FixedArray>(FixedArray::cast(from->elements())); | 2508 Handle<FixedArray>(FixedArray::cast(from->elements())); |
2508 Handle<FixedArray> to_elements = FACTORY->CopyFixedArray(from_elements); | 2509 Handle<FixedArray> to_elements = factory()->CopyFixedArray(from_elements); |
2509 to->set_elements(*to_elements); | 2510 to->set_elements(*to_elements); |
2510 } | 2511 } |
2511 | 2512 |
2512 | 2513 |
2513 void Genesis::TransferObject(Handle<JSObject> from, Handle<JSObject> to) { | 2514 void Genesis::TransferObject(Handle<JSObject> from, Handle<JSObject> to) { |
2514 HandleScope outer(isolate()); | 2515 HandleScope outer(isolate()); |
2515 Factory* factory = isolate()->factory(); | |
2516 | 2516 |
2517 ASSERT(!from->IsJSArray()); | 2517 ASSERT(!from->IsJSArray()); |
2518 ASSERT(!to->IsJSArray()); | 2518 ASSERT(!to->IsJSArray()); |
2519 | 2519 |
2520 TransferNamedProperties(from, to); | 2520 TransferNamedProperties(from, to); |
2521 TransferIndexedProperties(from, to); | 2521 TransferIndexedProperties(from, to); |
2522 | 2522 |
2523 // Transfer the prototype (new map is needed). | 2523 // Transfer the prototype (new map is needed). |
2524 Handle<Map> old_to_map = Handle<Map>(to->map()); | 2524 Handle<Map> old_to_map = Handle<Map>(to->map()); |
2525 Handle<Map> new_to_map = factory->CopyMap(old_to_map); | 2525 Handle<Map> new_to_map = factory()->CopyMap(old_to_map); |
2526 new_to_map->set_prototype(from->map()->prototype()); | 2526 new_to_map->set_prototype(from->map()->prototype()); |
2527 to->set_map(*new_to_map); | 2527 to->set_map(*new_to_map); |
2528 } | 2528 } |
2529 | 2529 |
2530 | 2530 |
2531 void Genesis::MakeFunctionInstancePrototypeWritable() { | 2531 void Genesis::MakeFunctionInstancePrototypeWritable() { |
2532 // The maps with writable prototype are created in CreateEmptyFunction | 2532 // The maps with writable prototype are created in CreateEmptyFunction |
2533 // and CreateStrictModeFunctionMaps respectively. Initially the maps are | 2533 // and CreateStrictModeFunctionMaps respectively. Initially the maps are |
2534 // created with read-only prototype for JS builtins processing. | 2534 // created with read-only prototype for JS builtins processing. |
2535 ASSERT(!function_map_writable_prototype_.is_null()); | 2535 ASSERT(!function_map_writable_prototype_.is_null()); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2627 return from + sizeof(NestingCounterType); | 2627 return from + sizeof(NestingCounterType); |
2628 } | 2628 } |
2629 | 2629 |
2630 | 2630 |
2631 // Called when the top-level V8 mutex is destroyed. | 2631 // Called when the top-level V8 mutex is destroyed. |
2632 void Bootstrapper::FreeThreadResources() { | 2632 void Bootstrapper::FreeThreadResources() { |
2633 ASSERT(!IsActive()); | 2633 ASSERT(!IsActive()); |
2634 } | 2634 } |
2635 | 2635 |
2636 } } // namespace v8::internal | 2636 } } // namespace v8::internal |
OLD | NEW |