| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 290 |
| 291 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder); | 291 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder); |
| 292 Handle<Code> code = | 292 Handle<Code> code = |
| 293 compiler.CompileCallConstant(object, holder, name, check, function); | 293 compiler.CompileCallConstant(object, holder, name, check, function); |
| 294 code->set_check_type(check); | 294 code->set_check_type(check); |
| 295 ASSERT(flags == code->flags()); | 295 ASSERT(flags == code->flags()); |
| 296 PROFILE(isolate_, | 296 PROFILE(isolate_, |
| 297 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); | 297 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); |
| 298 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); | 298 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); |
| 299 | 299 |
| 300 if (CallStubCompiler::CanBeCached(function)) { | 300 HeapObject::UpdateMapCodeCache(stub_holder, name, code); |
| 301 HeapObject::UpdateMapCodeCache(stub_holder, name, code); | |
| 302 } | |
| 303 return code; | 301 return code; |
| 304 } | 302 } |
| 305 | 303 |
| 306 | 304 |
| 307 Handle<Code> StubCache::ComputeCallField(int argc, | 305 Handle<Code> StubCache::ComputeCallField(int argc, |
| 308 Code::Kind kind, | 306 Code::Kind kind, |
| 309 ExtraICState extra_state, | 307 ExtraICState extra_state, |
| 310 Handle<Name> name, | 308 Handle<Name> name, |
| 311 Handle<Object> object, | 309 Handle<Object> object, |
| 312 Handle<JSObject> holder, | 310 Handle<JSObject> holder, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 isolate_); | 393 isolate_); |
| 396 if (probe->IsCode()) return Handle<Code>::cast(probe); | 394 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 397 | 395 |
| 398 CallStubCompiler compiler(isolate(), argc, kind, extra_state); | 396 CallStubCompiler compiler(isolate(), argc, kind, extra_state); |
| 399 Handle<Code> code = | 397 Handle<Code> code = |
| 400 compiler.CompileCallGlobal(receiver, holder, cell, function, name); | 398 compiler.CompileCallGlobal(receiver, holder, cell, function, name); |
| 401 ASSERT(flags == code->flags()); | 399 ASSERT(flags == code->flags()); |
| 402 PROFILE(isolate(), | 400 PROFILE(isolate(), |
| 403 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); | 401 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); |
| 404 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); | 402 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); |
| 405 if (CallStubCompiler::CanBeCached(function)) { | 403 HeapObject::UpdateMapCodeCache(receiver, name, code); |
| 406 HeapObject::UpdateMapCodeCache(receiver, name, code); | |
| 407 } | |
| 408 return code; | 404 return code; |
| 409 } | 405 } |
| 410 | 406 |
| 411 | 407 |
| 412 static void FillCache(Isolate* isolate, Handle<Code> code) { | 408 static void FillCache(Isolate* isolate, Handle<Code> code) { |
| 413 Handle<UnseededNumberDictionary> dictionary = | 409 Handle<UnseededNumberDictionary> dictionary = |
| 414 UnseededNumberDictionary::Set(isolate->factory()->non_monomorphic_cache(), | 410 UnseededNumberDictionary::Set(isolate->factory()->non_monomorphic_cache(), |
| 415 code->flags(), | 411 code->flags(), |
| 416 code); | 412 code); |
| 417 isolate->heap()->public_set_non_monomorphic_cache(*dictionary); | 413 isolate->heap()->public_set_non_monomorphic_cache(*dictionary); |
| (...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 #define CALL_GENERATOR_CASE(name) if (id == k##name) return true; | 1891 #define CALL_GENERATOR_CASE(name) if (id == k##name) return true; |
| 1896 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE) | 1892 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE) |
| 1897 #undef CALL_GENERATOR_CASE | 1893 #undef CALL_GENERATOR_CASE |
| 1898 } | 1894 } |
| 1899 | 1895 |
| 1900 CallOptimization optimization(function); | 1896 CallOptimization optimization(function); |
| 1901 return optimization.is_simple_api_call(); | 1897 return optimization.is_simple_api_call(); |
| 1902 } | 1898 } |
| 1903 | 1899 |
| 1904 | 1900 |
| 1905 bool CallStubCompiler::CanBeCached(Handle<JSFunction> function) { | |
| 1906 if (function->shared()->HasBuiltinFunctionId()) { | |
| 1907 BuiltinFunctionId id = function->shared()->builtin_function_id(); | |
| 1908 #define CALL_GENERATOR_CASE(name) if (id == k##name) return false; | |
| 1909 SITE_SPECIFIC_CALL_GENERATORS(CALL_GENERATOR_CASE) | |
| 1910 #undef CALL_GENERATOR_CASE | |
| 1911 } | |
| 1912 | |
| 1913 return true; | |
| 1914 } | |
| 1915 | |
| 1916 | |
| 1917 Handle<Code> CallStubCompiler::CompileCustomCall( | 1901 Handle<Code> CallStubCompiler::CompileCustomCall( |
| 1918 Handle<Object> object, | 1902 Handle<Object> object, |
| 1919 Handle<JSObject> holder, | 1903 Handle<JSObject> holder, |
| 1920 Handle<Cell> cell, | 1904 Handle<Cell> cell, |
| 1921 Handle<JSFunction> function, | 1905 Handle<JSFunction> function, |
| 1922 Handle<String> fname, | 1906 Handle<String> fname, |
| 1923 Code::StubType type) { | 1907 Code::StubType type) { |
| 1924 ASSERT(HasCustomCallGenerator(function)); | 1908 ASSERT(HasCustomCallGenerator(function)); |
| 1925 | 1909 |
| 1926 if (function->shared()->HasBuiltinFunctionId()) { | 1910 if (function->shared()->HasBuiltinFunctionId()) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2033 Handle<FunctionTemplateInfo>( | 2017 Handle<FunctionTemplateInfo>( |
| 2034 FunctionTemplateInfo::cast(signature->receiver())); | 2018 FunctionTemplateInfo::cast(signature->receiver())); |
| 2035 } | 2019 } |
| 2036 } | 2020 } |
| 2037 | 2021 |
| 2038 is_simple_api_call_ = true; | 2022 is_simple_api_call_ = true; |
| 2039 } | 2023 } |
| 2040 | 2024 |
| 2041 | 2025 |
| 2042 } } // namespace v8::internal | 2026 } } // namespace v8::internal |
| OLD | NEW |