| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 | 106 |
| 107 Handle<ObjectHashTable> Factory::NewObjectHashTable(int at_least_space_for) { | 107 Handle<ObjectHashTable> Factory::NewObjectHashTable(int at_least_space_for) { |
| 108 ASSERT(0 <= at_least_space_for); | 108 ASSERT(0 <= at_least_space_for); |
| 109 CALL_HEAP_FUNCTION(isolate(), | 109 CALL_HEAP_FUNCTION(isolate(), |
| 110 ObjectHashTable::Allocate(at_least_space_for), | 110 ObjectHashTable::Allocate(at_least_space_for), |
| 111 ObjectHashTable); | 111 ObjectHashTable); |
| 112 } | 112 } |
| 113 | 113 |
| 114 | 114 |
| 115 Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors, | 115 Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors) { |
| 116 int slack) { | |
| 117 ASSERT(0 <= number_of_descriptors); | 116 ASSERT(0 <= number_of_descriptors); |
| 118 CALL_HEAP_FUNCTION(isolate(), | 117 CALL_HEAP_FUNCTION(isolate(), |
| 119 DescriptorArray::Allocate(number_of_descriptors, slack), | 118 DescriptorArray::Allocate(number_of_descriptors), |
| 120 DescriptorArray); | 119 DescriptorArray); |
| 121 } | 120 } |
| 122 | 121 |
| 123 | 122 |
| 124 Handle<DeoptimizationInputData> Factory::NewDeoptimizationInputData( | 123 Handle<DeoptimizationInputData> Factory::NewDeoptimizationInputData( |
| 125 int deopt_entry_count, | 124 int deopt_entry_count, |
| 126 PretenureFlag pretenure) { | 125 PretenureFlag pretenure) { |
| 127 ASSERT(deopt_entry_count > 0); | 126 ASSERT(deopt_entry_count > 0); |
| 128 CALL_HEAP_FUNCTION(isolate(), | 127 CALL_HEAP_FUNCTION(isolate(), |
| 129 DeoptimizationInputData::Allocate(deopt_entry_count, | 128 DeoptimizationInputData::Allocate(deopt_entry_count, |
| (...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 // Set instance call-as-function information in the map. | 1277 // Set instance call-as-function information in the map. |
| 1279 if (!obj->instance_call_handler()->IsUndefined()) { | 1278 if (!obj->instance_call_handler()->IsUndefined()) { |
| 1280 map->set_has_instance_call_handler(); | 1279 map->set_has_instance_call_handler(); |
| 1281 } | 1280 } |
| 1282 | 1281 |
| 1283 result->shared()->set_function_data(*obj); | 1282 result->shared()->set_function_data(*obj); |
| 1284 result->shared()->set_construct_stub(*construct_stub); | 1283 result->shared()->set_construct_stub(*construct_stub); |
| 1285 result->shared()->DontAdaptArguments(); | 1284 result->shared()->DontAdaptArguments(); |
| 1286 | 1285 |
| 1287 // Recursively copy parent templates' accessors, 'data' may be modified. | 1286 // Recursively copy parent templates' accessors, 'data' may be modified. |
| 1288 int max_number_of_additional_properties = 0; | |
| 1289 FunctionTemplateInfo* info = *obj; | |
| 1290 while (true) { | |
| 1291 Object* props = info->property_accessors(); | |
| 1292 if (!props->IsUndefined()) { | |
| 1293 Handle<Object> props_handle(props); | |
| 1294 NeanderArray props_array(props_handle); | |
| 1295 max_number_of_additional_properties += props_array.length(); | |
| 1296 } | |
| 1297 Object* parent = info->parent_template(); | |
| 1298 if (parent->IsUndefined()) break; | |
| 1299 info = FunctionTemplateInfo::cast(parent); | |
| 1300 } | |
| 1301 | |
| 1302 Map::EnsureDescriptorSlack(map, max_number_of_additional_properties); | |
| 1303 | |
| 1304 while (true) { | 1287 while (true) { |
| 1305 Handle<Object> props = Handle<Object>(obj->property_accessors()); | 1288 Handle<Object> props = Handle<Object>(obj->property_accessors()); |
| 1306 if (!props->IsUndefined()) { | 1289 if (!props->IsUndefined()) { |
| 1307 Map::AppendCallbackDescriptors(map, props); | 1290 Map::CopyAppendCallbackDescriptors(map, props); |
| 1308 } | 1291 } |
| 1309 Handle<Object> parent = Handle<Object>(obj->parent_template()); | 1292 Handle<Object> parent = Handle<Object>(obj->parent_template()); |
| 1310 if (parent->IsUndefined()) break; | 1293 if (parent->IsUndefined()) break; |
| 1311 obj = Handle<FunctionTemplateInfo>::cast(parent); | 1294 obj = Handle<FunctionTemplateInfo>::cast(parent); |
| 1312 } | 1295 } |
| 1313 | 1296 |
| 1314 ASSERT(result->shared()->IsApiFunction()); | 1297 ASSERT(result->shared()->IsApiFunction()); |
| 1315 return result; | 1298 return result; |
| 1316 } | 1299 } |
| 1317 | 1300 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 | 1409 |
| 1427 | 1410 |
| 1428 Handle<Object> Factory::ToBoolean(bool value) { | 1411 Handle<Object> Factory::ToBoolean(bool value) { |
| 1429 return Handle<Object>(value | 1412 return Handle<Object>(value |
| 1430 ? isolate()->heap()->true_value() | 1413 ? isolate()->heap()->true_value() |
| 1431 : isolate()->heap()->false_value()); | 1414 : isolate()->heap()->false_value()); |
| 1432 } | 1415 } |
| 1433 | 1416 |
| 1434 | 1417 |
| 1435 } } // namespace v8::internal | 1418 } } // namespace v8::internal |
| OLD | NEW |