Chromium Code Reviews| 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 isolate()->counters()->total_parse_size()->Increment(source->length()); | 559 isolate()->counters()->total_parse_size()->Increment(source->length()); |
| 560 ElapsedTimer timer; | 560 ElapsedTimer timer; |
| 561 if (FLAG_trace_parse) { | 561 if (FLAG_trace_parse) { |
| 562 timer.Start(); | 562 timer.Start(); |
| 563 } | 563 } |
| 564 fni_ = new(zone()) FuncNameInferrer(isolate(), zone()); | 564 fni_ = new(zone()) FuncNameInferrer(isolate(), zone()); |
| 565 | 565 |
| 566 // Initialize parser state. | 566 // Initialize parser state. |
| 567 source = FlattenGetString(source); | 567 source = FlattenGetString(source); |
| 568 FunctionLiteral* result; | 568 FunctionLiteral* result; |
| 569 if (source->IsTwoByteRepresentation()) { | 569 delete reusable_preparser_; |
| 570 delete reusable_preparser_; | 570 delete scanner_; |
| 571 delete scanner_; | 571 if (source->IsTwoByteRepresentation()) |
| 572 scanner_ = new ExperimentalScanner<uint16_t>(source, isolate()); | 572 scanner_ = new ExperimentalScanner<uint16_t>(source, isolate()); |
| 573 } else { | 573 else |
| 574 delete reusable_preparser_; | |
| 575 delete scanner_; | |
| 576 scanner_ = new ExperimentalScanner<uint8_t>(source, isolate()); | 574 scanner_ = new ExperimentalScanner<uint8_t>(source, isolate()); |
|
ulan
2014/01/20 14:54:28
Please wrap the branches in { } since they are in
| |
| 577 } | |
| 578 SetScannerFlags(); | 575 SetScannerFlags(); |
| 579 scanner_->Init(); | 576 scanner_->Init(); |
| 580 result = DoParseProgram(info(), source); | 577 result = DoParseProgram(info(), source); |
| 581 | 578 |
| 582 if (FLAG_trace_parse && result != NULL) { | 579 if (FLAG_trace_parse && result != NULL) { |
| 583 double ms = timer.Elapsed().InMillisecondsF(); | 580 double ms = timer.Elapsed().InMillisecondsF(); |
| 584 if (info()->is_eval()) { | 581 if (info()->is_eval()) { |
| 585 PrintF("[parsing eval"); | 582 PrintF("[parsing eval"); |
| 586 } else if (info()->script()->name()->IsString()) { | 583 } else if (info()->script()->name()->IsString()) { |
| 587 String* name = String::cast(info()->script()->name()); | 584 String* name = String::cast(info()->script()->name()); |
| (...skipping 5100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5688 } | 5685 } |
| 5689 | 5686 |
| 5690 | 5687 |
| 5691 void Parser::SetScannerFlags() { | 5688 void Parser::SetScannerFlags() { |
| 5692 scanner_->SetHarmonyScoping(allow_harmony_scoping_); | 5689 scanner_->SetHarmonyScoping(allow_harmony_scoping_); |
| 5693 scanner_->SetHarmonyModules(allow_harmony_modules_); | 5690 scanner_->SetHarmonyModules(allow_harmony_modules_); |
| 5694 scanner_->SetHarmonyNumericLiterals(allow_harmony_numeric_literals_); | 5691 scanner_->SetHarmonyNumericLiterals(allow_harmony_numeric_literals_); |
| 5695 } | 5692 } |
| 5696 | 5693 |
| 5697 } } // namespace v8::internal | 5694 } } // namespace v8::internal |
| OLD | NEW |