forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals.js
41 lines (37 loc) · 1.69 KB
/
globals.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// RUN: %hermes -target=HBC -dump-bytecode -O -strict %s | %FileCheck --match-full-lines %s
// RUN: %hermes -target=HBC -dump-bytecode -O -non-strict %s | %FileCheck --match-full-lines --check-prefix=CHKNONSTRICT %s
var x = 5;
foo(x);
y = x;
//CHECK-LABEL:Function<global>{{.*}}:
//CHECK-NEXT:Offset in debug table: source 0x0000, lexical 0x0000
//CHECK-NEXT: DeclareGlobalVar "x"
//CHECK-NEXT: LoadConstUInt8 r0, 5
//CHECK-NEXT: GetGlobalObject r1
//CHECK-NEXT: PutById r1, r0, 1, "x"
//CHECK-NEXT: TryGetById r3, r1, 1, "foo"
//CHECK-NEXT: GetByIdShort r2, r1, 2, "x"
//CHECK-NEXT: LoadConstUndefined r0
//CHECK-NEXT: Call2 r0, r3, r0, r2
//CHECK-NEXT: GetByIdShort r0, r1, 2, "x"
//CHECK-NEXT: TryPutById r1, r0, 2, "y"
//CHECK-NEXT: Ret r0
//CHKNONSTRICT-LABEL:Function<global>{{.*}}:
//CHKNONSTRICT-NEXT:Offset in debug table: source 0x0000, lexical 0x0000
//CHKNONSTRICT-NEXT: DeclareGlobalVar "x"
//CHKNONSTRICT-NEXT: LoadConstUInt8 r0, 5
//CHKNONSTRICT-NEXT: GetGlobalObject r1
//CHKNONSTRICT-NEXT: PutById r1, r0, 1, "x"
//CHKNONSTRICT-NEXT: TryGetById r3, r1, 1, "foo"
//CHKNONSTRICT-NEXT: GetByIdShort r2, r1, 2, "x"
//CHKNONSTRICT-NEXT: LoadConstUndefined r0
//CHKNONSTRICT-NEXT: Call2 r0, r3, r0, r2
//CHKNONSTRICT-NEXT: GetByIdShort r0, r1, 2, "x"
//CHKNONSTRICT-NEXT: PutById r1, r0, 2, "y"
//CHKNONSTRICT-NEXT: Ret r0