forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jit: implement constants except strings and bigint
Summary: . Reviewed By: avp Differential Revision: D61764349 fbshipit-source-id: 40e6c1e3abcfcd4bb18e8fa8e82576c4673340a5
- Loading branch information
1 parent
63034eb
commit fd99ca5
Showing
4 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and 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 -Xforce-jit -Xdump-jitcode %s | %FileCheck --match-full-lines %s | ||
// REQUIRES: jit | ||
|
||
function constants(o) { | ||
o.zero = 0; | ||
o.uint8 = 5; | ||
o.int = 100_000_000; | ||
o.d = 3.14; | ||
o.undefined = void 0; | ||
o.null = null; | ||
o.true = true; | ||
o.false = false; | ||
return o; | ||
} | ||
|
||
print(JSON.stringify(constants({}), undefined, 2)); | ||
// CHECK: JIT successfully compiled FunctionID 1, 'constants' | ||
// CHECK-NEXT: { | ||
// CHECK-NEXT: "zero": 0, | ||
// CHECK-NEXT: "uint8": 5, | ||
// CHECK-NEXT: "int": 100000000, | ||
// CHECK-NEXT: "d": 3.14, | ||
// CHECK-NEXT: "null": null, | ||
// CHECK-NEXT: "true": true, | ||
// CHECK-NEXT: "false": false | ||
// CHECK-NEXT: } |