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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 | 548 |
549 literals->set(literals_index, *site); | 549 literals->set(literals_index, *site); |
550 } else { | 550 } else { |
551 site = Handle<AllocationSite>::cast(literal_site); | 551 site = Handle<AllocationSite>::cast(literal_site); |
552 } | 552 } |
553 | 553 |
554 return site; | 554 return site; |
555 } | 555 } |
556 | 556 |
557 | 557 |
558 static MaybeObject* CreateArrayLiteralImpl(Isolate* isolate, | 558 static MaybeHandle<JSObject> CreateArrayLiteralImpl(Isolate* isolate, |
559 Handle<FixedArray> literals, | 559 Handle<FixedArray> literals, |
560 int literals_index, | 560 int literals_index, |
561 Handle<FixedArray> elements, | 561 Handle<FixedArray> elements, |
562 int flags) { | 562 int flags) { |
563 Handle<AllocationSite> site; | 563 Handle<AllocationSite> site; |
564 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 564 ASSIGN_RETURN_ON_EXCEPTION( |
565 isolate, site, | 565 isolate, site, |
566 GetLiteralAllocationSite(isolate, literals, literals_index, elements)); | 566 GetLiteralAllocationSite(isolate, literals, literals_index, elements), |
| 567 JSObject); |
567 | 568 |
568 bool enable_mementos = (flags & ArrayLiteral::kDisableMementos) == 0; | 569 bool enable_mementos = (flags & ArrayLiteral::kDisableMementos) == 0; |
569 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info())); | 570 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info())); |
570 AllocationSiteUsageContext usage_context(isolate, site, enable_mementos); | 571 AllocationSiteUsageContext usage_context(isolate, site, enable_mementos); |
571 usage_context.EnterNewScope(); | 572 usage_context.EnterNewScope(); |
572 JSObject::DeepCopyHints hints = (flags & ArrayLiteral::kShallowElements) == 0 | 573 JSObject::DeepCopyHints hints = (flags & ArrayLiteral::kShallowElements) == 0 |
573 ? JSObject::kNoHints | 574 ? JSObject::kNoHints |
574 : JSObject::kObjectIsShallowArray; | 575 : JSObject::kObjectIsShallowArray; |
575 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context, | 576 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context, |
576 hints); | 577 hints); |
577 usage_context.ExitScope(site, boilerplate); | 578 usage_context.ExitScope(site, boilerplate); |
578 RETURN_IF_EMPTY_HANDLE(isolate, copy); | 579 return copy; |
579 return *copy; | |
580 } | 580 } |
581 | 581 |
582 | 582 |
583 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CreateArrayLiteral) { | 583 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CreateArrayLiteral) { |
584 HandleScope scope(isolate); | 584 HandleScope scope(isolate); |
585 ASSERT(args.length() == 4); | 585 ASSERT(args.length() == 4); |
586 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 586 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
587 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 587 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
588 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); | 588 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); |
589 CONVERT_SMI_ARG_CHECKED(flags, 3); | 589 CONVERT_SMI_ARG_CHECKED(flags, 3); |
590 | 590 |
591 return CreateArrayLiteralImpl(isolate, literals, literals_index, elements, | 591 Handle<JSObject> result; |
592 flags); | 592 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
| 593 CreateArrayLiteralImpl(isolate, literals, literals_index, elements, |
| 594 flags)); |
| 595 return *result; |
593 } | 596 } |
594 | 597 |
595 | 598 |
596 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CreateArrayLiteralStubBailout) { | 599 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_CreateArrayLiteralStubBailout) { |
597 HandleScope scope(isolate); | 600 HandleScope scope(isolate); |
598 ASSERT(args.length() == 3); | 601 ASSERT(args.length() == 3); |
599 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 602 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
600 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 603 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
601 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); | 604 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); |
602 | 605 |
603 return CreateArrayLiteralImpl(isolate, literals, literals_index, elements, | 606 Handle<JSObject> result; |
604 ArrayLiteral::kShallowElements); | 607 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
| 608 CreateArrayLiteralImpl(isolate, literals, literals_index, elements, |
| 609 ArrayLiteral::kShallowElements)); |
| 610 return *result; |
605 } | 611 } |
606 | 612 |
607 | 613 |
608 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) { | 614 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) { |
609 HandleScope scope(isolate); | 615 HandleScope scope(isolate); |
610 ASSERT(args.length() == 1); | 616 ASSERT(args.length() == 1); |
611 Handle<Object> name(args[0], isolate); | 617 Handle<Object> name(args[0], isolate); |
612 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); | 618 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); |
613 Symbol* symbol; | 619 Handle<Symbol> symbol = isolate->factory()->NewSymbol(); |
614 MaybeObject* maybe = isolate->heap()->AllocateSymbol(); | |
615 if (!maybe->To(&symbol)) return maybe; | |
616 if (name->IsString()) symbol->set_name(*name); | 620 if (name->IsString()) symbol->set_name(*name); |
617 return symbol; | 621 return *symbol; |
618 } | 622 } |
619 | 623 |
620 | 624 |
621 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreatePrivateSymbol) { | 625 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreatePrivateSymbol) { |
622 HandleScope scope(isolate); | 626 HandleScope scope(isolate); |
623 ASSERT(args.length() == 1); | 627 ASSERT(args.length() == 1); |
624 Handle<Object> name(args[0], isolate); | 628 Handle<Object> name(args[0], isolate); |
625 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); | 629 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); |
626 Symbol* symbol; | 630 Handle<Symbol> symbol = isolate->factory()->NewPrivateSymbol(); |
627 MaybeObject* maybe = isolate->heap()->AllocatePrivateSymbol(); | |
628 if (!maybe->To(&symbol)) return maybe; | |
629 if (name->IsString()) symbol->set_name(*name); | 631 if (name->IsString()) symbol->set_name(*name); |
630 return symbol; | 632 return *symbol; |
631 } | 633 } |
632 | 634 |
633 | 635 |
634 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateGlobalPrivateSymbol) { | 636 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateGlobalPrivateSymbol) { |
635 HandleScope scope(isolate); | 637 HandleScope scope(isolate); |
636 ASSERT(args.length() == 1); | 638 ASSERT(args.length() == 1); |
637 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 639 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
638 Handle<JSObject> registry = isolate->GetSymbolRegistry(); | 640 Handle<JSObject> registry = isolate->GetSymbolRegistry(); |
639 Handle<String> part = isolate->factory()->private_intern_string(); | 641 Handle<String> part = isolate->factory()->private_intern_string(); |
640 Handle<Object> privates; | 642 Handle<Object> privates; |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 do { | 1720 do { |
1719 if (obj->IsAccessCheckNeeded() && | 1721 if (obj->IsAccessCheckNeeded() && |
1720 !isolate->MayNamedAccess(Handle<JSObject>::cast(obj), | 1722 !isolate->MayNamedAccess(Handle<JSObject>::cast(obj), |
1721 isolate->factory()->proto_string(), | 1723 isolate->factory()->proto_string(), |
1722 v8::ACCESS_GET)) { | 1724 v8::ACCESS_GET)) { |
1723 isolate->ReportFailedAccessCheck(Handle<JSObject>::cast(obj), | 1725 isolate->ReportFailedAccessCheck(Handle<JSObject>::cast(obj), |
1724 v8::ACCESS_GET); | 1726 v8::ACCESS_GET); |
1725 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1727 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
1726 return isolate->heap()->undefined_value(); | 1728 return isolate->heap()->undefined_value(); |
1727 } | 1729 } |
1728 obj = handle(obj->GetPrototype(isolate), isolate); | 1730 obj = Object::GetPrototype(isolate, obj); |
1729 } while (obj->IsJSObject() && | 1731 } while (obj->IsJSObject() && |
1730 JSObject::cast(*obj)->map()->is_hidden_prototype()); | 1732 JSObject::cast(*obj)->map()->is_hidden_prototype()); |
1731 return *obj; | 1733 return *obj; |
1732 } | 1734 } |
1733 | 1735 |
1734 | 1736 |
1735 static inline Object* GetPrototypeSkipHiddenPrototypes(Isolate* isolate, | 1737 static inline Handle<Object> GetPrototypeSkipHiddenPrototypes( |
1736 Object* receiver) { | 1738 Isolate* isolate, Handle<Object> receiver) { |
1737 Object* current = receiver->GetPrototype(isolate); | 1739 Handle<Object> current = Object::GetPrototype(isolate, receiver); |
1738 while (current->IsJSObject() && | 1740 while (current->IsJSObject() && |
1739 JSObject::cast(current)->map()->is_hidden_prototype()) { | 1741 JSObject::cast(*current)->map()->is_hidden_prototype()) { |
1740 current = current->GetPrototype(isolate); | 1742 current = Object::GetPrototype(isolate, current); |
1741 } | 1743 } |
1742 return current; | 1744 return current; |
1743 } | 1745 } |
1744 | 1746 |
1745 | 1747 |
1746 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { | 1748 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { |
1747 HandleScope scope(isolate); | 1749 HandleScope scope(isolate); |
1748 ASSERT(args.length() == 2); | 1750 ASSERT(args.length() == 2); |
1749 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 1751 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
1750 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 1752 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
1751 if (obj->IsAccessCheckNeeded() && | 1753 if (obj->IsAccessCheckNeeded() && |
1752 !isolate->MayNamedAccess( | 1754 !isolate->MayNamedAccess( |
1753 obj, isolate->factory()->proto_string(), v8::ACCESS_SET)) { | 1755 obj, isolate->factory()->proto_string(), v8::ACCESS_SET)) { |
1754 isolate->ReportFailedAccessCheck(obj, v8::ACCESS_SET); | 1756 isolate->ReportFailedAccessCheck(obj, v8::ACCESS_SET); |
1755 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1757 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
1756 return isolate->heap()->undefined_value(); | 1758 return isolate->heap()->undefined_value(); |
1757 } | 1759 } |
1758 if (obj->map()->is_observed()) { | 1760 if (obj->map()->is_observed()) { |
1759 Handle<Object> old_value( | 1761 Handle<Object> old_value = GetPrototypeSkipHiddenPrototypes(isolate, obj); |
1760 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); | |
1761 | 1762 |
1762 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); | 1763 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); |
1763 RETURN_IF_EMPTY_HANDLE(isolate, result); | 1764 RETURN_IF_EMPTY_HANDLE(isolate, result); |
1764 | 1765 |
1765 Handle<Object> new_value( | 1766 Handle<Object> new_value = GetPrototypeSkipHiddenPrototypes(isolate, obj); |
1766 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate); | |
1767 if (!new_value->SameValue(*old_value)) { | 1767 if (!new_value->SameValue(*old_value)) { |
1768 JSObject::EnqueueChangeRecord(obj, "setPrototype", | 1768 JSObject::EnqueueChangeRecord(obj, "setPrototype", |
1769 isolate->factory()->proto_string(), | 1769 isolate->factory()->proto_string(), |
1770 old_value); | 1770 old_value); |
1771 } | 1771 } |
1772 return *result; | 1772 return *result; |
1773 } | 1773 } |
1774 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); | 1774 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); |
1775 RETURN_IF_EMPTY_HANDLE(isolate, result); | 1775 RETURN_IF_EMPTY_HANDLE(isolate, result); |
1776 return *result; | 1776 return *result; |
1777 } | 1777 } |
1778 | 1778 |
1779 | 1779 |
1780 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInPrototypeChain) { | 1780 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInPrototypeChain) { |
1781 SealHandleScope shs(isolate); | 1781 HandleScope shs(isolate); |
1782 ASSERT(args.length() == 2); | 1782 ASSERT(args.length() == 2); |
1783 // See ECMA-262, section 15.3.5.3, page 88 (steps 5 - 8). | 1783 // See ECMA-262, section 15.3.5.3, page 88 (steps 5 - 8). |
1784 Object* O = args[0]; | 1784 Handle<Object> O = args.at<Object>(0); |
1785 Object* V = args[1]; | 1785 Handle<Object> V = args.at<Object>(1); |
1786 while (true) { | 1786 while (true) { |
1787 Object* prototype = V->GetPrototype(isolate); | 1787 Handle<Object> prototype = Object::GetPrototype(isolate, V); |
1788 if (prototype->IsNull()) return isolate->heap()->false_value(); | 1788 if (prototype->IsNull()) return isolate->heap()->false_value(); |
1789 if (O == prototype) return isolate->heap()->true_value(); | 1789 if (*O == *prototype) return isolate->heap()->true_value(); |
1790 V = prototype; | 1790 V = prototype; |
1791 } | 1791 } |
1792 } | 1792 } |
1793 | 1793 |
1794 | 1794 |
1795 static bool CheckAccessException(Object* callback, | 1795 static bool CheckAccessException(Object* callback, |
1796 v8::AccessType access_type) { | 1796 v8::AccessType access_type) { |
1797 DisallowHeapAllocation no_gc; | 1797 DisallowHeapAllocation no_gc; |
1798 if (callback->IsAccessorInfo()) { | 1798 if (callback->IsAccessorInfo()) { |
1799 AccessorInfo* info = AccessorInfo::cast(callback); | 1799 AccessorInfo* info = AccessorInfo::cast(callback); |
(...skipping 11377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13177 isolate->context()->native_context()->array_function()); | 13177 isolate->context()->native_context()->array_function()); |
13178 Handle<JSObject> result = isolate->factory()->NewJSObject(array_function); | 13178 Handle<JSObject> result = isolate->factory()->NewJSObject(array_function); |
13179 JSArray::SetContent(Handle<JSArray>::cast(result), instances); | 13179 JSArray::SetContent(Handle<JSArray>::cast(result), instances); |
13180 return *result; | 13180 return *result; |
13181 } | 13181 } |
13182 | 13182 |
13183 | 13183 |
13184 // Find the effective prototype object as returned by __proto__. | 13184 // Find the effective prototype object as returned by __proto__. |
13185 // args[0]: the object to find the prototype for. | 13185 // args[0]: the object to find the prototype for. |
13186 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPrototype) { | 13186 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPrototype) { |
13187 SealHandleScope shs(isolate); | 13187 HandleScope shs(isolate); |
13188 ASSERT(args.length() == 1); | 13188 ASSERT(args.length() == 1); |
13189 CONVERT_ARG_CHECKED(JSObject, obj, 0); | 13189 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
13190 return GetPrototypeSkipHiddenPrototypes(isolate, obj); | 13190 return *GetPrototypeSkipHiddenPrototypes(isolate, obj); |
13191 } | 13191 } |
13192 | 13192 |
13193 | 13193 |
13194 // Patches script source (should be called upon BeforeCompile event). | 13194 // Patches script source (should be called upon BeforeCompile event). |
13195 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugSetScriptSource) { | 13195 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugSetScriptSource) { |
13196 HandleScope scope(isolate); | 13196 HandleScope scope(isolate); |
13197 ASSERT(args.length() == 2); | 13197 ASSERT(args.length() == 2); |
13198 | 13198 |
13199 CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0); | 13199 CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0); |
13200 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); | 13200 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14524 return *object; | 14524 return *object; |
14525 } | 14525 } |
14526 | 14526 |
14527 | 14527 |
14528 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_GetFromCache) { | 14528 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_GetFromCache) { |
14529 SealHandleScope shs(isolate); | 14529 SealHandleScope shs(isolate); |
14530 // This is only called from codegen, so checks might be more lax. | 14530 // This is only called from codegen, so checks might be more lax. |
14531 CONVERT_ARG_CHECKED(JSFunctionResultCache, cache, 0); | 14531 CONVERT_ARG_CHECKED(JSFunctionResultCache, cache, 0); |
14532 Object* key = args[1]; | 14532 Object* key = args[1]; |
14533 | 14533 |
14534 int finger_index = cache->finger_index(); | 14534 { |
14535 Object* o = cache->get(finger_index); | 14535 DisallowHeapAllocation no_alloc; |
14536 if (o == key) { | |
14537 // The fastest case: hit the same place again. | |
14538 return cache->get(finger_index + 1); | |
14539 } | |
14540 | 14536 |
14541 for (int i = finger_index - 2; | 14537 int finger_index = cache->finger_index(); |
14542 i >= JSFunctionResultCache::kEntriesIndex; | 14538 Object* o = cache->get(finger_index); |
14543 i -= 2) { | |
14544 o = cache->get(i); | |
14545 if (o == key) { | 14539 if (o == key) { |
14546 cache->set_finger_index(i); | 14540 // The fastest case: hit the same place again. |
14547 return cache->get(i + 1); | 14541 return cache->get(finger_index + 1); |
| 14542 } |
| 14543 |
| 14544 for (int i = finger_index - 2; |
| 14545 i >= JSFunctionResultCache::kEntriesIndex; |
| 14546 i -= 2) { |
| 14547 o = cache->get(i); |
| 14548 if (o == key) { |
| 14549 cache->set_finger_index(i); |
| 14550 return cache->get(i + 1); |
| 14551 } |
| 14552 } |
| 14553 |
| 14554 int size = cache->size(); |
| 14555 ASSERT(size <= cache->length()); |
| 14556 |
| 14557 for (int i = size - 2; i > finger_index; i -= 2) { |
| 14558 o = cache->get(i); |
| 14559 if (o == key) { |
| 14560 cache->set_finger_index(i); |
| 14561 return cache->get(i + 1); |
| 14562 } |
14548 } | 14563 } |
14549 } | 14564 } |
14550 | 14565 |
14551 int size = cache->size(); | |
14552 ASSERT(size <= cache->length()); | |
14553 | |
14554 for (int i = size - 2; i > finger_index; i -= 2) { | |
14555 o = cache->get(i); | |
14556 if (o == key) { | |
14557 cache->set_finger_index(i); | |
14558 return cache->get(i + 1); | |
14559 } | |
14560 } | |
14561 | |
14562 // There is no value in the cache. Invoke the function and cache result. | 14566 // There is no value in the cache. Invoke the function and cache result. |
14563 HandleScope scope(isolate); | 14567 HandleScope scope(isolate); |
14564 | 14568 |
14565 Handle<JSFunctionResultCache> cache_handle(cache); | 14569 Handle<JSFunctionResultCache> cache_handle(cache); |
14566 Handle<Object> key_handle(key, isolate); | 14570 Handle<Object> key_handle(key, isolate); |
14567 Handle<Object> value; | 14571 Handle<Object> value; |
14568 { | 14572 { |
14569 Handle<JSFunction> factory(JSFunction::cast( | 14573 Handle<JSFunction> factory(JSFunction::cast( |
14570 cache_handle->get(JSFunctionResultCache::kFactoryIndex))); | 14574 cache_handle->get(JSFunctionResultCache::kFactoryIndex))); |
14571 // TODO(antonm): consider passing a receiver when constructing a cache. | 14575 // TODO(antonm): consider passing a receiver when constructing a cache. |
14572 Handle<Object> receiver(isolate->native_context()->global_object(), | 14576 Handle<Object> receiver(isolate->native_context()->global_object(), |
14573 isolate); | 14577 isolate); |
14574 // This handle is nor shared, nor used later, so it's safe. | 14578 // This handle is nor shared, nor used later, so it's safe. |
14575 Handle<Object> argv[] = { key_handle }; | 14579 Handle<Object> argv[] = { key_handle }; |
14576 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 14580 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
14577 isolate, value, | 14581 isolate, value, |
14578 Execution::Call(isolate, factory, receiver, ARRAY_SIZE(argv), argv)); | 14582 Execution::Call(isolate, factory, receiver, ARRAY_SIZE(argv), argv)); |
14579 } | 14583 } |
14580 | 14584 |
14581 #ifdef VERIFY_HEAP | 14585 #ifdef VERIFY_HEAP |
14582 if (FLAG_verify_heap) { | 14586 if (FLAG_verify_heap) { |
14583 cache_handle->JSFunctionResultCacheVerify(); | 14587 cache_handle->JSFunctionResultCacheVerify(); |
14584 } | 14588 } |
14585 #endif | 14589 #endif |
14586 | 14590 |
14587 // Function invocation may have cleared the cache. Reread all the data. | 14591 // Function invocation may have cleared the cache. Reread all the data. |
14588 finger_index = cache_handle->finger_index(); | 14592 int finger_index = cache_handle->finger_index(); |
14589 size = cache_handle->size(); | 14593 int size = cache_handle->size(); |
14590 | 14594 |
14591 // If we have spare room, put new data into it, otherwise evict post finger | 14595 // If we have spare room, put new data into it, otherwise evict post finger |
14592 // entry which is likely to be the least recently used. | 14596 // entry which is likely to be the least recently used. |
14593 int index = -1; | 14597 int index = -1; |
14594 if (size < cache_handle->length()) { | 14598 if (size < cache_handle->length()) { |
14595 cache_handle->set_size(size + JSFunctionResultCache::kEntrySize); | 14599 cache_handle->set_size(size + JSFunctionResultCache::kEntrySize); |
14596 index = size; | 14600 index = size; |
14597 } else { | 14601 } else { |
14598 index = finger_index + JSFunctionResultCache::kEntrySize; | 14602 index = finger_index + JSFunctionResultCache::kEntrySize; |
14599 if (index == cache_handle->length()) { | 14603 if (index == cache_handle->length()) { |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15104 } | 15108 } |
15105 } | 15109 } |
15106 | 15110 |
15107 | 15111 |
15108 void Runtime::OutOfMemory() { | 15112 void Runtime::OutOfMemory() { |
15109 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); | 15113 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); |
15110 UNREACHABLE(); | 15114 UNREACHABLE(); |
15111 } | 15115 } |
15112 | 15116 |
15113 } } // namespace v8::internal | 15117 } } // namespace v8::internal |
OLD | NEW |