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 4238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4249 elements->set(0, *arg_string); | 4249 elements->set(0, *arg_string); |
4250 } | 4250 } |
4251 isolate()->debug()->OnCompileError(script()); | 4251 isolate()->debug()->OnCompileError(script()); |
4252 | 4252 |
4253 Handle<JSArray> array = factory->NewJSArrayWithElements(elements); | 4253 Handle<JSArray> array = factory->NewJSArrayWithElements(elements); |
4254 Handle<Object> error; | 4254 Handle<Object> error; |
4255 MaybeHandle<Object> maybe_error = | 4255 MaybeHandle<Object> maybe_error = |
4256 pending_error_is_reference_error_ | 4256 pending_error_is_reference_error_ |
4257 ? factory->NewReferenceError(pending_error_message_, array) | 4257 ? factory->NewReferenceError(pending_error_message_, array) |
4258 : factory->NewSyntaxError(pending_error_message_, array); | 4258 : factory->NewSyntaxError(pending_error_message_, array); |
4259 if (maybe_error.ToHandle(&error)) isolate()->Throw(*error, &location); | 4259 |
| 4260 if (maybe_error.ToHandle(&error)) { |
| 4261 Handle<JSObject> jserror = Handle<JSObject>::cast(error); |
| 4262 |
| 4263 Handle<Name> key_start_pos = factory->error_start_pos_symbol(); |
| 4264 JSObject::SetProperty( |
| 4265 jserror, key_start_pos, |
| 4266 handle(Smi::FromInt(location.start_pos()), isolate()), |
| 4267 SLOPPY).Check(); |
| 4268 |
| 4269 Handle<Name> key_end_pos = factory->error_end_pos_symbol(); |
| 4270 JSObject::SetProperty(jserror, key_end_pos, |
| 4271 handle(Smi::FromInt(location.end_pos()), isolate()), |
| 4272 SLOPPY).Check(); |
| 4273 |
| 4274 Handle<Name> key_script = factory->error_script_symbol(); |
| 4275 JSObject::SetProperty(jserror, key_script, script(), SLOPPY).Check(); |
| 4276 |
| 4277 isolate()->Throw(*error, &location); |
| 4278 } |
4260 } | 4279 } |
4261 } | 4280 } |
4262 | 4281 |
4263 | 4282 |
4264 void Parser::Internalize() { | 4283 void Parser::Internalize() { |
4265 // Internalize strings. | 4284 // Internalize strings. |
4266 ast_value_factory()->Internalize(isolate()); | 4285 ast_value_factory()->Internalize(isolate()); |
4267 | 4286 |
4268 // Error processing. | 4287 // Error processing. |
4269 if (info()->function() == NULL) { | 4288 if (info()->function() == NULL) { |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5383 } else { | 5402 } else { |
5384 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5403 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
5385 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5404 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
5386 raw_string->length()); | 5405 raw_string->length()); |
5387 } | 5406 } |
5388 } | 5407 } |
5389 | 5408 |
5390 return running_hash; | 5409 return running_hash; |
5391 } | 5410 } |
5392 } } // namespace v8::internal | 5411 } } // namespace v8::internal |
OLD | NEW |