diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/dfg/DFGCapabilities.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGCapabilities.cpp')
-rw-r--r-- | Source/JavaScriptCore/dfg/DFGCapabilities.cpp | 167 |
1 files changed, 105 insertions, 62 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGCapabilities.cpp b/Source/JavaScriptCore/dfg/DFGCapabilities.cpp index e6fcd8c11..b786d5563 100644 --- a/Source/JavaScriptCore/dfg/DFGCapabilities.cpp +++ b/Source/JavaScriptCore/dfg/DFGCapabilities.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, 2013, 2014 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2013-2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,44 +31,65 @@ #include "CodeBlock.h" #include "DFGCommon.h" #include "Interpreter.h" +#include "JSCInlines.h" +#include "Options.h" namespace JSC { namespace DFG { -#if ENABLE(DFG_JIT) +bool isSupported() +{ + return Options::useDFGJIT() + && MacroAssembler::supportsFloatingPoint(); +} + +bool isSupportedForInlining(CodeBlock* codeBlock) +{ + return codeBlock->ownerScriptExecutable()->isInliningCandidate(); +} + bool mightCompileEval(CodeBlock* codeBlock) { - return codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount(); + return isSupported() + && codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount() + && codeBlock->ownerScriptExecutable()->isOkToOptimize(); } bool mightCompileProgram(CodeBlock* codeBlock) { - return codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount(); + return isSupported() + && codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount() + && codeBlock->ownerScriptExecutable()->isOkToOptimize(); } bool mightCompileFunctionForCall(CodeBlock* codeBlock) { - return codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount(); + return isSupported() + && codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount() + && codeBlock->ownerScriptExecutable()->isOkToOptimize(); } bool mightCompileFunctionForConstruct(CodeBlock* codeBlock) { - return codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount(); + return isSupported() + && codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount() + && codeBlock->ownerScriptExecutable()->isOkToOptimize(); } bool mightInlineFunctionForCall(CodeBlock* codeBlock) { return codeBlock->instructionCount() <= Options::maximumFunctionForCallInlineCandidateInstructionCount() - && !codeBlock->ownerExecutable()->needsActivation() - && codeBlock->ownerExecutable()->isInliningCandidate(); + && isSupportedForInlining(codeBlock); } bool mightInlineFunctionForClosureCall(CodeBlock* codeBlock) { return codeBlock->instructionCount() <= Options::maximumFunctionForClosureCallInlineCandidateInstructionCount() - && !codeBlock->ownerExecutable()->needsActivation() - && codeBlock->ownerExecutable()->isInliningCandidate(); + && isSupportedForInlining(codeBlock); } bool mightInlineFunctionForConstruct(CodeBlock* codeBlock) { return codeBlock->instructionCount() <= Options::maximumFunctionForConstructInlineCandidateInstructionCount() - && !codeBlock->ownerExecutable()->needsActivation() - && codeBlock->ownerExecutable()->isInliningCandidate(); + && isSupportedForInlining(codeBlock); +} +bool canUseOSRExitFuzzing(CodeBlock* codeBlock) +{ + return codeBlock->ownerScriptExecutable()->canUseOSRExitFuzzing(); } inline void debugFail(CodeBlock* codeBlock, OpcodeID opcodeID, CapabilityLevel result) @@ -79,12 +100,15 @@ inline void debugFail(CodeBlock* codeBlock, OpcodeID opcodeID, CapabilityLevel r CapabilityLevel capabilityLevel(OpcodeID opcodeID, CodeBlock* codeBlock, Instruction* pc) { + UNUSED_PARAM(codeBlock); // This function does some bytecode parsing. Ordinarily bytecode parsing requires the owning CodeBlock. It's sort of strange that we don't use it here right now. + UNUSED_PARAM(pc); + switch (opcodeID) { case op_enter: - case op_touch_entry: case op_to_this: + case op_argument_count: + case op_check_tdz: case op_create_this: - case op_get_callee: case op_bitand: case op_bitor: case op_bitxor: @@ -99,19 +123,22 @@ CapabilityLevel capabilityLevel(OpcodeID opcodeID, CodeBlock* codeBlock, Instruc case op_negate: case op_mul: case op_mod: + case op_pow: case op_div: case op_debug: - case op_profile_will_call: - case op_profile_did_call: + case op_profile_type: + case op_profile_control_flow: case op_mov: - case op_captured_mov: - case op_check_has_instance: + case op_overrides_has_instance: case op_instanceof: + case op_instanceof_custom: + case op_is_empty: case op_is_undefined: case op_is_boolean: case op_is_number: - case op_is_string: case op_is_object: + case op_is_object_or_null: + case op_is_cell_with_type: case op_is_function: case op_not: case op_less: @@ -127,17 +154,25 @@ CapabilityLevel capabilityLevel(OpcodeID opcodeID, CodeBlock* codeBlock, Instruc case op_get_by_val: case op_put_by_val: case op_put_by_val_direct: + case op_try_get_by_id: case op_get_by_id: - case op_get_by_id_out_of_line: + case op_get_by_id_proto_load: + case op_get_by_id_unset: + case op_get_by_id_with_this: + case op_get_by_val_with_this: case op_get_array_length: case op_put_by_id: - case op_put_by_id_out_of_line: - case op_put_by_id_transition_direct: - case op_put_by_id_transition_direct_out_of_line: - case op_put_by_id_transition_normal: - case op_put_by_id_transition_normal_out_of_line: - case op_init_global_const_nop: - case op_init_global_const: + case op_put_by_id_with_this: + case op_put_by_val_with_this: + case op_put_getter_by_id: + case op_put_setter_by_id: + case op_put_getter_setter_by_id: + case op_put_getter_by_val: + case op_put_setter_by_val: + case op_define_data_property: + case op_define_accessor_property: + case op_del_by_id: + case op_del_by_val: case op_jmp: case op_jtrue: case op_jfalse: @@ -152,61 +187,71 @@ CapabilityLevel capabilityLevel(OpcodeID opcodeID, CodeBlock* codeBlock, Instruc case op_jngreater: case op_jngreatereq: case op_loop_hint: + case op_watchdog: case op_ret: case op_end: case op_new_object: case op_new_array: case op_new_array_with_size: case op_new_array_buffer: + case op_new_array_with_spread: + case op_spread: case op_strcat: case op_to_primitive: case op_throw: case op_throw_static_error: case op_call: + case op_tail_call: case op_construct: - case op_init_lazy_reg: - case op_create_arguments: - case op_tear_off_arguments: - case op_get_argument_by_val: - case op_get_arguments_length: + case op_call_varargs: + case op_tail_call_varargs: + case op_tail_call_forward_arguments: + case op_construct_varargs: + case op_create_direct_arguments: + case op_create_scoped_arguments: + case op_create_cloned_arguments: + case op_get_from_arguments: + case op_put_to_arguments: + case op_get_argument: case op_jneq_ptr: case op_typeof: case op_to_number: + case op_to_string: case op_switch_imm: case op_switch_char: case op_in: + case op_get_scope: case op_get_from_scope: - return CanCompileAndInline; - - case op_put_to_scope: { - ResolveType resolveType = ResolveModeAndType(pc[4].u.operand).type(); - // If we're writing to a readonly property we emit a Dynamic put that - // the DFG can't currently handle. - if (resolveType == Dynamic) - return CannotCompile; - return CanCompileAndInline; - } - - case op_resolve_scope: { - // We don't compile 'catch' or 'with', so there's no point in compiling variable resolution within them. - ResolveType resolveType = ResolveModeAndType(pc[3].u.operand).type(); - if (resolveType == Dynamic) - return CannotCompile; - return CanCompileAndInline; - } - - case op_call_varargs: - if (codeBlock->usesArguments() && pc[4].u.operand == codeBlock->argumentsRegister().offset()) - return CanInline; - return CannotCompile; - - case op_new_regexp: - case op_create_activation: - case op_tear_off_activation: + case op_get_enumerable_length: + case op_has_generic_property: + case op_has_structure_property: + case op_has_indexed_property: + case op_get_direct_pname: + case op_get_property_enumerator: + case op_enumerator_structure_pname: + case op_enumerator_generic_pname: + case op_to_index_string: case op_new_func: - case op_new_captured_func: case op_new_func_exp: + case op_new_generator_func: + case op_new_generator_func_exp: + case op_new_async_func: + case op_new_async_func_exp: + case op_set_function_name: + case op_create_lexical_environment: + case op_get_parent_scope: + case op_catch: + case op_create_rest: + case op_get_rest_length: + case op_log_shadow_chicken_prologue: + case op_log_shadow_chicken_tail: + case op_put_to_scope: + case op_resolve_scope: + case op_new_regexp: + return CanCompileAndInline; + case op_switch_string: // Don't inline because we don't want to copy string tables in the concurrent JIT. + case op_call_eval: return CanCompile; default: @@ -244,8 +289,6 @@ CapabilityLevel capabilityLevel(CodeBlock* codeBlock) return result; } -#endif - } } // namespace JSC::DFG #endif |