| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 ScopedVector<v8::Handle<v8::String> > names(2); | 1151 ScopedVector<v8::Handle<v8::String> > names(2); |
| 1152 names[0] = v8::String::NewFromUtf8(env->GetIsolate(), "test"); | 1152 names[0] = v8::String::NewFromUtf8(env->GetIsolate(), "test"); |
| 1153 names[1] = v8::String::NewFromUtf8( | 1153 names[1] = v8::String::NewFromUtf8( |
| 1154 env->GetIsolate(), ProfileGenerator::kUnresolvedFunctionName); | 1154 env->GetIsolate(), ProfileGenerator::kUnresolvedFunctionName); |
| 1155 CheckChildrenNames(startNode, names); | 1155 CheckChildrenNames(startNode, names); |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 const v8::CpuProfileNode* testNode = | 1158 const v8::CpuProfileNode* testNode = |
| 1159 FindChild(env->GetIsolate(), startNode, "test"); | 1159 FindChild(env->GetIsolate(), startNode, "test"); |
| 1160 if (testNode) { | 1160 if (testNode) { |
| 1161 ScopedVector<v8::Handle<v8::String> > names(2); | 1161 ScopedVector<v8::Handle<v8::String> > names(3); |
| 1162 names[0] = v8::String::NewFromUtf8(env->GetIsolate(), "bar"); | 1162 names[0] = v8::String::NewFromUtf8(env->GetIsolate(), "bar"); |
| 1163 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), "apply"); | 1163 names[1] = v8::String::NewFromUtf8(env->GetIsolate(), "apply"); |
| 1164 // apply calls "get length" before invoking the function itself |
| 1165 // and we may get hit into it. |
| 1166 names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "get length"); |
| 1164 CheckChildrenNames(testNode, names); | 1167 CheckChildrenNames(testNode, names); |
| 1165 } | 1168 } |
| 1166 | 1169 |
| 1167 if (const v8::CpuProfileNode* unresolvedNode = | 1170 if (const v8::CpuProfileNode* unresolvedNode = |
| 1168 FindChild(env->GetIsolate(), startNode, | 1171 FindChild(env->GetIsolate(), startNode, |
| 1169 ProfileGenerator::kUnresolvedFunctionName)) { | 1172 ProfileGenerator::kUnresolvedFunctionName)) { |
| 1170 ScopedVector<v8::Handle<v8::String> > names(1); | 1173 ScopedVector<v8::Handle<v8::String> > names(1); |
| 1171 names[0] = v8::String::NewFromUtf8(env->GetIsolate(), "apply"); | 1174 names[0] = v8::String::NewFromUtf8(env->GetIsolate(), "apply"); |
| 1172 CheckChildrenNames(unresolvedNode, names); | 1175 CheckChildrenNames(unresolvedNode, names); |
| 1173 GetChild(env->GetIsolate(), unresolvedNode, "apply"); | 1176 GetChild(env->GetIsolate(), unresolvedNode, "apply"); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 const v8::CpuProfileNode* startNode = | 1339 const v8::CpuProfileNode* startNode = |
| 1337 GetChild(env->GetIsolate(), root, "start"); | 1340 GetChild(env->GetIsolate(), root, "start"); |
| 1338 CHECK_EQ(1, startNode->GetChildrenCount()); | 1341 CHECK_EQ(1, startNode->GetChildrenCount()); |
| 1339 const v8::CpuProfileNode* nativeFunctionNode = | 1342 const v8::CpuProfileNode* nativeFunctionNode = |
| 1340 GetChild(env->GetIsolate(), startNode, "CallJsFunction"); | 1343 GetChild(env->GetIsolate(), startNode, "CallJsFunction"); |
| 1341 | 1344 |
| 1342 CHECK_EQ(1, nativeFunctionNode->GetChildrenCount()); | 1345 CHECK_EQ(1, nativeFunctionNode->GetChildrenCount()); |
| 1343 const v8::CpuProfileNode* barNode = | 1346 const v8::CpuProfileNode* barNode = |
| 1344 GetChild(env->GetIsolate(), nativeFunctionNode, "bar"); | 1347 GetChild(env->GetIsolate(), nativeFunctionNode, "bar"); |
| 1345 | 1348 |
| 1346 CHECK_EQ(1, barNode->GetChildrenCount()); | 1349 // The child is in fact a bound foo. |
| 1350 // A bound function has a wrapper that may make calls to |
| 1351 // other functions e.g. "get length". |
| 1352 CHECK_LE(1, barNode->GetChildrenCount()); |
| 1353 CHECK_GE(2, barNode->GetChildrenCount()); |
| 1347 GetChild(env->GetIsolate(), barNode, "foo"); | 1354 GetChild(env->GetIsolate(), barNode, "foo"); |
| 1348 | 1355 |
| 1349 profile->Delete(); | 1356 profile->Delete(); |
| 1350 } | 1357 } |
| 1351 | 1358 |
| 1352 | 1359 |
| 1353 static void CallJsFunction2(const v8::FunctionCallbackInfo<v8::Value>& info) { | 1360 static void CallJsFunction2(const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 1354 CallJsFunction(info); | 1361 CallJsFunction(info); |
| 1355 } | 1362 } |
| 1356 | 1363 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1587 inner_profile = NULL; | 1594 inner_profile = NULL; |
| 1588 CHECK_EQ(0, iprofiler->GetProfilesCount()); | 1595 CHECK_EQ(0, iprofiler->GetProfilesCount()); |
| 1589 | 1596 |
| 1590 v8::CpuProfile* outer_profile = profiler->StopProfiling(outer); | 1597 v8::CpuProfile* outer_profile = profiler->StopProfiling(outer); |
| 1591 CHECK(outer_profile); | 1598 CHECK(outer_profile); |
| 1592 CHECK_EQ(1, iprofiler->GetProfilesCount()); | 1599 CHECK_EQ(1, iprofiler->GetProfilesCount()); |
| 1593 outer_profile->Delete(); | 1600 outer_profile->Delete(); |
| 1594 outer_profile = NULL; | 1601 outer_profile = NULL; |
| 1595 CHECK_EQ(0, iprofiler->GetProfilesCount()); | 1602 CHECK_EQ(0, iprofiler->GetProfilesCount()); |
| 1596 } | 1603 } |
| OLD | NEW |