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

Side by Side Diff: src/codegen.cc

Issue 16537: Runtime logging (Closed)
Patch Set: Created 11 years, 11 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
« no previous file with comments | « no previous file | src/codegen-arm.h » ('j') | src/codegen-ia32.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 #endif // ENABLE_DISASSEMBLER 156 #endif // ENABLE_DISASSEMBLER
157 157
158 if (!code.is_null()) { 158 if (!code.is_null()) {
159 Counters::total_compiled_code_size.Increment(code->instruction_size()); 159 Counters::total_compiled_code_size.Increment(code->instruction_size());
160 } 160 }
161 161
162 return code; 162 return code;
163 } 163 }
164 164
165 165
166 bool CodeGenerator::ShouldGenerateLog(Expression* type) {
167 ASSERT(type != NULL);
168 if (!Logger::is_enabled()) return false;
169 Handle<String> name = Handle<String>::cast(type->AsLiteral()->handle());
170 if (FLAG_log_regexp) {
171 static Vector<const char> kRegexp = CStrVector("regexp");
172 if (name->IsEqualTo(kRegexp))
173 return true;
174 }
175 return false;
176 }
177
178
166 // Sets the function info on a function. 179 // Sets the function info on a function.
167 // The start_position points to the first '(' character after the function name 180 // The start_position points to the first '(' character after the function name
168 // in the full script source. When counting characters in the script source the 181 // in the full script source. When counting characters in the script source the
169 // the first character is number 0 (not 1). 182 // the first character is number 0 (not 1).
170 void CodeGenerator::SetFunctionInfo(Handle<JSFunction> fun, 183 void CodeGenerator::SetFunctionInfo(Handle<JSFunction> fun,
171 int length, 184 int length,
172 int function_token_position, 185 int function_token_position,
173 int start_position, 186 int start_position,
174 int end_position, 187 int end_position,
175 bool is_expression, 188 bool is_expression,
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 "_ArgumentsLength"}, 344 "_ArgumentsLength"},
332 {&v8::internal::CodeGenerator::GenerateArgumentsAccess, 345 {&v8::internal::CodeGenerator::GenerateArgumentsAccess,
333 "_Arguments"}, 346 "_Arguments"},
334 {&v8::internal::CodeGenerator::GenerateValueOf, 347 {&v8::internal::CodeGenerator::GenerateValueOf,
335 "_ValueOf"}, 348 "_ValueOf"},
336 {&v8::internal::CodeGenerator::GenerateSetValueOf, 349 {&v8::internal::CodeGenerator::GenerateSetValueOf,
337 "_SetValueOf"}, 350 "_SetValueOf"},
338 {&v8::internal::CodeGenerator::GenerateFastCharCodeAt, 351 {&v8::internal::CodeGenerator::GenerateFastCharCodeAt,
339 "_FastCharCodeAt"}, 352 "_FastCharCodeAt"},
340 {&v8::internal::CodeGenerator::GenerateObjectEquals, 353 {&v8::internal::CodeGenerator::GenerateObjectEquals,
341 "_ObjectEquals"} 354 "_ObjectEquals"},
355 {&v8::internal::CodeGenerator::GenerateLog,
356 "_Log"}
342 }; 357 };
343 Handle<String> name = node->name(); 358 Handle<String> name = node->name();
344 StringShape shape(*name); 359 StringShape shape(*name);
345 if (name->length(shape) > 0 && name->Get(shape, 0) == '_') { 360 if (name->length(shape) > 0 && name->Get(shape, 0) == '_') {
346 for (unsigned i = 0; 361 for (unsigned i = 0;
347 i < sizeof(kInlineRuntimeLUT) / sizeof(InlineRuntimeLUT); 362 i < sizeof(kInlineRuntimeLUT) / sizeof(InlineRuntimeLUT);
348 i++) { 363 i++) {
349 const InlineRuntimeLUT* entry = kInlineRuntimeLUT + i; 364 const InlineRuntimeLUT* entry = kInlineRuntimeLUT + i;
350 if (name->IsEqualTo(CStrVector(entry->name))) { 365 if (name->IsEqualTo(CStrVector(entry->name))) {
351 ((*this).*(entry->method))(args); 366 ((*this).*(entry->method))(args);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { 512 void ArgumentsAccessStub::Generate(MacroAssembler* masm) {
498 switch (type_) { 513 switch (type_) {
499 case READ_LENGTH: GenerateReadLength(masm); break; 514 case READ_LENGTH: GenerateReadLength(masm); break;
500 case READ_ELEMENT: GenerateReadElement(masm); break; 515 case READ_ELEMENT: GenerateReadElement(masm); break;
501 case NEW_OBJECT: GenerateNewObject(masm); break; 516 case NEW_OBJECT: GenerateNewObject(masm); break;
502 } 517 }
503 } 518 }
504 519
505 520
506 } } // namespace v8::internal 521 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/codegen-arm.h » ('j') | src/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698