Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
facc2189
Commit
facc2189
authored
Nov 30, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 30, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Use bytecode for delete on array expression implementation.
parent
6c47177c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
2 deletions
+90
-2
compile.c
dlls/jscript/compile.c
+30
-0
engine.c
dlls/jscript/engine.c
+51
-1
engine.h
dlls/jscript/engine.h
+1
-0
parser.y
dlls/jscript/parser.y
+1
-1
lang.js
dlls/jscript/tests/lang.js
+7
-0
No files found.
dlls/jscript/compile.c
View file @
facc2189
...
...
@@ -301,6 +301,34 @@ static HRESULT compile_interp_fallback(compiler_ctx_t *ctx, expression_t *expr)
return
S_OK
;
}
static
HRESULT
compile_delete_expression
(
compiler_ctx_t
*
ctx
,
unary_expression_t
*
expr
)
{
HRESULT
hres
;
switch
(
expr
->
expression
->
type
)
{
case
EXPR_ARRAY
:
{
array_expression_t
*
array_expr
=
(
array_expression_t
*
)
expr
->
expression
;
hres
=
compile_expression
(
ctx
,
array_expr
->
member_expr
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
compile_expression
(
ctx
,
array_expr
->
expression
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
push_instr
(
ctx
,
OP_delete
)
==
-
1
)
return
E_OUTOFMEMORY
;
break
;
}
default:
expr
->
expr
.
eval
=
delete_expression_eval
;
return
compile_interp_fallback
(
ctx
,
&
expr
->
expr
);
}
return
S_OK
;
}
static
HRESULT
compile_literal
(
compiler_ctx_t
*
ctx
,
literal_t
*
literal
)
{
switch
(
literal
->
type
)
{
...
...
@@ -352,6 +380,8 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr)
return
compile_comma_expression
(
ctx
,
(
binary_expression_t
*
)
expr
);
case
EXPR_COND
:
return
compile_conditional_expression
(
ctx
,
(
conditional_expression_t
*
)
expr
);
case
EXPR_DELETE
:
return
compile_delete_expression
(
ctx
,
(
unary_expression_t
*
)
expr
);
case
EXPR_DIV
:
return
compile_binary_expression
(
ctx
,
(
binary_expression_t
*
)
expr
,
OP_div
);
case
EXPR_EQ
:
...
...
dlls/jscript/engine.c
View file @
facc2189
...
...
@@ -2498,6 +2498,53 @@ HRESULT delete_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD fla
}
/* ECMA-262 3rd Edition 11.4.2 */
static
HRESULT
interp_delete
(
exec_ctx_t
*
ctx
)
{
VARIANT
*
obj_var
,
*
name_var
;
IDispatchEx
*
dispex
;
IDispatch
*
obj
;
BSTR
name
;
BOOL
ret
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
name_var
=
stack_pop
(
ctx
);
obj_var
=
stack_pop
(
ctx
);
hres
=
to_object
(
ctx
->
parser
->
script
,
obj_var
,
&
obj
);
VariantClear
(
obj_var
);
if
(
FAILED
(
hres
))
{
VariantClear
(
name_var
);
return
hres
;
}
hres
=
to_string
(
ctx
->
parser
->
script
,
name_var
,
&
ctx
->
ei
,
&
name
);
VariantClear
(
name_var
);
if
(
FAILED
(
hres
))
{
IDispatch_Release
(
obj
);
return
hres
;
}
hres
=
IDispatch_QueryInterface
(
obj
,
&
IID_IDispatchEx
,
(
void
**
)
&
dispex
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
IDispatchEx_DeleteMemberByName
(
dispex
,
name
,
make_grfdex
(
ctx
->
parser
->
script
,
fdexNameCaseSensitive
));
ret
=
TRUE
;
IDispatchEx_Release
(
dispex
);
}
else
{
hres
=
S_OK
;
ret
=
FALSE
;
}
IDispatch_Release
(
obj
);
SysFreeString
(
name
);
if
(
FAILED
(
hres
))
return
hres
;
return
stack_push_bool
(
ctx
,
ret
);
}
/* ECMA-262 3rd Edition 11.4.2 */
static
HRESULT
interp_void
(
exec_ctx_t
*
ctx
)
{
VARIANT
v
;
...
...
@@ -3469,5 +3516,8 @@ HRESULT compiled_expression_eval(script_ctx_t *ctx, expression_t *expr, DWORD fl
if
(
FAILED
(
hres
))
return
hres
;
return
(
expr
->
eval
=
interp_expression_eval
)(
ctx
,
expr
,
flags
,
ei
,
ret
);
if
(
expr
->
eval
==
compiled_expression_eval
)
expr
->
eval
=
interp_expression_eval
;
return
expr
->
eval
(
ctx
,
expr
,
flags
,
ei
,
ret
);
}
dlls/jscript/engine.h
View file @
facc2189
...
...
@@ -45,6 +45,7 @@ typedef struct _func_stack {
X(add, 1, 0,0) \
X(bool, 1, ARG_INT, 0) \
X(bneg, 1, 0,0) \
X(delete, 1, 0,0) \
X(div, 1, 0,0) \
X(double, 1, ARG_SBL, 0) \
X(eq, 1, 0,0) \
...
...
dlls/jscript/parser.y
View file @
facc2189
...
...
@@ -1318,7 +1318,7 @@ static const expression_eval_t expression_eval_table[] = {
compiled_expression_eval,
compiled_expression_eval,
compiled_expression_eval,
delete
_expression_eval,
compiled
_expression_eval,
compiled_expression_eval,
typeof_expression_eval,
compiled_expression_eval,
...
...
dlls/jscript/tests/lang.js
View file @
facc2189
...
...
@@ -830,9 +830,16 @@ tmp = new Object();
tmp
.
test
=
false
;
ok
((
delete
tmp
.
test
)
===
true
,
"delete returned false"
);
ok
(
typeof
(
tmp
.
test
)
===
"undefined"
,
"tmp.test type = "
+
typeof
(
tmp
.
test
));
ok
(
!
(
"test"
in
tmp
),
"test is still in tmp after delete?"
);
for
(
iter
in
tmp
)
ok
(
false
,
"tmp has prop "
+
iter
);
tmp
=
new
Object
();
tmp
.
test
=
false
;
ok
((
delete
tmp
[
"test"
])
===
true
,
"delete returned false"
);
ok
(
typeof
(
tmp
.
test
)
===
"undefined"
,
"tmp.test type = "
+
typeof
(
tmp
.
test
));
ok
(
!
(
"test"
in
tmp
),
"test is still in tmp after delete?"
);
tmp
.
testWith
=
true
;
with
(
tmp
)
ok
(
testWith
===
true
,
"testWith !== true"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment