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
2d83bdcf
Commit
2d83bdcf
authored
Nov 21, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 21, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Use bytecode for binary negation implementation.
parent
06d759ed
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
20 deletions
+17
-20
compile.c
dlls/jscript/compile.c
+2
-0
engine.c
dlls/jscript/engine.c
+8
-18
engine.h
dlls/jscript/engine.h
+1
-1
parser.y
dlls/jscript/parser.y
+1
-1
lang.js
dlls/jscript/tests/lang.js
+5
-0
No files found.
dlls/jscript/compile.c
View file @
2d83bdcf
...
...
@@ -107,6 +107,8 @@ static HRESULT compile_interp_fallback(compiler_ctx_t *ctx, expression_t *expr)
static
HRESULT
compile_expression
(
compiler_ctx_t
*
ctx
,
expression_t
*
expr
)
{
switch
(
expr
->
type
)
{
case
EXPR_BITNEG
:
return
compile_unary_expression
(
ctx
,
(
unary_expression_t
*
)
expr
,
OP_bneg
);
case
EXPR_EQEQ
:
return
compile_binary_expression
(
ctx
,
(
binary_expression_t
*
)
expr
,
OP_eq2
);
case
EXPR_LOGNEG
:
...
...
dlls/jscript/engine.c
View file @
2d83bdcf
...
...
@@ -3020,33 +3020,23 @@ HRESULT greatereq_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD
}
/* ECMA-262 3rd Edition 11.4.8 */
HRESULT
binary_negation_expression_eval
(
script_ctx_t
*
ctx
,
expression_t
*
_expr
,
DWORD
flags
,
jsexcept_t
*
ei
,
exprval_t
*
ret
)
HRESULT
interp_bneg
(
exec_ctx_t
*
ctx
)
{
unary_expression_t
*
expr
=
(
unary_expression_t
*
)
_expr
;
exprval_t
exprval
;
VARIANT
val
;
VARIANT
*
v
,
r
;
INT
i
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
hres
=
expr_eval
(
ctx
,
expr
->
expression
,
EXPR_NEWREF
,
ei
,
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
exprval_to_value
(
ctx
,
&
exprval
,
ei
,
&
val
);
exprval_release
(
&
exprval
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
to_int32
(
ctx
,
&
val
,
ei
,
&
i
);
v
=
stack_pop
(
ctx
);
hres
=
to_int32
(
ctx
->
parser
->
script
,
v
,
&
ctx
->
ei
,
&
i
);
VariantClear
(
v
);
if
(
FAILED
(
hres
))
return
hres
;
ret
->
type
=
EXPRVAL_VARIANT
;
V_VT
(
&
ret
->
u
.
var
)
=
VT_I4
;
V_I4
(
&
ret
->
u
.
var
)
=
~
i
;
return
S_OK
;
V_VT
(
&
r
)
=
VT_I4
;
V_I4
(
&
r
)
=
~
i
;
return
stack_push
(
ctx
,
&
r
);
}
/* ECMA-262 3rd Edition 11.4.9 */
...
...
dlls/jscript/engine.h
View file @
2d83bdcf
...
...
@@ -42,6 +42,7 @@ typedef struct _func_stack {
}
func_stack_t
;
#define OP_LIST \
X(bneg, 1, 0) \
X(eq2, 1, 0) \
X(neg, 1, 0) \
X(neq2, 1, 0) \
...
...
@@ -547,7 +548,6 @@ HRESULT less_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprv
HRESULT
lesseq_expression_eval
(
script_ctx_t
*
,
expression_t
*
,
DWORD
,
jsexcept_t
*
,
exprval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
greater_expression_eval
(
script_ctx_t
*
,
expression_t
*
,
DWORD
,
jsexcept_t
*
,
exprval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
greatereq_expression_eval
(
script_ctx_t
*
,
expression_t
*
,
DWORD
,
jsexcept_t
*
,
exprval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
binary_negation_expression_eval
(
script_ctx_t
*
,
expression_t
*
,
DWORD
,
jsexcept_t
*
,
exprval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
left_shift_expression_eval
(
script_ctx_t
*
,
expression_t
*
,
DWORD
,
jsexcept_t
*
,
exprval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
right_shift_expression_eval
(
script_ctx_t
*
,
expression_t
*
,
DWORD
,
jsexcept_t
*
,
exprval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
right2_shift_expression_eval
(
script_ctx_t
*
,
expression_t
*
,
DWORD
,
jsexcept_t
*
,
exprval_t
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/jscript/parser.y
View file @
2d83bdcf
...
...
@@ -1335,7 +1335,7 @@ static const expression_eval_t expression_eval_table[] = {
lesseq_expression_eval,
greater_expression_eval,
greatereq_expression_eval,
binary_negation
_expression_eval,
compiled
_expression_eval,
compiled_expression_eval,
left_shift_expression_eval,
right_shift_expression_eval,
...
...
dlls/jscript/tests/lang.js
View file @
2d83bdcf
...
...
@@ -210,6 +210,11 @@ for(var iter in pureDisp)
tmp
=
new
Object
();
ok
(
!
tmp
.
nonexistent
,
"!tmp.nonexistent = "
+
!
tmp
.
nonexistent
);
ok
(
!
(
"nonexistent"
in
tmp
),
"nonexistent is in tmp after '!' expression"
)
tmp
=
new
Object
();
ok
((
~
tmp
.
nonexistent
)
===
-
1
,
"!tmp.nonexistent = "
+
~
tmp
.
nonexistent
);
ok
(
!
(
"nonexistent"
in
tmp
),
"nonexistent is in tmp after '~' expression"
)
tmp
=
0
;
if
(
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