| 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/api-natives.h" | 5 #include "src/api-natives.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/isolate-inl.h" | 8 #include "src/isolate-inl.h" |
| 9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
| 10 #include "src/messages.h" | 10 #include "src/messages.h" |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 InstantiateFunction(isolate, | 292 InstantiateFunction(isolate, |
| 293 Handle<FunctionTemplateInfo>::cast(parent)), | 293 Handle<FunctionTemplateInfo>::cast(parent)), |
| 294 JSFunction); | 294 JSFunction); |
| 295 // TODO(dcarney): decide what to do here. | 295 // TODO(dcarney): decide what to do here. |
| 296 Handle<Object> parent_prototype; | 296 Handle<Object> parent_prototype; |
| 297 ASSIGN_RETURN_ON_EXCEPTION( | 297 ASSIGN_RETURN_ON_EXCEPTION( |
| 298 isolate, parent_prototype, | 298 isolate, parent_prototype, |
| 299 JSObject::GetProperty(parent_instance, | 299 JSObject::GetProperty(parent_instance, |
| 300 isolate->factory()->prototype_string()), | 300 isolate->factory()->prototype_string()), |
| 301 JSFunction); | 301 JSFunction); |
| 302 RETURN_ON_EXCEPTION( | 302 MAYBE_RETURN(JSObject::SetPrototype(prototype, parent_prototype, false, |
| 303 isolate, JSObject::SetPrototype(prototype, parent_prototype, false), | 303 THROW_ON_ERROR), |
| 304 JSFunction); | 304 MaybeHandle<JSFunction>()); |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 auto function = ApiNatives::CreateApiFunction( | 307 auto function = ApiNatives::CreateApiFunction( |
| 308 isolate, data, prototype, ApiNatives::JavaScriptObjectType); | 308 isolate, data, prototype, ApiNatives::JavaScriptObjectType); |
| 309 if (!name.is_null() && name->IsString()) { | 309 if (!name.is_null() && name->IsString()) { |
| 310 function->shared()->set_name(*name); | 310 function->shared()->set_name(*name); |
| 311 } | 311 } |
| 312 if (!data->do_not_cache()) { | 312 if (!data->do_not_cache()) { |
| 313 // Cache the function. | 313 // Cache the function. |
| 314 CacheFunction(isolate, serial_number, function); | 314 CacheFunction(isolate, serial_number, function); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); | 630 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); |
| 631 JSObject::SetAccessor(result, accessor).Assert(); | 631 JSObject::SetAccessor(result, accessor).Assert(); |
| 632 } | 632 } |
| 633 | 633 |
| 634 DCHECK(result->shared()->IsApiFunction()); | 634 DCHECK(result->shared()->IsApiFunction()); |
| 635 return result; | 635 return result; |
| 636 } | 636 } |
| 637 | 637 |
| 638 } // namespace internal | 638 } // namespace internal |
| 639 } // namespace v8 | 639 } // namespace v8 |
| OLD | NEW |