Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Unified Diff: test/mjsunit/regress/regress-2225.js

Issue 10736009: Fix inline constructors for Harmony Proxy prototypes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Andreas Rossberg. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-2225.js
diff --git a/test/cctest/test-ast.cc b/test/mjsunit/regress/regress-2225.js
similarity index 53%
copy from test/cctest/test-ast.cc
copy to test/mjsunit/regress/regress-2225.js
index c72f87ec3dee0fcc4d356a0a45bc1dedb3c1e36b..9957d8d463dc7c6dc3f2f30a718ea75ec9b83514 100644
--- a/test/cctest/test-ast.cc
+++ b/test/mjsunit/regress/regress-2225.js
@@ -25,37 +25,41 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <stdlib.h>
+// Flags: --harmony-proxies
-#include "v8.h"
-
-#include "ast.h"
-#include "cctest.h"
-
-using namespace v8::internal;
+var proxy_has_x = false;
+var proxy = Proxy.create({ getPropertyDescriptor:function(key) {
+ assertSame('x', key);
+ if (proxy_has_x) {
+ return { configurable:true, writable:false, value:19 };
+ }
+}});
-TEST(List) {
- v8::internal::V8::Initialize(NULL);
- List<AstNode*>* list = new List<AstNode*>(0);
- CHECK_EQ(0, list->length());
+// Test __lookupGetter__/__lookupSetter__ with proxy.
+assertSame(undefined, Object.prototype.__lookupGetter__.call(proxy, 'foo'));
+assertSame(undefined, Object.prototype.__lookupSetter__.call(proxy, 'bar'));
+assertSame(undefined, Object.prototype.__lookupGetter__.call(proxy, '123'));
+assertSame(undefined, Object.prototype.__lookupSetter__.call(proxy, '456'));
- Isolate* isolate = Isolate::Current();
- Zone* zone = isolate->runtime_zone();
- ZoneScope zone_scope(zone, DELETE_ON_EXIT);
- AstNodeFactory<AstNullVisitor> factory(isolate, zone);
- AstNode* node = factory.NewEmptyStatement();
- list->Add(node);
- CHECK_EQ(1, list->length());
- CHECK_EQ(node, list->at(0));
- CHECK_EQ(node, list->last());
+// Test __lookupGetter__/__lookupSetter__ with proxy in prototype chain.
+var object = Object.create(proxy);
+assertSame(undefined, Object.prototype.__lookupGetter__.call(object, 'foo'));
+assertSame(undefined, Object.prototype.__lookupSetter__.call(object, 'bar'));
+assertSame(undefined, Object.prototype.__lookupGetter__.call(object, '123'));
+assertSame(undefined, Object.prototype.__lookupSetter__.call(object, '456'));
- const int kElements = 100;
- for (int i = 0; i < kElements; i++) {
- list->Add(node);
- }
- CHECK_EQ(1 + kElements, list->length());
+// Test inline constructors with proxy as prototype.
+function f() { this.x = 23; }
+f.prototype = proxy;
+proxy_has_x = false;
+assertSame(23, new f().x);
+proxy_has_x = true;
+assertSame(19, new f().x);
- list->Clear();
- CHECK_EQ(0, list->length());
- delete list;
-}
+// Test inline constructors with proxy in prototype chain.
+function g() { this.x = 42; }
+g.prototype.__proto__ = proxy;
+proxy_has_x = false;
+assertSame(42, new g().x);
+proxy_has_x = true;
+assertSame(19, new g().x);
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698