| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 isolate->counters()->total_compiled_code_size()->Increment( | 117 isolate->counters()->total_compiled_code_size()->Increment( |
| 118 code->instruction_size()); | 118 code->instruction_size()); |
| 119 code->set_prologue_offset(info->prologue_offset()); | 119 code->set_prologue_offset(info->prologue_offset()); |
| 120 return code; | 120 return code; |
| 121 } | 121 } |
| 122 | 122 |
| 123 | 123 |
| 124 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { | 124 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { |
| 125 #ifdef ENABLE_DISASSEMBLER | 125 #ifdef ENABLE_DISASSEMBLER |
| 126 AllowDeferredHandleDereference allow_deference_for_print_code; | 126 AllowDeferredHandleDereference allow_deference_for_print_code; |
| 127 bool print_code = Isolate::Current()->bootstrapper()->IsActive() | 127 bool print_code = info->isolate()->bootstrapper()->IsActive() |
| 128 ? FLAG_print_builtin_code | 128 ? FLAG_print_builtin_code |
| 129 : (FLAG_print_code || | 129 : (FLAG_print_code || |
| 130 (info->IsStub() && FLAG_print_code_stubs) || | 130 (info->IsStub() && FLAG_print_code_stubs) || |
| 131 (info->IsOptimizing() && FLAG_print_opt_code)); | 131 (info->IsOptimizing() && FLAG_print_opt_code)); |
| 132 if (print_code) { | 132 if (print_code) { |
| 133 // Print the source code if available. | 133 // Print the source code if available. |
| 134 FunctionLiteral* function = info->function(); | 134 FunctionLiteral* function = info->function(); |
| 135 if (code->kind() == Code::OPTIMIZED_FUNCTION) { | 135 if (code->kind() == Code::OPTIMIZED_FUNCTION) { |
| 136 Handle<Script> script = info->script(); | 136 Handle<Script> script = info->script(); |
| 137 if (!script->IsUndefined() && !script->source()->IsUndefined()) { | 137 if (!script->IsUndefined() && !script->source()->IsUndefined()) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 164 CodeStub::Major major_key = info->code_stub()->MajorKey(); | 164 CodeStub::Major major_key = info->code_stub()->MajorKey(); |
| 165 code->Disassemble(CodeStub::MajorName(major_key, false)); | 165 code->Disassemble(CodeStub::MajorName(major_key, false)); |
| 166 } else { | 166 } else { |
| 167 code->Disassemble(*function->debug_name()->ToCString()); | 167 code->Disassemble(*function->debug_name()->ToCString()); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 #endif // ENABLE_DISASSEMBLER | 170 #endif // ENABLE_DISASSEMBLER |
| 171 } | 171 } |
| 172 | 172 |
| 173 | 173 |
| 174 bool CodeGenerator::ShouldGenerateLog(Expression* type) { | 174 bool CodeGenerator::ShouldGenerateLog(Isolate* isolate, Expression* type) { |
| 175 ASSERT(type != NULL); | 175 ASSERT(type != NULL); |
| 176 Isolate* isolate = Isolate::Current(); | |
| 177 if (!isolate->logger()->is_logging() && | 176 if (!isolate->logger()->is_logging() && |
| 178 !isolate->cpu_profiler()->is_profiling()) { | 177 !isolate->cpu_profiler()->is_profiling()) { |
| 179 return false; | 178 return false; |
| 180 } | 179 } |
| 181 Handle<String> name = Handle<String>::cast(type->AsLiteral()->value()); | 180 Handle<String> name = Handle<String>::cast(type->AsLiteral()->value()); |
| 182 if (FLAG_log_regexp) { | 181 if (FLAG_log_regexp) { |
| 183 if (name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("regexp"))) | 182 if (name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("regexp"))) |
| 184 return true; | 183 return true; |
| 185 } | 184 } |
| 186 return false; | 185 return false; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 ASSERT(result_size_ == 1 || result_size_ == 2); | 223 ASSERT(result_size_ == 1 || result_size_ == 2); |
| 225 #ifdef _WIN64 | 224 #ifdef _WIN64 |
| 226 return result | ((result_size_ == 1) ? 0 : 2); | 225 return result | ((result_size_ == 1) ? 0 : 2); |
| 227 #else | 226 #else |
| 228 return result; | 227 return result; |
| 229 #endif | 228 #endif |
| 230 } | 229 } |
| 231 | 230 |
| 232 | 231 |
| 233 } } // namespace v8::internal | 232 } } // namespace v8::internal |
| OLD | NEW |