| 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 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 | 1480 |
| 1481 Object* Heap::AllocateJSGlobalPropertyCell(Object* value) { | 1481 Object* Heap::AllocateJSGlobalPropertyCell(Object* value) { |
| 1482 Object* result = AllocateRawCell(); | 1482 Object* result = AllocateRawCell(); |
| 1483 if (result->IsFailure()) return result; | 1483 if (result->IsFailure()) return result; |
| 1484 HeapObject::cast(result)->set_map(global_property_cell_map()); | 1484 HeapObject::cast(result)->set_map(global_property_cell_map()); |
| 1485 JSGlobalPropertyCell::cast(result)->set_value(value); | 1485 JSGlobalPropertyCell::cast(result)->set_value(value); |
| 1486 return result; | 1486 return result; |
| 1487 } | 1487 } |
| 1488 | 1488 |
| 1489 | 1489 |
| 1490 Object* Heap::CreateOddball(Map* map, | 1490 Object* Heap::CreateOddball(const char* to_string, |
| 1491 const char* to_string, | |
| 1492 Object* to_number) { | 1491 Object* to_number) { |
| 1493 Object* result = Allocate(map, OLD_DATA_SPACE); | 1492 Object* result = Allocate(oddball_map(), OLD_DATA_SPACE); |
| 1494 if (result->IsFailure()) return result; | 1493 if (result->IsFailure()) return result; |
| 1495 return Oddball::cast(result)->Initialize(to_string, to_number); | 1494 return Oddball::cast(result)->Initialize(to_string, to_number); |
| 1496 } | 1495 } |
| 1497 | 1496 |
| 1498 | 1497 |
| 1499 bool Heap::CreateApiObjects() { | 1498 bool Heap::CreateApiObjects() { |
| 1500 Object* obj; | 1499 Object* obj; |
| 1501 | 1500 |
| 1502 obj = AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 1501 obj = AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
| 1503 if (obj->IsFailure()) return false; | 1502 if (obj->IsFailure()) return false; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1587 if (obj->IsFailure()) return false; | 1586 if (obj->IsFailure()) return false; |
| 1588 // Don't use set_symbol_table() due to asserts. | 1587 // Don't use set_symbol_table() due to asserts. |
| 1589 roots_[kSymbolTableRootIndex] = obj; | 1588 roots_[kSymbolTableRootIndex] = obj; |
| 1590 | 1589 |
| 1591 // Assign the print strings for oddballs after creating symboltable. | 1590 // Assign the print strings for oddballs after creating symboltable. |
| 1592 Object* symbol = LookupAsciiSymbol("undefined"); | 1591 Object* symbol = LookupAsciiSymbol("undefined"); |
| 1593 if (symbol->IsFailure()) return false; | 1592 if (symbol->IsFailure()) return false; |
| 1594 Oddball::cast(undefined_value())->set_to_string(String::cast(symbol)); | 1593 Oddball::cast(undefined_value())->set_to_string(String::cast(symbol)); |
| 1595 Oddball::cast(undefined_value())->set_to_number(nan_value()); | 1594 Oddball::cast(undefined_value())->set_to_number(nan_value()); |
| 1596 | 1595 |
| 1597 // Assign the print strings for oddballs after creating symboltable. | |
| 1598 symbol = LookupAsciiSymbol("null"); | |
| 1599 if (symbol->IsFailure()) return false; | |
| 1600 Oddball::cast(null_value())->set_to_string(String::cast(symbol)); | |
| 1601 Oddball::cast(null_value())->set_to_number(Smi::FromInt(0)); | |
| 1602 | |
| 1603 // Allocate the null_value | 1596 // Allocate the null_value |
| 1604 obj = Oddball::cast(null_value())->Initialize("null", Smi::FromInt(0)); | 1597 obj = Oddball::cast(null_value())->Initialize("null", Smi::FromInt(0)); |
| 1605 if (obj->IsFailure()) return false; | 1598 if (obj->IsFailure()) return false; |
| 1606 | 1599 |
| 1607 obj = CreateOddball(oddball_map(), "true", Smi::FromInt(1)); | 1600 obj = CreateOddball("true", Smi::FromInt(1)); |
| 1608 if (obj->IsFailure()) return false; | 1601 if (obj->IsFailure()) return false; |
| 1609 set_true_value(obj); | 1602 set_true_value(obj); |
| 1610 | 1603 |
| 1611 obj = CreateOddball(oddball_map(), "false", Smi::FromInt(0)); | 1604 obj = CreateOddball("false", Smi::FromInt(0)); |
| 1612 if (obj->IsFailure()) return false; | 1605 if (obj->IsFailure()) return false; |
| 1613 set_false_value(obj); | 1606 set_false_value(obj); |
| 1614 | 1607 |
| 1615 obj = CreateOddball(oddball_map(), "hole", Smi::FromInt(-1)); | 1608 obj = CreateOddball("hole", Smi::FromInt(-1)); |
| 1616 if (obj->IsFailure()) return false; | 1609 if (obj->IsFailure()) return false; |
| 1617 set_the_hole_value(obj); | 1610 set_the_hole_value(obj); |
| 1618 | 1611 |
| 1619 obj = CreateOddball( | 1612 obj = CreateOddball("no_interceptor_result_sentinel", Smi::FromInt(-2)); |
| 1620 oddball_map(), "no_interceptor_result_sentinel", Smi::FromInt(-2)); | |
| 1621 if (obj->IsFailure()) return false; | 1613 if (obj->IsFailure()) return false; |
| 1622 set_no_interceptor_result_sentinel(obj); | 1614 set_no_interceptor_result_sentinel(obj); |
| 1623 | 1615 |
| 1624 obj = CreateOddball(oddball_map(), "termination_exception", Smi::FromInt(-3)); | 1616 obj = CreateOddball("termination_exception", Smi::FromInt(-3)); |
| 1625 if (obj->IsFailure()) return false; | 1617 if (obj->IsFailure()) return false; |
| 1626 set_termination_exception(obj); | 1618 set_termination_exception(obj); |
| 1627 | 1619 |
| 1628 // Allocate the empty string. | 1620 // Allocate the empty string. |
| 1629 obj = AllocateRawAsciiString(0, TENURED); | 1621 obj = AllocateRawAsciiString(0, TENURED); |
| 1630 if (obj->IsFailure()) return false; | 1622 if (obj->IsFailure()) return false; |
| 1631 set_empty_string(String::cast(obj)); | 1623 set_empty_string(String::cast(obj)); |
| 1632 | 1624 |
| 1633 for (unsigned i = 0; i < ARRAY_SIZE(constant_symbol_table); i++) { | 1625 for (unsigned i = 0; i < ARRAY_SIZE(constant_symbol_table); i++) { |
| 1634 obj = LookupAsciiSymbol(constant_symbol_table[i].contents); | 1626 obj = LookupAsciiSymbol(constant_symbol_table[i].contents); |
| (...skipping 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4388 void ExternalStringTable::TearDown() { | 4380 void ExternalStringTable::TearDown() { |
| 4389 new_space_strings_.Free(); | 4381 new_space_strings_.Free(); |
| 4390 old_space_strings_.Free(); | 4382 old_space_strings_.Free(); |
| 4391 } | 4383 } |
| 4392 | 4384 |
| 4393 | 4385 |
| 4394 List<Object*> ExternalStringTable::new_space_strings_; | 4386 List<Object*> ExternalStringTable::new_space_strings_; |
| 4395 List<Object*> ExternalStringTable::old_space_strings_; | 4387 List<Object*> ExternalStringTable::old_space_strings_; |
| 4396 | 4388 |
| 4397 } } // namespace v8::internal | 4389 } } // namespace v8::internal |
| OLD | NEW |