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 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 DATA_VIEW_SETTER(Float32, float) | 1497 DATA_VIEW_SETTER(Float32, float) |
1498 DATA_VIEW_SETTER(Float64, double) | 1498 DATA_VIEW_SETTER(Float64, double) |
1499 | 1499 |
1500 #undef DATA_VIEW_SETTER | 1500 #undef DATA_VIEW_SETTER |
1501 | 1501 |
1502 | 1502 |
1503 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetInitialize) { | 1503 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetInitialize) { |
1504 HandleScope scope(isolate); | 1504 HandleScope scope(isolate); |
1505 ASSERT(args.length() == 1); | 1505 ASSERT(args.length() == 1); |
1506 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); | 1506 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); |
1507 Handle<ObjectHashSet> table = isolate->factory()->NewObjectHashSet(0); | 1507 Handle<OrderedHashSet> table = isolate->factory()->NewOrderedHashSet(); |
1508 holder->set_table(*table); | 1508 holder->set_table(*table); |
1509 return *holder; | 1509 return *holder; |
1510 } | 1510 } |
1511 | 1511 |
1512 | 1512 |
1513 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAdd) { | 1513 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAdd) { |
1514 HandleScope scope(isolate); | 1514 HandleScope scope(isolate); |
1515 ASSERT(args.length() == 2); | 1515 ASSERT(args.length() == 2); |
1516 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); | 1516 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); |
1517 Handle<Object> key(args[1], isolate); | 1517 Handle<Object> key(args[1], isolate); |
1518 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); | 1518 Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table())); |
1519 table = ObjectHashSet::Add(table, key); | 1519 table = OrderedHashSet::Add(table, key); |
1520 holder->set_table(*table); | 1520 holder->set_table(*table); |
1521 return isolate->heap()->undefined_value(); | 1521 return isolate->heap()->undefined_value(); |
1522 } | 1522 } |
1523 | 1523 |
1524 | 1524 |
1525 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHas) { | 1525 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHas) { |
1526 HandleScope scope(isolate); | 1526 HandleScope scope(isolate); |
1527 ASSERT(args.length() == 2); | 1527 ASSERT(args.length() == 2); |
1528 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); | 1528 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); |
1529 Handle<Object> key(args[1], isolate); | 1529 Handle<Object> key(args[1], isolate); |
1530 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); | 1530 Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table())); |
1531 return isolate->heap()->ToBoolean(table->Contains(*key)); | 1531 return isolate->heap()->ToBoolean(table->Contains(*key)); |
1532 } | 1532 } |
1533 | 1533 |
1534 | 1534 |
1535 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) { | 1535 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) { |
1536 HandleScope scope(isolate); | 1536 HandleScope scope(isolate); |
1537 ASSERT(args.length() == 2); | 1537 ASSERT(args.length() == 2); |
1538 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); | 1538 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); |
1539 Handle<Object> key(args[1], isolate); | 1539 Handle<Object> key(args[1], isolate); |
1540 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); | 1540 Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table())); |
1541 table = ObjectHashSet::Remove(table, key); | 1541 table = OrderedHashSet::Remove(table, key); |
1542 holder->set_table(*table); | 1542 holder->set_table(*table); |
1543 return isolate->heap()->undefined_value(); | 1543 return isolate->heap()->undefined_value(); |
1544 } | 1544 } |
1545 | 1545 |
1546 | 1546 |
1547 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetGetSize) { | 1547 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetGetSize) { |
1548 HandleScope scope(isolate); | 1548 HandleScope scope(isolate); |
1549 ASSERT(args.length() == 1); | 1549 ASSERT(args.length() == 1); |
1550 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); | 1550 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); |
1551 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); | 1551 Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table())); |
1552 return Smi::FromInt(table->NumberOfElements()); | 1552 return Smi::FromInt(table->NumberOfElements()); |
1553 } | 1553 } |
1554 | 1554 |
1555 | 1555 |
1556 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapInitialize) { | 1556 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapInitialize) { |
1557 HandleScope scope(isolate); | 1557 HandleScope scope(isolate); |
1558 ASSERT(args.length() == 1); | 1558 ASSERT(args.length() == 1); |
1559 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); | 1559 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); |
1560 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); | 1560 Handle<OrderedHashMap> table = isolate->factory()->NewOrderedHashMap(); |
1561 holder->set_table(*table); | 1561 holder->set_table(*table); |
1562 return *holder; | 1562 return *holder; |
1563 } | 1563 } |
1564 | 1564 |
1565 | 1565 |
1566 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGet) { | 1566 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGet) { |
1567 HandleScope scope(isolate); | 1567 HandleScope scope(isolate); |
1568 ASSERT(args.length() == 2); | 1568 ASSERT(args.length() == 2); |
1569 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); | 1569 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); |
1570 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 1570 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
1571 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); | 1571 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table())); |
1572 Handle<Object> lookup(table->Lookup(*key), isolate); | 1572 Handle<Object> lookup(table->Lookup(*key), isolate); |
1573 return lookup->IsTheHole() ? isolate->heap()->undefined_value() : *lookup; | 1573 return lookup->IsTheHole() ? isolate->heap()->undefined_value() : *lookup; |
1574 } | 1574 } |
1575 | 1575 |
1576 | 1576 |
1577 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapHas) { | 1577 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapHas) { |
1578 HandleScope scope(isolate); | 1578 HandleScope scope(isolate); |
1579 ASSERT(args.length() == 2); | 1579 ASSERT(args.length() == 2); |
1580 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); | 1580 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); |
1581 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 1581 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
1582 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); | 1582 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table())); |
1583 Handle<Object> lookup(table->Lookup(*key), isolate); | 1583 Handle<Object> lookup(table->Lookup(*key), isolate); |
1584 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); | 1584 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); |
1585 } | 1585 } |
1586 | 1586 |
1587 | 1587 |
1588 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapDelete) { | 1588 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapDelete) { |
1589 HandleScope scope(isolate); | 1589 HandleScope scope(isolate); |
1590 ASSERT(args.length() == 2); | 1590 ASSERT(args.length() == 2); |
1591 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); | 1591 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); |
1592 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 1592 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
1593 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); | 1593 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table())); |
1594 Handle<Object> lookup(table->Lookup(*key), isolate); | 1594 Handle<Object> lookup(table->Lookup(*key), isolate); |
1595 Handle<ObjectHashTable> new_table = | 1595 Handle<OrderedHashMap> new_table = |
1596 ObjectHashTable::Put(table, key, isolate->factory()->the_hole_value()); | 1596 OrderedHashMap::Put(table, key, isolate->factory()->the_hole_value()); |
1597 holder->set_table(*new_table); | 1597 holder->set_table(*new_table); |
1598 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); | 1598 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); |
1599 } | 1599 } |
1600 | 1600 |
1601 | 1601 |
1602 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) { | 1602 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) { |
1603 HandleScope scope(isolate); | 1603 HandleScope scope(isolate); |
1604 ASSERT(args.length() == 3); | 1604 ASSERT(args.length() == 3); |
1605 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); | 1605 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); |
1606 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 1606 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
1607 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); | 1607 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
1608 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); | 1608 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table())); |
1609 Handle<ObjectHashTable> new_table = ObjectHashTable::Put(table, key, value); | 1609 Handle<OrderedHashMap> new_table = OrderedHashMap::Put(table, key, value); |
1610 holder->set_table(*new_table); | 1610 holder->set_table(*new_table); |
1611 return isolate->heap()->undefined_value(); | 1611 return isolate->heap()->undefined_value(); |
1612 } | 1612 } |
1613 | 1613 |
1614 | 1614 |
1615 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGetSize) { | 1615 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGetSize) { |
1616 HandleScope scope(isolate); | 1616 HandleScope scope(isolate); |
1617 ASSERT(args.length() == 1); | 1617 ASSERT(args.length() == 1); |
1618 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); | 1618 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); |
1619 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); | 1619 Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table())); |
1620 return Smi::FromInt(table->NumberOfElements()); | 1620 return Smi::FromInt(table->NumberOfElements()); |
1621 } | 1621 } |
1622 | 1622 |
1623 | 1623 |
1624 static JSWeakCollection* WeakCollectionInitialize(Isolate* isolate, | 1624 static JSWeakCollection* WeakCollectionInitialize(Isolate* isolate, |
1625 Handle<JSWeakCollection> weak_collection) { | 1625 Handle<JSWeakCollection> weak_collection) { |
1626 ASSERT(weak_collection->map()->inobject_properties() == 0); | 1626 ASSERT(weak_collection->map()->inobject_properties() == 0); |
1627 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); | 1627 Handle<ObjectHashTable> table = isolate->factory()->NewObjectHashTable(0); |
1628 weak_collection->set_table(*table); | 1628 weak_collection->set_table(*table); |
1629 weak_collection->set_next(Smi::FromInt(0)); | 1629 weak_collection->set_next(Smi::FromInt(0)); |
(...skipping 13628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15258 } | 15258 } |
15259 } | 15259 } |
15260 | 15260 |
15261 | 15261 |
15262 void Runtime::OutOfMemory() { | 15262 void Runtime::OutOfMemory() { |
15263 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); | 15263 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); |
15264 UNREACHABLE(); | 15264 UNREACHABLE(); |
15265 } | 15265 } |
15266 | 15266 |
15267 } } // namespace v8::internal | 15267 } } // namespace v8::internal |
OLD | NEW |