Index: test/mjsunit/compiler/proto-chain-constant.js |
diff --git a/test/mjsunit/compiler/proto-chain-load.js b/test/mjsunit/compiler/proto-chain-constant.js |
similarity index 63% |
copy from test/mjsunit/compiler/proto-chain-load.js |
copy to test/mjsunit/compiler/proto-chain-constant.js |
index 60c6431d2b180f858abecef650b27ddb6a23f4e4..0d9e3b0e1e10b46737904db6c9b53c702ed9fa25 100644 |
--- a/test/mjsunit/compiler/proto-chain-load.js |
+++ b/test/mjsunit/compiler/proto-chain-constant.js |
@@ -1,4 +1,4 @@ |
-// Copyright 2012 the V8 project authors. All rights reserved. |
+// Copyright 2013 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -27,18 +27,29 @@ |
// Flags: --allow-natives-syntax |
-// Test HLoadNamedField on the proto chain. |
+// Test loading a constant function on the prototype chain. |
-var obj4 = Object.create(null, { f4: {value: 4} }); |
-var obj3 = Object.create(obj4, { f3: {value: 3} }); |
-var obj2 = Object.create(obj3, { f2: {value: 2} }); |
-var obj1 = Object.create(obj2, { f1: {value: 1} }); |
-var obj0 = Object.create(obj1, { f0: {value: 0} }); |
+var c = Object.create; |
+var obj4 = c(null, { f4: { value: function() { return 4; }, writable: true }}); |
+var obj3 = c(obj4, { f3: { value: function() { return 3; }, writable: true }}); |
+var obj2 = c(obj3, { f2: { value: function() { return 2; }, writable: true }}); |
+var obj1 = c(obj2, { f1: { value: function() { return 1; }, writable: true }}); |
+var obj0 = c(obj1, { f0: { value: function() { return 0; }, writable: true }}); |
function get4(obj) { return obj.f4; } |
-assertEquals(4, get4(obj0)); |
-assertEquals(4, get4(obj0)); |
+assertEquals(4, get4(obj0)()); |
+assertEquals(4, get4(obj0)()); |
%OptimizeFunctionOnNextCall(get4); |
-assertEquals(4, get4(obj0)); |
-assertEquals(4, get4(obj0)); |
+assertEquals(4, get4(obj0)()); |
+obj4.f4 = function() { return 5; }; |
+assertEquals(5, get4(obj0)()); |
+ |
+function get3(obj) { return obj.f3; } |
+ |
+assertEquals(3, get3(obj0)()); |
+assertEquals(3, get3(obj0)()); |
+%OptimizeFunctionOnNextCall(get3); |
+assertEquals(3, get3(obj0)()); |
+obj2.f3 = function() { return 6; }; |
+assertEquals(6, get3(obj0)()); |