summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/bytecode/BytecodeUseDef.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/bytecode/BytecodeUseDef.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/JavaScriptCore/bytecode/BytecodeUseDef.h')
-rw-r--r--Source/JavaScriptCore/bytecode/BytecodeUseDef.h334
1 files changed, 205 insertions, 129 deletions
diff --git a/Source/JavaScriptCore/bytecode/BytecodeUseDef.h b/Source/JavaScriptCore/bytecode/BytecodeUseDef.h
index 45cb91a1c..99b939403 100644
--- a/Source/JavaScriptCore/bytecode/BytecodeUseDef.h
+++ b/Source/JavaScriptCore/bytecode/BytecodeUseDef.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015-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
@@ -23,50 +23,45 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef BytecodeUseDef_h
-#define BytecodeUseDef_h
+#pragma once
#include "CodeBlock.h"
+#include "Interpreter.h"
namespace JSC {
-template<typename Functor>
-void computeUsesForBytecodeOffset(
- CodeBlock* codeBlock, unsigned bytecodeOffset, Functor& functor)
+template<typename Block, typename Functor, typename Instruction>
+void computeUsesForBytecodeOffset(Block* codeBlock, OpcodeID opcodeID, Instruction* instruction, const Functor& functor)
{
- Interpreter* interpreter = codeBlock->vm()->interpreter;
- Instruction* instructionsBegin = codeBlock->instructions().begin();
- Instruction* instruction = &instructionsBegin[bytecodeOffset];
- OpcodeID opcodeID = interpreter->getOpcodeID(instruction->u.opcode);
+ if (opcodeID != op_enter && codeBlock->wasCompiledWithDebuggingOpcodes() && codeBlock->scopeRegister().isValid())
+ functor(codeBlock, instruction, opcodeID, codeBlock->scopeRegister().offset());
+
switch (opcodeID) {
// No uses.
case op_new_regexp:
case op_new_array_buffer:
case op_throw_static_error:
case op_debug:
- case op_resolve_scope:
- case op_pop_scope:
case op_jneq_ptr:
- case op_new_func_exp:
case op_loop_hint:
case op_jmp:
case op_new_object:
- case op_init_lazy_reg:
- case op_get_callee:
case op_enter:
+ case op_argument_count:
case op_catch:
- case op_touch_entry:
+ case op_profile_control_flow:
+ case op_create_direct_arguments:
+ case op_create_cloned_arguments:
+ case op_get_rest_length:
+ case op_watchdog:
+ case op_get_argument:
return;
- case op_new_func:
- case op_new_captured_func:
- case op_create_activation:
- case op_create_arguments:
+ case op_assert:
+ case op_get_scope:
case op_to_this:
- case op_tear_off_activation:
- case op_profile_will_call:
- case op_profile_did_call:
+ case op_check_tdz:
+ case op_profile_type:
case op_throw:
- case op_push_with_scope:
case op_end:
case op_ret:
case op_jtrue:
@@ -74,11 +69,12 @@ void computeUsesForBytecodeOffset(
case op_jeq_null:
case op_jneq_null:
case op_dec:
- case op_inc: {
+ case op_inc:
+ case op_log_shadow_chicken_prologue: {
+ ASSERT(opcodeLengths[opcodeID] > 1);
functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
return;
}
- case op_ret_object_or_this:
case op_jlesseq:
case op_jgreater:
case op_jgreatereq:
@@ -86,91 +82,146 @@ void computeUsesForBytecodeOffset(
case op_jnlesseq:
case op_jngreater:
case op_jngreatereq:
- case op_jless: {
+ case op_jless:
+ case op_set_function_name:
+ case op_log_shadow_chicken_tail: {
+ ASSERT(opcodeLengths[opcodeID] > 2);
functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
return;
}
case op_put_by_val_direct:
case op_put_by_val: {
+ ASSERT(opcodeLengths[opcodeID] > 3);
functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
return;
}
case op_put_by_index:
- case op_put_by_id_replace:
- case op_put_by_id_transition:
- 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_put_by_id_generic:
- case op_put_by_id_out_of_line:
case op_put_by_id:
- case op_put_to_scope: {
+ case op_put_to_scope:
+ case op_put_to_arguments: {
+ ASSERT(opcodeLengths[opcodeID] > 3);
functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
return;
}
- case op_put_getter_setter: {
+ case op_put_by_id_with_this: {
+ ASSERT(opcodeLengths[opcodeID] > 4);
functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[4].u.operand);
+ return;
+ }
+ case op_put_by_val_with_this: {
+ ASSERT(opcodeLengths[opcodeID] > 4);
+ functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[4].u.operand);
return;
}
- case op_init_global_const_nop:
- case op_init_global_const:
- case op_push_name_scope:
+ case op_put_getter_by_id:
+ case op_put_setter_by_id: {
+ ASSERT(opcodeLengths[opcodeID] > 4);
+ functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[4].u.operand);
+ return;
+ }
+ case op_put_getter_setter_by_id: {
+ ASSERT(opcodeLengths[opcodeID] > 5);
+ functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[4].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[5].u.operand);
+ return;
+ }
+ case op_put_getter_by_val:
+ case op_put_setter_by_val: {
+ ASSERT(opcodeLengths[opcodeID] > 4);
+ functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[4].u.operand);
+ return;
+ }
+ case op_define_data_property: {
+ ASSERT(opcodeLengths[opcodeID] > 4);
+ functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[4].u.operand);
+ return;
+ }
+ case op_define_accessor_property: {
+ ASSERT(opcodeLengths[opcodeID] > 5);
+ functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[4].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[5].u.operand);
+ return;
+ }
+ case op_spread:
+ case op_get_property_enumerator:
+ case op_get_enumerable_length:
+ case op_new_func_exp:
+ case op_new_generator_func_exp:
+ case op_new_async_func_exp:
+ case op_to_index_string:
+ case op_create_lexical_environment:
+ case op_resolve_scope:
case op_get_from_scope:
case op_to_primitive:
+ case op_try_get_by_id:
case op_get_by_id:
- case op_get_by_id_out_of_line:
- case op_get_by_id_self:
- case op_get_by_id_proto:
- case op_get_by_id_chain:
- case op_get_by_id_getter_self:
- case op_get_by_id_getter_proto:
- case op_get_by_id_getter_chain:
- case op_get_by_id_custom_self:
- case op_get_by_id_custom_proto:
- case op_get_by_id_custom_chain:
- case op_get_by_id_generic:
+ case op_get_by_id_proto_load:
+ case op_get_by_id_unset:
case op_get_array_length:
- case op_get_string_length:
- case op_get_arguments_length:
case op_typeof:
+ 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_to_number:
+ case op_to_string:
case op_negate:
case op_neq_null:
case op_eq_null:
case op_not:
case op_mov:
- case op_captured_mov:
case op_new_array_with_size:
case op_create_this:
- case op_get_pnames:
case op_del_by_id:
- case op_unsigned: {
+ case op_unsigned:
+ case op_new_func:
+ case op_new_generator_func:
+ case op_new_async_func:
+ case op_get_parent_scope:
+ case op_create_scoped_arguments:
+ case op_create_rest:
+ case op_get_from_arguments: {
+ ASSERT(opcodeLengths[opcodeID] > 2);
functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
return;
}
+ case op_has_generic_property:
+ case op_has_indexed_property:
+ case op_enumerator_structure_pname:
+ case op_enumerator_generic_pname:
case op_get_by_val:
- case op_get_argument_by_val:
case op_in:
+ case op_overrides_has_instance:
case op_instanceof:
- case op_check_has_instance:
case op_add:
case op_mul:
case op_div:
case op_mod:
case op_sub:
+ case op_pow:
case op_lshift:
case op_rshift:
case op_urshift:
@@ -185,38 +236,49 @@ void computeUsesForBytecodeOffset(
case op_stricteq:
case op_neq:
case op_eq:
- case op_del_by_val: {
+ case op_push_with_scope:
+ case op_get_by_id_with_this:
+ case op_del_by_val:
+ case op_tail_call_forward_arguments: {
+ ASSERT(opcodeLengths[opcodeID] > 3);
functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
return;
}
- case op_call_varargs: {
+ case op_get_by_val_with_this: {
+ ASSERT(opcodeLengths[opcodeID] > 4);
functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[4].u.operand);
return;
}
- case op_next_pname: {
+ case op_instanceof_custom:
+ case op_has_structure_property:
+ case op_construct_varargs:
+ case op_call_varargs:
+ case op_tail_call_varargs: {
+ ASSERT(opcodeLengths[opcodeID] > 4);
functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[4].u.operand);
- functor(codeBlock, instruction, opcodeID, instruction[5].u.operand);
return;
}
- case op_get_by_pname: {
+ case op_get_direct_pname: {
+ ASSERT(opcodeLengths[opcodeID] > 5);
functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[4].u.operand);
functor(codeBlock, instruction, opcodeID, instruction[5].u.operand);
- functor(codeBlock, instruction, opcodeID, instruction[6].u.operand);
return;
}
case op_switch_string:
case op_switch_char:
case op_switch_imm: {
+ ASSERT(opcodeLengths[opcodeID] > 3);
functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
return;
}
+ case op_new_array_with_spread:
case op_new_array:
case op_strcat: {
int base = instruction[2].u.operand;
@@ -227,19 +289,21 @@ void computeUsesForBytecodeOffset(
}
case op_construct:
case op_call_eval:
- case op_call: {
+ case op_call:
+ case op_tail_call: {
functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
int argCount = instruction[3].u.operand;
int registerOffset = -instruction[4].u.operand;
int lastArg = registerOffset + CallFrame::thisArgumentOffset();
- for (int i = opcodeID == op_construct ? 1 : 0; i < argCount; i++)
+ for (int i = 0; i < argCount; i++)
functor(codeBlock, instruction, opcodeID, lastArg + i);
+ if (opcodeID == op_call_eval)
+ functor(codeBlock, instruction, opcodeID, codeBlock->scopeRegister().offset());
return;
}
- case op_tear_off_arguments: {
+ case op_yield: {
functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
- functor(codeBlock, instruction, opcodeID, unmodifiedArgumentsRegister(VirtualRegister(instruction[1].u.operand)).offset());
- functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
return;
}
default:
@@ -248,29 +312,18 @@ void computeUsesForBytecodeOffset(
}
}
-template<typename Functor>
-void computeDefsForBytecodeOffset(CodeBlock* codeBlock, unsigned bytecodeOffset, Functor& functor)
+template<typename Block, typename Instruction, typename Functor>
+void computeDefsForBytecodeOffset(Block* codeBlock, OpcodeID opcodeID, Instruction* instruction, const Functor& functor)
{
- Interpreter* interpreter = codeBlock->vm()->interpreter;
- Instruction* instructionsBegin = codeBlock->instructions().begin();
- Instruction* instruction = &instructionsBegin[bytecodeOffset];
- OpcodeID opcodeID = interpreter->getOpcodeID(instruction->u.opcode);
switch (opcodeID) {
// These don't define anything.
- case op_init_global_const:
- case op_init_global_const_nop:
- case op_push_name_scope:
- case op_push_with_scope:
case op_put_to_scope:
- case op_pop_scope:
case op_end:
- case op_profile_will_call:
- case op_profile_did_call:
case op_throw:
case op_throw_static_error:
+ case op_assert:
case op_debug:
case op_ret:
- case op_ret_object_or_this:
case op_jmp:
case op_jtrue:
case op_jfalse:
@@ -290,79 +343,99 @@ void computeDefsForBytecodeOffset(CodeBlock* codeBlock, unsigned bytecodeOffset,
case op_switch_char:
case op_switch_string:
case op_put_by_id:
- case op_put_by_id_out_of_line:
- case op_put_by_id_replace:
- case op_put_by_id_transition:
- 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_put_by_id_generic:
- case op_put_getter_setter:
+ 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_put_by_val:
case op_put_by_val_direct:
case op_put_by_index:
- case op_tear_off_arguments:
- case op_touch_entry:
+ case op_define_data_property:
+ case op_define_accessor_property:
+ case op_profile_type:
+ case op_profile_control_flow:
+ case op_put_to_arguments:
+ case op_set_function_name:
+ case op_watchdog:
+ case op_log_shadow_chicken_prologue:
+ case op_log_shadow_chicken_tail:
+ case op_yield:
#define LLINT_HELPER_OPCODES(opcode, length) case opcode:
FOR_EACH_LLINT_OPCODE_EXTENSION(LLINT_HELPER_OPCODES);
#undef LLINT_HELPER_OPCODES
return;
// These all have a single destination for the first argument.
- case op_next_pname:
+ case op_argument_count:
+ case op_to_index_string:
+ case op_get_enumerable_length:
+ case op_has_indexed_property:
+ case op_has_structure_property:
+ case op_has_generic_property:
+ case op_get_direct_pname:
+ case op_get_property_enumerator:
+ case op_enumerator_structure_pname:
+ case op_enumerator_generic_pname:
+ case op_get_parent_scope:
+ case op_push_with_scope:
+ case op_create_lexical_environment:
case op_resolve_scope:
case op_strcat:
- case op_tear_off_activation:
case op_to_primitive:
- case op_catch:
case op_create_this:
case op_new_array:
+ case op_new_array_with_spread:
+ case op_spread:
case op_new_array_buffer:
case op_new_array_with_size:
case op_new_regexp:
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_call_varargs:
+ case op_tail_call_varargs:
+ case op_tail_call_forward_arguments:
+ case op_construct_varargs:
case op_get_from_scope:
case op_call:
+ case op_tail_call:
case op_call_eval:
case op_construct:
+ case op_try_get_by_id:
case op_get_by_id:
- case op_get_by_id_out_of_line:
- case op_get_by_id_self:
- case op_get_by_id_proto:
- case op_get_by_id_chain:
- case op_get_by_id_getter_self:
- case op_get_by_id_getter_proto:
- case op_get_by_id_getter_chain:
- case op_get_by_id_custom_self:
- case op_get_by_id_custom_proto:
- case op_get_by_id_custom_chain:
- case op_get_by_id_generic:
+ 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_get_string_length:
- case op_check_has_instance:
+ case op_overrides_has_instance:
case op_instanceof:
+ case op_instanceof_custom:
case op_get_by_val:
- case op_get_argument_by_val:
- case op_get_by_pname:
- case op_get_arguments_length:
case op_typeof:
+ 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_in:
case op_to_number:
+ case op_to_string:
case op_negate:
case op_add:
case op_mul:
case op_div:
case op_mod:
case op_sub:
+ case op_pow:
case op_lshift:
case op_rshift:
case op_urshift:
@@ -383,33 +456,36 @@ void computeDefsForBytecodeOffset(CodeBlock* codeBlock, unsigned bytecodeOffset,
case op_eq_null:
case op_not:
case op_mov:
- case op_captured_mov:
case op_new_object:
case op_to_this:
- case op_get_callee:
- case op_init_lazy_reg:
- case op_create_activation:
- case op_create_arguments:
+ case op_check_tdz:
+ case op_get_scope:
+ case op_create_direct_arguments:
+ case op_create_scoped_arguments:
+ case op_create_cloned_arguments:
case op_del_by_id:
case op_del_by_val:
- case op_unsigned: {
+ case op_unsigned:
+ case op_get_from_arguments:
+ case op_get_argument:
+ case op_create_rest:
+ case op_get_rest_length: {
+ ASSERT(opcodeLengths[opcodeID] > 1);
functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
return;
}
- case op_get_pnames: {
+ case op_catch: {
+ ASSERT(opcodeLengths[opcodeID] > 2);
functor(codeBlock, instruction, opcodeID, instruction[1].u.operand);
- functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
- functor(codeBlock, instruction, opcodeID, instruction[4].u.operand);
+ functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
return;
}
case op_enter: {
for (unsigned i = codeBlock->m_numVars; i--;)
functor(codeBlock, instruction, opcodeID, virtualRegisterForLocal(i).offset());
return;
- } }
+ }
+ }
}
} // namespace JSC
-
-#endif // BytecodeUseDef_h
-