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

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

Issue 141363005: A64: Synchronize with r15204. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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/stub-cache.h ('k') | src/type-info.h » ('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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 314
315 Handle<Code> StubCache::ComputeLoadNormal(Handle<Name> name, 315 Handle<Code> StubCache::ComputeLoadNormal(Handle<Name> name,
316 Handle<JSObject> receiver) { 316 Handle<JSObject> receiver) {
317 return isolate_->builtins()->LoadIC_Normal(); 317 return isolate_->builtins()->LoadIC_Normal();
318 } 318 }
319 319
320 320
321 Handle<Code> StubCache::ComputeLoadGlobal(Handle<Name> name, 321 Handle<Code> StubCache::ComputeLoadGlobal(Handle<Name> name,
322 Handle<JSObject> receiver, 322 Handle<JSObject> receiver,
323 Handle<GlobalObject> holder, 323 Handle<GlobalObject> holder,
324 Handle<JSGlobalPropertyCell> cell, 324 Handle<PropertyCell> cell,
325 bool is_dont_delete) { 325 bool is_dont_delete) {
326 Handle<JSObject> stub_holder = StubHolder(receiver, holder); 326 Handle<JSObject> stub_holder = StubHolder(receiver, holder);
327 Handle<Code> stub = FindIC(name, stub_holder, Code::LOAD_IC, Code::NORMAL); 327 Handle<Code> stub = FindIC(name, stub_holder, Code::LOAD_IC, Code::NORMAL);
328 if (!stub.is_null()) return stub; 328 if (!stub.is_null()) return stub;
329 329
330 LoadStubCompiler compiler(isolate_); 330 LoadStubCompiler compiler(isolate_);
331 Handle<Code> ic = 331 Handle<Code> ic =
332 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete); 332 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete);
333 JSObject::UpdateMapCodeCache(stub_holder, name, ic); 333 JSObject::UpdateMapCodeCache(stub_holder, name, ic);
334 return ic; 334 return ic;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 490
491 Handle<Code> StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) { 491 Handle<Code> StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) {
492 return (strict_mode == kStrictMode) 492 return (strict_mode == kStrictMode)
493 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict() 493 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict()
494 : isolate_->builtins()->Builtins::StoreIC_Normal(); 494 : isolate_->builtins()->Builtins::StoreIC_Normal();
495 } 495 }
496 496
497 497
498 Handle<Code> StubCache::ComputeStoreGlobal(Handle<Name> name, 498 Handle<Code> StubCache::ComputeStoreGlobal(Handle<Name> name,
499 Handle<GlobalObject> receiver, 499 Handle<GlobalObject> receiver,
500 Handle<JSGlobalPropertyCell> cell, 500 Handle<PropertyCell> cell,
501 StrictModeFlag strict_mode) { 501 StrictModeFlag strict_mode) {
502 Handle<Code> stub = FindIC( 502 Handle<Code> stub = FindIC(
503 name, Handle<JSObject>::cast(receiver), 503 name, Handle<JSObject>::cast(receiver),
504 Code::STORE_IC, Code::NORMAL, strict_mode); 504 Code::STORE_IC, Code::NORMAL, strict_mode);
505 if (!stub.is_null()) return stub; 505 if (!stub.is_null()) return stub;
506 506
507 StoreStubCompiler compiler(isolate_, strict_mode); 507 StoreStubCompiler compiler(isolate_, strict_mode);
508 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name); 508 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name);
509 JSObject::UpdateMapCodeCache(receiver, name, code); 509 JSObject::UpdateMapCodeCache(receiver, name, code);
510 return code; 510 return code;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 if (probe->IsCode()) return Handle<Code>::cast(probe); 637 if (probe->IsCode()) return Handle<Code>::cast(probe);
638 638
639 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder); 639 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder);
640 Handle<Code> code = 640 Handle<Code> code =
641 compiler.CompileCallConstant(object, holder, name, check, function); 641 compiler.CompileCallConstant(object, holder, name, check, function);
642 code->set_check_type(check); 642 code->set_check_type(check);
643 ASSERT(flags == code->flags()); 643 ASSERT(flags == code->flags());
644 PROFILE(isolate_, 644 PROFILE(isolate_,
645 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); 645 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name));
646 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); 646 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
647 JSObject::UpdateMapCodeCache(stub_holder, name, code); 647
648 if (CallStubCompiler::CanBeCached(function)) {
649 JSObject::UpdateMapCodeCache(stub_holder, name, code);
650 }
648 return code; 651 return code;
649 } 652 }
650 653
651 654
652 Handle<Code> StubCache::ComputeCallField(int argc, 655 Handle<Code> StubCache::ComputeCallField(int argc,
653 Code::Kind kind, 656 Code::Kind kind,
654 Code::ExtraICState extra_state, 657 Code::ExtraICState extra_state,
655 Handle<Name> name, 658 Handle<Name> name,
656 Handle<Object> object, 659 Handle<Object> object,
657 Handle<JSObject> holder, 660 Handle<JSObject> holder,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 return code; 730 return code;
728 } 731 }
729 732
730 733
731 Handle<Code> StubCache::ComputeCallGlobal(int argc, 734 Handle<Code> StubCache::ComputeCallGlobal(int argc,
732 Code::Kind kind, 735 Code::Kind kind,
733 Code::ExtraICState extra_state, 736 Code::ExtraICState extra_state,
734 Handle<Name> name, 737 Handle<Name> name,
735 Handle<JSObject> receiver, 738 Handle<JSObject> receiver,
736 Handle<GlobalObject> holder, 739 Handle<GlobalObject> holder,
737 Handle<JSGlobalPropertyCell> cell, 740 Handle<PropertyCell> cell,
738 Handle<JSFunction> function) { 741 Handle<JSFunction> function) {
739 InlineCacheHolderFlag cache_holder = 742 InlineCacheHolderFlag cache_holder =
740 IC::GetCodeCacheForObject(*receiver, *holder); 743 IC::GetCodeCacheForObject(*receiver, *holder);
741 Handle<JSObject> stub_holder(IC::GetCodeCacheHolder( 744 Handle<JSObject> stub_holder(IC::GetCodeCacheHolder(
742 isolate_, *receiver, cache_holder)); 745 isolate_, *receiver, cache_holder));
743 Code::Flags flags = Code::ComputeMonomorphicFlags( 746 Code::Flags flags = Code::ComputeMonomorphicFlags(
744 kind, extra_state, Code::NORMAL, argc, cache_holder); 747 kind, extra_state, Code::NORMAL, argc, cache_holder);
745 Handle<Object> probe(stub_holder->map()->FindInCodeCache(*name, flags), 748 Handle<Object> probe(stub_holder->map()->FindInCodeCache(*name, flags),
746 isolate_); 749 isolate_);
747 if (probe->IsCode()) return Handle<Code>::cast(probe); 750 if (probe->IsCode()) return Handle<Code>::cast(probe);
748 751
749 CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder); 752 CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder);
750 Handle<Code> code = 753 Handle<Code> code =
751 compiler.CompileCallGlobal(receiver, holder, cell, function, name); 754 compiler.CompileCallGlobal(receiver, holder, cell, function, name);
752 ASSERT(flags == code->flags()); 755 ASSERT(flags == code->flags());
753 PROFILE(isolate(), 756 PROFILE(isolate(),
754 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); 757 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name));
755 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); 758 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
756 JSObject::UpdateMapCodeCache(stub_holder, name, code); 759 if (CallStubCompiler::CanBeCached(function)) {
760 JSObject::UpdateMapCodeCache(stub_holder, name, code);
761 }
757 return code; 762 return code;
758 } 763 }
759 764
760 765
761 static void FillCache(Isolate* isolate, Handle<Code> code) { 766 static void FillCache(Isolate* isolate, Handle<Code> code) {
762 Handle<UnseededNumberDictionary> dictionary = 767 Handle<UnseededNumberDictionary> dictionary =
763 UnseededNumberDictionary::Set(isolate->factory()->non_monomorphic_cache(), 768 UnseededNumberDictionary::Set(isolate->factory()->non_monomorphic_cache(),
764 code->flags(), 769 code->flags(),
765 code); 770 code);
766 isolate->heap()->public_set_non_monomorphic_cache(*dictionary); 771 isolate->heap()->public_set_non_monomorphic_cache(*dictionary);
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 #define CALL_GENERATOR_CASE(name) if (id == k##name) return true; 1972 #define CALL_GENERATOR_CASE(name) if (id == k##name) return true;
1968 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE) 1973 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE)
1969 #undef CALL_GENERATOR_CASE 1974 #undef CALL_GENERATOR_CASE
1970 } 1975 }
1971 1976
1972 CallOptimization optimization(function); 1977 CallOptimization optimization(function);
1973 return optimization.is_simple_api_call(); 1978 return optimization.is_simple_api_call();
1974 } 1979 }
1975 1980
1976 1981
1982 bool CallStubCompiler::CanBeCached(Handle<JSFunction> function) {
1983 if (function->shared()->HasBuiltinFunctionId()) {
1984 BuiltinFunctionId id = function->shared()->builtin_function_id();
1985 #define CALL_GENERATOR_CASE(name) if (id == k##name) return false;
1986 SITE_SPECIFIC_CALL_GENERATORS(CALL_GENERATOR_CASE)
1987 #undef CALL_GENERATOR_CASE
1988 }
1989
1990 return true;
1991 }
1992
1993
1977 Handle<Code> CallStubCompiler::CompileCustomCall( 1994 Handle<Code> CallStubCompiler::CompileCustomCall(
1978 Handle<Object> object, 1995 Handle<Object> object,
1979 Handle<JSObject> holder, 1996 Handle<JSObject> holder,
1980 Handle<JSGlobalPropertyCell> cell, 1997 Handle<Cell> cell,
1981 Handle<JSFunction> function, 1998 Handle<JSFunction> function,
1982 Handle<String> fname) { 1999 Handle<String> fname,
2000 Code::StubType type) {
1983 ASSERT(HasCustomCallGenerator(function)); 2001 ASSERT(HasCustomCallGenerator(function));
1984 2002
1985 if (function->shared()->HasBuiltinFunctionId()) { 2003 if (function->shared()->HasBuiltinFunctionId()) {
1986 BuiltinFunctionId id = function->shared()->builtin_function_id(); 2004 BuiltinFunctionId id = function->shared()->builtin_function_id();
1987 #define CALL_GENERATOR_CASE(name) \ 2005 #define CALL_GENERATOR_CASE(name) \
1988 if (id == k##name) { \ 2006 if (id == k##name) { \
1989 return CallStubCompiler::Compile##name##Call(object, \ 2007 return CallStubCompiler::Compile##name##Call(object, \
1990 holder, \ 2008 holder, \
1991 cell, \ 2009 cell, \
1992 function, \ 2010 function, \
1993 fname); \ 2011 fname, \
2012 type); \
1994 } 2013 }
1995 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE) 2014 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE)
1996 #undef CALL_GENERATOR_CASE 2015 #undef CALL_GENERATOR_CASE
1997 } 2016 }
1998 CallOptimization optimization(function); 2017 CallOptimization optimization(function);
1999 ASSERT(optimization.is_simple_api_call()); 2018 ASSERT(optimization.is_simple_api_call());
2000 return CompileFastApiCall(optimization, 2019 return CompileFastApiCall(optimization,
2001 object, 2020 object,
2002 holder, 2021 holder,
2003 cell, 2022 cell,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 Handle<FunctionTemplateInfo>( 2112 Handle<FunctionTemplateInfo>(
2094 FunctionTemplateInfo::cast(signature->receiver())); 2113 FunctionTemplateInfo::cast(signature->receiver()));
2095 } 2114 }
2096 } 2115 }
2097 2116
2098 is_simple_api_call_ = true; 2117 is_simple_api_call_ = true;
2099 } 2118 }
2100 2119
2101 2120
2102 } } // namespace v8::internal 2121 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/type-info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698