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

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

Issue 1221433010: Move compatible receiver check from CompileHandler to UpdateCaches (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 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 unified diff | Download patch
« no previous file with comments | « src/ic/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 21727 matching lines...) Expand 10 before | Expand all | Expand 10 after
21738 CHECK(set->Has(env.local(), set).FromJust()); 21738 CHECK(set->Has(env.local(), set).FromJust());
21739 21739
21740 CHECK(set->Delete(env.local(), set).FromJust()); 21740 CHECK(set->Delete(env.local(), set).FromJust());
21741 CHECK_EQ(2U, set->Size()); 21741 CHECK_EQ(2U, set->Size());
21742 CHECK(!set->Has(env.local(), set).FromJust()); 21742 CHECK(!set->Has(env.local(), set).FromJust());
21743 CHECK(!set->Delete(env.local(), set).FromJust()); 21743 CHECK(!set->Delete(env.local(), set).FromJust());
21744 21744
21745 set->Clear(); 21745 set->Clear();
21746 CHECK_EQ(0U, set->Size()); 21746 CHECK_EQ(0U, set->Size());
21747 } 21747 }
21748
21749
21750 TEST(CompatibleReceiverCheckOnCachedICHandler) {
21751 v8::Isolate* isolate = CcTest::isolate();
21752 v8::HandleScope scope(isolate);
21753 v8::Local<v8::FunctionTemplate> parent = FunctionTemplate::New(isolate);
21754 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, parent);
21755 auto returns_42 =
21756 v8::FunctionTemplate::New(isolate, Returns42, Local<Value>(), signature);
21757 parent->PrototypeTemplate()->SetAccessorProperty(v8_str("age"), returns_42);
21758 v8::Local<v8::FunctionTemplate> child = v8::FunctionTemplate::New(isolate);
21759 child->Inherit(parent);
21760 LocalContext env;
21761 env->Global()->Set(v8_str("Child"), child->GetFunction());
21762
21763 // Make sure there's a compiled stub for "Child.prototype.age" in the cache.
21764 CompileRun(
21765 "var real = new Child();\n"
21766 "for (var i = 0; i < 3; ++i) {\n"
21767 " real.age;\n"
21768 "}\n");
21769
21770 // Check that the cached stub is never used.
21771 ExpectInt32(
21772 "var fake = Object.create(Child.prototype);\n"
21773 "var result = 0;\n"
21774 "function test(d) {\n"
21775 " if (d == 3) return;\n"
21776 " try {\n"
21777 " fake.age;\n"
21778 " result = 1;\n"
21779 " } catch (e) {\n"
21780 " }\n"
21781 " test(d+1);\n"
21782 "}\n"
21783 "test(0);\n"
21784 "result;\n",
21785 0);
21786 }
OLDNEW
« no previous file with comments | « src/ic/ic.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698