| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <iomanip> | 8 #include <iomanip> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 MessageTemplate::kProxyRevoked, | 663 MessageTemplate::kProxyRevoked, |
| 664 isolate->factory()->NewStringFromAsciiChecked("IsArray"))); | 664 isolate->factory()->NewStringFromAsciiChecked("IsArray"))); |
| 665 return Nothing<bool>(); | 665 return Nothing<bool>(); |
| 666 } | 666 } |
| 667 return Object::IsArray(handle(proxy->target(), isolate)); | 667 return Object::IsArray(handle(proxy->target(), isolate)); |
| 668 } | 668 } |
| 669 return Just(false); | 669 return Just(false); |
| 670 } | 670 } |
| 671 | 671 |
| 672 | 672 |
| 673 bool Object::IsPromise(Handle<Object> object) { | |
| 674 if (!object->IsJSObject()) return false; | |
| 675 auto js_object = Handle<JSObject>::cast(object); | |
| 676 // Promises can't have access checks. | |
| 677 if (js_object->map()->is_access_check_needed()) return false; | |
| 678 auto isolate = js_object->GetIsolate(); | |
| 679 // TODO(dcarney): this should just be read from the symbol registry so as not | |
| 680 // to be context dependent. | |
| 681 auto key = isolate->factory()->promise_state_symbol(); | |
| 682 // Shouldn't be possible to throw here. | |
| 683 return JSObject::HasRealNamedProperty(js_object, key).FromJust(); | |
| 684 } | |
| 685 | |
| 686 | |
| 687 // static | 673 // static |
| 688 MaybeHandle<Object> Object::GetMethod(Handle<JSReceiver> receiver, | 674 MaybeHandle<Object> Object::GetMethod(Handle<JSReceiver> receiver, |
| 689 Handle<Name> name) { | 675 Handle<Name> name) { |
| 690 Handle<Object> func; | 676 Handle<Object> func; |
| 691 Isolate* isolate = receiver->GetIsolate(); | 677 Isolate* isolate = receiver->GetIsolate(); |
| 692 ASSIGN_RETURN_ON_EXCEPTION(isolate, func, | 678 ASSIGN_RETURN_ON_EXCEPTION(isolate, func, |
| 693 JSReceiver::GetProperty(receiver, name), Object); | 679 JSReceiver::GetProperty(receiver, name), Object); |
| 694 if (func->IsNull(isolate) || func->IsUndefined(isolate)) { | 680 if (func->IsNull(isolate) || func->IsUndefined(isolate)) { |
| 695 return isolate->factory()->undefined_value(); | 681 return isolate->factory()->undefined_value(); |
| 696 } | 682 } |
| (...skipping 18178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18875 } else { | 18861 } else { |
| 18876 // Old-style generators. | 18862 // Old-style generators. |
| 18877 int offset = continuation(); | 18863 int offset = continuation(); |
| 18878 CHECK(0 <= offset && offset < function()->code()->instruction_size()); | 18864 CHECK(0 <= offset && offset < function()->code()->instruction_size()); |
| 18879 return function()->code()->SourcePosition(offset); | 18865 return function()->code()->SourcePosition(offset); |
| 18880 } | 18866 } |
| 18881 } | 18867 } |
| 18882 | 18868 |
| 18883 } // namespace internal | 18869 } // namespace internal |
| 18884 } // namespace v8 | 18870 } // namespace v8 |
| OLD | NEW |