| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 entry.address = address; | 152 entry.address = address; |
| 153 entry.code = EncodeExternal(type, id); | 153 entry.code = EncodeExternal(type, id); |
| 154 entry.name = name; | 154 entry.name = name; |
| 155 ASSERT_NE(0, entry.code); | 155 ASSERT_NE(0, entry.code); |
| 156 refs_.Add(entry); | 156 refs_.Add(entry); |
| 157 if (id > max_id_[type]) max_id_[type] = id; | 157 if (id > max_id_[type]) max_id_[type] = id; |
| 158 } | 158 } |
| 159 | 159 |
| 160 | 160 |
| 161 void ExternalReferenceTable::PopulateTable() { | 161 void ExternalReferenceTable::PopulateTable() { |
| 162 Isolate* isolate = Isolate::Current(); |
| 163 |
| 162 for (int type_code = 0; type_code < kTypeCodeCount; type_code++) { | 164 for (int type_code = 0; type_code < kTypeCodeCount; type_code++) { |
| 163 max_id_[type_code] = 0; | 165 max_id_[type_code] = 0; |
| 164 } | 166 } |
| 165 | 167 |
| 166 // The following populates all of the different type of external references | 168 // The following populates all of the different type of external references |
| 167 // into the ExternalReferenceTable. | 169 // into the ExternalReferenceTable. |
| 168 // | 170 // |
| 169 // NOTE: This function was originally 100k of code. It has since been | 171 // NOTE: This function was originally 100k of code. It has since been |
| 170 // rewritten to be mostly table driven, as the callback macro style tends to | 172 // rewritten to be mostly table driven, as the callback macro style tends to |
| 171 // very easily cause code bloat. Please be careful in the future when adding | 173 // very easily cause code bloat. Please be careful in the future when adding |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 #undef C | 287 #undef C |
| 286 }; | 288 }; |
| 287 | 289 |
| 288 int top_format_length = StrLength(top_address_format) - 2; | 290 int top_format_length = StrLength(top_address_format) - 2; |
| 289 for (uint16_t i = 0; i < Isolate::k_isolate_address_count; ++i) { | 291 for (uint16_t i = 0; i < Isolate::k_isolate_address_count; ++i) { |
| 290 const char* address_name = AddressNames[i]; | 292 const char* address_name = AddressNames[i]; |
| 291 Vector<char> name = | 293 Vector<char> name = |
| 292 Vector<char>::New(top_format_length + StrLength(address_name) + 1); | 294 Vector<char>::New(top_format_length + StrLength(address_name) + 1); |
| 293 const char* chars = name.start(); | 295 const char* chars = name.start(); |
| 294 OS::SNPrintF(name, top_address_format, address_name); | 296 OS::SNPrintF(name, top_address_format, address_name); |
| 295 Add(Isolate::Current()->get_address_from_id((Isolate::AddressId)i), | 297 Add(isolate->get_address_from_id((Isolate::AddressId)i), |
| 296 TOP_ADDRESS, i, chars); | 298 TOP_ADDRESS, i, chars); |
| 297 } | 299 } |
| 298 | 300 |
| 299 // Extensions | 301 // Extensions |
| 300 Add(FUNCTION_ADDR(GCExtension::GC), EXTENSION, 1, | 302 Add(FUNCTION_ADDR(GCExtension::GC), EXTENSION, 1, |
| 301 "GCExtension::GC"); | 303 "GCExtension::GC"); |
| 302 | 304 |
| 303 // Accessors | 305 // Accessors |
| 304 #define ACCESSOR_DESCRIPTOR_DECLARATION(name) \ | 306 #define ACCESSOR_DESCRIPTOR_DECLARATION(name) \ |
| 305 Add((Address)&Accessors::name, \ | 307 Add((Address)&Accessors::name, \ |
| 306 ACCESSOR, \ | 308 ACCESSOR, \ |
| 307 Accessors::k##name, \ | 309 Accessors::k##name, \ |
| 308 "Accessors::" #name); | 310 "Accessors::" #name); |
| 309 | 311 |
| 310 ACCESSOR_DESCRIPTOR_LIST(ACCESSOR_DESCRIPTOR_DECLARATION) | 312 ACCESSOR_DESCRIPTOR_LIST(ACCESSOR_DESCRIPTOR_DECLARATION) |
| 311 #undef ACCESSOR_DESCRIPTOR_DECLARATION | 313 #undef ACCESSOR_DESCRIPTOR_DECLARATION |
| 312 | 314 |
| 315 StubCache* stub_cache = isolate->stub_cache(); |
| 316 |
| 313 // Stub cache tables | 317 // Stub cache tables |
| 314 Add(SCTableReference::keyReference(StubCache::kPrimary).address(), | 318 Add(stub_cache->key_reference(StubCache::kPrimary).address(), |
| 315 STUB_CACHE_TABLE, | 319 STUB_CACHE_TABLE, |
| 316 1, | 320 1, |
| 317 "StubCache::primary_->key"); | 321 "StubCache::primary_->key"); |
| 318 Add(SCTableReference::valueReference(StubCache::kPrimary).address(), | 322 Add(stub_cache->value_reference(StubCache::kPrimary).address(), |
| 319 STUB_CACHE_TABLE, | 323 STUB_CACHE_TABLE, |
| 320 2, | 324 2, |
| 321 "StubCache::primary_->value"); | 325 "StubCache::primary_->value"); |
| 322 Add(SCTableReference::keyReference(StubCache::kSecondary).address(), | 326 Add(stub_cache->key_reference(StubCache::kSecondary).address(), |
| 323 STUB_CACHE_TABLE, | 327 STUB_CACHE_TABLE, |
| 324 3, | 328 3, |
| 325 "StubCache::secondary_->key"); | 329 "StubCache::secondary_->key"); |
| 326 Add(SCTableReference::valueReference(StubCache::kSecondary).address(), | 330 Add(stub_cache->value_reference(StubCache::kSecondary).address(), |
| 327 STUB_CACHE_TABLE, | 331 STUB_CACHE_TABLE, |
| 328 4, | 332 4, |
| 329 "StubCache::secondary_->value"); | 333 "StubCache::secondary_->value"); |
| 330 | 334 |
| 331 // Runtime entries | 335 // Runtime entries |
| 332 Add(ExternalReference::perform_gc_function().address(), | 336 Add(ExternalReference::perform_gc_function().address(), |
| 333 RUNTIME_ENTRY, | 337 RUNTIME_ENTRY, |
| 334 1, | 338 1, |
| 335 "Runtime::PerformGC"); | 339 "Runtime::PerformGC"); |
| 336 Add(ExternalReference::fill_heap_number_with_random_function().address(), | 340 Add(ExternalReference::fill_heap_number_with_random_function().address(), |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1458 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1462 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
| 1459 } | 1463 } |
| 1460 } | 1464 } |
| 1461 int allocation_address = fullness_[space]; | 1465 int allocation_address = fullness_[space]; |
| 1462 fullness_[space] = allocation_address + size; | 1466 fullness_[space] = allocation_address + size; |
| 1463 return allocation_address; | 1467 return allocation_address; |
| 1464 } | 1468 } |
| 1465 | 1469 |
| 1466 | 1470 |
| 1467 } } // namespace v8::internal | 1471 } } // namespace v8::internal |
| OLD | NEW |