| 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 #include "src/factory.h" | 5 #include "src/factory.h" |
| 6 | 6 |
| 7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 2426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2437 Handle<FixedArray> new_cache = NewFixedArray(kMapCacheSize, TENURED); | 2437 Handle<FixedArray> new_cache = NewFixedArray(kMapCacheSize, TENURED); |
| 2438 context->set_map_cache(*new_cache); | 2438 context->set_map_cache(*new_cache); |
| 2439 } | 2439 } |
| 2440 // Check to see whether there is a matching element in the cache. | 2440 // Check to see whether there is a matching element in the cache. |
| 2441 Handle<FixedArray> cache(FixedArray::cast(context->map_cache())); | 2441 Handle<FixedArray> cache(FixedArray::cast(context->map_cache())); |
| 2442 { | 2442 { |
| 2443 Object* result = cache->get(cache_index); | 2443 Object* result = cache->get(cache_index); |
| 2444 if (result->IsWeakCell()) { | 2444 if (result->IsWeakCell()) { |
| 2445 WeakCell* cell = WeakCell::cast(result); | 2445 WeakCell* cell = WeakCell::cast(result); |
| 2446 if (!cell->cleared()) { | 2446 if (!cell->cleared()) { |
| 2447 return handle(Map::cast(cell->value()), isolate()); | 2447 return handle(Map::cast(cell->value(isolate()->heap())), isolate()); |
| 2448 } | 2448 } |
| 2449 } | 2449 } |
| 2450 } | 2450 } |
| 2451 // Create a new map and add it to the cache. | 2451 // Create a new map and add it to the cache. |
| 2452 Handle<Map> map = Map::Create(isolate(), number_of_properties); | 2452 Handle<Map> map = Map::Create(isolate(), number_of_properties); |
| 2453 Handle<WeakCell> cell = NewWeakCell(map); | 2453 Handle<WeakCell> cell = NewWeakCell(map); |
| 2454 cache->set(cache_index, *cell); | 2454 cache->set(cache_index, *cell); |
| 2455 return map; | 2455 return map; |
| 2456 } | 2456 } |
| 2457 | 2457 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2514 return Handle<Object>::null(); | 2514 return Handle<Object>::null(); |
| 2515 } | 2515 } |
| 2516 | 2516 |
| 2517 | 2517 |
| 2518 Handle<Object> Factory::ToBoolean(bool value) { | 2518 Handle<Object> Factory::ToBoolean(bool value) { |
| 2519 return value ? true_value() : false_value(); | 2519 return value ? true_value() : false_value(); |
| 2520 } | 2520 } |
| 2521 | 2521 |
| 2522 | 2522 |
| 2523 } } // namespace v8::internal | 2523 } } // namespace v8::internal |
| OLD | NEW |