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

Side by Side Diff: src/ic.cc

Issue 300693002: Revert "Customized support for feedback on calls to Array." and follow-up fixes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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/ic.h ('k') | src/mips/code-stubs-mips.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "api.h" 8 #include "api.h"
9 #include "arguments.h" 9 #include "arguments.h"
10 #include "codegen.h" 10 #include "codegen.h"
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 // through the embedded maps. 494 // through the embedded maps.
495 SetTargetAtAddress(address, *pre_monomorphic_stub(isolate), constant_pool); 495 SetTargetAtAddress(address, *pre_monomorphic_stub(isolate), constant_pool);
496 } 496 }
497 497
498 498
499 void CallIC::Clear(Isolate* isolate, 499 void CallIC::Clear(Isolate* isolate,
500 Address address, 500 Address address,
501 Code* target, 501 Code* target,
502 ConstantPoolArray* constant_pool) { 502 ConstantPoolArray* constant_pool) {
503 // Currently, CallIC doesn't have state changes. 503 // Currently, CallIC doesn't have state changes.
504 if (target->ic_state() != v8::internal::MONOMORPHIC) return; 504 ASSERT(target->ic_state() == v8::internal::GENERIC);
505 CallIC::State existing_state(target->extra_ic_state());
506
507 // Monomorphic array stubs don't need to be cleared because
508 // 1) the stub doesn't store information that should be cleared, and
509 // 2) the AllocationSite stored in the type feedback vector is immune
510 // from gc type feedback clearing.
511 ASSERT(existing_state.stub_type() == MONOMORPHIC_ARRAY);
512 } 505 }
513 506
514 507
515 void LoadIC::Clear(Isolate* isolate, 508 void LoadIC::Clear(Isolate* isolate,
516 Address address, 509 Address address,
517 Code* target, 510 Code* target,
518 ConstantPoolArray* constant_pool) { 511 ConstantPoolArray* constant_pool) {
519 if (IsCleared(target)) return; 512 if (IsCleared(target)) return;
520 Code* code = target->GetIsolate()->stub_cache()->FindPreMonomorphicIC( 513 Code* code = target->GetIsolate()->stub_cache()->FindPreMonomorphicIC(
521 Code::LOAD_IC, target->extra_ic_state()); 514 Code::LOAD_IC, target->extra_ic_state());
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 set_target(*stub); 1811 set_target(*stub);
1819 TRACE_IC("StoreIC", key); 1812 TRACE_IC("StoreIC", key);
1820 } 1813 }
1821 1814
1822 return store_handle; 1815 return store_handle;
1823 } 1816 }
1824 1817
1825 1818
1826 CallIC::State::State(ExtraICState extra_ic_state) 1819 CallIC::State::State(ExtraICState extra_ic_state)
1827 : argc_(ArgcBits::decode(extra_ic_state)), 1820 : argc_(ArgcBits::decode(extra_ic_state)),
1828 call_type_(CallTypeBits::decode(extra_ic_state)), 1821 call_type_(CallTypeBits::decode(extra_ic_state)) {
1829 stub_type_(StubTypeBits::decode(extra_ic_state)) {
1830 } 1822 }
1831 1823
1832 1824
1833 ExtraICState CallIC::State::GetExtraICState() const { 1825 ExtraICState CallIC::State::GetExtraICState() const {
1834 ExtraICState extra_ic_state = 1826 ExtraICState extra_ic_state =
1835 ArgcBits::encode(argc_) | 1827 ArgcBits::encode(argc_) |
1836 CallTypeBits::encode(call_type_) | 1828 CallTypeBits::encode(call_type_);
1837 StubTypeBits::encode(stub_type_);
1838 return extra_ic_state; 1829 return extra_ic_state;
1839 } 1830 }
1840 1831
1841 1832
1842 bool CallIC::DoCustomHandler(Handle<Object> receiver,
1843 Handle<Object> function,
1844 Handle<FixedArray> vector,
1845 Handle<Smi> slot,
1846 const State& state) {
1847 ASSERT(function->IsJSFunction());
1848 // Are we the array function?
1849 Handle<JSFunction> array_function = Handle<JSFunction>(
1850 isolate()->context()->native_context()->array_function(), isolate());
1851 if (array_function.is_identical_to(Handle<JSFunction>::cast(function))) {
1852 // Alter the slot.
1853 Handle<AllocationSite> new_site = isolate()->factory()->NewAllocationSite();
1854 vector->set(slot->value(), *new_site);
1855 State new_state = state.ToMonomorphicArrayCallState();
1856 CallICStub stub(isolate(), new_state);
1857 set_target(*stub.GetCode());
1858 Handle<String> name;
1859 if (array_function->shared()->name()->IsString()) {
1860 name = Handle<String>(String::cast(array_function->shared()->name()),
1861 isolate());
1862 }
1863
1864 TRACE_IC("CallIC (Array call)", name);
1865 return true;
1866 }
1867 return false;
1868 }
1869
1870
1871 void CallIC::HandleMiss(Handle<Object> receiver, 1833 void CallIC::HandleMiss(Handle<Object> receiver,
1872 Handle<Object> function, 1834 Handle<Object> function,
1873 Handle<FixedArray> vector, 1835 Handle<FixedArray> vector,
1874 Handle<Smi> slot) { 1836 Handle<Smi> slot) {
1875 State state(target()->extra_ic_state()); 1837 State state(target()->extra_ic_state());
1876 Object* feedback = vector->get(slot->value()); 1838 Object* feedback = vector->get(slot->value());
1877 1839
1878 if (feedback->IsJSFunction() || !function->IsJSFunction() || 1840 if (feedback->IsJSFunction() || !function->IsJSFunction()) {
1879 state.stub_type() != DEFAULT) {
1880 // We are going generic. 1841 // We are going generic.
1842 ASSERT(!function->IsJSFunction() || *function != feedback);
1843
1881 vector->set(slot->value(), 1844 vector->set(slot->value(),
1882 *TypeFeedbackInfo::MegamorphicSentinel(isolate()), 1845 *TypeFeedbackInfo::MegamorphicSentinel(isolate()),
1883 SKIP_WRITE_BARRIER); 1846 SKIP_WRITE_BARRIER);
1884
1885 State new_state = state.ToGenericState();
1886 if (new_state != state) {
1887 // Only happens when the array ic goes generic.
1888 ASSERT(state.stub_type() == MONOMORPHIC_ARRAY);
1889 CallICStub stub(isolate(), new_state);
1890 Handle<Code> code = stub.GetCode();
1891 set_target(*code);
1892 }
1893
1894 TRACE_GENERIC_IC(isolate(), "CallIC", "megamorphic"); 1847 TRACE_GENERIC_IC(isolate(), "CallIC", "megamorphic");
1895 } else { 1848 } else {
1896 // If we came here feedback must be the uninitialized sentinel, 1849 // If we came here feedback must be the uninitialized sentinel,
1897 // and we are going monomorphic. 1850 // and we are going monomorphic.
1898 ASSERT(feedback == *TypeFeedbackInfo::UninitializedSentinel(isolate())); 1851 ASSERT(feedback == *TypeFeedbackInfo::UninitializedSentinel(isolate()));
1899
1900 // Do we want to install a custom handler?
1901 if (DoCustomHandler(receiver, function, vector, slot, state)) {
1902 return;
1903 }
1904
1905 Handle<JSFunction> js_function = Handle<JSFunction>::cast(function); 1852 Handle<JSFunction> js_function = Handle<JSFunction>::cast(function);
1906 Handle<Object> name(js_function->shared()->name(), isolate()); 1853 Handle<Object> name(js_function->shared()->name(), isolate());
1907 TRACE_IC("CallIC", name); 1854 TRACE_IC("CallIC", name);
1908 vector->set(slot->value(), *function); 1855 vector->set(slot->value(), *function);
1909 } 1856 }
1910 } 1857 }
1911 1858
1912 1859
1913 #undef TRACE_IC 1860 #undef TRACE_IC
1914 1861
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
3039 #undef ADDR 2986 #undef ADDR
3040 }; 2987 };
3041 2988
3042 2989
3043 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2990 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3044 return IC_utilities[id]; 2991 return IC_utilities[id];
3045 } 2992 }
3046 2993
3047 2994
3048 } } // namespace v8::internal 2995 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698