| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/execution.h" | 8 #include "src/execution.h" |
| 9 #include "src/messages.h" | 9 #include "src/messages.h" |
| 10 #include "src/string-builder.h" | 10 #include "src/string-builder.h" |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 builder.AppendString(name); | 427 builder.AppendString(name); |
| 428 builder.AppendCString(": "); | 428 builder.AppendCString(": "); |
| 429 builder.AppendString(message); | 429 builder.AppendString(message); |
| 430 return builder.Finish(); | 430 return builder.Finish(); |
| 431 } | 431 } |
| 432 | 432 |
| 433 | 433 |
| 434 bool ErrorToStringHelper::ShadowsInternalError( | 434 bool ErrorToStringHelper::ShadowsInternalError( |
| 435 Isolate* isolate, LookupIterator* property_lookup, | 435 Isolate* isolate, LookupIterator* property_lookup, |
| 436 LookupIterator* internal_error_lookup) { | 436 LookupIterator* internal_error_lookup) { |
| 437 if (!property_lookup->IsFound()) return false; |
| 437 Handle<JSObject> holder = property_lookup->GetHolder<JSObject>(); | 438 Handle<JSObject> holder = property_lookup->GetHolder<JSObject>(); |
| 438 // It's fine if the property is defined on the error itself. | 439 // It's fine if the property is defined on the error itself. |
| 439 if (holder.is_identical_to(property_lookup->GetReceiver())) return true; | 440 if (holder.is_identical_to(property_lookup->GetReceiver())) return true; |
| 440 PrototypeIterator it(isolate, holder, PrototypeIterator::START_AT_RECEIVER); | 441 PrototypeIterator it(isolate, holder, PrototypeIterator::START_AT_RECEIVER); |
| 441 while (true) { | 442 while (true) { |
| 442 if (it.IsAtEnd()) return false; | 443 if (it.IsAtEnd()) return false; |
| 443 if (it.IsAtEnd(internal_error_lookup->GetHolder<JSObject>())) return true; | 444 if (it.IsAtEnd(internal_error_lookup->GetHolder<JSObject>())) return true; |
| 444 it.AdvanceIgnoringProxies(); | 445 it.AdvanceIgnoringProxies(); |
| 445 } | 446 } |
| 446 } | 447 } |
| 447 | 448 |
| 448 | 449 |
| 449 MaybeHandle<String> ErrorToStringHelper::GetStringifiedProperty( | 450 MaybeHandle<String> ErrorToStringHelper::GetStringifiedProperty( |
| 450 Isolate* isolate, LookupIterator* property_lookup, | 451 Isolate* isolate, LookupIterator* property_lookup, |
| 451 Handle<String> default_value) { | 452 Handle<String> default_value) { |
| 452 if (!property_lookup->IsFound()) return default_value; | 453 if (!property_lookup->IsFound()) return default_value; |
| 453 Handle<Object> obj; | 454 Handle<Object> obj; |
| 454 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Object::GetProperty(property_lookup), | 455 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Object::GetProperty(property_lookup), |
| 455 String); | 456 String); |
| 456 if (obj->IsUndefined()) return default_value; | 457 if (obj->IsUndefined()) return default_value; |
| 457 if (!obj->IsString()) { | 458 if (!obj->IsString()) { |
| 458 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Execution::ToString(isolate, obj), | 459 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Execution::ToString(isolate, obj), |
| 459 String); | 460 String); |
| 460 } | 461 } |
| 461 return Handle<String>::cast(obj); | 462 return Handle<String>::cast(obj); |
| 462 } | 463 } |
| 463 | 464 |
| 464 } // namespace internal | 465 } // namespace internal |
| 465 } // namespace v8 | 466 } // namespace v8 |
| OLD | NEW |