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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 // stack overflow. The isolate allows only one pending exception at at time | 676 // stack overflow. The isolate allows only one pending exception at at time |
677 // and we want to report the stack overflow later. | 677 // and we want to report the stack overflow later. |
678 return; | 678 return; |
679 } | 679 } |
680 MessageLocation location(parser_->script_, | 680 MessageLocation location(parser_->script_, |
681 source_location.beg_pos, | 681 source_location.beg_pos, |
682 source_location.end_pos); | 682 source_location.end_pos); |
683 Factory* factory = parser_->isolate()->factory(); | 683 Factory* factory = parser_->isolate()->factory(); |
684 Handle<FixedArray> elements = factory->NewFixedArray(args.length()); | 684 Handle<FixedArray> elements = factory->NewFixedArray(args.length()); |
685 for (int i = 0; i < args.length(); i++) { | 685 for (int i = 0; i < args.length(); i++) { |
686 Handle<String> arg_string = factory->NewStringFromUtf8(CStrVector(args[i])); | 686 Handle<String> arg_string = |
687 ASSERT(!arg_string.is_null()); | 687 factory->NewStringFromUtf8(CStrVector(args[i])).ToHandleChecked(); |
688 elements->set(i, *arg_string); | 688 elements->set(i, *arg_string); |
689 } | 689 } |
690 Handle<JSArray> array = factory->NewJSArrayWithElements(elements); | 690 Handle<JSArray> array = factory->NewJSArrayWithElements(elements); |
691 Handle<Object> result = is_reference_error | 691 Handle<Object> result = is_reference_error |
692 ? factory->NewReferenceError(message, array) | 692 ? factory->NewReferenceError(message, array) |
693 : factory->NewSyntaxError(message, array); | 693 : factory->NewSyntaxError(message, array); |
694 parser_->isolate()->Throw(*result, &location); | 694 parser_->isolate()->Throw(*result, &location); |
695 } | 695 } |
696 | 696 |
697 | 697 |
(...skipping 3137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3835 } | 3835 } |
3836 | 3836 |
3837 | 3837 |
3838 bool RegExpParser::simple() { | 3838 bool RegExpParser::simple() { |
3839 return simple_; | 3839 return simple_; |
3840 } | 3840 } |
3841 | 3841 |
3842 | 3842 |
3843 RegExpTree* RegExpParser::ReportError(Vector<const char> message) { | 3843 RegExpTree* RegExpParser::ReportError(Vector<const char> message) { |
3844 failed_ = true; | 3844 failed_ = true; |
3845 *error_ = isolate()->factory()->NewStringFromAscii(message, NOT_TENURED); | 3845 *error_ = isolate()->factory()->NewStringFromAscii( |
3846 ASSERT(!error_->is_null()); | 3846 message, NOT_TENURED).ToHandleChecked(); |
3847 // Zip to the end to make sure the no more input is read. | 3847 // Zip to the end to make sure the no more input is read. |
3848 current_ = kEndMarker; | 3848 current_ = kEndMarker; |
3849 next_pos_ = in()->length(); | 3849 next_pos_ = in()->length(); |
3850 return NULL; | 3850 return NULL; |
3851 } | 3851 } |
3852 | 3852 |
3853 | 3853 |
3854 // Pattern :: | 3854 // Pattern :: |
3855 // Disjunction | 3855 // Disjunction |
3856 RegExpTree* RegExpParser::ParsePattern() { | 3856 RegExpTree* RegExpParser::ParsePattern() { |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4693 ASSERT(info()->isolate()->has_pending_exception()); | 4693 ASSERT(info()->isolate()->has_pending_exception()); |
4694 } else { | 4694 } else { |
4695 result = ParseProgram(); | 4695 result = ParseProgram(); |
4696 } | 4696 } |
4697 } | 4697 } |
4698 info()->SetFunction(result); | 4698 info()->SetFunction(result); |
4699 return (result != NULL); | 4699 return (result != NULL); |
4700 } | 4700 } |
4701 | 4701 |
4702 } } // namespace v8::internal | 4702 } } // namespace v8::internal |
OLD | NEW |