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

Side by Side Diff: test/cctest/test-api.cc

Issue 10827113: Fix the 137002 fix (Don't generate ICs for accessors on slow (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ic.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 16985 matching lines...) Expand 10 before | Expand all | Expand 10 after
16996 v8::HandleScope scope; 16996 v8::HandleScope scope;
16997 LocalContext context; 16997 LocalContext context;
16998 Local<ObjectTemplate> templ = ObjectTemplate::New(); 16998 Local<ObjectTemplate> templ = ObjectTemplate::New();
16999 templ->SetAccessor(v8_str("foo"), 16999 templ->SetAccessor(v8_str("foo"),
17000 GetterWhichReturns42, 17000 GetterWhichReturns42,
17001 SetterWhichSetsYOnThisTo23); 17001 SetterWhichSetsYOnThisTo23);
17002 context->Global()->Set(v8_str("obj"), templ->NewInstance()); 17002 context->Global()->Set(v8_str("obj"), templ->NewInstance());
17003 17003
17004 // Turn monomorphic on slow object with native accessor, then just 17004 // Turn monomorphic on slow object with native accessor, then just
17005 // delete the property and fail. 17005 // delete the property and fail.
17006 CompileRun("function f(x) { return x.foo; }" 17006 CompileRun("function load(x) { return x.foo; }"
17007 "function store(x) { x.foo = void 0; }"
17008 "function keyed_load(x, key) { return x[key]; }"
17009 // Second version of function has a different source (add void 0)
17010 // so that it does not share code with the first version. This
17011 // ensures that the ICs are monomorphic.
17012 "function load2(x) { void 0; return x.foo; }"
17013 "function store2(x) { void 0; x.foo = void 0; }"
17014 "function keyed_load2(x, key) { void 0; return x[key]; }"
17015
17016 "obj.__proto__ = null;"
17017 "var subobj = {};"
17018 "subobj.__proto__ = obj;"
17007 "%OptimizeObjectForAddingMultipleProperties(obj, 1);" 17019 "%OptimizeObjectForAddingMultipleProperties(obj, 1);"
17008 "obj.__proto__ = null;" 17020
17009 "f(obj); f(obj); delete obj.foo;" 17021 // Make the ICs monomorphic.
17010 "var result = f(obj);"); 17022 "load(obj); load(obj);"
17011 CHECK(context->Global()->Get(v8_str("result"))->IsUndefined()); 17023 "load2(subobj); load2(subobj);"
17024 "store(obj);"
17025 "store2(subobj);"
17026 "keyed_load(obj, 'foo'); keyed_load(obj, 'foo');"
17027 "keyed_load2(subobj, 'foo'); keyed_load2(subobj, 'foo');"
17028
17029 // Delete the accessor. It better not be called any more now.
17030 "delete obj.foo;"
17031 "obj.y = void 0;"
17032 "subobj.y = void 0;"
17033
17034 "var load_result = load(obj);"
17035 "var load_result2 = load2(subobj);"
17036 "var keyed_load_result = keyed_load(obj, 'foo');"
17037 "var keyed_load_result2 = keyed_load2(subobj, 'foo');"
17038 "store(obj);"
17039 "store2(subobj);"
17040 "var y_from_obj = obj.y;"
17041 "var y_from_subobj = subobj.y;");
17042 CHECK(context->Global()->Get(v8_str("load_result"))->IsUndefined());
17043 CHECK(context->Global()->Get(v8_str("load_result2"))->IsUndefined());
17044 CHECK(context->Global()->Get(v8_str("keyed_load_result"))->IsUndefined());
17045 CHECK(context->Global()->Get(v8_str("keyed_load_result2"))->IsUndefined());
17046 CHECK(context->Global()->Get(v8_str("y_from_obj"))->IsUndefined());
17047 CHECK(context->Global()->Get(v8_str("y_from_subobj"))->IsUndefined());
17012 } 17048 }
17013 17049
17014 17050
17015 THREADED_TEST(Regress137496) { 17051 THREADED_TEST(Regress137496) {
17016 i::FLAG_expose_gc = true; 17052 i::FLAG_expose_gc = true;
17017 v8::HandleScope scope; 17053 v8::HandleScope scope;
17018 LocalContext context; 17054 LocalContext context;
17019 17055
17020 // Compile a try-finally clause where the finally block causes a GC 17056 // Compile a try-finally clause where the finally block causes a GC
17021 // while there still is a message pending for external reporting. 17057 // while there still is a message pending for external reporting.
17022 TryCatch try_catch; 17058 TryCatch try_catch;
17023 try_catch.SetVerbose(true); 17059 try_catch.SetVerbose(true);
17024 CompileRun("try { throw new Error(); } finally { gc(); }"); 17060 CompileRun("try { throw new Error(); } finally { gc(); }");
17025 CHECK(try_catch.HasCaught()); 17061 CHECK(try_catch.HasCaught());
17026 } 17062 }
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698