| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 | 1406 |
| 1407 | 1407 |
| 1408 bool Heap::CreateInitialMaps() { | 1408 bool Heap::CreateInitialMaps() { |
| 1409 Object* obj = AllocatePartialMap(MAP_TYPE, Map::kSize); | 1409 Object* obj = AllocatePartialMap(MAP_TYPE, Map::kSize); |
| 1410 if (obj->IsFailure()) return false; | 1410 if (obj->IsFailure()) return false; |
| 1411 // Map::cast cannot be used due to uninitialized map field. | 1411 // Map::cast cannot be used due to uninitialized map field. |
| 1412 Map* new_meta_map = reinterpret_cast<Map*>(obj); | 1412 Map* new_meta_map = reinterpret_cast<Map*>(obj); |
| 1413 set_meta_map(new_meta_map); | 1413 set_meta_map(new_meta_map); |
| 1414 new_meta_map->set_map(new_meta_map); | 1414 new_meta_map->set_map(new_meta_map); |
| 1415 | 1415 |
| 1416 obj = AllocatePartialMap(FIXED_ARRAY_TYPE, FixedArray::kHeaderSize); | 1416 obj = AllocatePartialMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
| 1417 if (obj->IsFailure()) return false; | 1417 if (obj->IsFailure()) return false; |
| 1418 set_fixed_array_map(Map::cast(obj)); | 1418 set_fixed_array_map(Map::cast(obj)); |
| 1419 | 1419 |
| 1420 obj = AllocatePartialMap(ODDBALL_TYPE, Oddball::kSize); | 1420 obj = AllocatePartialMap(ODDBALL_TYPE, Oddball::kSize); |
| 1421 if (obj->IsFailure()) return false; | 1421 if (obj->IsFailure()) return false; |
| 1422 set_oddball_map(Map::cast(obj)); | 1422 set_oddball_map(Map::cast(obj)); |
| 1423 | 1423 |
| 1424 // Allocate the empty array. | 1424 // Allocate the empty array. |
| 1425 obj = AllocateEmptyFixedArray(); | 1425 obj = AllocateEmptyFixedArray(); |
| 1426 if (obj->IsFailure()) return false; | 1426 if (obj->IsFailure()) return false; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1448 // Fix prototype object for existing maps. | 1448 // Fix prototype object for existing maps. |
| 1449 meta_map()->set_prototype(null_value()); | 1449 meta_map()->set_prototype(null_value()); |
| 1450 meta_map()->set_constructor(null_value()); | 1450 meta_map()->set_constructor(null_value()); |
| 1451 | 1451 |
| 1452 fixed_array_map()->set_prototype(null_value()); | 1452 fixed_array_map()->set_prototype(null_value()); |
| 1453 fixed_array_map()->set_constructor(null_value()); | 1453 fixed_array_map()->set_constructor(null_value()); |
| 1454 | 1454 |
| 1455 oddball_map()->set_prototype(null_value()); | 1455 oddball_map()->set_prototype(null_value()); |
| 1456 oddball_map()->set_constructor(null_value()); | 1456 oddball_map()->set_constructor(null_value()); |
| 1457 | 1457 |
| 1458 obj = AllocateMap(FIXED_ARRAY_TYPE, FixedArray::kHeaderSize); | 1458 obj = AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
| 1459 if (obj->IsFailure()) return false; | 1459 if (obj->IsFailure()) return false; |
| 1460 set_fixed_cow_array_map(Map::cast(obj)); | 1460 set_fixed_cow_array_map(Map::cast(obj)); |
| 1461 ASSERT(fixed_array_map() != fixed_cow_array_map()); | 1461 ASSERT(fixed_array_map() != fixed_cow_array_map()); |
| 1462 | 1462 |
| 1463 obj = AllocateMap(HEAP_NUMBER_TYPE, HeapNumber::kSize); | 1463 obj = AllocateMap(HEAP_NUMBER_TYPE, HeapNumber::kSize); |
| 1464 if (obj->IsFailure()) return false; | 1464 if (obj->IsFailure()) return false; |
| 1465 set_heap_number_map(Map::cast(obj)); | 1465 set_heap_number_map(Map::cast(obj)); |
| 1466 | 1466 |
| 1467 obj = AllocateMap(PROXY_TYPE, Proxy::kSize); | 1467 obj = AllocateMap(PROXY_TYPE, Proxy::kSize); |
| 1468 if (obj->IsFailure()) return false; | 1468 if (obj->IsFailure()) return false; |
| 1469 set_proxy_map(Map::cast(obj)); | 1469 set_proxy_map(Map::cast(obj)); |
| 1470 | 1470 |
| 1471 for (unsigned i = 0; i < ARRAY_SIZE(string_type_table); i++) { | 1471 for (unsigned i = 0; i < ARRAY_SIZE(string_type_table); i++) { |
| 1472 const StringTypeTable& entry = string_type_table[i]; | 1472 const StringTypeTable& entry = string_type_table[i]; |
| 1473 obj = AllocateMap(entry.type, entry.size); | 1473 obj = AllocateMap(entry.type, entry.size); |
| 1474 if (obj->IsFailure()) return false; | 1474 if (obj->IsFailure()) return false; |
| 1475 roots_[entry.index] = Map::cast(obj); | 1475 roots_[entry.index] = Map::cast(obj); |
| 1476 } | 1476 } |
| 1477 | 1477 |
| 1478 obj = AllocateMap(STRING_TYPE, SeqTwoByteString::kAlignedSize); | 1478 obj = AllocateMap(STRING_TYPE, kVariableSizeSentinel); |
| 1479 if (obj->IsFailure()) return false; | 1479 if (obj->IsFailure()) return false; |
| 1480 set_undetectable_string_map(Map::cast(obj)); | 1480 set_undetectable_string_map(Map::cast(obj)); |
| 1481 Map::cast(obj)->set_is_undetectable(); | 1481 Map::cast(obj)->set_is_undetectable(); |
| 1482 | 1482 |
| 1483 obj = AllocateMap(ASCII_STRING_TYPE, SeqAsciiString::kAlignedSize); | 1483 obj = AllocateMap(ASCII_STRING_TYPE, kVariableSizeSentinel); |
| 1484 if (obj->IsFailure()) return false; | 1484 if (obj->IsFailure()) return false; |
| 1485 set_undetectable_ascii_string_map(Map::cast(obj)); | 1485 set_undetectable_ascii_string_map(Map::cast(obj)); |
| 1486 Map::cast(obj)->set_is_undetectable(); | 1486 Map::cast(obj)->set_is_undetectable(); |
| 1487 | 1487 |
| 1488 obj = AllocateMap(BYTE_ARRAY_TYPE, ByteArray::kAlignedSize); | 1488 obj = AllocateMap(BYTE_ARRAY_TYPE, kVariableSizeSentinel); |
| 1489 if (obj->IsFailure()) return false; | 1489 if (obj->IsFailure()) return false; |
| 1490 set_byte_array_map(Map::cast(obj)); | 1490 set_byte_array_map(Map::cast(obj)); |
| 1491 | 1491 |
| 1492 obj = AllocateMap(PIXEL_ARRAY_TYPE, PixelArray::kAlignedSize); | 1492 obj = AllocateMap(PIXEL_ARRAY_TYPE, PixelArray::kAlignedSize); |
| 1493 if (obj->IsFailure()) return false; | 1493 if (obj->IsFailure()) return false; |
| 1494 set_pixel_array_map(Map::cast(obj)); | 1494 set_pixel_array_map(Map::cast(obj)); |
| 1495 | 1495 |
| 1496 obj = AllocateMap(EXTERNAL_BYTE_ARRAY_TYPE, | 1496 obj = AllocateMap(EXTERNAL_BYTE_ARRAY_TYPE, |
| 1497 ExternalArray::kAlignedSize); | 1497 ExternalArray::kAlignedSize); |
| 1498 if (obj->IsFailure()) return false; | 1498 if (obj->IsFailure()) return false; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1521 obj = AllocateMap(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, | 1521 obj = AllocateMap(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, |
| 1522 ExternalArray::kAlignedSize); | 1522 ExternalArray::kAlignedSize); |
| 1523 if (obj->IsFailure()) return false; | 1523 if (obj->IsFailure()) return false; |
| 1524 set_external_unsigned_int_array_map(Map::cast(obj)); | 1524 set_external_unsigned_int_array_map(Map::cast(obj)); |
| 1525 | 1525 |
| 1526 obj = AllocateMap(EXTERNAL_FLOAT_ARRAY_TYPE, | 1526 obj = AllocateMap(EXTERNAL_FLOAT_ARRAY_TYPE, |
| 1527 ExternalArray::kAlignedSize); | 1527 ExternalArray::kAlignedSize); |
| 1528 if (obj->IsFailure()) return false; | 1528 if (obj->IsFailure()) return false; |
| 1529 set_external_float_array_map(Map::cast(obj)); | 1529 set_external_float_array_map(Map::cast(obj)); |
| 1530 | 1530 |
| 1531 obj = AllocateMap(CODE_TYPE, Code::kHeaderSize); | 1531 obj = AllocateMap(CODE_TYPE, kVariableSizeSentinel); |
| 1532 if (obj->IsFailure()) return false; | 1532 if (obj->IsFailure()) return false; |
| 1533 set_code_map(Map::cast(obj)); | 1533 set_code_map(Map::cast(obj)); |
| 1534 | 1534 |
| 1535 obj = AllocateMap(JS_GLOBAL_PROPERTY_CELL_TYPE, | 1535 obj = AllocateMap(JS_GLOBAL_PROPERTY_CELL_TYPE, |
| 1536 JSGlobalPropertyCell::kSize); | 1536 JSGlobalPropertyCell::kSize); |
| 1537 if (obj->IsFailure()) return false; | 1537 if (obj->IsFailure()) return false; |
| 1538 set_global_property_cell_map(Map::cast(obj)); | 1538 set_global_property_cell_map(Map::cast(obj)); |
| 1539 | 1539 |
| 1540 obj = AllocateMap(FILLER_TYPE, kPointerSize); | 1540 obj = AllocateMap(FILLER_TYPE, kPointerSize); |
| 1541 if (obj->IsFailure()) return false; | 1541 if (obj->IsFailure()) return false; |
| 1542 set_one_pointer_filler_map(Map::cast(obj)); | 1542 set_one_pointer_filler_map(Map::cast(obj)); |
| 1543 | 1543 |
| 1544 obj = AllocateMap(FILLER_TYPE, 2 * kPointerSize); | 1544 obj = AllocateMap(FILLER_TYPE, 2 * kPointerSize); |
| 1545 if (obj->IsFailure()) return false; | 1545 if (obj->IsFailure()) return false; |
| 1546 set_two_pointer_filler_map(Map::cast(obj)); | 1546 set_two_pointer_filler_map(Map::cast(obj)); |
| 1547 | 1547 |
| 1548 for (unsigned i = 0; i < ARRAY_SIZE(struct_table); i++) { | 1548 for (unsigned i = 0; i < ARRAY_SIZE(struct_table); i++) { |
| 1549 const StructTable& entry = struct_table[i]; | 1549 const StructTable& entry = struct_table[i]; |
| 1550 obj = AllocateMap(entry.type, entry.size); | 1550 obj = AllocateMap(entry.type, entry.size); |
| 1551 if (obj->IsFailure()) return false; | 1551 if (obj->IsFailure()) return false; |
| 1552 roots_[entry.index] = Map::cast(obj); | 1552 roots_[entry.index] = Map::cast(obj); |
| 1553 } | 1553 } |
| 1554 | 1554 |
| 1555 obj = AllocateMap(FIXED_ARRAY_TYPE, HeapObject::kHeaderSize); | 1555 obj = AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
| 1556 if (obj->IsFailure()) return false; | 1556 if (obj->IsFailure()) return false; |
| 1557 set_hash_table_map(Map::cast(obj)); | 1557 set_hash_table_map(Map::cast(obj)); |
| 1558 | 1558 |
| 1559 obj = AllocateMap(FIXED_ARRAY_TYPE, HeapObject::kHeaderSize); | 1559 obj = AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
| 1560 if (obj->IsFailure()) return false; | 1560 if (obj->IsFailure()) return false; |
| 1561 set_context_map(Map::cast(obj)); | 1561 set_context_map(Map::cast(obj)); |
| 1562 | 1562 |
| 1563 obj = AllocateMap(FIXED_ARRAY_TYPE, HeapObject::kHeaderSize); | 1563 obj = AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
| 1564 if (obj->IsFailure()) return false; | 1564 if (obj->IsFailure()) return false; |
| 1565 set_catch_context_map(Map::cast(obj)); | 1565 set_catch_context_map(Map::cast(obj)); |
| 1566 | 1566 |
| 1567 obj = AllocateMap(FIXED_ARRAY_TYPE, HeapObject::kHeaderSize); | 1567 obj = AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
| 1568 if (obj->IsFailure()) return false; | 1568 if (obj->IsFailure()) return false; |
| 1569 set_global_context_map(Map::cast(obj)); | 1569 set_global_context_map(Map::cast(obj)); |
| 1570 | 1570 |
| 1571 obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE, | 1571 obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE, |
| 1572 SharedFunctionInfo::kAlignedSize); | 1572 SharedFunctionInfo::kAlignedSize); |
| 1573 if (obj->IsFailure()) return false; | 1573 if (obj->IsFailure()) return false; |
| 1574 set_shared_function_info_map(Map::cast(obj)); | 1574 set_shared_function_info_map(Map::cast(obj)); |
| 1575 | 1575 |
| 1576 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array())); | 1576 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array())); |
| 1577 return true; | 1577 return true; |
| (...skipping 3281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4859 void ExternalStringTable::TearDown() { | 4859 void ExternalStringTable::TearDown() { |
| 4860 new_space_strings_.Free(); | 4860 new_space_strings_.Free(); |
| 4861 old_space_strings_.Free(); | 4861 old_space_strings_.Free(); |
| 4862 } | 4862 } |
| 4863 | 4863 |
| 4864 | 4864 |
| 4865 List<Object*> ExternalStringTable::new_space_strings_; | 4865 List<Object*> ExternalStringTable::new_space_strings_; |
| 4866 List<Object*> ExternalStringTable::old_space_strings_; | 4866 List<Object*> ExternalStringTable::old_space_strings_; |
| 4867 | 4867 |
| 4868 } } // namespace v8::internal | 4868 } } // namespace v8::internal |
| OLD | NEW |