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 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 return *holder; | 1406 return *holder; |
1407 } | 1407 } |
1408 | 1408 |
1409 | 1409 |
1410 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAdd) { | 1410 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAdd) { |
1411 HandleScope scope(isolate); | 1411 HandleScope scope(isolate); |
1412 ASSERT(args.length() == 2); | 1412 ASSERT(args.length() == 2); |
1413 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); | 1413 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); |
1414 Handle<Object> key(args[1], isolate); | 1414 Handle<Object> key(args[1], isolate); |
1415 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); | 1415 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); |
1416 table = ObjectHashSetAdd(table, key); | 1416 table = ObjectHashSet::Add(table, key); |
1417 holder->set_table(*table); | 1417 holder->set_table(*table); |
1418 return isolate->heap()->undefined_value(); | 1418 return isolate->heap()->undefined_value(); |
1419 } | 1419 } |
1420 | 1420 |
1421 | 1421 |
1422 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHas) { | 1422 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHas) { |
1423 HandleScope scope(isolate); | 1423 HandleScope scope(isolate); |
1424 ASSERT(args.length() == 2); | 1424 ASSERT(args.length() == 2); |
1425 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); | 1425 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); |
1426 Handle<Object> key(args[1], isolate); | 1426 Handle<Object> key(args[1], isolate); |
1427 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); | 1427 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); |
1428 return isolate->heap()->ToBoolean(table->Contains(*key)); | 1428 return isolate->heap()->ToBoolean(table->Contains(*key)); |
1429 } | 1429 } |
1430 | 1430 |
1431 | 1431 |
1432 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) { | 1432 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) { |
1433 HandleScope scope(isolate); | 1433 HandleScope scope(isolate); |
1434 ASSERT(args.length() == 2); | 1434 ASSERT(args.length() == 2); |
1435 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); | 1435 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); |
1436 Handle<Object> key(args[1], isolate); | 1436 Handle<Object> key(args[1], isolate); |
1437 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); | 1437 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); |
1438 table = ObjectHashSetRemove(table, key); | 1438 table = ObjectHashSet::Remove(table, key); |
1439 holder->set_table(*table); | 1439 holder->set_table(*table); |
1440 return isolate->heap()->undefined_value(); | 1440 return isolate->heap()->undefined_value(); |
1441 } | 1441 } |
1442 | 1442 |
1443 | 1443 |
1444 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetGetSize) { | 1444 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetGetSize) { |
1445 HandleScope scope(isolate); | 1445 HandleScope scope(isolate); |
1446 ASSERT(args.length() == 1); | 1446 ASSERT(args.length() == 1); |
1447 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); | 1447 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); |
1448 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); | 1448 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 | 1483 |
1484 | 1484 |
1485 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapDelete) { | 1485 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapDelete) { |
1486 HandleScope scope(isolate); | 1486 HandleScope scope(isolate); |
1487 ASSERT(args.length() == 2); | 1487 ASSERT(args.length() == 2); |
1488 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); | 1488 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); |
1489 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 1489 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
1490 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); | 1490 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); |
1491 Handle<Object> lookup(table->Lookup(*key), isolate); | 1491 Handle<Object> lookup(table->Lookup(*key), isolate); |
1492 Handle<ObjectHashTable> new_table = | 1492 Handle<ObjectHashTable> new_table = |
1493 PutIntoObjectHashTable(table, key, isolate->factory()->the_hole_value()); | 1493 ObjectHashTable::Put(table, key, isolate->factory()->the_hole_value()); |
1494 holder->set_table(*new_table); | 1494 holder->set_table(*new_table); |
1495 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); | 1495 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); |
1496 } | 1496 } |
1497 | 1497 |
1498 | 1498 |
1499 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) { | 1499 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) { |
1500 HandleScope scope(isolate); | 1500 HandleScope scope(isolate); |
1501 ASSERT(args.length() == 3); | 1501 ASSERT(args.length() == 3); |
1502 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); | 1502 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); |
1503 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 1503 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
1504 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); | 1504 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
1505 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); | 1505 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); |
1506 Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value); | 1506 Handle<ObjectHashTable> new_table = ObjectHashTable::Put(table, key, value); |
1507 holder->set_table(*new_table); | 1507 holder->set_table(*new_table); |
1508 return isolate->heap()->undefined_value(); | 1508 return isolate->heap()->undefined_value(); |
1509 } | 1509 } |
1510 | 1510 |
1511 | 1511 |
1512 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGetSize) { | 1512 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGetSize) { |
1513 HandleScope scope(isolate); | 1513 HandleScope scope(isolate); |
1514 ASSERT(args.length() == 1); | 1514 ASSERT(args.length() == 1); |
1515 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); | 1515 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); |
1516 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); | 1516 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 | 1562 |
1563 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakCollectionDelete) { | 1563 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakCollectionDelete) { |
1564 HandleScope scope(isolate); | 1564 HandleScope scope(isolate); |
1565 ASSERT(args.length() == 2); | 1565 ASSERT(args.length() == 2); |
1566 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); | 1566 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); |
1567 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 1567 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
1568 Handle<ObjectHashTable> table(ObjectHashTable::cast( | 1568 Handle<ObjectHashTable> table(ObjectHashTable::cast( |
1569 weak_collection->table())); | 1569 weak_collection->table())); |
1570 Handle<Object> lookup(table->Lookup(*key), isolate); | 1570 Handle<Object> lookup(table->Lookup(*key), isolate); |
1571 Handle<ObjectHashTable> new_table = | 1571 Handle<ObjectHashTable> new_table = |
1572 PutIntoObjectHashTable(table, key, isolate->factory()->the_hole_value()); | 1572 ObjectHashTable::Put(table, key, isolate->factory()->the_hole_value()); |
1573 weak_collection->set_table(*new_table); | 1573 weak_collection->set_table(*new_table); |
1574 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); | 1574 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); |
1575 } | 1575 } |
1576 | 1576 |
1577 | 1577 |
1578 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakCollectionSet) { | 1578 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakCollectionSet) { |
1579 HandleScope scope(isolate); | 1579 HandleScope scope(isolate); |
1580 ASSERT(args.length() == 3); | 1580 ASSERT(args.length() == 3); |
1581 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); | 1581 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); |
1582 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); | 1582 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
1583 Handle<Object> value(args[2], isolate); | 1583 Handle<Object> value(args[2], isolate); |
1584 Handle<ObjectHashTable> table( | 1584 Handle<ObjectHashTable> table( |
1585 ObjectHashTable::cast(weak_collection->table())); | 1585 ObjectHashTable::cast(weak_collection->table())); |
1586 Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value); | 1586 Handle<ObjectHashTable> new_table = ObjectHashTable::Put(table, key, value); |
1587 weak_collection->set_table(*new_table); | 1587 weak_collection->set_table(*new_table); |
1588 return isolate->heap()->undefined_value(); | 1588 return isolate->heap()->undefined_value(); |
1589 } | 1589 } |
1590 | 1590 |
1591 | 1591 |
1592 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { | 1592 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { |
1593 SealHandleScope shs(isolate); | 1593 SealHandleScope shs(isolate); |
1594 ASSERT(args.length() == 1); | 1594 ASSERT(args.length() == 1); |
1595 Object* obj = args[0]; | 1595 Object* obj = args[0]; |
1596 if (!obj->IsJSObject()) return isolate->heap()->null_value(); | 1596 if (!obj->IsJSObject()) return isolate->heap()->null_value(); |
(...skipping 13269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14866 // Handle last resort GC and make sure to allow future allocations | 14866 // Handle last resort GC and make sure to allow future allocations |
14867 // to grow the heap without causing GCs (if possible). | 14867 // to grow the heap without causing GCs (if possible). |
14868 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14868 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14869 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14869 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14870 "Runtime::PerformGC"); | 14870 "Runtime::PerformGC"); |
14871 } | 14871 } |
14872 } | 14872 } |
14873 | 14873 |
14874 | 14874 |
14875 } } // namespace v8::internal | 14875 } } // namespace v8::internal |
OLD | NEW |