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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 3937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3948 elements->set(0, *arg_string); | 3948 elements->set(0, *arg_string); |
3949 } else if (pending_error_char_arg_ != NULL) { | 3949 } else if (pending_error_char_arg_ != NULL) { |
3950 Handle<String> arg_string = | 3950 Handle<String> arg_string = |
3951 factory->NewStringFromUtf8(CStrVector(pending_error_char_arg_)) | 3951 factory->NewStringFromUtf8(CStrVector(pending_error_char_arg_)) |
3952 .ToHandleChecked(); | 3952 .ToHandleChecked(); |
3953 elements->set(0, *arg_string); | 3953 elements->set(0, *arg_string); |
3954 } | 3954 } |
3955 isolate()->debug()->OnCompileError(script_); | 3955 isolate()->debug()->OnCompileError(script_); |
3956 | 3956 |
3957 Handle<JSArray> array = factory->NewJSArrayWithElements(elements); | 3957 Handle<JSArray> array = factory->NewJSArrayWithElements(elements); |
3958 Handle<Object> result = pending_error_is_reference_error_ | 3958 Handle<Object> error; |
3959 ? factory->NewReferenceError(pending_error_message_, array) | 3959 MaybeHandle<Object> maybe_error = |
3960 : factory->NewSyntaxError(pending_error_message_, array); | 3960 pending_error_is_reference_error_ |
3961 isolate()->Throw(*result, &location); | 3961 ? factory->NewReferenceError(pending_error_message_, array) |
| 3962 : factory->NewSyntaxError(pending_error_message_, array); |
| 3963 if (maybe_error.ToHandle(&error)) isolate()->Throw(*error, &location); |
3962 } | 3964 } |
3963 } | 3965 } |
3964 | 3966 |
3965 | 3967 |
3966 void Parser::InternalizeUseCounts() { | 3968 void Parser::InternalizeUseCounts() { |
3967 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; | 3969 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; |
3968 ++feature) { | 3970 ++feature) { |
3969 for (int i = 0; i < use_counts_[feature]; ++i) { | 3971 for (int i = 0; i < use_counts_[feature]; ++i) { |
3970 isolate()->CountUsage(v8::Isolate::UseCounterFeature(feature)); | 3972 isolate()->CountUsage(v8::Isolate::UseCounterFeature(feature)); |
3971 } | 3973 } |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4837 info()->SetAstValueFactory(ast_value_factory_); | 4839 info()->SetAstValueFactory(ast_value_factory_); |
4838 } | 4840 } |
4839 ast_value_factory_ = NULL; | 4841 ast_value_factory_ = NULL; |
4840 | 4842 |
4841 InternalizeUseCounts(); | 4843 InternalizeUseCounts(); |
4842 | 4844 |
4843 return (result != NULL); | 4845 return (result != NULL); |
4844 } | 4846 } |
4845 | 4847 |
4846 } } // namespace v8::internal | 4848 } } // namespace v8::internal |
OLD | NEW |