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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 type->IsFunctionTemplateInfo(); | 234 type->IsFunctionTemplateInfo(); |
235 type = FunctionTemplateInfo::cast(type)->parent_template()) { | 235 type = FunctionTemplateInfo::cast(type)->parent_template()) { |
236 if (type == this) return true; | 236 if (type == this) return true; |
237 } | 237 } |
238 // Didn't find the required type in the inheritance chain. | 238 // Didn't find the required type in the inheritance chain. |
239 return false; | 239 return false; |
240 } | 240 } |
241 | 241 |
242 | 242 |
243 // TODO(dcarney): CallOptimization duplicates this logic, merge. | 243 // TODO(dcarney): CallOptimization duplicates this logic, merge. |
244 Handle<Object> FunctionTemplateInfo::GetCompatibleReceiver( | 244 Object* FunctionTemplateInfo::GetCompatibleReceiver(Isolate* isolate, |
245 Isolate* isolate, Handle<Object> receiver, bool is_construct) { | 245 Object* receiver) { |
246 // API calls are only supported with JSObject receivers. | 246 // API calls are only supported with JSObject receivers. |
247 if (!receiver->IsJSObject()) return isolate->factory()->null_value(); | 247 if (!receiver->IsJSObject()) return isolate->heap()->null_value(); |
248 auto js_receiver = Handle<JSObject>::cast(receiver); | |
249 if (!is_construct && js_receiver->IsAccessCheckNeeded() && | |
250 !isolate->MayAccess(js_receiver)) { | |
251 return isolate->factory()->null_value(); | |
252 } | |
253 Object* recv_type = this->signature(); | 248 Object* recv_type = this->signature(); |
254 // No signature, return holder. | 249 // No signature, return holder. |
255 if (recv_type->IsUndefined()) return receiver; | 250 if (recv_type->IsUndefined()) return receiver; |
256 FunctionTemplateInfo* signature = FunctionTemplateInfo::cast(recv_type); | 251 FunctionTemplateInfo* signature = FunctionTemplateInfo::cast(recv_type); |
257 // Check the receiver. | 252 // Check the receiver. |
258 for (PrototypeIterator iter(isolate, *receiver, | 253 for (PrototypeIterator iter(isolate, receiver, |
259 PrototypeIterator::START_AT_RECEIVER); | 254 PrototypeIterator::START_AT_RECEIVER); |
260 !iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN); iter.Advance()) { | 255 !iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN); iter.Advance()) { |
261 if (signature->IsTemplateFor(iter.GetCurrent())) { | 256 if (signature->IsTemplateFor(iter.GetCurrent())) return iter.GetCurrent(); |
262 return Handle<Object>(iter.GetCurrent(), isolate); | |
263 } | |
264 } | 257 } |
265 return isolate->factory()->null_value(); | 258 return isolate->heap()->null_value(); |
266 } | 259 } |
267 | 260 |
268 | 261 |
269 Handle<FixedArray> JSObject::EnsureWritableFastElements( | 262 Handle<FixedArray> JSObject::EnsureWritableFastElements( |
270 Handle<JSObject> object) { | 263 Handle<JSObject> object) { |
271 DCHECK(object->HasFastSmiOrObjectElements()); | 264 DCHECK(object->HasFastSmiOrObjectElements()); |
272 Isolate* isolate = object->GetIsolate(); | 265 Isolate* isolate = object->GetIsolate(); |
273 Handle<FixedArray> elems(FixedArray::cast(object->elements()), isolate); | 266 Handle<FixedArray> elems(FixedArray::cast(object->elements()), isolate); |
274 if (elems->map() != isolate->heap()->fixed_cow_array_map()) return elems; | 267 if (elems->map() != isolate->heap()->fixed_cow_array_map()) return elems; |
275 Handle<FixedArray> writable_elems = isolate->factory()->CopyFixedArrayWithMap( | 268 Handle<FixedArray> writable_elems = isolate->factory()->CopyFixedArrayWithMap( |
(...skipping 16847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17123 CompilationInfo* info) { | 17116 CompilationInfo* info) { |
17124 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( | 17117 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( |
17125 handle(cell->dependent_code(), info->isolate()), | 17118 handle(cell->dependent_code(), info->isolate()), |
17126 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); | 17119 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); |
17127 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 17120 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
17128 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 17121 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
17129 cell, info->zone()); | 17122 cell, info->zone()); |
17130 } | 17123 } |
17131 | 17124 |
17132 } } // namespace v8::internal | 17125 } } // namespace v8::internal |
OLD | NEW |