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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 const char* name_start = name.start(); | 127 const char* name_start = name.start(); |
128 i::SNPrintF(script, | 128 i::SNPrintF(script, |
129 "function %s() {\n" | 129 "function %s() {\n" |
130 "var counter = 0;\n" | 130 "var counter = 0;\n" |
131 "for (var i = 0; i < %d; ++i) counter += i;\n" | 131 "for (var i = 0; i < %d; ++i) counter += i;\n" |
132 "return '%s_' + counter;\n" | 132 "return '%s_' + counter;\n" |
133 "}\n" | 133 "}\n" |
134 "%s();\n", name_start, counter, name_start, name_start); | 134 "%s();\n", name_start, counter, name_start, name_start); |
135 CompileRun(script.start()); | 135 CompileRun(script.start()); |
136 | 136 |
137 i::Handle<i::JSFunction> fun = | 137 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast( |
138 v8::Utils::OpenHandle(*GetFunction(**env, name_start)); | 138 v8::Utils::OpenHandle(*GetFunction(**env, name_start))); |
139 return fun->code(); | 139 return fun->code(); |
140 } | 140 } |
141 | 141 |
142 | 142 |
143 TEST(CodeEvents) { | 143 TEST(CodeEvents) { |
144 CcTest::InitializeVM(); | 144 CcTest::InitializeVM(); |
145 LocalContext env; | 145 LocalContext env; |
146 i::Isolate* isolate = CcTest::i_isolate(); | 146 i::Isolate* isolate = CcTest::i_isolate(); |
147 i::Factory* factory = isolate->factory(); | 147 i::Factory* factory = isolate->factory(); |
148 TestSetup test_setup; | 148 TestSetup test_setup; |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 " while (m > 1) {\n" | 1069 " while (m > 1) {\n" |
1070 " m--;\n" | 1070 " m--;\n" |
1071 " n += m * m * m;\n" | 1071 " n += m * m * m;\n" |
1072 " }\n" | 1072 " }\n" |
1073 "}\n" | 1073 "}\n" |
1074 "%s();\n", | 1074 "%s();\n", |
1075 func_name, func_name); | 1075 func_name, func_name); |
1076 | 1076 |
1077 CompileRun(script.start()); | 1077 CompileRun(script.start()); |
1078 | 1078 |
1079 i::Handle<i::JSFunction> func = | 1079 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast( |
1080 v8::Utils::OpenHandle(*GetFunction(*env, func_name)); | 1080 v8::Utils::OpenHandle(*GetFunction(*env, func_name))); |
1081 CHECK(func->shared()); | 1081 CHECK(func->shared()); |
1082 CHECK(func->shared()->code()); | 1082 CHECK(func->shared()->code()); |
1083 i::Code* code = NULL; | 1083 i::Code* code = NULL; |
1084 if (func->code()->is_optimized_code()) { | 1084 if (func->code()->is_optimized_code()) { |
1085 code = func->code(); | 1085 code = func->code(); |
1086 } else { | 1086 } else { |
1087 CHECK(func->shared()->code() == func->code() || !i::FLAG_crankshaft); | 1087 CHECK(func->shared()->code() == func->code() || !i::FLAG_crankshaft); |
1088 code = func->shared()->code(); | 1088 code = func->shared()->code(); |
1089 } | 1089 } |
1090 CHECK(code); | 1090 CHECK(code); |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2028 iprofile->Print(); | 2028 iprofile->Print(); |
2029 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); | 2029 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); |
2030 | 2030 |
2031 const char* branch[] = {"", "test"}; | 2031 const char* branch[] = {"", "test"}; |
2032 const ProfileNode* itest_node = | 2032 const ProfileNode* itest_node = |
2033 GetSimpleBranch(profile, branch, arraysize(branch)); | 2033 GetSimpleBranch(profile, branch, arraysize(branch)); |
2034 CHECK_EQ(0U, itest_node->deopt_infos().size()); | 2034 CHECK_EQ(0U, itest_node->deopt_infos().size()); |
2035 | 2035 |
2036 iprofiler->DeleteProfile(iprofile); | 2036 iprofiler->DeleteProfile(iprofile); |
2037 } | 2037 } |
OLD | NEW |