7 Star 45 Fork 26

Gitee 极速下载/WebKit

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/WebKit/webkit
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
undefined-property-access.js 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
//@ skip if $architecture == "x86"
var someGlobal;
// This is a simple speed test. It should go fast.
function foo() {
var myObject = {};
for (var i = 0; i < 10000000; ++i) {
someGlobal = myObject.undefinedProperty;
}
return someGlobal;
}
result = foo();
if (result != undefined)
throw new Error("Bad result: " + result);
// This test checks that a cached property lookup miss doesn't continue to fire when the property suddenly appears on the object.
function bar() {
var myObject = {};
for (var i = 0; i < 100000000; ++i) {
someGlobal = myObject.someProperty;
if (i == 50000000)
myObject.someProperty = 1;
}
return someGlobal;
}
var result = bar();
if (result != 1)
throw new Error("Bad result: " + result);
someGlobal = undefined;
// This test checks that a cached property lookup miss doesn't continue to fire when the property suddenly appears on the object's prototype.
function baz() {
var myPrototype = {}
var myObject = {};
myObject.__proto__ = myPrototype;
for (var i = 0; i < 100000000; ++i) {
someGlobal = myObject.someProperty;
if (i == 50000000)
myPrototype.someProperty = 2;
}
return someGlobal;
}
var result = baz();
if (result != 2)
throw new Error("Bad result: " + result);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/mirrors/WebKit.git
git@gitee.com:mirrors/WebKit.git
mirrors
WebKit
WebKit
main

搜索帮助