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

Side by Side Diff: src/compiler.cc

Issue 113763: Merge in changes from readability review. (Closed)
Patch Set: Created 11 years, 7 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 // Check for stack-overflow exceptions. 153 // Check for stack-overflow exceptions.
154 if (code.is_null()) { 154 if (code.is_null()) {
155 Top::StackOverflow(); 155 Top::StackOverflow();
156 return Handle<JSFunction>::null(); 156 return Handle<JSFunction>::null();
157 } 157 }
158 158
159 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT 159 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
160 // Log the code generation for the script. Check explicit whether logging is 160 // Log the code generation for the script. Check explicit whether logging is
161 // to avoid allocating when not required. 161 // to avoid allocating when not required.
162 if (Logger::is_enabled() || OProfileAgent::is_enabled()) { 162 if (Logger::IsEnabled() || OProfileAgent::is_enabled()) {
163 if (script->name()->IsString()) { 163 if (script->name()->IsString()) {
164 SmartPointer<char> data = 164 SmartPointer<char> data =
165 String::cast(script->name())->ToCString(DISALLOW_NULLS); 165 String::cast(script->name())->ToCString(DISALLOW_NULLS);
166 LOG(CodeCreateEvent(is_eval ? "Eval" : "Script", *code, *data)); 166 LOG(CodeCreateEvent(is_eval ? "Eval" : "Script", *code, *data));
167 OProfileAgent::CreateNativeCodeRegion(*data, code->address(), 167 OProfileAgent::CreateNativeCodeRegion(*data, code->address(),
168 code->ExecutableSize()); 168 code->ExecutableSize());
169 } else { 169 } else {
170 LOG(CodeCreateEvent(is_eval ? "Eval" : "Script", *code, "")); 170 LOG(CodeCreateEvent(is_eval ? "Eval" : "Script", *code, ""));
171 OProfileAgent::CreateNativeCodeRegion(is_eval ? "Eval" : "Script", 171 OProfileAgent::CreateNativeCodeRegion(is_eval ? "Eval" : "Script",
172 code->address(), code->ExecutableSize()); 172 code->address(), code->ExecutableSize());
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // Check for stack-overflow exception. 349 // Check for stack-overflow exception.
350 if (code.is_null()) { 350 if (code.is_null()) {
351 Top::StackOverflow(); 351 Top::StackOverflow();
352 return false; 352 return false;
353 } 353 }
354 354
355 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT 355 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT
356 // Log the code generation. If source information is available include script 356 // Log the code generation. If source information is available include script
357 // name and line number. Check explicit whether logging is enabled as finding 357 // name and line number. Check explicit whether logging is enabled as finding
358 // the line number is not for free. 358 // the line number is not for free.
359 if (Logger::is_enabled() || OProfileAgent::is_enabled()) { 359 if (Logger::IsEnabled() || OProfileAgent::is_enabled()) {
360 Handle<String> func_name(name->length() > 0 ? 360 Handle<String> func_name(name->length() > 0 ?
361 *name : shared->inferred_name()); 361 *name : shared->inferred_name());
362 if (script->name()->IsString()) { 362 if (script->name()->IsString()) {
363 int line_num = GetScriptLineNumber(script, start_position); 363 int line_num = GetScriptLineNumber(script, start_position);
364 if (line_num > 0) { 364 if (line_num > 0) {
365 line_num += script->line_offset()->value() + 1; 365 line_num += script->line_offset()->value() + 1;
366 } 366 }
367 LOG(CodeCreateEvent("LazyCompile", *code, *func_name, 367 LOG(CodeCreateEvent("LazyCompile", *code, *func_name,
368 String::cast(script->name()), line_num)); 368 String::cast(script->name()), line_num));
369 OProfileAgent::CreateNativeCodeRegion(*func_name, 369 OProfileAgent::CreateNativeCodeRegion(*func_name,
(...skipping 14 matching lines...) Expand all
384 // Set the expected number of properties for instances. 384 // Set the expected number of properties for instances.
385 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); 385 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count());
386 386
387 // Check the function has compiled code. 387 // Check the function has compiled code.
388 ASSERT(shared->is_compiled()); 388 ASSERT(shared->is_compiled());
389 return true; 389 return true;
390 } 390 }
391 391
392 392
393 } } // namespace v8::internal 393 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/func-name-inferrer.h » ('j') | src/log.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698