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

Side by Side Diff: src/compiler.cc

Issue 119304: Add log compression ability. (Closed)
Patch Set: Created 11 years, 6 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
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 return Handle<JSFunction>::null(); 157 return Handle<JSFunction>::null();
158 } 158 }
159 159
160 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT 160 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
161 // Log the code generation for the script. Check explicit whether logging is 161 // Log the code generation for the script. Check explicit whether logging is
162 // to avoid allocating when not required. 162 // to avoid allocating when not required.
163 if (Logger::IsEnabled() || OProfileAgent::is_enabled()) { 163 if (Logger::IsEnabled() || OProfileAgent::is_enabled()) {
164 if (script->name()->IsString()) { 164 if (script->name()->IsString()) {
165 SmartPointer<char> data = 165 SmartPointer<char> data =
166 String::cast(script->name())->ToCString(DISALLOW_NULLS); 166 String::cast(script->name())->ToCString(DISALLOW_NULLS);
167 LOG(CodeCreateEvent(is_eval ? "Eval" : "Script", *code, *data)); 167 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG,
168 *code, *data));
168 OProfileAgent::CreateNativeCodeRegion(*data, code->address(), 169 OProfileAgent::CreateNativeCodeRegion(*data, code->address(),
169 code->ExecutableSize()); 170 code->ExecutableSize());
170 } else { 171 } else {
171 LOG(CodeCreateEvent(is_eval ? "Eval" : "Script", *code, "")); 172 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG,
173 *code, ""));
172 OProfileAgent::CreateNativeCodeRegion(is_eval ? "Eval" : "Script", 174 OProfileAgent::CreateNativeCodeRegion(is_eval ? "Eval" : "Script",
173 code->address(), code->ExecutableSize()); 175 code->address(), code->ExecutableSize());
174 } 176 }
175 } 177 }
176 #endif 178 #endif
177 179
178 // Allocate function. 180 // Allocate function.
179 Handle<JSFunction> fun = 181 Handle<JSFunction> fun =
180 Factory::NewFunctionBoilerplate(lit->name(), 182 Factory::NewFunctionBoilerplate(lit->name(),
181 lit->materialized_literal_count(), 183 lit->materialized_literal_count(),
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // name and line number. Check explicit whether logging is enabled as finding 360 // name and line number. Check explicit whether logging is enabled as finding
359 // the line number is not for free. 361 // the line number is not for free.
360 if (Logger::IsEnabled() || OProfileAgent::is_enabled()) { 362 if (Logger::IsEnabled() || OProfileAgent::is_enabled()) {
361 Handle<String> func_name(name->length() > 0 ? 363 Handle<String> func_name(name->length() > 0 ?
362 *name : shared->inferred_name()); 364 *name : shared->inferred_name());
363 if (script->name()->IsString()) { 365 if (script->name()->IsString()) {
364 int line_num = GetScriptLineNumber(script, start_position); 366 int line_num = GetScriptLineNumber(script, start_position);
365 if (line_num > 0) { 367 if (line_num > 0) {
366 line_num += script->line_offset()->value() + 1; 368 line_num += script->line_offset()->value() + 1;
367 } 369 }
368 LOG(CodeCreateEvent("LazyCompile", *code, *func_name, 370 LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name,
369 String::cast(script->name()), line_num)); 371 String::cast(script->name()), line_num));
370 OProfileAgent::CreateNativeCodeRegion(*func_name, 372 OProfileAgent::CreateNativeCodeRegion(*func_name,
371 String::cast(script->name()), 373 String::cast(script->name()),
372 line_num, code->address(), 374 line_num, code->address(),
373 code->ExecutableSize()); 375 code->ExecutableSize());
374 } else { 376 } else {
375 LOG(CodeCreateEvent("LazyCompile", *code, *func_name)); 377 LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name));
376 OProfileAgent::CreateNativeCodeRegion(*func_name, code->address(), 378 OProfileAgent::CreateNativeCodeRegion(*func_name, code->address(),
377 code->ExecutableSize()); 379 code->ExecutableSize());
378 } 380 }
379 } 381 }
380 #endif 382 #endif
381 383
382 // Update the shared function info with the compiled code. 384 // Update the shared function info with the compiled code.
383 shared->set_code(*code); 385 shared->set_code(*code);
384 386
385 // Set the expected number of properties for instances. 387 // Set the expected number of properties for instances.
386 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); 388 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count());
387 389
388 // Check the function has compiled code. 390 // Check the function has compiled code.
389 ASSERT(shared->is_compiled()); 391 ASSERT(shared->is_compiled());
390 return true; 392 return true;
391 } 393 }
392 394
393 395
394 } } // namespace v8::internal 396 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/flag-definitions.h » ('j') | src/log.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698