OLD | NEW |
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT | 175 #if defined ENABLE_LOGGING_AND_PROFILING || defined ENABLE_OPROFILE_AGENT |
176 // Log the code generation for the script. Check explicit whether logging is | 176 // Log the code generation for the script. Check explicit whether logging is |
177 // to avoid allocating when not required. | 177 // to avoid allocating when not required. |
178 if (Logger::IsEnabled() || OProfileAgent::is_enabled()) { | 178 if (Logger::IsEnabled() || OProfileAgent::is_enabled()) { |
179 if (script->name()->IsString()) { | 179 if (script->name()->IsString()) { |
180 SmartPointer<char> data = | 180 SmartPointer<char> data = |
181 String::cast(script->name())->ToCString(DISALLOW_NULLS); | 181 String::cast(script->name())->ToCString(DISALLOW_NULLS); |
182 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, | 182 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, |
183 *code, *data)); | 183 *code, *data)); |
184 OProfileAgent::CreateNativeCodeRegion(*data, code->address(), | 184 OProfileAgent::CreateNativeCodeRegion(*data, |
185 code->ExecutableSize()); | 185 code->instruction_start(), |
| 186 code->instruction_size()); |
186 } else { | 187 } else { |
187 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, | 188 LOG(CodeCreateEvent(is_eval ? Logger::EVAL_TAG : Logger::SCRIPT_TAG, |
188 *code, "")); | 189 *code, "")); |
189 OProfileAgent::CreateNativeCodeRegion(is_eval ? "Eval" : "Script", | 190 OProfileAgent::CreateNativeCodeRegion(is_eval ? "Eval" : "Script", |
190 code->address(), code->ExecutableSize()); | 191 code->instruction_start(), |
| 192 code->instruction_size()); |
191 } | 193 } |
192 } | 194 } |
193 #endif | 195 #endif |
194 | 196 |
195 // Allocate function. | 197 // Allocate function. |
196 Handle<JSFunction> fun = | 198 Handle<JSFunction> fun = |
197 Factory::NewFunctionBoilerplate(lit->name(), | 199 Factory::NewFunctionBoilerplate(lit->name(), |
198 lit->materialized_literal_count(), | 200 lit->materialized_literal_count(), |
199 lit->contains_array_literal(), | 201 lit->contains_array_literal(), |
200 code); | 202 code); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 *name : shared->inferred_name()); | 381 *name : shared->inferred_name()); |
380 if (script->name()->IsString()) { | 382 if (script->name()->IsString()) { |
381 int line_num = GetScriptLineNumber(script, start_position); | 383 int line_num = GetScriptLineNumber(script, start_position); |
382 if (line_num > 0) { | 384 if (line_num > 0) { |
383 line_num += script->line_offset()->value() + 1; | 385 line_num += script->line_offset()->value() + 1; |
384 } | 386 } |
385 LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name, | 387 LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name, |
386 String::cast(script->name()), line_num)); | 388 String::cast(script->name()), line_num)); |
387 OProfileAgent::CreateNativeCodeRegion(*func_name, | 389 OProfileAgent::CreateNativeCodeRegion(*func_name, |
388 String::cast(script->name()), | 390 String::cast(script->name()), |
389 line_num, code->address(), | 391 line_num, |
390 code->ExecutableSize()); | 392 code->instruction_start(), |
| 393 code->instruction_size()); |
391 } else { | 394 } else { |
392 LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name)); | 395 LOG(CodeCreateEvent(Logger::LAZY_COMPILE_TAG, *code, *func_name)); |
393 OProfileAgent::CreateNativeCodeRegion(*func_name, code->address(), | 396 OProfileAgent::CreateNativeCodeRegion(*func_name, |
394 code->ExecutableSize()); | 397 code->instruction_start(), |
| 398 code->instruction_size()); |
395 } | 399 } |
396 } | 400 } |
397 #endif | 401 #endif |
398 | 402 |
399 // Update the shared function info with the compiled code. | 403 // Update the shared function info with the compiled code. |
400 shared->set_code(*code); | 404 shared->set_code(*code); |
401 | 405 |
402 // Set the expected number of properties for instances. | 406 // Set the expected number of properties for instances. |
403 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); | 407 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); |
404 | 408 |
405 // Check the function has compiled code. | 409 // Check the function has compiled code. |
406 ASSERT(shared->is_compiled()); | 410 ASSERT(shared->is_compiled()); |
407 return true; | 411 return true; |
408 } | 412 } |
409 | 413 |
410 | 414 |
411 } } // namespace v8::internal | 415 } } // namespace v8::internal |
OLD | NEW |