Remove intrinsics (native_call opcode).
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
@@ -1,93 +0,0 @@
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2015 University of Szeged.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "opcodes-ecma-support.h"
|
||||
|
||||
#include "jrt.h"
|
||||
#include "vm.h"
|
||||
#include "opcodes.h"
|
||||
|
||||
#include "opcodes-native-call.h"
|
||||
|
||||
#include "jrt-libc-includes.h"
|
||||
|
||||
/**
|
||||
* 'Native call' opcode handler.
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
opfunc_native_call (vm_instr_t instr, /**< instruction */
|
||||
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
|
||||
{
|
||||
const idx_t dst_var_idx __attr_unused___ = instr.data.native_call.lhs;
|
||||
const idx_t native_call_id_idx = instr.data.native_call.name;
|
||||
const idx_t args_number = instr.data.native_call.arg_list;
|
||||
const vm_instr_counter_t __attr_unused___ lit_oc = frame_ctx_p->pos;
|
||||
|
||||
JERRY_ASSERT (native_call_id_idx < OPCODE_NATIVE_CALL__COUNT);
|
||||
|
||||
frame_ctx_p->pos++;
|
||||
|
||||
JERRY_STATIC_ASSERT (OPCODE_NATIVE_CALL__COUNT < (1u << (sizeof (native_call_id_idx) * JERRY_BITSINBYTE)));
|
||||
|
||||
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
|
||||
|
||||
MEM_DEFINE_LOCAL_ARRAY (arg_values, args_number, ecma_value_t);
|
||||
|
||||
ecma_length_t args_read;
|
||||
ecma_completion_value_t get_arg_completion = fill_varg_list (frame_ctx_p,
|
||||
args_number,
|
||||
arg_values,
|
||||
&args_read);
|
||||
|
||||
if (ecma_is_completion_value_empty (get_arg_completion))
|
||||
{
|
||||
JERRY_ASSERT (args_read == args_number);
|
||||
|
||||
switch ((opcode_native_call_t)native_call_id_idx)
|
||||
{
|
||||
case OPCODE_NATIVE_CALL_LED_TOGGLE:
|
||||
case OPCODE_NATIVE_CALL_LED_ON:
|
||||
case OPCODE_NATIVE_CALL_LED_OFF:
|
||||
case OPCODE_NATIVE_CALL_LED_ONCE:
|
||||
case OPCODE_NATIVE_CALL_WAIT:
|
||||
{
|
||||
JERRY_UNIMPLEMENTED ("Device operations are not implemented.");
|
||||
}
|
||||
|
||||
case OPCODE_NATIVE_CALL__COUNT:
|
||||
{
|
||||
JERRY_UNREACHABLE ();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JERRY_ASSERT (!ecma_is_completion_value_normal (get_arg_completion));
|
||||
|
||||
ret_value = get_arg_completion;
|
||||
}
|
||||
|
||||
for (ecma_length_t arg_index = 0;
|
||||
arg_index < args_read;
|
||||
arg_index++)
|
||||
{
|
||||
ecma_free_value (arg_values[arg_index], true);
|
||||
}
|
||||
|
||||
MEM_FINALIZE_LOCAL_ARRAY (arg_values);
|
||||
|
||||
return ret_value;
|
||||
} /* opfunc_native_call */
|
||||
@@ -1,32 +0,0 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OPCODES_NATIVE_CALL_H
|
||||
#define OPCODES_NATIVE_CALL_H
|
||||
|
||||
/**
|
||||
* Identifier of a native call
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
OPCODE_NATIVE_CALL_LED_TOGGLE,
|
||||
OPCODE_NATIVE_CALL_LED_ON,
|
||||
OPCODE_NATIVE_CALL_LED_OFF,
|
||||
OPCODE_NATIVE_CALL_LED_ONCE,
|
||||
OPCODE_NATIVE_CALL_WAIT,
|
||||
OPCODE_NATIVE_CALL__COUNT
|
||||
} opcode_native_call_t;
|
||||
|
||||
#endif /* !OPCODES_NATIVE_CALL_H */
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "pretty-printer.h"
|
||||
#include "jrt-libc-includes.h"
|
||||
#include "lexer.h"
|
||||
#include "opcodes-native-call.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "serializer.h"
|
||||
@@ -279,28 +278,6 @@ pp_op_meta (const vm_instr_t *instrs_p,
|
||||
|
||||
break;
|
||||
}
|
||||
case VM_OP_NATIVE_CALL:
|
||||
{
|
||||
if (opm.op.data.native_call.arg_list == 0)
|
||||
{
|
||||
printf ("%s = ", VAR (1));
|
||||
switch (opm.op.data.native_call.name)
|
||||
{
|
||||
case OPCODE_NATIVE_CALL_LED_TOGGLE: printf ("LEDToggle ();"); break;
|
||||
case OPCODE_NATIVE_CALL_LED_ON: printf ("LEDOn ();"); break;
|
||||
case OPCODE_NATIVE_CALL_LED_OFF: printf ("LEDOff ();"); break;
|
||||
case OPCODE_NATIVE_CALL_LED_ONCE: printf ("LEDOnce ();"); break;
|
||||
case OPCODE_NATIVE_CALL_WAIT: printf ("wait ();"); break;
|
||||
default: JERRY_UNREACHABLE ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vargs_num = opm.op.data.native_call.arg_list;
|
||||
seen_vargs = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VM_OP_CONSTRUCT_N:
|
||||
{
|
||||
if (opm.op.data.construct_n.arg_list == 0)
|
||||
@@ -403,7 +380,6 @@ pp_op_meta (const vm_instr_t *instrs_p,
|
||||
switch (serializer_get_instr (instrs_p, start).op_idx)
|
||||
{
|
||||
case VM_OP_CALL_N:
|
||||
case VM_OP_NATIVE_CALL:
|
||||
case VM_OP_CONSTRUCT_N:
|
||||
case VM_OP_FUNC_DECL_N:
|
||||
case VM_OP_FUNC_EXPR_N:
|
||||
@@ -423,20 +399,6 @@ pp_op_meta (const vm_instr_t *instrs_p,
|
||||
pp_printf ("%s = %s (", start_op, NULL, start, 1);
|
||||
break;
|
||||
}
|
||||
case VM_OP_NATIVE_CALL:
|
||||
{
|
||||
pp_printf ("%s = ", start_op, NULL, start, 1);
|
||||
switch (start_op.data.native_call.name)
|
||||
{
|
||||
case OPCODE_NATIVE_CALL_LED_TOGGLE: printf ("LEDToggle ("); break;
|
||||
case OPCODE_NATIVE_CALL_LED_ON: printf ("LEDOn ("); break;
|
||||
case OPCODE_NATIVE_CALL_LED_OFF: printf ("LEDOff ("); break;
|
||||
case OPCODE_NATIVE_CALL_LED_ONCE: printf ("LEDOnce ("); break;
|
||||
case OPCODE_NATIVE_CALL_WAIT: printf ("wait ("); break;
|
||||
default: JERRY_UNREACHABLE ();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VM_OP_CONSTRUCT_N:
|
||||
{
|
||||
pp_printf ("%s = new %s (", start_op, NULL, start, 1);
|
||||
|
||||
@@ -38,11 +38,6 @@ VM_OP_3 (call_n, CALL_N,
|
||||
function_var_idx, VM_OP_ARG_TYPE_VARIABLE,
|
||||
arg_list, VM_OP_ARG_TYPE_INTEGER_CONST)
|
||||
|
||||
VM_OP_3 (native_call, NATIVE_CALL,
|
||||
lhs, VM_OP_ARG_TYPE_VARIABLE,
|
||||
name, VM_OP_ARG_TYPE_INTEGER_CONST,
|
||||
arg_list, VM_OP_ARG_TYPE_INTEGER_CONST)
|
||||
|
||||
VM_OP_3 (construct_n, CONSTRUCT_N,
|
||||
lhs, VM_OP_ARG_TYPE_VARIABLE,
|
||||
name_lit_idx, VM_OP_ARG_TYPE_VARIABLE,
|
||||
|
||||
Reference in New Issue
Block a user