| 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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 Handle<String> subject, | 640 Handle<String> subject, |
| 641 int previous_index, | 641 int previous_index, |
| 642 Handle<JSArray> last_match_info) { | 642 Handle<JSArray> last_match_info) { |
| 643 Isolate* isolate = regexp->GetIsolate(); | 643 Isolate* isolate = regexp->GetIsolate(); |
| 644 ASSERT_EQ(regexp->TypeTag(), JSRegExp::IRREGEXP); | 644 ASSERT_EQ(regexp->TypeTag(), JSRegExp::IRREGEXP); |
| 645 | 645 |
| 646 // Prepare space for the return values. | 646 // Prepare space for the return values. |
| 647 #if defined(V8_INTERPRETED_REGEXP) && defined(DEBUG) | 647 #if defined(V8_INTERPRETED_REGEXP) && defined(DEBUG) |
| 648 if (FLAG_trace_regexp_bytecodes) { | 648 if (FLAG_trace_regexp_bytecodes) { |
| 649 String* pattern = regexp->Pattern(); | 649 String* pattern = regexp->Pattern(); |
| 650 PrintF("\n\nRegexp match: /%s/\n\n", *(pattern->ToCString())); | 650 PrintF("\n\nRegexp match: /%s/\n\n", pattern->ToCString().get()); |
| 651 PrintF("\n\nSubject string: '%s'\n\n", *(subject->ToCString())); | 651 PrintF("\n\nSubject string: '%s'\n\n", subject->ToCString().get()); |
| 652 } | 652 } |
| 653 #endif | 653 #endif |
| 654 int required_registers = RegExpImpl::IrregexpPrepare(regexp, subject); | 654 int required_registers = RegExpImpl::IrregexpPrepare(regexp, subject); |
| 655 if (required_registers < 0) { | 655 if (required_registers < 0) { |
| 656 // Compiling failed with an exception. | 656 // Compiling failed with an exception. |
| 657 ASSERT(isolate->has_pending_exception()); | 657 ASSERT(isolate->has_pending_exception()); |
| 658 return Handle<Object>::null(); | 658 return Handle<Object>::null(); |
| 659 } | 659 } |
| 660 | 660 |
| 661 int32_t* output_registers = NULL; | 661 int32_t* output_registers = NULL; |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 work_list.RemoveLast()->Emit(this, &new_trace); | 1146 work_list.RemoveLast()->Emit(this, &new_trace); |
| 1147 } | 1147 } |
| 1148 if (reg_exp_too_big_) return IrregexpRegExpTooBig(zone_->isolate()); | 1148 if (reg_exp_too_big_) return IrregexpRegExpTooBig(zone_->isolate()); |
| 1149 | 1149 |
| 1150 Handle<HeapObject> code = macro_assembler_->GetCode(pattern); | 1150 Handle<HeapObject> code = macro_assembler_->GetCode(pattern); |
| 1151 heap->IncreaseTotalRegexpCodeGenerated(code->Size()); | 1151 heap->IncreaseTotalRegexpCodeGenerated(code->Size()); |
| 1152 work_list_ = NULL; | 1152 work_list_ = NULL; |
| 1153 #ifdef DEBUG | 1153 #ifdef DEBUG |
| 1154 if (FLAG_print_code) { | 1154 if (FLAG_print_code) { |
| 1155 CodeTracer::Scope trace_scope(heap->isolate()->GetCodeTracer()); | 1155 CodeTracer::Scope trace_scope(heap->isolate()->GetCodeTracer()); |
| 1156 Handle<Code>::cast(code)->Disassemble(*pattern->ToCString(), | 1156 Handle<Code>::cast(code)->Disassemble(pattern->ToCString().get(), |
| 1157 trace_scope.file()); | 1157 trace_scope.file()); |
| 1158 } | 1158 } |
| 1159 if (FLAG_trace_regexp_assembler) { | 1159 if (FLAG_trace_regexp_assembler) { |
| 1160 delete macro_assembler_; | 1160 delete macro_assembler_; |
| 1161 } | 1161 } |
| 1162 #endif | 1162 #endif |
| 1163 return RegExpEngine::CompilationResult(*code, next_register_); | 1163 return RegExpEngine::CompilationResult(*code, next_register_); |
| 1164 } | 1164 } |
| 1165 | 1165 |
| 1166 | 1166 |
| (...skipping 3202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4369 stream()->Add("\""); | 4369 stream()->Add("\""); |
| 4370 break; | 4370 break; |
| 4371 default: | 4371 default: |
| 4372 stream()->Put(label[i]); | 4372 stream()->Put(label[i]); |
| 4373 break; | 4373 break; |
| 4374 } | 4374 } |
| 4375 } | 4375 } |
| 4376 stream()->Add("\"];\n"); | 4376 stream()->Add("\"];\n"); |
| 4377 Visit(node); | 4377 Visit(node); |
| 4378 stream()->Add("}\n"); | 4378 stream()->Add("}\n"); |
| 4379 printf("%s", *(stream()->ToCString())); | 4379 printf("%s", stream()->ToCString().get()); |
| 4380 } | 4380 } |
| 4381 | 4381 |
| 4382 | 4382 |
| 4383 void DotPrinter::Visit(RegExpNode* node) { | 4383 void DotPrinter::Visit(RegExpNode* node) { |
| 4384 if (node->info()->visited) return; | 4384 if (node->info()->visited) return; |
| 4385 node->info()->visited = true; | 4385 node->info()->visited = true; |
| 4386 node->Accept(this); | 4386 node->Accept(this); |
| 4387 } | 4387 } |
| 4388 | 4388 |
| 4389 | 4389 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4664 } | 4664 } |
| 4665 stream()->Add("}\n"); | 4665 stream()->Add("}\n"); |
| 4666 } | 4666 } |
| 4667 | 4667 |
| 4668 | 4668 |
| 4669 void DispatchTable::Dump() { | 4669 void DispatchTable::Dump() { |
| 4670 HeapStringAllocator alloc; | 4670 HeapStringAllocator alloc; |
| 4671 StringStream stream(&alloc); | 4671 StringStream stream(&alloc); |
| 4672 DispatchTableDumper dumper(&stream); | 4672 DispatchTableDumper dumper(&stream); |
| 4673 tree()->ForEach(&dumper); | 4673 tree()->ForEach(&dumper); |
| 4674 OS::PrintError("%s", *stream.ToCString()); | 4674 OS::PrintError("%s", stream.ToCString().get()); |
| 4675 } | 4675 } |
| 4676 | 4676 |
| 4677 | 4677 |
| 4678 void RegExpEngine::DotPrint(const char* label, | 4678 void RegExpEngine::DotPrint(const char* label, |
| 4679 RegExpNode* node, | 4679 RegExpNode* node, |
| 4680 bool ignore_case) { | 4680 bool ignore_case) { |
| 4681 DotPrinter printer(ignore_case); | 4681 DotPrinter printer(ignore_case); |
| 4682 printer.PrintNode(label, node); | 4682 printer.PrintNode(label, node); |
| 4683 } | 4683 } |
| 4684 | 4684 |
| (...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6120 } | 6120 } |
| 6121 | 6121 |
| 6122 return compiler.Assemble(¯o_assembler, | 6122 return compiler.Assemble(¯o_assembler, |
| 6123 node, | 6123 node, |
| 6124 data->capture_count, | 6124 data->capture_count, |
| 6125 pattern); | 6125 pattern); |
| 6126 } | 6126 } |
| 6127 | 6127 |
| 6128 | 6128 |
| 6129 }} // namespace v8::internal | 6129 }} // namespace v8::internal |
| OLD | NEW |