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/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 4087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4098 elements->set(0, *arg_string); | 4098 elements->set(0, *arg_string); |
4099 } | 4099 } |
4100 isolate()->debug()->OnCompileError(script()); | 4100 isolate()->debug()->OnCompileError(script()); |
4101 | 4101 |
4102 Handle<JSArray> array = factory->NewJSArrayWithElements(elements); | 4102 Handle<JSArray> array = factory->NewJSArrayWithElements(elements); |
4103 Handle<Object> error; | 4103 Handle<Object> error; |
4104 MaybeHandle<Object> maybe_error = | 4104 MaybeHandle<Object> maybe_error = |
4105 pending_error_is_reference_error_ | 4105 pending_error_is_reference_error_ |
4106 ? factory->NewReferenceError(pending_error_message_, array) | 4106 ? factory->NewReferenceError(pending_error_message_, array) |
4107 : factory->NewSyntaxError(pending_error_message_, array); | 4107 : factory->NewSyntaxError(pending_error_message_, array); |
4108 if (maybe_error.ToHandle(&error)) isolate()->Throw(*error, &location); | 4108 |
| 4109 if (maybe_error.ToHandle(&error)) { |
| 4110 Handle<JSObject> jserror = Handle<JSObject>::cast(error); |
| 4111 |
| 4112 Handle<Name> key_start_pos = factory->error_start_pos_symbol(); |
| 4113 JSObject::SetProperty( |
| 4114 jserror, key_start_pos, |
| 4115 handle(Smi::FromInt(location.start_pos()), isolate()), |
| 4116 SLOPPY).Check(); |
| 4117 |
| 4118 Handle<Name> key_end_pos = factory->error_end_pos_symbol(); |
| 4119 JSObject::SetProperty(jserror, key_end_pos, |
| 4120 handle(Smi::FromInt(location.end_pos()), isolate()), |
| 4121 SLOPPY).Check(); |
| 4122 |
| 4123 Handle<Name> key_script = factory->error_script_symbol(); |
| 4124 JSObject::SetProperty(jserror, key_script, script(), SLOPPY).Check(); |
| 4125 |
| 4126 isolate()->Throw(*error, &location); |
| 4127 } |
4109 } | 4128 } |
4110 } | 4129 } |
4111 | 4130 |
4112 | 4131 |
4113 void Parser::Internalize() { | 4132 void Parser::Internalize() { |
4114 // Internalize strings. | 4133 // Internalize strings. |
4115 ast_value_factory()->Internalize(isolate()); | 4134 ast_value_factory()->Internalize(isolate()); |
4116 | 4135 |
4117 // Error processing. | 4136 // Error processing. |
4118 if (info()->function() == NULL) { | 4137 if (info()->function() == NULL) { |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5232 } else { | 5251 } else { |
5233 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5252 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
5234 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5253 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
5235 raw_string->length()); | 5254 raw_string->length()); |
5236 } | 5255 } |
5237 } | 5256 } |
5238 | 5257 |
5239 return running_hash; | 5258 return running_hash; |
5240 } | 5259 } |
5241 } } // namespace v8::internal | 5260 } } // namespace v8::internal |
OLD | NEW |