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

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

Issue 1233453004: Version 4.4.63.16 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.4
Patch Set: 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 20909 matching lines...) Expand 10 before | Expand all | Expand 10 after
20920 20920
20921 { 20921 {
20922 v8::HandleScope handle_scope(isolate); 20922 v8::HandleScope handle_scope(isolate);
20923 20923
20924 // Should work 20924 // Should work
20925 v8::Local<v8::Object> obj = v8::Object::New(isolate); 20925 v8::Local<v8::Object> obj = v8::Object::New(isolate);
20926 20926
20927 USE(obj); 20927 USE(obj);
20928 } 20928 }
20929 } 20929 }
20930
20931
20932 TEST(CompatibleReceiverCheckOnCachedICHandler) {
20933 v8::Isolate* isolate = CcTest::isolate();
20934 v8::HandleScope scope(isolate);
20935 v8::Local<v8::FunctionTemplate> parent = FunctionTemplate::New(isolate);
20936 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, parent);
20937 auto returns_42 =
20938 v8::FunctionTemplate::New(isolate, Returns42, Local<Value>(), signature);
20939 parent->PrototypeTemplate()->SetAccessorProperty(v8_str("age"), returns_42);
20940 v8::Local<v8::FunctionTemplate> child = v8::FunctionTemplate::New(isolate);
20941 child->Inherit(parent);
20942 LocalContext env;
20943 env->Global()->Set(v8_str("Child"), child->GetFunction());
20944
20945 // Make sure there's a compiled stub for "Child.prototype.age" in the cache.
20946 CompileRun(
20947 "var real = new Child();\n"
20948 "for (var i = 0; i < 3; ++i) {\n"
20949 " real.age;\n"
20950 "}\n");
20951
20952 // Check that the cached stub is never used.
20953 ExpectInt32(
20954 "var fake = Object.create(Child.prototype);\n"
20955 "var result = 0;\n"
20956 "function test(d) {\n"
20957 " if (d == 3) return;\n"
20958 " try {\n"
20959 " fake.age;\n"
20960 " result = 1;\n"
20961 " } catch (e) {\n"
20962 " }\n"
20963 " test(d+1);\n"
20964 "}\n"
20965 "test(0);\n"
20966 "result;\n",
20967 0);
20968 }
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