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

Side by Side Diff: src/runtime.cc

Issue 238933002: First round of runtime.cc handlification. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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/objects.cc ('k') | no next file » | 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(); 620 RETURN_IF_EMPTY_HANDLE(isolate, symbol);
Dmitry Lomov (no reviews) 2014/04/15 12:47:31 Removed macro as discussed offline.
615 if (!maybe->To(&symbol)) return maybe;
616 if (name->IsString()) symbol->set_name(*name); 621 if (name->IsString()) symbol->set_name(*name);
617 return symbol; 622 return *symbol;
618 } 623 }
619 624
620 625
621 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreatePrivateSymbol) { 626 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreatePrivateSymbol) {
622 HandleScope scope(isolate); 627 HandleScope scope(isolate);
623 ASSERT(args.length() == 1); 628 ASSERT(args.length() == 1);
624 Handle<Object> name(args[0], isolate); 629 Handle<Object> name(args[0], isolate);
625 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); 630 RUNTIME_ASSERT(name->IsString() || name->IsUndefined());
626 Symbol* symbol; 631 Handle<Symbol> symbol = isolate->factory()->NewPrivateSymbol();
627 MaybeObject* maybe = isolate->heap()->AllocatePrivateSymbol(); 632 RETURN_IF_EMPTY_HANDLE(isolate, symbol);
628 if (!maybe->To(&symbol)) return maybe;
629 if (name->IsString()) symbol->set_name(*name); 633 if (name->IsString()) symbol->set_name(*name);
630 return symbol; 634 return *symbol;
631 } 635 }
632 636
633 637
634 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateGlobalPrivateSymbol) { 638 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateGlobalPrivateSymbol) {
635 HandleScope scope(isolate); 639 HandleScope scope(isolate);
636 ASSERT(args.length() == 1); 640 ASSERT(args.length() == 1);
637 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); 641 CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
638 Handle<JSObject> registry = isolate->GetSymbolRegistry(); 642 Handle<JSObject> registry = isolate->GetSymbolRegistry();
639 Handle<String> part = isolate->factory()->private_intern_string(); 643 Handle<String> part = isolate->factory()->private_intern_string();
640 Handle<Object> privates; 644 Handle<Object> privates;
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 do { 1722 do {
1719 if (obj->IsAccessCheckNeeded() && 1723 if (obj->IsAccessCheckNeeded() &&
1720 !isolate->MayNamedAccess(Handle<JSObject>::cast(obj), 1724 !isolate->MayNamedAccess(Handle<JSObject>::cast(obj),
1721 isolate->factory()->proto_string(), 1725 isolate->factory()->proto_string(),
1722 v8::ACCESS_GET)) { 1726 v8::ACCESS_GET)) {
1723 isolate->ReportFailedAccessCheck(Handle<JSObject>::cast(obj), 1727 isolate->ReportFailedAccessCheck(Handle<JSObject>::cast(obj),
1724 v8::ACCESS_GET); 1728 v8::ACCESS_GET);
1725 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 1729 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
1726 return isolate->heap()->undefined_value(); 1730 return isolate->heap()->undefined_value();
1727 } 1731 }
1728 obj = handle(obj->GetPrototype(isolate), isolate); 1732 obj = Object::GetPrototype(isolate, obj);
1729 } while (obj->IsJSObject() && 1733 } while (obj->IsJSObject() &&
1730 JSObject::cast(*obj)->map()->is_hidden_prototype()); 1734 JSObject::cast(*obj)->map()->is_hidden_prototype());
1731 return *obj; 1735 return *obj;
1732 } 1736 }
1733 1737
1734 1738
1735 static inline Object* GetPrototypeSkipHiddenPrototypes(Isolate* isolate, 1739 static inline Handle<Object> GetPrototypeSkipHiddenPrototypes(
1736 Object* receiver) { 1740 Isolate* isolate, Handle<Object> receiver) {
1737 Object* current = receiver->GetPrototype(isolate); 1741 Handle<Object> current = Object::GetPrototype(isolate, receiver);
1738 while (current->IsJSObject() && 1742 while (current->IsJSObject() &&
1739 JSObject::cast(current)->map()->is_hidden_prototype()) { 1743 JSObject::cast(*current)->map()->is_hidden_prototype()) {
1740 current = current->GetPrototype(isolate); 1744 current = Object::GetPrototype(isolate, current);
1741 } 1745 }
1742 return current; 1746 return current;
1743 } 1747 }
1744 1748
1745 1749
1746 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) { 1750 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetPrototype) {
1747 HandleScope scope(isolate); 1751 HandleScope scope(isolate);
1748 ASSERT(args.length() == 2); 1752 ASSERT(args.length() == 2);
1749 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); 1753 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
1750 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); 1754 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1);
1751 if (obj->IsAccessCheckNeeded() && 1755 if (obj->IsAccessCheckNeeded() &&
1752 !isolate->MayNamedAccess( 1756 !isolate->MayNamedAccess(
1753 obj, isolate->factory()->proto_string(), v8::ACCESS_SET)) { 1757 obj, isolate->factory()->proto_string(), v8::ACCESS_SET)) {
1754 isolate->ReportFailedAccessCheck(obj, v8::ACCESS_SET); 1758 isolate->ReportFailedAccessCheck(obj, v8::ACCESS_SET);
1755 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 1759 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
1756 return isolate->heap()->undefined_value(); 1760 return isolate->heap()->undefined_value();
1757 } 1761 }
1758 if (obj->map()->is_observed()) { 1762 if (obj->map()->is_observed()) {
1759 Handle<Object> old_value( 1763 Handle<Object> old_value = GetPrototypeSkipHiddenPrototypes(isolate, obj);
1760 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate);
1761 1764
1762 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); 1765 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true);
1763 RETURN_IF_EMPTY_HANDLE(isolate, result); 1766 RETURN_IF_EMPTY_HANDLE(isolate, result);
1764 1767
1765 Handle<Object> new_value( 1768 Handle<Object> new_value = GetPrototypeSkipHiddenPrototypes(isolate, obj);
1766 GetPrototypeSkipHiddenPrototypes(isolate, *obj), isolate);
1767 if (!new_value->SameValue(*old_value)) { 1769 if (!new_value->SameValue(*old_value)) {
1768 JSObject::EnqueueChangeRecord(obj, "setPrototype", 1770 JSObject::EnqueueChangeRecord(obj, "setPrototype",
1769 isolate->factory()->proto_string(), 1771 isolate->factory()->proto_string(),
1770 old_value); 1772 old_value);
1771 } 1773 }
1772 return *result; 1774 return *result;
1773 } 1775 }
1774 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true); 1776 Handle<Object> result = JSObject::SetPrototype(obj, prototype, true);
1775 RETURN_IF_EMPTY_HANDLE(isolate, result); 1777 RETURN_IF_EMPTY_HANDLE(isolate, result);
1776 return *result; 1778 return *result;
1777 } 1779 }
1778 1780
1779 1781
1780 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInPrototypeChain) { 1782 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsInPrototypeChain) {
1781 SealHandleScope shs(isolate); 1783 HandleScope shs(isolate);
1782 ASSERT(args.length() == 2); 1784 ASSERT(args.length() == 2);
1783 // See ECMA-262, section 15.3.5.3, page 88 (steps 5 - 8). 1785 // See ECMA-262, section 15.3.5.3, page 88 (steps 5 - 8).
1784 Object* O = args[0]; 1786 CONVERT_ARG_HANDLE_CHECKED(Object, O, 0);
Yang 2014/04/15 10:21:06 We usuall just use Handle<Object> O = args.at<Obje
Dmitry Lomov (no reviews) 2014/04/15 12:47:31 Done.
1785 Object* V = args[1]; 1787 CONVERT_ARG_HANDLE_CHECKED(Object, V, 1);
1786 while (true) { 1788 while (true) {
1787 Object* prototype = V->GetPrototype(isolate); 1789 Handle<Object> prototype = Object::GetPrototype(isolate, V);
1788 if (prototype->IsNull()) return isolate->heap()->false_value(); 1790 if (prototype->IsNull()) return isolate->heap()->false_value();
1789 if (O == prototype) return isolate->heap()->true_value(); 1791 if (*O == *prototype) return isolate->heap()->true_value();
1790 V = prototype; 1792 V = prototype;
1791 } 1793 }
1792 } 1794 }
1793 1795
1794 1796
1795 static bool CheckAccessException(Object* callback, 1797 static bool CheckAccessException(Object* callback,
1796 v8::AccessType access_type) { 1798 v8::AccessType access_type) {
1797 DisallowHeapAllocation no_gc; 1799 DisallowHeapAllocation no_gc;
1798 if (callback->IsAccessorInfo()) { 1800 if (callback->IsAccessorInfo()) {
1799 AccessorInfo* info = AccessorInfo::cast(callback); 1801 AccessorInfo* info = AccessorInfo::cast(callback);
(...skipping 11377 matching lines...) Expand 10 before | Expand all | Expand 10 after
13177 isolate->context()->native_context()->array_function()); 13179 isolate->context()->native_context()->array_function());
13178 Handle<JSObject> result = isolate->factory()->NewJSObject(array_function); 13180 Handle<JSObject> result = isolate->factory()->NewJSObject(array_function);
13179 JSArray::SetContent(Handle<JSArray>::cast(result), instances); 13181 JSArray::SetContent(Handle<JSArray>::cast(result), instances);
13180 return *result; 13182 return *result;
13181 } 13183 }
13182 13184
13183 13185
13184 // Find the effective prototype object as returned by __proto__. 13186 // Find the effective prototype object as returned by __proto__.
13185 // args[0]: the object to find the prototype for. 13187 // args[0]: the object to find the prototype for.
13186 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPrototype) { 13188 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPrototype) {
13187 SealHandleScope shs(isolate); 13189 HandleScope shs(isolate);
13188 ASSERT(args.length() == 1); 13190 ASSERT(args.length() == 1);
13189 CONVERT_ARG_CHECKED(JSObject, obj, 0); 13191 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
13190 return GetPrototypeSkipHiddenPrototypes(isolate, obj); 13192 return *GetPrototypeSkipHiddenPrototypes(isolate, obj);
13191 } 13193 }
13192 13194
13193 13195
13194 // Patches script source (should be called upon BeforeCompile event). 13196 // Patches script source (should be called upon BeforeCompile event).
13195 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugSetScriptSource) { 13197 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugSetScriptSource) {
13196 HandleScope scope(isolate); 13198 HandleScope scope(isolate);
13197 ASSERT(args.length() == 2); 13199 ASSERT(args.length() == 2);
13198 13200
13199 CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0); 13201 CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0);
13200 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); 13202 CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
14524 return *object; 14526 return *object;
14525 } 14527 }
14526 14528
14527 14529
14528 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_GetFromCache) { 14530 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_GetFromCache) {
14529 SealHandleScope shs(isolate); 14531 SealHandleScope shs(isolate);
14530 // This is only called from codegen, so checks might be more lax. 14532 // This is only called from codegen, so checks might be more lax.
14531 CONVERT_ARG_CHECKED(JSFunctionResultCache, cache, 0); 14533 CONVERT_ARG_CHECKED(JSFunctionResultCache, cache, 0);
14532 Object* key = args[1]; 14534 Object* key = args[1];
14533 14535
14534 int finger_index = cache->finger_index(); 14536 {
14535 Object* o = cache->get(finger_index); 14537 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 14538
14541 for (int i = finger_index - 2; 14539 int finger_index = cache->finger_index();
14542 i >= JSFunctionResultCache::kEntriesIndex; 14540 Object* o = cache->get(finger_index);
14543 i -= 2) {
14544 o = cache->get(i);
14545 if (o == key) { 14541 if (o == key) {
14546 cache->set_finger_index(i); 14542 // The fastest case: hit the same place again.
14547 return cache->get(i + 1); 14543 return cache->get(finger_index + 1);
14544 }
14545
14546 for (int i = finger_index - 2;
14547 i >= JSFunctionResultCache::kEntriesIndex;
14548 i -= 2) {
14549 o = cache->get(i);
14550 if (o == key) {
14551 cache->set_finger_index(i);
14552 return cache->get(i + 1);
14553 }
14554 }
14555
14556 int size = cache->size();
14557 ASSERT(size <= cache->length());
14558
14559 for (int i = size - 2; i > finger_index; i -= 2) {
14560 o = cache->get(i);
14561 if (o == key) {
14562 cache->set_finger_index(i);
14563 return cache->get(i + 1);
14564 }
14548 } 14565 }
14549 } 14566 }
14550 14567
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. 14568 // There is no value in the cache. Invoke the function and cache result.
14563 HandleScope scope(isolate); 14569 HandleScope scope(isolate);
14564 14570
14565 Handle<JSFunctionResultCache> cache_handle(cache); 14571 Handle<JSFunctionResultCache> cache_handle(cache);
14566 Handle<Object> key_handle(key, isolate); 14572 Handle<Object> key_handle(key, isolate);
14567 Handle<Object> value; 14573 Handle<Object> value;
14568 { 14574 {
14569 Handle<JSFunction> factory(JSFunction::cast( 14575 Handle<JSFunction> factory(JSFunction::cast(
14570 cache_handle->get(JSFunctionResultCache::kFactoryIndex))); 14576 cache_handle->get(JSFunctionResultCache::kFactoryIndex)));
14571 // TODO(antonm): consider passing a receiver when constructing a cache. 14577 // TODO(antonm): consider passing a receiver when constructing a cache.
14572 Handle<Object> receiver(isolate->native_context()->global_object(), 14578 Handle<Object> receiver(isolate->native_context()->global_object(),
14573 isolate); 14579 isolate);
14574 // This handle is nor shared, nor used later, so it's safe. 14580 // This handle is nor shared, nor used later, so it's safe.
14575 Handle<Object> argv[] = { key_handle }; 14581 Handle<Object> argv[] = { key_handle };
14576 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 14582 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
14577 isolate, value, 14583 isolate, value,
14578 Execution::Call(isolate, factory, receiver, ARRAY_SIZE(argv), argv)); 14584 Execution::Call(isolate, factory, receiver, ARRAY_SIZE(argv), argv));
14579 } 14585 }
14580 14586
14581 #ifdef VERIFY_HEAP 14587 #ifdef VERIFY_HEAP
14582 if (FLAG_verify_heap) { 14588 if (FLAG_verify_heap) {
14583 cache_handle->JSFunctionResultCacheVerify(); 14589 cache_handle->JSFunctionResultCacheVerify();
14584 } 14590 }
14585 #endif 14591 #endif
14586 14592
14587 // Function invocation may have cleared the cache. Reread all the data. 14593 // Function invocation may have cleared the cache. Reread all the data.
14588 finger_index = cache_handle->finger_index(); 14594 int finger_index = cache_handle->finger_index();
14589 size = cache_handle->size(); 14595 int size = cache_handle->size();
14590 14596
14591 // If we have spare room, put new data into it, otherwise evict post finger 14597 // 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. 14598 // entry which is likely to be the least recently used.
14593 int index = -1; 14599 int index = -1;
14594 if (size < cache_handle->length()) { 14600 if (size < cache_handle->length()) {
14595 cache_handle->set_size(size + JSFunctionResultCache::kEntrySize); 14601 cache_handle->set_size(size + JSFunctionResultCache::kEntrySize);
14596 index = size; 14602 index = size;
14597 } else { 14603 } else {
14598 index = finger_index + JSFunctionResultCache::kEntrySize; 14604 index = finger_index + JSFunctionResultCache::kEntrySize;
14599 if (index == cache_handle->length()) { 14605 if (index == cache_handle->length()) {
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
15104 } 15110 }
15105 } 15111 }
15106 15112
15107 15113
15108 void Runtime::OutOfMemory() { 15114 void Runtime::OutOfMemory() {
15109 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15115 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15110 UNREACHABLE(); 15116 UNREACHABLE();
15111 } 15117 }
15112 15118
15113 } } // namespace v8::internal 15119 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698