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 | |
129 MaybeHandle<Object> Object::GetProperty(LookupIterator* it) { | 115 MaybeHandle<Object> Object::GetProperty(LookupIterator* it) { |
130 for (; it->IsFound(); it->Next()) { | 116 for (; it->IsFound(); it->Next()) { |
131 switch (it->state()) { | 117 switch (it->state()) { |
132 case LookupIterator::NOT_FOUND: | 118 case LookupIterator::NOT_FOUND: |
133 case LookupIterator::TRANSITION: | 119 case LookupIterator::TRANSITION: |
134 UNREACHABLE(); | 120 UNREACHABLE(); |
135 case LookupIterator::JSPROXY: | 121 case LookupIterator::JSPROXY: |
136 return JSProxy::GetPropertyWithHandler(it->GetHolder<JSProxy>(), | 122 return JSProxy::GetPropertyWithHandler(it->GetHolder<JSProxy>(), |
137 it->GetReceiver(), it->name()); | 123 it->GetReceiver(), it->name()); |
138 case LookupIterator::INTERCEPTOR: { | 124 case LookupIterator::INTERCEPTOR: { |
(...skipping 17113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17252 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, | 17238 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, |
17253 Handle<Object> new_value) { | 17239 Handle<Object> new_value) { |
17254 if (cell->value() != *new_value) { | 17240 if (cell->value() != *new_value) { |
17255 cell->set_value(*new_value); | 17241 cell->set_value(*new_value); |
17256 Isolate* isolate = cell->GetIsolate(); | 17242 Isolate* isolate = cell->GetIsolate(); |
17257 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17243 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
17258 isolate, DependentCode::kPropertyCellChangedGroup); | 17244 isolate, DependentCode::kPropertyCellChangedGroup); |
17259 } | 17245 } |
17260 } | 17246 } |
17261 } } // namespace v8::internal | 17247 } } // namespace v8::internal |
OLD | NEW |