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

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

Issue 551191: Port caching of lookup followups for interceptors to ARM (Closed)
Patch Set: Next iteration Created 10 years, 10 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/x64/stub-cache-x64.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 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 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 5657 matching lines...) Expand 10 before | Expand all | Expand 10 after
5668 "}" 5668 "}"
5669 "this.y = function(x) { return x - 1; };" 5669 "this.y = function(x) { return x - 1; };"
5670 "var result = 0;" 5670 "var result = 0;"
5671 "for (var i = 0; i < 7; i++) {" 5671 "for (var i = 0; i < 7; i++) {"
5672 " result += o.y(42);" 5672 " result += o.y(42);"
5673 "}"); 5673 "}");
5674 CHECK_EQ(41 * 7, value->Int32Value()); 5674 CHECK_EQ(41 * 7, value->Int32Value());
5675 } 5675 }
5676 5676
5677 5677
5678 // Test the case when actual function to call sits on global object.
5679 THREADED_TEST(InterceptorCallICCachedFromGlobal) {
5680 v8::HandleScope scope;
5681 v8::Handle<v8::ObjectTemplate> templ_o = ObjectTemplate::New();
5682 templ_o->SetNamedPropertyHandler(NoBlockGetterX);
5683
5684 LocalContext context;
5685 context->Global()->Set(v8_str("o"), templ_o->NewInstance());
5686
5687 v8::Handle<Value> value = CompileRun(
5688 "try {"
5689 " o.__proto__ = this;"
5690 " for (var i = 0; i < 10; i++) {"
5691 " var v = o.parseFloat('239');"
5692 " if (v != 239) throw v;"
5693 // Now it should be ICed and keep a reference to parseFloat.
5694 " }"
5695 " var result = 0;"
5696 " for (var i = 0; i < 10; i++) {"
5697 " result += o.parseFloat('239');"
5698 " }"
5699 " result"
5700 "} catch(e) {"
5701 " e"
5702 "};");
5703 CHECK_EQ(239 * 10, value->Int32Value());
5704 }
5705
5706
5678 static int interceptor_call_count = 0; 5707 static int interceptor_call_count = 0;
5679 5708
5680 static v8::Handle<Value> InterceptorICRefErrorGetter(Local<String> name, 5709 static v8::Handle<Value> InterceptorICRefErrorGetter(Local<String> name,
5681 const AccessorInfo& info) { 5710 const AccessorInfo& info) {
5682 ApiTestFuzzer::Fuzz(); 5711 ApiTestFuzzer::Fuzz();
5683 if (v8_str("x")->Equals(name) && interceptor_call_count++ < 20) { 5712 if (v8_str("x")->Equals(name) && interceptor_call_count++ < 20) {
5684 return call_ic_function2; 5713 return call_ic_function2;
5685 } 5714 }
5686 return v8::Handle<Value>(); 5715 return v8::Handle<Value>();
5687 } 5716 }
(...skipping 3015 matching lines...) Expand 10 before | Expand all | Expand 10 after
8703 CompileRun(source_exception); 8732 CompileRun(source_exception);
8704 other_context->Exit(); 8733 other_context->Exit();
8705 v8::internal::Heap::CollectAllGarbage(false); 8734 v8::internal::Heap::CollectAllGarbage(false);
8706 if (GetGlobalObjectsCount() == 1) break; 8735 if (GetGlobalObjectsCount() == 1) break;
8707 } 8736 }
8708 CHECK_GE(2, gc_count); 8737 CHECK_GE(2, gc_count);
8709 CHECK_EQ(1, GetGlobalObjectsCount()); 8738 CHECK_EQ(1, GetGlobalObjectsCount());
8710 8739
8711 other_context.Dispose(); 8740 other_context.Dispose();
8712 } 8741 }
OLDNEW
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698