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