OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
(...skipping 3343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3354 Handle<String> source_url = scanner_.SourceUrl(isolate); | 3354 Handle<String> source_url = scanner_.SourceUrl(isolate); |
3355 if (!source_url.is_null()) { | 3355 if (!source_url.is_null()) { |
3356 script->set_source_url(*source_url); | 3356 script->set_source_url(*source_url); |
3357 } | 3357 } |
3358 Handle<String> source_mapping_url = scanner_.SourceMappingUrl(isolate); | 3358 Handle<String> source_mapping_url = scanner_.SourceMappingUrl(isolate); |
3359 if (!source_mapping_url.is_null()) { | 3359 if (!source_mapping_url.is_null()) { |
3360 script->set_source_mapping_url(*source_mapping_url); | 3360 script->set_source_mapping_url(*source_mapping_url); |
3361 } | 3361 } |
3362 } | 3362 } |
3363 | 3363 |
3364 void Parser::ReportErrors(Isolate* isolate, Handle<Script> script) { | 3364 |
3365 if (stack_overflow()) { | 3365 void Parser::Internalize(Isolate* isolate, Handle<Script> script, bool error) { |
3366 isolate->StackOverflow(); | 3366 // Internalize strings and values. |
3367 } else { | 3367 ast_value_factory()->Internalize(isolate); |
3368 DCHECK(pending_error_handler_.has_pending_error()); | 3368 |
3369 // Internalize ast values for throwing the pending error. | 3369 // Error processing. |
3370 ast_value_factory()->Internalize(isolate); | 3370 if (error) { |
3371 pending_error_handler_.ThrowPendingError(isolate, script); | 3371 if (stack_overflow()) { |
| 3372 isolate->StackOverflow(); |
| 3373 } else { |
| 3374 DCHECK(pending_error_handler_.has_pending_error()); |
| 3375 pending_error_handler_.ThrowPendingError(isolate, script); |
| 3376 } |
3372 } | 3377 } |
3373 } | |
3374 | 3378 |
3375 void Parser::UpdateStatistics(Isolate* isolate, Handle<Script> script) { | |
3376 // Move statistics to Isolate. | 3379 // Move statistics to Isolate. |
3377 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; | 3380 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; |
3378 ++feature) { | 3381 ++feature) { |
3379 if (use_counts_[feature] > 0) { | 3382 if (use_counts_[feature] > 0) { |
3380 isolate->CountUsage(v8::Isolate::UseCounterFeature(feature)); | 3383 isolate->CountUsage(v8::Isolate::UseCounterFeature(feature)); |
3381 } | 3384 } |
3382 } | 3385 } |
3383 if (scanner_.FoundHtmlComment()) { | 3386 if (scanner_.FoundHtmlComment()) { |
3384 isolate->CountUsage(v8::Isolate::kHtmlComment); | 3387 isolate->CountUsage(v8::Isolate::kHtmlComment); |
3385 if (script->line_offset() == 0 && script->column_offset() == 0) { | 3388 if (script->line_offset() == 0 && script->column_offset() == 0) { |
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5023 | 5026 |
5024 return final_loop; | 5027 return final_loop; |
5025 } | 5028 } |
5026 | 5029 |
5027 #undef CHECK_OK | 5030 #undef CHECK_OK |
5028 #undef CHECK_OK_VOID | 5031 #undef CHECK_OK_VOID |
5029 #undef CHECK_FAILED | 5032 #undef CHECK_FAILED |
5030 | 5033 |
5031 } // namespace internal | 5034 } // namespace internal |
5032 } // namespace v8 | 5035 } // namespace v8 |
OLD | NEW |