Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 16084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16095 CompileRun("throw 'exception';"); | 16095 CompileRun("throw 'exception';"); |
| 16096 } | 16096 } |
| 16097 | 16097 |
| 16098 | 16098 |
| 16099 TEST(CallCompletedCallbackTwoExceptions) { | 16099 TEST(CallCompletedCallbackTwoExceptions) { |
| 16100 v8::HandleScope scope; | 16100 v8::HandleScope scope; |
| 16101 LocalContext env; | 16101 LocalContext env; |
| 16102 v8::V8::AddCallCompletedCallback(CallCompletedCallbackException); | 16102 v8::V8::AddCallCompletedCallback(CallCompletedCallbackException); |
| 16103 CompileRun("throw 'first exception';"); | 16103 CompileRun("throw 'first exception';"); |
| 16104 } | 16104 } |
| 16105 | |
| 16106 | |
| 16107 static int probes_counter = 0; | |
| 16108 static int misses_counter = 0; | |
| 16109 static int updates_counter = 0; | |
| 16110 | |
| 16111 | |
| 16112 static int* LookupCounter(const char* name) { | |
|
Sven Panne
2012/02/29 09:37:42
It seems that all those statics here are only used
Erik Corry
2012/02/29 10:45:59
It does not complain about probes_counter etc. but
| |
| 16113 if (strcmp(name, "c:V8.MegamorphicStubCacheProbes") == 0) { | |
| 16114 return &probes_counter; | |
| 16115 } else if (strcmp(name, "c:V8.MegamorphicStubCacheMisses") == 0) { | |
| 16116 return &misses_counter; | |
| 16117 } else if (strcmp(name, "c:V8.MegamorphicStubCacheUpdates") == 0) { | |
| 16118 return &updates_counter; | |
| 16119 } | |
| 16120 return NULL; | |
| 16121 } | |
| 16122 | |
| 16123 | |
| 16124 static const char* kMegamorphicTestProgram = | |
| 16125 "function ClassA() { };" | |
| 16126 "function ClassB() { };" | |
| 16127 "ClassA.prototype.foo = function() { };" | |
| 16128 "ClassB.prototype.foo = function() { };" | |
| 16129 "function fooify(obj) { obj.foo(); };" | |
| 16130 "var a = new ClassA();" | |
| 16131 "var b = new ClassB();" | |
| 16132 "for (var i = 0; i < 10000; i++) {" | |
| 16133 " fooify(a);" | |
| 16134 " fooify(b);" | |
| 16135 "}"; | |
| 16136 | |
| 16137 | |
| 16138 TEST(SecondaryStubCache) { | |
|
Sven Panne
2012/02/29 09:37:42
This differs from TEST(PrimaryStubCache) only in a
Erik Corry
2012/02/29 10:45:59
Done
| |
| 16139 #ifdef DEBUG | |
| 16140 i::FLAG_native_code_counters = true; | |
| 16141 i::FLAG_test_secondary_stub_cache = true; | |
| 16142 i::FLAG_crankshaft = false; | |
| 16143 V8::SetCounterFunction(LookupCounter); | |
| 16144 v8::HandleScope scope; | |
| 16145 LocalContext env; | |
| 16146 int initial_probes = probes_counter; | |
| 16147 int initial_misses = misses_counter; | |
| 16148 int initial_updates = updates_counter; | |
| 16149 CompileRun(kMegamorphicTestProgram); | |
| 16150 int probes = probes_counter - initial_probes; | |
| 16151 int misses = misses_counter - initial_misses; | |
| 16152 int updates = updates_counter - initial_updates; | |
| 16153 CHECK_LT(updates, 10); | |
| 16154 CHECK_LT(misses, 10); | |
| 16155 CHECK_GE(probes, 10000); | |
| 16156 #endif | |
| 16157 } | |
| 16158 | |
| 16159 | |
| 16160 TEST(PrimaryStubCache) { | |
| 16161 #ifdef DEBUG | |
| 16162 i::FLAG_native_code_counters = true; | |
| 16163 i::FLAG_test_primary_stub_cache = true; | |
| 16164 i::FLAG_crankshaft = false; | |
| 16165 V8::SetCounterFunction(LookupCounter); | |
| 16166 v8::HandleScope scope; | |
| 16167 LocalContext env; | |
| 16168 int initial_probes = probes_counter; | |
| 16169 int initial_misses = misses_counter; | |
| 16170 int initial_updates = updates_counter; | |
| 16171 CompileRun(kMegamorphicTestProgram); | |
| 16172 int probes = probes_counter - initial_probes; | |
| 16173 int misses = misses_counter - initial_misses; | |
| 16174 int updates = updates_counter - initial_updates; | |
| 16175 CHECK_LT(updates, 10); | |
| 16176 CHECK_LT(misses, 10); | |
| 16177 CHECK_GE(probes, 10000); | |
| 16178 #endif | |
| 16179 } | |
| 16180 | |
| OLD | NEW |