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 2313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2324 context->set_map_cache(*new_cache); | 2324 context->set_map_cache(*new_cache); |
2325 } | 2325 } |
2326 // Check to see whether there is a matching element in the cache. | 2326 // Check to see whether there is a matching element in the cache. |
2327 Handle<MapCache> cache = | 2327 Handle<MapCache> cache = |
2328 Handle<MapCache>(MapCache::cast(context->map_cache())); | 2328 Handle<MapCache>(MapCache::cast(context->map_cache())); |
2329 Handle<Object> result = Handle<Object>(cache->Lookup(*keys), isolate()); | 2329 Handle<Object> result = Handle<Object>(cache->Lookup(*keys), isolate()); |
2330 if (result->IsMap()) return Handle<Map>::cast(result); | 2330 if (result->IsMap()) return Handle<Map>::cast(result); |
2331 int length = keys->length(); | 2331 int length = keys->length(); |
2332 // Create a new map and add it to the cache. Reuse the initial map of the | 2332 // Create a new map and add it to the cache. Reuse the initial map of the |
2333 // Object function if the literal has no predeclared properties. | 2333 // Object function if the literal has no predeclared properties. |
2334 Handle<Map> map = | 2334 Handle<Map> map = length == 0 |
2335 length == 0 ? handle(context->object_function()->initial_map()) | 2335 ? handle(context->object_function()->initial_map()) |
2336 : Map::Create(handle(context->object_function()), length); | 2336 : Map::Create(isolate(), length); |
2337 AddToMapCache(context, keys, map); | 2337 AddToMapCache(context, keys, map); |
2338 return map; | 2338 return map; |
2339 } | 2339 } |
2340 | 2340 |
2341 | 2341 |
2342 void Factory::SetRegExpAtomData(Handle<JSRegExp> regexp, | 2342 void Factory::SetRegExpAtomData(Handle<JSRegExp> regexp, |
2343 JSRegExp::Type type, | 2343 JSRegExp::Type type, |
2344 Handle<String> source, | 2344 Handle<String> source, |
2345 JSRegExp::Flags flags, | 2345 JSRegExp::Flags flags, |
2346 Handle<Object> data) { | 2346 Handle<Object> data) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2397 return Handle<Object>::null(); | 2397 return Handle<Object>::null(); |
2398 } | 2398 } |
2399 | 2399 |
2400 | 2400 |
2401 Handle<Object> Factory::ToBoolean(bool value) { | 2401 Handle<Object> Factory::ToBoolean(bool value) { |
2402 return value ? true_value() : false_value(); | 2402 return value ? true_value() : false_value(); |
2403 } | 2403 } |
2404 | 2404 |
2405 | 2405 |
2406 } } // namespace v8::internal | 2406 } } // namespace v8::internal |
OLD | NEW |