| OLD | NEW |
| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 #endif // ENABLE_DISASSEMBLER | 152 #endif // ENABLE_DISASSEMBLER |
| 153 | 153 |
| 154 if (!code.is_null()) { | 154 if (!code.is_null()) { |
| 155 Counters::total_compiled_code_size.Increment(code->instruction_size()); | 155 Counters::total_compiled_code_size.Increment(code->instruction_size()); |
| 156 } | 156 } |
| 157 | 157 |
| 158 return code; | 158 return code; |
| 159 } | 159 } |
| 160 | 160 |
| 161 | 161 |
| 162 bool CodeGenerator::ShouldGenerateLog(Expression* type) { |
| 163 ASSERT(type != NULL); |
| 164 if (!Logger::is_enabled()) return false; |
| 165 Handle<String> name = Handle<String>::cast(type->AsLiteral()->handle()); |
| 166 if (FLAG_log_regexp) { |
| 167 static Vector<const char> kRegexp = CStrVector("regexp"); |
| 168 if (name->IsEqualTo(kRegexp)) |
| 169 return true; |
| 170 } |
| 171 return false; |
| 172 } |
| 173 |
| 174 |
| 162 // Sets the function info on a function. | 175 // Sets the function info on a function. |
| 163 // The start_position points to the first '(' character after the function name | 176 // The start_position points to the first '(' character after the function name |
| 164 // in the full script source. When counting characters in the script source the | 177 // in the full script source. When counting characters in the script source the |
| 165 // the first character is number 0 (not 1). | 178 // the first character is number 0 (not 1). |
| 166 void CodeGenerator::SetFunctionInfo(Handle<JSFunction> fun, | 179 void CodeGenerator::SetFunctionInfo(Handle<JSFunction> fun, |
| 167 int length, | 180 int length, |
| 168 int function_token_position, | 181 int function_token_position, |
| 169 int start_position, | 182 int start_position, |
| 170 int end_position, | 183 int end_position, |
| 171 bool is_expression, | 184 bool is_expression, |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 "_ArgumentsLength"}, | 340 "_ArgumentsLength"}, |
| 328 {&v8::internal::CodeGenerator::GenerateArgumentsAccess, | 341 {&v8::internal::CodeGenerator::GenerateArgumentsAccess, |
| 329 "_Arguments"}, | 342 "_Arguments"}, |
| 330 {&v8::internal::CodeGenerator::GenerateValueOf, | 343 {&v8::internal::CodeGenerator::GenerateValueOf, |
| 331 "_ValueOf"}, | 344 "_ValueOf"}, |
| 332 {&v8::internal::CodeGenerator::GenerateSetValueOf, | 345 {&v8::internal::CodeGenerator::GenerateSetValueOf, |
| 333 "_SetValueOf"}, | 346 "_SetValueOf"}, |
| 334 {&v8::internal::CodeGenerator::GenerateFastCharCodeAt, | 347 {&v8::internal::CodeGenerator::GenerateFastCharCodeAt, |
| 335 "_FastCharCodeAt"}, | 348 "_FastCharCodeAt"}, |
| 336 {&v8::internal::CodeGenerator::GenerateObjectEquals, | 349 {&v8::internal::CodeGenerator::GenerateObjectEquals, |
| 337 "_ObjectEquals"} | 350 "_ObjectEquals"}, |
| 351 {&v8::internal::CodeGenerator::GenerateLog, |
| 352 "_Log"} |
| 338 }; | 353 }; |
| 339 Handle<String> name = node->name(); | 354 Handle<String> name = node->name(); |
| 340 StringShape shape(*name); | 355 StringShape shape(*name); |
| 341 if (name->length(shape) > 0 && name->Get(shape, 0) == '_') { | 356 if (name->length(shape) > 0 && name->Get(shape, 0) == '_') { |
| 342 for (unsigned i = 0; | 357 for (unsigned i = 0; |
| 343 i < sizeof(kInlineRuntimeLUT) / sizeof(InlineRuntimeLUT); | 358 i < sizeof(kInlineRuntimeLUT) / sizeof(InlineRuntimeLUT); |
| 344 i++) { | 359 i++) { |
| 345 const InlineRuntimeLUT* entry = kInlineRuntimeLUT + i; | 360 const InlineRuntimeLUT* entry = kInlineRuntimeLUT + i; |
| 346 if (name->IsEqualTo(CStrVector(entry->name))) { | 361 if (name->IsEqualTo(CStrVector(entry->name))) { |
| 347 ((*this).*(entry->method))(args); | 362 ((*this).*(entry->method))(args); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { | 523 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { |
| 509 switch (type_) { | 524 switch (type_) { |
| 510 case READ_LENGTH: GenerateReadLength(masm); break; | 525 case READ_LENGTH: GenerateReadLength(masm); break; |
| 511 case READ_ELEMENT: GenerateReadElement(masm); break; | 526 case READ_ELEMENT: GenerateReadElement(masm); break; |
| 512 case NEW_OBJECT: GenerateNewObject(masm); break; | 527 case NEW_OBJECT: GenerateNewObject(masm); break; |
| 513 } | 528 } |
| 514 } | 529 } |
| 515 | 530 |
| 516 | 531 |
| 517 } } // namespace v8::internal | 532 } } // namespace v8::internal |
| OLD | NEW |