OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const Object* fun = this; | 105 const Object* fun = this; |
106 while (fun->IsJSFunctionProxy()) { | 106 while (fun->IsJSFunctionProxy()) { |
107 fun = JSFunctionProxy::cast(fun)->call_trap(); | 107 fun = JSFunctionProxy::cast(fun)->call_trap(); |
108 } | 108 } |
109 return fun->IsJSFunction() || | 109 return fun->IsJSFunction() || |
110 (fun->IsHeapObject() && | 110 (fun->IsHeapObject() && |
111 HeapObject::cast(fun)->map()->has_instance_call_handler()); | 111 HeapObject::cast(fun)->map()->has_instance_call_handler()); |
112 } | 112 } |
113 | 113 |
114 | 114 |
| 115 bool Object::IsPromise(Handle<Object> object) { |
| 116 if (!object->IsJSObject()) return false; |
| 117 auto js_object = Handle<JSObject>::cast(object); |
| 118 // Promises can't have access checks. |
| 119 if (js_object->map()->is_access_check_needed()) return false; |
| 120 auto isolate = js_object->GetIsolate(); |
| 121 // TODO(dcarney): this should just be read from the symbol registry so as not |
| 122 // to be context dependent. |
| 123 auto key = isolate->promise_status(); |
| 124 // Shouldn't be possible to throw here. |
| 125 return JSObject::HasRealNamedProperty(js_object, key).FromJust(); |
| 126 } |
| 127 |
| 128 |
115 MaybeHandle<Object> Object::GetProperty(LookupIterator* it) { | 129 MaybeHandle<Object> Object::GetProperty(LookupIterator* it) { |
116 for (; it->IsFound(); it->Next()) { | 130 for (; it->IsFound(); it->Next()) { |
117 switch (it->state()) { | 131 switch (it->state()) { |
118 case LookupIterator::NOT_FOUND: | 132 case LookupIterator::NOT_FOUND: |
119 case LookupIterator::TRANSITION: | 133 case LookupIterator::TRANSITION: |
120 UNREACHABLE(); | 134 UNREACHABLE(); |
121 case LookupIterator::JSPROXY: | 135 case LookupIterator::JSPROXY: |
122 return JSProxy::GetPropertyWithHandler(it->GetHolder<JSProxy>(), | 136 return JSProxy::GetPropertyWithHandler(it->GetHolder<JSProxy>(), |
123 it->GetReceiver(), it->name()); | 137 it->GetReceiver(), it->name()); |
124 case LookupIterator::INTERCEPTOR: { | 138 case LookupIterator::INTERCEPTOR: { |
(...skipping 17094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17219 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, | 17233 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, |
17220 Handle<Object> new_value) { | 17234 Handle<Object> new_value) { |
17221 if (cell->value() != *new_value) { | 17235 if (cell->value() != *new_value) { |
17222 cell->set_value(*new_value); | 17236 cell->set_value(*new_value); |
17223 Isolate* isolate = cell->GetIsolate(); | 17237 Isolate* isolate = cell->GetIsolate(); |
17224 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17238 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
17225 isolate, DependentCode::kPropertyCellChangedGroup); | 17239 isolate, DependentCode::kPropertyCellChangedGroup); |
17226 } | 17240 } |
17227 } | 17241 } |
17228 } } // namespace v8::internal | 17242 } } // namespace v8::internal |
OLD | NEW |