Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: src/runtime.cc

Issue 153923005: A64: Synchronize with r17525. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | src/serialize.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info())); 568 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info()));
569 AllocationSiteUsageContext usage_context(isolate, site, true); 569 AllocationSiteUsageContext usage_context(isolate, site, true);
570 usage_context.EnterNewScope(); 570 usage_context.EnterNewScope();
571 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context); 571 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context);
572 usage_context.ExitScope(site, boilerplate); 572 usage_context.ExitScope(site, boilerplate);
573 RETURN_IF_EMPTY_HANDLE(isolate, copy); 573 RETURN_IF_EMPTY_HANDLE(isolate, copy);
574 return *copy; 574 return *copy;
575 } 575 }
576 576
577 577
578 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) {
579 HandleScope scope(isolate);
580 ASSERT(args.length() == 3);
581 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
582 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
583 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
584
585 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals,
586 literals_index, elements);
587 RETURN_IF_EMPTY_HANDLE(isolate, site);
588
589 JSObject* boilerplate = JSObject::cast(site->transition_info());
590 if (boilerplate->elements()->map() ==
591 isolate->heap()->fixed_cow_array_map()) {
592 isolate->counters()->cow_arrays_created_runtime()->Increment();
593 }
594
595 if (AllocationSite::GetMode(boilerplate->GetElementsKind()) ==
596 TRACK_ALLOCATION_SITE) {
597 return isolate->heap()->CopyJSObject(boilerplate, *site);
598 }
599
600 return isolate->heap()->CopyJSObject(boilerplate);
601 }
602
603
604 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) { 578 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) {
605 HandleScope scope(isolate); 579 HandleScope scope(isolate);
606 ASSERT(args.length() == 1); 580 ASSERT(args.length() == 1);
607 Handle<Object> name(args[0], isolate); 581 Handle<Object> name(args[0], isolate);
608 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); 582 RUNTIME_ASSERT(name->IsString() || name->IsUndefined());
609 Symbol* symbol; 583 Symbol* symbol;
610 MaybeObject* maybe = isolate->heap()->AllocateSymbol(); 584 MaybeObject* maybe = isolate->heap()->AllocateSymbol();
611 if (!maybe->To(&symbol)) return maybe; 585 if (!maybe->To(&symbol)) return maybe;
612 if (name->IsString()) symbol->set_name(*name); 586 if (name->IsString()) symbol->set_name(*name);
613 return symbol; 587 return symbol;
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 return *holder; 1380 return *holder;
1407 } 1381 }
1408 1382
1409 1383
1410 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAdd) { 1384 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAdd) {
1411 HandleScope scope(isolate); 1385 HandleScope scope(isolate);
1412 ASSERT(args.length() == 2); 1386 ASSERT(args.length() == 2);
1413 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); 1387 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
1414 Handle<Object> key(args[1], isolate); 1388 Handle<Object> key(args[1], isolate);
1415 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); 1389 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table()));
1416 table = ObjectHashSetAdd(table, key); 1390 table = ObjectHashSet::Add(table, key);
1417 holder->set_table(*table); 1391 holder->set_table(*table);
1418 return isolate->heap()->undefined_value(); 1392 return isolate->heap()->undefined_value();
1419 } 1393 }
1420 1394
1421 1395
1422 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHas) { 1396 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetHas) {
1423 HandleScope scope(isolate); 1397 HandleScope scope(isolate);
1424 ASSERT(args.length() == 2); 1398 ASSERT(args.length() == 2);
1425 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); 1399 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
1426 Handle<Object> key(args[1], isolate); 1400 Handle<Object> key(args[1], isolate);
1427 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); 1401 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table()));
1428 return isolate->heap()->ToBoolean(table->Contains(*key)); 1402 return isolate->heap()->ToBoolean(table->Contains(*key));
1429 } 1403 }
1430 1404
1431 1405
1432 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) { 1406 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) {
1433 HandleScope scope(isolate); 1407 HandleScope scope(isolate);
1434 ASSERT(args.length() == 2); 1408 ASSERT(args.length() == 2);
1435 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); 1409 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
1436 Handle<Object> key(args[1], isolate); 1410 Handle<Object> key(args[1], isolate);
1437 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); 1411 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table()));
1438 table = ObjectHashSetRemove(table, key); 1412 table = ObjectHashSet::Remove(table, key);
1439 holder->set_table(*table); 1413 holder->set_table(*table);
1440 return isolate->heap()->undefined_value(); 1414 return isolate->heap()->undefined_value();
1441 } 1415 }
1442 1416
1443 1417
1444 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetGetSize) { 1418 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetGetSize) {
1445 HandleScope scope(isolate); 1419 HandleScope scope(isolate);
1446 ASSERT(args.length() == 1); 1420 ASSERT(args.length() == 1);
1447 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0); 1421 CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
1448 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table())); 1422 Handle<ObjectHashSet> table(ObjectHashSet::cast(holder->table()));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 1457
1484 1458
1485 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapDelete) { 1459 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapDelete) {
1486 HandleScope scope(isolate); 1460 HandleScope scope(isolate);
1487 ASSERT(args.length() == 2); 1461 ASSERT(args.length() == 2);
1488 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); 1462 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
1489 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 1463 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
1490 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); 1464 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table()));
1491 Handle<Object> lookup(table->Lookup(*key), isolate); 1465 Handle<Object> lookup(table->Lookup(*key), isolate);
1492 Handle<ObjectHashTable> new_table = 1466 Handle<ObjectHashTable> new_table =
1493 PutIntoObjectHashTable(table, key, isolate->factory()->the_hole_value()); 1467 ObjectHashTable::Put(table, key, isolate->factory()->the_hole_value());
1494 holder->set_table(*new_table); 1468 holder->set_table(*new_table);
1495 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); 1469 return isolate->heap()->ToBoolean(!lookup->IsTheHole());
1496 } 1470 }
1497 1471
1498 1472
1499 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) { 1473 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) {
1500 HandleScope scope(isolate); 1474 HandleScope scope(isolate);
1501 ASSERT(args.length() == 3); 1475 ASSERT(args.length() == 3);
1502 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); 1476 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
1503 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 1477 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
1504 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); 1478 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
1505 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); 1479 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table()));
1506 Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value); 1480 Handle<ObjectHashTable> new_table = ObjectHashTable::Put(table, key, value);
1507 holder->set_table(*new_table); 1481 holder->set_table(*new_table);
1508 return isolate->heap()->undefined_value(); 1482 return isolate->heap()->undefined_value();
1509 } 1483 }
1510 1484
1511 1485
1512 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGetSize) { 1486 RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGetSize) {
1513 HandleScope scope(isolate); 1487 HandleScope scope(isolate);
1514 ASSERT(args.length() == 1); 1488 ASSERT(args.length() == 1);
1515 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); 1489 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
1516 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); 1490 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table()));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 1536
1563 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakCollectionDelete) { 1537 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakCollectionDelete) {
1564 HandleScope scope(isolate); 1538 HandleScope scope(isolate);
1565 ASSERT(args.length() == 2); 1539 ASSERT(args.length() == 2);
1566 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); 1540 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0);
1567 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 1541 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
1568 Handle<ObjectHashTable> table(ObjectHashTable::cast( 1542 Handle<ObjectHashTable> table(ObjectHashTable::cast(
1569 weak_collection->table())); 1543 weak_collection->table()));
1570 Handle<Object> lookup(table->Lookup(*key), isolate); 1544 Handle<Object> lookup(table->Lookup(*key), isolate);
1571 Handle<ObjectHashTable> new_table = 1545 Handle<ObjectHashTable> new_table =
1572 PutIntoObjectHashTable(table, key, isolate->factory()->the_hole_value()); 1546 ObjectHashTable::Put(table, key, isolate->factory()->the_hole_value());
1573 weak_collection->set_table(*new_table); 1547 weak_collection->set_table(*new_table);
1574 return isolate->heap()->ToBoolean(!lookup->IsTheHole()); 1548 return isolate->heap()->ToBoolean(!lookup->IsTheHole());
1575 } 1549 }
1576 1550
1577 1551
1578 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakCollectionSet) { 1552 RUNTIME_FUNCTION(MaybeObject*, Runtime_WeakCollectionSet) {
1579 HandleScope scope(isolate); 1553 HandleScope scope(isolate);
1580 ASSERT(args.length() == 3); 1554 ASSERT(args.length() == 3);
1581 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0); 1555 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0);
1582 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 1556 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
1583 Handle<Object> value(args[2], isolate); 1557 Handle<Object> value(args[2], isolate);
1584 Handle<ObjectHashTable> table( 1558 Handle<ObjectHashTable> table(
1585 ObjectHashTable::cast(weak_collection->table())); 1559 ObjectHashTable::cast(weak_collection->table()));
1586 Handle<ObjectHashTable> new_table = PutIntoObjectHashTable(table, key, value); 1560 Handle<ObjectHashTable> new_table = ObjectHashTable::Put(table, key, value);
1587 weak_collection->set_table(*new_table); 1561 weak_collection->set_table(*new_table);
1588 return isolate->heap()->undefined_value(); 1562 return isolate->heap()->undefined_value();
1589 } 1563 }
1590 1564
1591 1565
1592 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) { 1566 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClassOf) {
1593 SealHandleScope shs(isolate); 1567 SealHandleScope shs(isolate);
1594 ASSERT(args.length() == 1); 1568 ASSERT(args.length() == 1);
1595 Object* obj = args[0]; 1569 Object* obj = args[0];
1596 if (!obj->IsJSObject()) return isolate->heap()->null_value(); 1570 if (!obj->IsJSObject()) return isolate->heap()->null_value();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 if (FLAG_harmony_observation && obj->map()->is_observed()) { 1613 if (FLAG_harmony_observation && obj->map()->is_observed()) {
1640 Handle<Object> old_value( 1614 Handle<Object> old_value(
1641 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); 1615 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate);
1642 1616
1643 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); 1617 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true);
1644 RETURN_IF_EMPTY_HANDLE(isolate, result); 1618 RETURN_IF_EMPTY_HANDLE(isolate, result);
1645 1619
1646 Handle<Object> new_value( 1620 Handle<Object> new_value(
1647 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); 1621 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate);
1648 if (!new_value->SameValue(*old_value)) { 1622 if (!new_value->SameValue(*old_value)) {
1649 JSObject::EnqueueChangeRecord(obj, "prototype", 1623 JSObject::EnqueueChangeRecord(obj, "setPrototype",
1650 isolate->factory()->proto_string(), 1624 isolate->factory()->proto_string(),
1651 old_value); 1625 old_value);
1652 } 1626 }
1653 return *result; 1627 return *result;
1654 } 1628 }
1655 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); 1629 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true);
1656 RETURN_IF_EMPTY_HANDLE(isolate, result); 1630 RETURN_IF_EMPTY_HANDLE(isolate, result);
1657 return *result; 1631 return *result;
1658 } 1632 }
1659 1633
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2993 Handle<Map>(func->initial_map())); 2967 Handle<Map>(func->initial_map()));
2994 new_initial_map->set_unused_property_fields(num); 2968 new_initial_map->set_unused_property_fields(num);
2995 func->set_initial_map(*new_initial_map); 2969 func->set_initial_map(*new_initial_map);
2996 } 2970 }
2997 } 2971 }
2998 return isolate->heap()->undefined_value(); 2972 return isolate->heap()->undefined_value();
2999 } 2973 }
3000 2974
3001 2975
3002 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSGeneratorObject) { 2976 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSGeneratorObject) {
3003 SealHandleScope shs(isolate); 2977 HandleScope scope(isolate);
3004 ASSERT(args.length() == 0); 2978 ASSERT(args.length() == 0);
3005 2979
3006 JavaScriptFrameIterator it(isolate); 2980 JavaScriptFrameIterator it(isolate);
3007 JavaScriptFrame* frame = it.frame(); 2981 JavaScriptFrame* frame = it.frame();
3008 JSFunction* function = frame->function(); 2982 Handle<JSFunction> function(frame->function());
3009 RUNTIME_ASSERT(function->shared()->is_generator()); 2983 RUNTIME_ASSERT(function->shared()->is_generator());
3010 2984
3011 JSGeneratorObject* generator; 2985 Handle<JSGeneratorObject> generator;
3012 if (frame->IsConstructor()) { 2986 if (frame->IsConstructor()) {
3013 generator = JSGeneratorObject::cast(frame->receiver()); 2987 generator = handle(JSGeneratorObject::cast(frame->receiver()));
3014 } else { 2988 } else {
3015 MaybeObject* maybe_generator = 2989 generator = isolate->factory()->NewJSGeneratorObject(function);
3016 isolate->heap()->AllocateJSGeneratorObject(function);
3017 if (!maybe_generator->To(&generator)) return maybe_generator;
3018 } 2990 }
3019 generator->set_function(function); 2991 generator->set_function(*function);
3020 generator->set_context(Context::cast(frame->context())); 2992 generator->set_context(Context::cast(frame->context()));
3021 generator->set_receiver(frame->receiver()); 2993 generator->set_receiver(frame->receiver());
3022 generator->set_continuation(0); 2994 generator->set_continuation(0);
3023 generator->set_operand_stack(isolate->heap()->empty_fixed_array()); 2995 generator->set_operand_stack(isolate->heap()->empty_fixed_array());
3024 generator->set_stack_handler_index(-1); 2996 generator->set_stack_handler_index(-1);
3025 2997
3026 return generator; 2998 return *generator;
3027 } 2999 }
3028 3000
3029 3001
3030 RUNTIME_FUNCTION(MaybeObject*, Runtime_SuspendJSGeneratorObject) { 3002 RUNTIME_FUNCTION(MaybeObject*, Runtime_SuspendJSGeneratorObject) {
3031 SealHandleScope shs(isolate); 3003 SealHandleScope shs(isolate);
3032 ASSERT(args.length() == 1); 3004 ASSERT(args.length() == 1);
3033 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0); 3005 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0);
3034 3006
3035 JavaScriptFrameIterator stack_iterator(isolate); 3007 JavaScriptFrameIterator stack_iterator(isolate);
3036 JavaScriptFrame* frame = stack_iterator.frame(); 3008 JavaScriptFrame* frame = stack_iterator.frame();
(...skipping 11829 matching lines...) Expand 10 before | Expand all | Expand 10 after
14866 // Handle last resort GC and make sure to allow future allocations 14838 // Handle last resort GC and make sure to allow future allocations
14867 // to grow the heap without causing GCs (if possible). 14839 // to grow the heap without causing GCs (if possible).
14868 isolate->counters()->gc_last_resort_from_js()->Increment(); 14840 isolate->counters()->gc_last_resort_from_js()->Increment();
14869 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14841 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14870 "Runtime::PerformGC"); 14842 "Runtime::PerformGC");
14871 } 14843 }
14872 } 14844 }
14873 14845
14874 14846
14875 } } // namespace v8::internal 14847 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698