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 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context, | 1360 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context, |
1361 Handle<FixedArray> keys) { | 1361 Handle<FixedArray> keys) { |
1362 if (context->map_cache()->IsUndefined()) { | 1362 if (context->map_cache()->IsUndefined()) { |
1363 // Allocate the new map cache for the native context. | 1363 // Allocate the new map cache for the native context. |
1364 Handle<MapCache> new_cache = NewMapCache(24); | 1364 Handle<MapCache> new_cache = NewMapCache(24); |
1365 context->set_map_cache(*new_cache); | 1365 context->set_map_cache(*new_cache); |
1366 } | 1366 } |
1367 // Check to see whether there is a matching element in the cache. | 1367 // Check to see whether there is a matching element in the cache. |
1368 Handle<MapCache> cache = | 1368 Handle<MapCache> cache = |
1369 Handle<MapCache>(MapCache::cast(context->map_cache())); | 1369 Handle<MapCache>(MapCache::cast(context->map_cache())); |
1370 Handle<Object> result = Handle<Object>(cache->Lookup(*keys)); | 1370 Handle<Object> result = Handle<Object>(cache->Lookup(*keys), isolate()); |
1371 if (result->IsMap()) return Handle<Map>::cast(result); | 1371 if (result->IsMap()) return Handle<Map>::cast(result); |
1372 // Create a new map and add it to the cache. | 1372 // Create a new map and add it to the cache. |
1373 Handle<Map> map = | 1373 Handle<Map> map = |
1374 CopyMap(Handle<Map>(context->object_function()->initial_map()), | 1374 CopyMap(Handle<Map>(context->object_function()->initial_map()), |
1375 keys->length()); | 1375 keys->length()); |
1376 AddToMapCache(context, keys, map); | 1376 AddToMapCache(context, keys, map); |
1377 return Handle<Map>(map); | 1377 return Handle<Map>(map); |
1378 } | 1378 } |
1379 | 1379 |
1380 | 1380 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 regexp->set_data(*store); | 1412 regexp->set_data(*store); |
1413 } | 1413 } |
1414 | 1414 |
1415 | 1415 |
1416 | 1416 |
1417 void Factory::ConfigureInstance(Handle<FunctionTemplateInfo> desc, | 1417 void Factory::ConfigureInstance(Handle<FunctionTemplateInfo> desc, |
1418 Handle<JSObject> instance, | 1418 Handle<JSObject> instance, |
1419 bool* pending_exception) { | 1419 bool* pending_exception) { |
1420 // Configure the instance by adding the properties specified by the | 1420 // Configure the instance by adding the properties specified by the |
1421 // instance template. | 1421 // instance template. |
1422 Handle<Object> instance_template = Handle<Object>(desc->instance_template()); | 1422 Handle<Object> instance_template(desc->instance_template(), isolate()); |
1423 if (!instance_template->IsUndefined()) { | 1423 if (!instance_template->IsUndefined()) { |
1424 Execution::ConfigureInstance(instance, | 1424 Execution::ConfigureInstance(instance, |
1425 instance_template, | 1425 instance_template, |
1426 pending_exception); | 1426 pending_exception); |
1427 } else { | 1427 } else { |
1428 *pending_exception = false; | 1428 *pending_exception = false; |
1429 } | 1429 } |
1430 } | 1430 } |
1431 | 1431 |
1432 | 1432 |
1433 Handle<Object> Factory::GlobalConstantFor(Handle<String> name) { | 1433 Handle<Object> Factory::GlobalConstantFor(Handle<String> name) { |
1434 Heap* h = isolate()->heap(); | 1434 Heap* h = isolate()->heap(); |
1435 if (name->Equals(h->undefined_symbol())) return undefined_value(); | 1435 if (name->Equals(h->undefined_symbol())) return undefined_value(); |
1436 if (name->Equals(h->nan_symbol())) return nan_value(); | 1436 if (name->Equals(h->nan_symbol())) return nan_value(); |
1437 if (name->Equals(h->infinity_symbol())) return infinity_value(); | 1437 if (name->Equals(h->infinity_symbol())) return infinity_value(); |
1438 return Handle<Object>::null(); | 1438 return Handle<Object>::null(); |
1439 } | 1439 } |
1440 | 1440 |
1441 | 1441 |
1442 Handle<Object> Factory::ToBoolean(bool value) { | 1442 Handle<Object> Factory::ToBoolean(bool value) { |
1443 return Handle<Object>(value | 1443 return Handle<Object>(value |
1444 ? isolate()->heap()->true_value() | 1444 ? isolate()->heap()->true_value() |
1445 : isolate()->heap()->false_value()); | 1445 : isolate()->heap()->false_value()); |
1446 } | 1446 } |
1447 | 1447 |
1448 | 1448 |
1449 } } // namespace v8::internal | 1449 } } // namespace v8::internal |
OLD | NEW |