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

Side by Side Diff: src/stub-cache.cc

Issue 8332003: Handlify CallStubCompiler::CompileCallField. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rename some functions on ARM. Created 9 years, 1 month 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 code->set_check_type(check); 828 code->set_check_type(check);
829 ASSERT_EQ(flags, code->flags()); 829 ASSERT_EQ(flags, code->flags());
830 PROFILE(isolate_, 830 PROFILE(isolate_,
831 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); 831 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name));
832 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); 832 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
833 JSObject::UpdateMapCodeCache(map_holder, name, code); 833 JSObject::UpdateMapCodeCache(map_holder, name, code);
834 return code; 834 return code;
835 } 835 }
836 836
837 837
838 Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object,
839 Handle<JSObject> holder,
840 int index,
841 Handle<String> name) {
842 CALL_HEAP_FUNCTION(
843 isolate(),
844 (set_failure(NULL), CompileCallField(*object, *holder, index, *name)),
845 Code);
846 }
847
848
849 Handle<Code> StubCache::ComputeCallField(int argc, 838 Handle<Code> StubCache::ComputeCallField(int argc,
850 Code::Kind kind, 839 Code::Kind kind,
851 Code::ExtraICState extra_state, 840 Code::ExtraICState extra_state,
852 Handle<String> name, 841 Handle<String> name,
853 Handle<Object> object, 842 Handle<Object> object,
854 Handle<JSObject> holder, 843 Handle<JSObject> holder,
855 int index) { 844 int index) {
856 // Compute the check type and the map. 845 // Compute the check type and the map.
857 InlineCacheHolderFlag cache_holder = 846 InlineCacheHolderFlag cache_holder =
858 IC::GetCodeCacheForObject(*object, *holder); 847 IC::GetCodeCacheForObject(*object, *holder);
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 CodeDesc desc; 1616 CodeDesc desc;
1628 masm_.GetCode(&desc); 1617 masm_.GetCode(&desc);
1629 Handle<Code> code = factory()->NewCode(desc, flags, masm_.CodeObject()); 1618 Handle<Code> code = factory()->NewCode(desc, flags, masm_.CodeObject());
1630 #ifdef ENABLE_DISASSEMBLER 1619 #ifdef ENABLE_DISASSEMBLER
1631 if (FLAG_print_code_stubs) code->Disassemble(name); 1620 if (FLAG_print_code_stubs) code->Disassemble(name);
1632 #endif 1621 #endif
1633 return code; 1622 return code;
1634 } 1623 }
1635 1624
1636 1625
1626 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags,
1627 Handle<String> name) {
1628 return (FLAG_print_code_stubs && !name.is_null())
1629 ? GetCodeWithFlags(flags, *name->ToCString())
1630 : GetCodeWithFlags(flags, reinterpret_cast<char*>(NULL));
1631 }
1632
1633
1637 MaybeObject* StubCompiler::TryGetCodeWithFlags(Code::Flags flags, 1634 MaybeObject* StubCompiler::TryGetCodeWithFlags(Code::Flags flags,
1638 const char* name) { 1635 const char* name) {
1639 // Check for allocation failures during stub compilation. 1636 // Check for allocation failures during stub compilation.
1640 if (failure_->IsFailure()) return failure_; 1637 if (failure_->IsFailure()) return failure_;
1641 1638
1642 // Create code object in the heap. 1639 // Create code object in the heap.
1643 CodeDesc desc; 1640 CodeDesc desc;
1644 masm_.GetCode(&desc); 1641 masm_.GetCode(&desc);
1645 MaybeObject* result = heap()->CreateCode(desc, flags, masm_.CodeObject()); 1642 MaybeObject* result = heap()->CreateCode(desc, flags, masm_.CodeObject());
1646 #ifdef ENABLE_DISASSEMBLER 1643 #ifdef ENABLE_DISASSEMBLER
1647 if (FLAG_print_code_stubs && !result->IsFailure()) { 1644 if (FLAG_print_code_stubs && !result->IsFailure()) {
1648 Code::cast(result->ToObjectUnchecked())->Disassemble(name); 1645 Code::cast(result->ToObjectUnchecked())->Disassemble(name);
1649 } 1646 }
1650 #endif 1647 #endif
1651 return result; 1648 return result;
1652 } 1649 }
1653 1650
1654 1651
1655 MaybeObject* StubCompiler::TryGetCodeWithFlags(Code::Flags flags, 1652 MaybeObject* StubCompiler::TryGetCodeWithFlags(Code::Flags flags,
1656 String* name) { 1653 String* name) {
1657 if (FLAG_print_code_stubs && (name != NULL)) { 1654 if (FLAG_print_code_stubs && name != NULL) {
1658 return TryGetCodeWithFlags(flags, *name->ToCString()); 1655 return TryGetCodeWithFlags(flags, *name->ToCString());
1659 } 1656 }
1660 return TryGetCodeWithFlags(flags, reinterpret_cast<char*>(NULL)); 1657 return TryGetCodeWithFlags(flags, reinterpret_cast<char*>(NULL));
1661 } 1658 }
1662 1659
1663 1660
1664 void StubCompiler::LookupPostInterceptor(JSObject* holder, 1661 void StubCompiler::LookupPostInterceptor(JSObject* holder,
1665 String* name, 1662 String* name,
1666 LookupResult* lookup) { 1663 LookupResult* lookup) {
1667 holder->LocalLookupRealNamedProperty(name, lookup); 1664 holder->LocalLookupRealNamedProperty(name, lookup);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 ASSERT(optimization.is_simple_api_call()); 1804 ASSERT(optimization.is_simple_api_call());
1808 return CompileFastApiCall(optimization, 1805 return CompileFastApiCall(optimization,
1809 object, 1806 object,
1810 holder, 1807 holder,
1811 cell, 1808 cell,
1812 function, 1809 function,
1813 fname); 1810 fname);
1814 } 1811 }
1815 1812
1816 1813
1817 MaybeObject* CallStubCompiler::GetCode(PropertyType type, String* name) { 1814 Handle<Code> CallStubCompiler::GetCode(PropertyType type, Handle<String> name) {
1818 int argc = arguments_.immediate(); 1815 int argc = arguments_.immediate();
1819 Code::Flags flags = Code::ComputeMonomorphicFlags(kind_, 1816 Code::Flags flags = Code::ComputeMonomorphicFlags(kind_,
1820 type, 1817 type,
1818 extra_state_,
1819 cache_holder_,
1820 argc);
1821 return GetCodeWithFlags(flags, name);
1822 }
1823
1824
1825 Handle<Code> CallStubCompiler::GetCode(Handle<JSFunction> function) {
1826 Handle<String> function_name;
1827 if (function->shared()->name()->IsString()) {
1828 function_name = Handle<String>(String::cast(function->shared()->name()));
1829 }
1830 return GetCode(CONSTANT_FUNCTION, function_name);
1831 }
1832
1833
1834 // TODO(kmillikin): Eliminate this function when the stub cache is fully
1835 // handlified.
1836 MaybeObject* CallStubCompiler::TryGetCode(PropertyType type, String* name) {
1837 int argc = arguments_.immediate();
1838 Code::Flags flags = Code::ComputeMonomorphicFlags(kind_,
1839 type,
1821 extra_state_, 1840 extra_state_,
1822 cache_holder_, 1841 cache_holder_,
1823 argc); 1842 argc);
1824 return TryGetCodeWithFlags(flags, name); 1843 return TryGetCodeWithFlags(flags, name);
1825 } 1844 }
1826 1845
1827 1846
1828 MaybeObject* CallStubCompiler::GetCode(JSFunction* function) { 1847 // TODO(kmillikin): Eliminate this function when the stub cache is fully
1848 // handlified.
1849 MaybeObject* CallStubCompiler::TryGetCode(JSFunction* function) {
1829 String* function_name = NULL; 1850 String* function_name = NULL;
1830 if (function->shared()->name()->IsString()) { 1851 if (function->shared()->name()->IsString()) {
1831 function_name = String::cast(function->shared()->name()); 1852 function_name = String::cast(function->shared()->name());
1832 } 1853 }
1833 return GetCode(CONSTANT_FUNCTION, function_name); 1854 return TryGetCode(CONSTANT_FUNCTION, function_name);
1834 } 1855 }
1835 1856
1836 1857
1837 MaybeObject* ConstructStubCompiler::GetCode() { 1858 MaybeObject* ConstructStubCompiler::GetCode() {
1838 Code::Flags flags = Code::ComputeFlags(Code::STUB); 1859 Code::Flags flags = Code::ComputeFlags(Code::STUB);
1839 Object* result; 1860 Object* result;
1840 { MaybeObject* maybe_result = TryGetCodeWithFlags(flags, "ConstructStub"); 1861 { MaybeObject* maybe_result = TryGetCodeWithFlags(flags, "ConstructStub");
1841 if (!maybe_result->ToObject(&result)) return maybe_result; 1862 if (!maybe_result->ToObject(&result)) return maybe_result;
1842 } 1863 }
1843 Code* code = Code::cast(result); 1864 Code* code = Code::cast(result);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 expected_receiver_type_ = 1930 expected_receiver_type_ =
1910 FunctionTemplateInfo::cast(signature->receiver()); 1931 FunctionTemplateInfo::cast(signature->receiver());
1911 } 1932 }
1912 } 1933 }
1913 1934
1914 is_simple_api_call_ = true; 1935 is_simple_api_call_ = true;
1915 } 1936 }
1916 1937
1917 1938
1918 } } // namespace v8::internal 1939 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698